Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

version: correctly parse codeload URLs #49354

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Library/Homebrew/test/test_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ def test_new_github_style
assert_version_detected "1.1.4", "https://github.com/sam-github/libnet/tarball/libnet-1.1.4"
end

def test_codeload_style
assert_version_detected "0.7.1", "https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1"
end

def test_gloox_beta_style
assert_version_detected "1.0-beta7", "http://camaya.net/download/gloox-1.0-beta7.tar.bz2"
end
Expand Down
6 changes: 4 additions & 2 deletions Library/Homebrew/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,10 @@ def self._parse(spec)
m = /[-_]((?:\d+\.)*\d\.\d+-(?:p|rc|RC)?\d+)(?:[-._](?:bin|dist|stable|src|sources))?$/.match(stem)
return m.captures.first unless m.nil?

# URL with no extension e.g. https://waf.io/waf-1.8.12
m = /-((?:\d+\.)*\d+)$/.match(spec_s)
# URL with no extension
# e.g. https://waf.io/waf-1.8.12
# e.g. https://codeload.github.com/gsamokovarov/jump/tar.gz/v0.7.1
m = /[-v]((?:\d+\.)*\d+)$/.match(spec_s)
return m.captures.first unless m.nil?

# e.g. lame-398-1
Expand Down