Skip to content
This repository
Browse code

Added support for plugins to be installed as submodules with the appl…

…ication templater. [#1517 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 9eca588bdfbb41f6b48477025d1cd8eea4a38296 1 parent 731dcd8
Peter Cooper authored December 05, 2008 lifo committed December 06, 2008
8  railties/lib/rails_generator/generators/applications/app/template_runner.rb
@@ -57,16 +57,22 @@ def file(filename, data = nil, &block)
57 57
     end
58 58
 
59 59
     # Install a plugin.  You must provide either a Subversion url or Git url.
  60
+    # For a Git-hosted plugin, you can specify if it should be added as a submodule instead of cloned.
60 61
     #
61 62
     # ==== Examples
62 63
     #
63 64
     #   plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
  65
+    #   plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
64 66
     #   plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk'
65 67
     #
66 68
     def plugin(name, options)
67 69
       puts "installing plugin #{name}"
68 70
 
69  
-      if options[:git] || options[:svn]
  71
+      if options[:git] && options[:submodule]
  72
+        in_root do
  73
+          Git.run("submodule add #{options[:git]} vendor/plugins/#{name}")
  74
+        end
  75
+      elsif options[:git] || options[:svn]
70 76
         in_root do
71 77
           `script/plugin install #{options[:svn] || options[:git]}`
72 78
         end

0 notes on commit 9eca588

Please sign in to comment.
Something went wrong with that request. Please try again.