My code base initially was written in ruby. It had a rakefile.rb
file to perform db migration. I later changed the whole thing to jruby for the ease of deployment
Finally found something that works.... i first tried
java -jar lib/jruby-complete-1.6.7.jar -S rake db_migrate[1]
which was working fine on my personal machine but giving me something like the message below on production
rake aborted!
cannot load Java class com.mysql.jdbc.Driver
Tasks: TOP => db_migrate
(See full trace by running task with --trace)
this was because i was using gems like sequel, logger etc inside my rake task.... i head those installed on my machine but not on production machine.... installing those gems on production was not an option.... so i installed the gems required in the rake task in a separate directory and converted it into a jar file( http://blog.nicksieger.com/articles/2009/01/10/jruby-1-1-6-gems-in-a-jar)... this command finally worked...
java -jar lib/jruby-complete-1.6.7.jar -rlib/mygems.jar -S rake db_migrate[1]
point to note: no matter where you place the jar file, warbler 'll always send this to lib directory although you 'll still see a dummy jar file at the original location... i think the solution can be a bit neater if worked out in a couple of ways, although haven't tried this....
i>by including the gem files in jruby-complete-1.6.7.jar itself as mentioned in the blog mentioned above...
java -jar lib/jruby-complete-1.6.7.jar -S rake db_migrate[1]
should work then...
ii>by writing some kind of a manifest file and include it in the mygems.jar to make this run independently... if this happens
java -jar myapp.jar -S rake db_migrate[1]
should work
this seems not yet supported by warbler - executing jruby style commads works with an executable .jar but making a .war executable only allows it to run with an embed web server ... nothing else.