Fixed that installing plugins from SVN repositories that use trunk/ will work (closes #8188) [evan]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7698 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2007-09-30 22:53:27 +00:00
parent 7275d2749c
commit 00cecf83b5
2 changed files with 14 additions and 8 deletions

@ -1,5 +1,7 @@
*2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.1.4 - 1.2.3]
* Fixed that installing plugins from SVN repositories that use trunk/ will work #8188 [evan]
* Moved the SourceAnnotationExtractor to a separate file in case libraries try to load the rails rake tasks twice. [Rick]
* Moved Dispatcher to ActionController::Dispatcher. [Jeremy Kemper]

@ -91,7 +91,7 @@ def install(name_uri_or_plugin)
unless plugin.nil?
plugin.install
else
puts "plugin not found: #{name_uri_or_plugin}"
puts "Plugin not found: #{name_uri_or_plugin}"
end
end
@ -239,10 +239,10 @@ def install_using_externals(options = {})
def install_using_http(options = {})
root = rails_env.root
mkdir_p "#{root}/vendor/plugins"
Dir.chdir "#{root}/vendor/plugins" do
mkdir_p "#{root}/vendor/plugins/#{@name}"
Dir.chdir "#{root}/vendor/plugins/#{@name}" do
puts "fetching from '#{uri}'" if $verbose
fetcher = RecursiveHTTPFetcher.new(uri)
fetcher = RecursiveHTTPFetcher.new(uri, -1)
fetcher.quiet = true if options[:quiet]
fetcher.fetch
end
@ -765,8 +765,9 @@ def parse!(args)
args.each do |name|
::Plugin.find(name).install(install_method, @options)
end
rescue
rescue StandardError => e
puts "Plugin not found: #{args.inspect}"
puts e.inspect if $verbose
exit 1
end
end
@ -853,7 +854,8 @@ def parse!(args)
class RecursiveHTTPFetcher
attr_accessor :quiet
def initialize(urls_to_fetch, cwd = ".")
def initialize(urls_to_fetch, level = 1, cwd = ".")
@level = level
@cwd = cwd
@urls_to_fetch = urls_to_fetch.to_a
@quiet = false
@ -907,12 +909,14 @@ def fetch(links = @urls_to_fetch)
end
def fetch_dir(url)
push_d(File.basename(url))
@level += 1
push_d(File.basename(url)) if @level > 0
open(url) do |stream|
contents = stream.read
fetch(links(url, contents))
end
pop_d
pop_d if @level > 0
@level -= 1
end
end