Reputation: 3543
I'm new to Rails. I have been doing some work on asset resources (e.g. javascripts) in a vendor plugin's assets directory and hate having to restart webrick every time I change a file to get it copied over to the appropriate location in the public assets folder.
e.g. from vendor/PLUGIN/assets to public/plugin_assets/PLUGIN
I'm trying to figure out what task the server script fires off to accomplish this so that I can add a shortcut task in my IDE. We are moving to Rails 3.1 at some point, but for now I need something quick and dirty that doesn't require changing the code base or introducing dependencies. Anybody know where this is done? I might end up debugging the damn thing to see where this happens or right a simple 'cp -r' type script. Surely there must be something easier though ...
Upvotes: 0
Views: 742
Reputation: 3543
I finally found what I was looking for in:
vendor/plugins/engines/lib/engines.rb
includes the method Engines.mirror_files_from in it. So I wrote a rake task:
require "vendor/plugins/engines/lib/engines.rb"
namespace :myspace do
desc 'Mirror plugin assets with public assets folder'
task :mirror_assets do
plugin = "PLUGIN_NAME"
Engines.mirror_files_from("vendor/plugins/#{plugin}/assets",
"public/plugin_assets/#{plugin}")
end
end
Upvotes: 2