Michael Schuerig
2006-Aug-06 18:15 UTC
[Rails] Best practice: installing plugin assets in rake task or install.rb?
I noticed that a few plugins come with rake tasks to install additional assets. In Rails 1.1.4 there''s a hook file, install.rb, that is run when after the plugin has been installed (edge Rails has uninstall.rb, too). Wouldn''t it be nicer to use this (these) hooks to install (remove) plugin specific files automatically? Preferrably existing (different) files are overwritten only after asking and removed only when unchanged. Also, I saw that several plugin READMEs tell the plugin user to include JavaScript files in their views or layouts. This isn''t necessary as it can be automated: ActionView::Helpers::AssetTagHelper::register_javascript_include_default(''cool_plugin'') After this, <%= javascript_include_tag :default %> will additionally write out an include element for public/javascripts/cool_plugin.js Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/