diff options
| author | Austin Ziegler | 2011-01-09 22:41:03 -0500 |
|---|---|---|
| committer | Adam Vandenberg | 2011-03-25 22:30:10 -0700 |
| commit | 007b9e72d513c515f216cde4ae59ea37f826277b (patch) | |
| tree | 58e7b9d3b126647806cb5f8948d031d222fb1c5b /Library | |
| parent | 846087d5859cb0fb8b37321e477fb5114d0d4104 (diff) | |
| download | brew-007b9e72d513c515f216cde4ae59ea37f826277b.tar.bz2 | |
Adding version detection to sf.net /download urls
SourceForge links can end with /download which appears to be part of
what is used to drive mirror selection. Modifying the version detection
extension of pathname.rb to detect this case for both sourceforge.net
and sf.net download selections.
This is sufficient for version detection but may not be sufficient for
other uses of /download links. I have not found any problems with links
that use /download, though.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_versions.rb | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 5534cd752..1436e2e8e 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -105,7 +105,12 @@ class Pathname # directories don't have extnames stem=basename.to_s else - stem=self.stem + # sourceforge /download + if %r[((?:sourceforge.net|sf.net)/.*)/download$].match to_s + stem=Pathname.new(dirname).stem + else + stem=self.stem + end end # github tarballs, like v1.2.3 diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb index 8010cf1c5..5e8783232 100644 --- a/Library/Homebrew/test/test_versions.rb +++ b/Library/Homebrew/test/test_versions.rb @@ -98,6 +98,11 @@ class VersionTests < Test::Unit::TestCase check "http://example.com/foo_bar-1.21.tar.gz", '1.21' end + def test_version_sourceforge_download + check "http://sourceforge.net/foo_bar-1.21.tar.gz/download", '1.21' + check "http://sf.net/foo_bar-1.21.tar.gz/download", '1.21' + end + def test_version_github check "http://github.com/lloyd/yajl/tarball/1.0.5", '1.0.5' end |
