Browse files

Fixed that installing plugins from SVN repositories that use trunk/ w…

…ill work (closes #8188) [evan]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7698 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 7275d27 commit 00cecf83b5a3303d9b879746fdcc3405cf834974 @dhh dhh committed Sep 30, 2007
Showing with 14 additions and 8 deletions.
  1. +2 −0 railties/CHANGELOG
  2. +12 −8 railties/lib/commands/plugin.rb
View
2 railties/CHANGELOG
@@ -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]
View
20 railties/lib/commands/plugin.rb
@@ -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

0 comments on commit 00cecf8

Please sign in to comment.