Permalink
Browse files

Enhances plugin#discover allowing it to discover svn:// like URIs (cl…

…oses #4565) [ruben.nine@gmail.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 52d298a commit 9935a3561e0bc9f356b8c0213cec65fc853fd7d6 @technoweenie technoweenie committed Apr 6, 2006
Showing with 13 additions and 6 deletions.
  1. +2 −0 railties/CHANGELOG
  2. +11 −6 railties/lib/commands/plugin.rb
View
@@ -1,5 +1,7 @@
*1.1.1* (April 6th, 2005)
+* Enhances plugin#discover allowing it to discover svn:// like URIs (closes #4565) [ruben.nine@gmail.com]
+
* Update to Prototype 1.5.0_rc0 [Sam Stephenson]
* Fixed that the -r/--ruby path option of the rails command was not being respected #4549 [ryan.raaum@gmail.com]
@@ -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 @@ def use_externals?
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 @@ def installed?
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 @@ def scrape(uri)
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 @@ def initialize(urls_to_fetch, cwd = ".")
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

0 comments on commit 9935a35

Please sign in to comment.