Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add install.rb file to plugin generation which is loaded, if it exist…

…s, when you install a plugin.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 4f1e37ccd4cf19f74ce6c4b1fe746c20a548292f 1 parent 6abda69
Marcel Molina authored
View
2  railties/CHANGELOG
@@ -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
7 railties/lib/commands/plugin.rb
@@ -166,6 +166,7 @@ def install(method=nil, options = {})
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 @@ def uninstall
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
4 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/
+ vendor/plugins/browser_filters/generators/browser_filters/templates/
View
1  railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
@@ -16,6 +16,7 @@ def manifest
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
1  railties/lib/rails_generator/generators/components/plugin/templates/install.rb
@@ -0,0 +1 @@
+# Install hook code here
Please sign in to comment.
Something went wrong with that request. Please try again.