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>
This commit is contained in:
parent
846087d585
commit
007b9e72d5
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user