提交 21d50e4d 编写于 作者: J Jeremy Kemper

script/plugin: handle root paths and plugin names which contain spaces. References #2995.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3175 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 d9336270
*SVN*
* script/plugin: handle root paths and plugin names which contain spaces. #2995 [justin@aspect.net]
* Model generator: correct relative path to test_helper in unit test. [Jeremy Kemper]
* Make the db_schema_dump task honor the SCHEMA environment variable if present the way db_schema_import does. #2931. [Blair Zajac]
......
......@@ -61,7 +61,7 @@ class RailsEnvironment
def initialize(dir)
@root = dir
end
def self.find(dir=nil)
dir ||= pwd
while dir.length > 1
......@@ -104,14 +104,14 @@ def use_svn?
def use_externals?
use_svn? && File.directory?("#{root}/vendor/plugins/.svn")
end
def use_checkout?
# this is a bit of a guess. we assume that if the rails environment
# is under subversion than they probably want the plugin checked out
# instead of exported. This can be overridden on the command line
File.directory?("#{root}/.svn")
end
def best_install_method
return :http unless use_svn?
case
......@@ -123,12 +123,12 @@ def best_install_method
def externals
return [] unless use_externals?
ext = `svn propget svn:externals #{root}/vendor/plugins`
ext = `svn propget svn:externals "#{root}/vendor/plugins"`
ext.reject{ |line| line.strip == '' }.map do |line|
line.strip.split(/\s+/, 2)
end
end
def externals=(items)
unless items.is_a? String
items = items.map{|name,uri| "#{name.ljust(29)} #{uri.chomp('/')}"}.join("\n")
......@@ -136,7 +136,7 @@ def externals=(items)
Tempfile.open("svn-set-prop") do |file|
file.write(items)
file.flush
system("svn propset -q svn:externals -F #{file.path} #{root}/vendor/plugins")
system("svn propset -q svn:externals -F #{file.path} \"#{root}/vendor/plugins\"")
end
end
......@@ -212,7 +212,7 @@ def install_using_http(options = {})
def svn_command(cmd, options = {})
root = rails_env.root
mkdir_p "#{root}/vendor/plugins"
base_cmd = "svn #{cmd} #{uri} #{root}/vendor/plugins/#{name}"
base_cmd = "svn #{cmd} #{uri} \"#{root}/vendor/plugins/#{name}\""
base_cmd += ' -q' if options[:quiet] and not $verbose
base_cmd += " -r #{options[:revision]}" if options[:revision]
system(base_cmd)
......@@ -754,14 +754,15 @@ def options
def parse!(args)
options.parse!(args)
root = @base_command.environment.root
args = Dir["#{root}/vendor/plugins/*"].map do |f|
cd root
args = Dir["vendor/plugins/*"].map do |f|
File.directory?("#{f}/.svn") ? File.basename(f) : nil
end.compact if args.empty?
cd "#{root}/vendor/plugins"
cd "vendor/plugins"
args.each do |name|
if File.directory?(name)
puts "Updating plugin: #{name}"
system("svn #{$verbose ? '' : '-q'} up #{name} #{@revision ? "-r #{@revision}" : ''}")
system("svn #{$verbose ? '' : '-q'} up \"#{name}\" #{@revision ? "-r #{@revision}" : ''}")
else
puts "Plugin doesn't exist: #{name}"
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册