Skip to content
Snippets Groups Projects
Commit 007b9e72 authored by Austin Ziegler's avatar Austin Ziegler Committed by Adam Vandenberg
Browse files

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: default avatarAdam Vandenberg <flangy@gmail.com>
parent 846087d5
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment