aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/commands
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-04-06 15:31:41 +0000
committerRick Olson <technoweenie@gmail.com>2006-04-06 15:31:41 +0000
commit9935a3561e0bc9f356b8c0213cec65fc853fd7d6 (patch)
tree66c9e9c23b8c37603ab996d1a95ee808d4f75a68 /railties/lib/commands
parent52d298a8bd5800d9149b0b288bd8a929110b5260 (diff)
downloadrails-9935a3561e0bc9f356b8c0213cec65fc853fd7d6.tar.gz
rails-9935a3561e0bc9f356b8c0213cec65fc853fd7d6.tar.bz2
rails-9935a3561e0bc9f356b8c0213cec65fc853fd7d6.zip
Enhances plugin#discover allowing it to discover svn:// like URIs (closes #4565) [ruben.nine@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/commands')
-rw-r--r--railties/lib/commands/plugin.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb
index 664e2f795f..dd32f5416a 100644
--- a/railties/lib/commands/plugin.rb
+++ b/railties/lib/commands/plugin.rb
@@ -31,7 +31,7 @@
# look like subversion repositories with plugins:
# http://wiki.rubyonrails.org/rails/pages/Plugins
#
-# * Unless you specify that you want to use svn, script/plugin uses plain ole
+# * Unless you specify that you want to use svn, script/plugin uses plain old
# HTTP for downloads. The following bullets are true if you specify
# that you want to use svn.
#
@@ -107,7 +107,7 @@ class RailsEnvironment
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
+ # is under subversion then they probably want the plugin checked out
# instead of exported. This can be overridden on the command line
File.directory?("#{root}/.svn")
end
@@ -161,6 +161,7 @@ class Plugin
def install(method=nil, options = {})
method ||= rails_env.best_install_method?
+ method = :export if method == :http and @uri =~ /svn:\/\/*/
uninstall if installed? and options[:force]
@@ -655,7 +656,7 @@ module Commands
puts "Scraping #{uri}" if $verbose
dupes = []
content = open(uri).each do |line|
- if line =~ /<a[^>]*href=['"]([^'"]*)['"]/
+ if line =~ /<a[^>]*href=['"]([^'"]*)['"]/ or line =~ /(svn:\/\/[^<|\n]*)/
uri = $1
if uri =~ /\/plugins\// and uri !~ /\/browser\//
uri = extract_repository_uri(uri)
@@ -813,9 +814,13 @@ class RecursiveHTTPFetcher
def ls
@urls_to_fetch.collect do |url|
- open(url) do |stream|
- links("", stream.read)
- end rescue nil
+ if url =~ /^svn:\/\/.*/
+ `svn ls #{url}`.split("\n").map {|entry| "/#{entry}"} rescue nil
+ else
+ open(url) do |stream|
+ links("", stream.read)
+ end rescue nil
+ end
end.flatten
end