L-exp Mobile

Warble with Console

By default, creating a war via warble doesn't include script/. I was told that I "shouldn't" need it in production environments, but, I think the positives outweigh the negatives by far. Console can be an excellent diagnostic tool in production... and of course, can cause chaos if used incorrectly (see 'root').

Our custom warbler config is a bit complex due to the nature of our applications directory hierarchy, but here is the small piece that shows the shows the jist of the script/ addition. Some evil twin style approach or mixing in would definitely be preferred, but... alas.

This is a little hack in warbler/lib/warbler/task.rb:

1 def define_scripts_task 2 scripts = Dir.glob("script/**/*").map do |f| 3 define_file_task(f, "#{@config.staging_dir}/#{apply_pathmaps(f, :application)}") 4 end 5 with_namespace_and_config do 6 task "public" => scripts 7 end 8 end

And add define_scripts_task to the private define_tasks method. Nothing mind blowing, but, helpful.

Now you can play with script/console on your deployed application, as the full script directory will be added to WEB-INF. And a shout out to Nick for Warble in the first place. It's an excellent package.



Options:   Save This | Share
Viewed 2 times
Published 7 months ago
By Dylan Stamat
From Resource Elc Tech Blog in lists:
Best Ruby on Rails Blogs

Menu

by Genís