Mailinglist Archive: yast-devel (36 mails)

< Previous Next >
[yast-devel] Yast webservice - sharing .rake files
  • From: Ladislav Slezak <lslezak@xxxxxxx>
  • Date: Thu, 21 May 2009 15:20:25 +0200
  • Message-id: <4A155519.50501@xxxxxxx>
Hi all,

I started to implement an example WebYast package and I have a yast2-devtools
skeleton for REST API package ready.

But I found that many things are duplicated in all REST plugins. E.g. each
contains the same copied targets (e.g. 'package'). The common targets should be
shared instead of copying. If there is a bug or we want to add a new feature we
to fix a lot of packages...

Here is my proposal:

- Add include.rake file into rakelib[*] subdirectory in each plugin, see
the attachment. (It includes the files from the current directory if it's
inside the git repository otherwise it includes system files from

- Define the shared tasks in rest-service/webservice/lib/tasks/webservice
subdirectory. The tasks should use webservice: namespace prefix so it's
obvious that they are defined in the webservice not in the plugin or somewhere
else. (See syntax_check.rake example)

After that 'rake -T' in a plugin subdirectory will display the syntax check
from the shared directory, no need to copy&paste the code.

What do you think about it? Any comments? I'm not a Rakefile expert...

[*] I found that tasks defined in 'tasks' subdirectory in plugins are not found
rake, they must be in 'rakelib' subdirectory instead. We have to call 'git mv
rakelib' for all plugins and fix the .spec files...


Best Regards

Ladislav Slez√°k
Yast Developer
SUSE LINUX, s.r.o. e-mail: lslezak@xxxxxxx
Lihovarsk√° 1060/12 tel: +420 284 028 960
190 00 Prague 9 fax: +420 284 028 951
Czech Republic

# import global .rake files for plugins
if File.exist?
# use delopemnt files if we are in git repository

{ |ext| load ext }
# use the files from yast2-webservice package
Dir["/srv/www/yastws/lib/tasks/webservice/*.rake"].each { |ext| load ext }

require 'rake'

namespace :webservice do

desc "Check syntax of all Ruby (*.rb) files"
task :syntax_check do
`find . -name "*.rb" |xargs -n1 ruby -c |grep -v "Syntax OK"`
puts "* Done"


< Previous Next >
Follow Ups