Add install.rb file to plugin generation which is loaded, if it exists, when you install a plugin.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Marcel Molina
2005-12-03 06:53:14 +00:00
parent 6abda696b5
commit 4f1e37ccd4
5 changed files with 14 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
*SVN*
* Add install.rb file to plugin generation which is loaded, if it exists, when you install a plugin. [Marcel Molina Jr.]
* Run initialize_logger in script/lighttpd to ensure the log file exists before tailing it. [Sam Stephenson]
* Make load_fixtures include csv fixtures. #3053. [me@mdaines.com]

View File

@@ -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

View File

@@ -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/
vendor/plugins/browser_filters/generators/browser_filters/templates/

View File

@@ -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"

View File

@@ -0,0 +1 @@
# Install hook code here