aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/commands
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-07-28 12:03:16 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-07-28 12:03:16 +0100
commitde211914d84737c4314e862b459b9a23a0baa28f (patch)
tree3f04c940a4c821014332ddc4f119a81a37db3a33 /railties/lib/commands
parent6246a8e06035973c88a38826ce1ee6b07b03b8dc (diff)
parent10d9fe4bf3110c1d5de0c6b509fe0cbb9d5eda1d (diff)
downloadrails-de211914d84737c4314e862b459b9a23a0baa28f.tar.gz
rails-de211914d84737c4314e862b459b9a23a0baa28f.tar.bz2
rails-de211914d84737c4314e862b459b9a23a0baa28f.zip
Merge commit 'mainstream/master'
Conflicts: actionpack/lib/action_controller/cookies.rb actionpack/lib/action_controller/streaming.rb actionpack/lib/action_controller/test_case.rb actionpack/lib/action_view/base.rb actionpack/lib/action_view/helpers/date_helper.rb actionpack/lib/action_view/helpers/debug_helper.rb actionpack/lib/action_view/helpers/form_options_helper.rb actionpack/lib/action_view/helpers/javascript_helper.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/validations.rb activeresource/README activesupport/lib/active_support/core_ext/hash/reverse_merge.rb activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb railties/doc/guides/actionview/helpers.markdown railties/doc/guides/actionview/partials.markdown railties/doc/guides/activerecord/basics.markdown
Diffstat (limited to 'railties/lib/commands')
-rw-r--r--railties/lib/commands/plugin.rb49
-rw-r--r--railties/lib/commands/server.rb6
2 files changed, 36 insertions, 19 deletions
diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb
index ce4b0d051d..980244a71b 100644
--- a/railties/lib/commands/plugin.rb
+++ b/railties/lib/commands/plugin.rb
@@ -43,6 +43,16 @@
# plugin is pulled via `svn checkout` or `svn export` but looks
# exactly the same.
#
+# Specifying revisions:
+#
+# * Subversion revision is a single integer.
+#
+# * Git revision format:
+# - full - 'refs/tags/1.8.0' or 'refs/heads/experimental'
+# - short: 'experimental' (equivalent to 'refs/heads/experimental')
+# 'tag 1.8.0' (equivalent to 'refs/tags/1.8.0')
+#
+#
# This is Free Software, copyright 2005 by Ryan Tomayko (rtomayko@gmail.com)
# and is licensed MIT: (http://www.opensource.org/licenses/mit-license.php)
@@ -175,7 +185,7 @@ class Plugin
method ||= rails_env.best_install_method?
if :http == method
method = :export if svn_url?
- method = :clone if git_url?
+ method = :git if git_url?
end
uninstall if installed? and options[:force]
@@ -255,8 +265,25 @@ class Plugin
end
end
- def install_using_clone(options = {})
- git_command :clone, options
+ def install_using_git(options = {})
+ root = rails_env.root
+ install_path = mkdir_p "#{root}/vendor/plugins/#{name}"
+ Dir.chdir install_path do
+ init_cmd = "git init"
+ init_cmd += " -q" if options[:quiet] and not $verbose
+ puts init_cmd if $verbose
+ system(init_cmd)
+ base_cmd = "git pull --depth 1 #{uri}"
+ base_cmd += " -q" if options[:quiet] and not $verbose
+ base_cmd += " #{options[:revision]}" if options[:revision]
+ puts base_cmd if $verbose
+ if system(base_cmd)
+ puts "removing: .git" if $verbose
+ rm_rf ".git"
+ else
+ rm_rf install_path
+ end
+ end
end
def svn_command(cmd, options = {})
@@ -268,16 +295,6 @@ class Plugin
puts base_cmd if $verbose
system(base_cmd)
end
-
- def git_command(cmd, options = {})
- root = rails_env.root
- mkdir_p "#{root}/vendor/plugins"
- base_cmd = "git #{cmd} --depth 1 #{uri} \"#{root}/vendor/plugins/#{name}\""
- puts base_cmd if $verbose
- puts "removing: #{root}/vendor/plugins/#{name}/.git"
- system(base_cmd)
- rm_rf "#{root}/vendor/plugins/#{name}/.git"
- end
def guess_name(url)
@name = File.basename(url)
@@ -756,8 +773,8 @@ module Commands
"Suppresses the output from installation.",
"Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true }
o.on( "-r REVISION", "--revision REVISION",
- "Checks out the given revision from subversion.",
- "Ignored if subversion is not used.") { |v| @options[:revision] = v }
+ "Checks out the given revision from subversion or git.",
+ "Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
o.on( "-f", "--force",
"Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
o.separator ""
@@ -890,7 +907,7 @@ class RecursiveHTTPFetcher
def ls
@urls_to_fetch.collect do |url|
- if url =~ /^svn:\/\/.*/
+ if url =~ /^svn(\+ssh)?:\/\/.*/
`svn ls #{url}`.split("\n").map {|entry| "/#{entry}"} rescue nil
else
open(url) do |stream|
diff --git a/railties/lib/commands/server.rb b/railties/lib/commands/server.rb
index 7306c248fb..15f417b5be 100644
--- a/railties/lib/commands/server.rb
+++ b/railties/lib/commands/server.rb
@@ -23,10 +23,10 @@ server = case ARGV.first
when "lighttpd", "mongrel", "new_mongrel", "webrick", "thin"
ARGV.shift
else
- if defined?(Thin)
- "thin"
- elsif defined?(Mongrel)
+ if defined?(Mongrel)
"mongrel"
+ elsif defined?(Thin)
+ "thin"
elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
"lighttpd"
else