diff options
Diffstat (limited to 'railties/lib')
4 files changed, 12 insertions, 1 deletions
diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index 9ae0a40314..0cb9b83894 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -166,6 +166,7 @@ class Plugin unless installed? send("install_using_#{method}", options) + run_install_hook else puts "already installed: #{name} (#{uri}). pass --force to reinstall" end @@ -185,6 +186,12 @@ class Plugin end private + + def run_install_hook + install_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/install.rb" + load install_hook_file if File.exists? install_hook_file + end + def install_using_export(options = {}) svn_command :export, options end diff --git a/railties/lib/rails_generator/generators/components/plugin/USAGE b/railties/lib/rails_generator/generators/components/plugin/USAGE index e858ada9b9..f033c81442 100644 --- a/railties/lib/rails_generator/generators/components/plugin/USAGE +++ b/railties/lib/rails_generator/generators/components/plugin/USAGE @@ -16,6 +16,7 @@ Example: This will create: vendor/plugins/browser_filters/README vendor/plugins/browser_filters/init.rb + vendor/plugins/browser_filters/install.rb vendor/plugins/browser_filters/lib/browser_filters.rb vendor/plugins/browser_filters/test/browser_filters_test.rb vendor/plugins/browser_filters/tasks/browser_filters_tasks.rake @@ -25,9 +26,10 @@ Example: This will create: vendor/plugins/browser_filters/README vendor/plugins/browser_filters/init.rb + vendor/plugins/browser_filters/install.rb vendor/plugins/browser_filters/lib/browser_filters.rb vendor/plugins/browser_filters/test/browser_filters_test.rb vendor/plugins/browser_filters/tasks/browser_filters_tasks.rake vendor/plugins/browser_filters/generators/browser_filters/browser_filters_generator.rb vendor/plugins/browser_filters/generators/browser_filters/USAGE - vendor/plugins/browser_filters/generators/browser_filters/templates/
\ No newline at end of file + vendor/plugins/browser_filters/generators/browser_filters/templates/ diff --git a/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb b/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb index 18ac5a1c5c..ea5fdf2b7d 100644 --- a/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb +++ b/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb @@ -16,6 +16,7 @@ class PluginGenerator < Rails::Generator::NamedBase m.template 'README', "#{plugin_path}/README" m.template 'Rakefile', "#{plugin_path}/Rakefile" m.template 'init.rb', "#{plugin_path}/init.rb" + m.template 'install.rb', "#{plugin_path}/install.rb" m.template 'plugin.rb', "#{plugin_path}/lib/#{file_name}.rb" m.template 'tasks.rake', "#{plugin_path}/tasks/#{file_name}_tasks.rake" m.template 'unit_test.rb', "#{plugin_path}/test/#{file_name}_test.rb" diff --git a/railties/lib/rails_generator/generators/components/plugin/templates/install.rb b/railties/lib/rails_generator/generators/components/plugin/templates/install.rb new file mode 100644 index 0000000000..f7732d3796 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/plugin/templates/install.rb @@ -0,0 +1 @@ +# Install hook code here |