0
# plugin is pulled via `svn checkout` or `svn export` but looks
0
+# Specifying revisions:
0
+# * Subversion revision is a single integer.
0
+# * Git revision format:
0
+# - full - 'refs/tags/1.8.0' or 'refs/heads/experimental'
0
+# - short: 'experimental' (equivalent to 'refs/heads/experimental')
0
+# 'tag 1.8.0' (equivalent to 'refs/tags/1.8.0')
0
# This is Free Software, copyright 2005 by Ryan Tomayko (rtomayko@gmail.com)
0
# and is licensed MIT: (http://www.opensource.org/licenses/mit-license.php)
0
@@ -175,7 +185,7 @@ class Plugin
0
method ||= rails_env.best_install_method?
0
method = :export if svn_url?
0
- method = :
clone if git_url?
0
+ method = :
git if git_url?
0
uninstall if installed? and options[:force]
0
@@ -255,8 +265,25 @@ class Plugin
0
- def install_using_clone(options = {})
0
- git_command :clone, options
0
+ def install_using_git(options = {})
0
+ install_path = mkdir_p "#{root}/vendor/plugins/#{name}"
0
+ Dir.chdir install_path do
0
+ init_cmd += " -q" if options[:quiet] and not $verbose
0
+ puts init_cmd if $verbose
0
+ base_cmd = "git pull --depth 1 #{uri}"
0
+ base_cmd += " -q" if options[:quiet] and not $verbose
0
+ base_cmd += " #{options[:revision]}" if options[:revision]
0
+ puts base_cmd if $verbose
0
+ puts "removing: .git" if $verbose
0
def svn_command(cmd, options = {})
0
@@ -268,16 +295,6 @@ class Plugin
0
puts base_cmd if $verbose
0
- def git_command(cmd, options = {})
0
- mkdir_p "#{root}/vendor/plugins"
0
- base_cmd = "git #{cmd} --depth 1 #{uri} \"#{root}/vendor/plugins/#{name}\""
0
- puts base_cmd if $verbose
0
- puts "removing: #{root}/vendor/plugins/#{name}/.git"
0
- rm_rf "#{root}/vendor/plugins/#{name}/.git"
0
@name = File.basename(url)
0
@@ -756,8 +773,8 @@ module Commands
0
"Suppresses the output from installation.",
0
"Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true }
0
o.on( "-r REVISION", "--revision REVISION",
0
- "Checks out the given revision from subversion.",
0
- "Ignored if subversion is not used.") { |v| @options[:revision] = v }
0
+ "Checks out the given revision from subversion or git.",
0
+ "Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
0
"Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }