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
Rakefile
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
have
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
called
inside the git repository otherwise it includes system files from
/srv/www/yastws/...)

- 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
target
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
by
rake, they must be in 'rakelib' subdirectory instead. We have to call 'git mv
tasks
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 http://www.suse.cz/

# import global .rake files for plugins
if File.exist?
"#{File.dirname(__FILE__)}/../../../webservice/lib/tasks/webservice/"
# use delopemnt files if we are in git repository

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

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"
end

end

< Previous Next >
Follow Ups