From 8169a0e0a1009a74c2389c8bf291f25879830e7a Mon Sep 17 00:00:00 2001 From: Zack Hobson Date: Thu, 26 Mar 2009 11:53:16 -0700 Subject: [PATCH] Template runner: plugins can specify branch or revision. This adds a couple of options to the application template "plugin" declaration. Users can now pass :branch for git plugins and :revision for subversion plugins. --- .../generators/applications/app/template_runner.rb | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/railties/lib/rails_generator/generators/applications/app/template_runner.rb b/railties/lib/rails_generator/generators/applications/app/template_runner.rb index 3b49b1f..c36d28e 100644 --- a/railties/lib/rails_generator/generators/applications/app/template_runner.rb +++ b/railties/lib/rails_generator/generators/applications/app/template_runner.rb @@ -58,22 +58,31 @@ module Rails end # Install a plugin. You must provide either a Subversion url or Git url. - # For a Git-hosted plugin, you can specify if it should be added as a submodule instead of cloned. + # + # For a Git-hosted plugin you can specify a branch and + # whether it should be added as a submodule instead of cloned, + # + # For a Subversion-hosted plugin you can specify a revision. # # ==== Examples # # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git' + # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :branch => 'stable' # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true # plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk' + # plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk', :revision => 1234 # def plugin(name, options) log 'plugin', name if options[:git] && options[:submodule] + options[:git] = "-b #{options[:branch]} #{options[:git]}" if options[:branch] in_root do Git.run("submodule add #{options[:git]} vendor/plugins/#{name}") end elsif options[:git] || options[:svn] + options[:git] = "-r #{options[:branch]} #{options[:git]}" if options[:branch] + options[:svn] = "-r #{options[:revision]} #{options[:svn]}" if options[:revision] in_root do run_ruby_script("script/plugin install #{options[:svn] || options[:git]}", false) end -- 1.6.2.1