bottles: use dedicated version class.
This commit is contained in:
parent
705a248719
commit
cfdd23b3ef
8
Library/Homebrew/bottle_version.rb
Normal file
8
Library/Homebrew/bottle_version.rb
Normal file
@ -0,0 +1,8 @@
|
||||
class BottleVersion < Version
|
||||
def self._parse spec
|
||||
spec = Pathname.new(spec) unless spec.is_a? Pathname
|
||||
stem = spec.stem
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
@ -1,6 +1,7 @@
|
||||
require 'tab'
|
||||
require 'macos'
|
||||
require 'extend/ARGV'
|
||||
require 'bottle_version'
|
||||
|
||||
# TODO: use options={} for some arguments.
|
||||
|
||||
@ -91,8 +92,8 @@ def bottle_tag
|
||||
end
|
||||
|
||||
def bottle_filename_formula_name filename
|
||||
version = Version.parse(filename).to_s
|
||||
path = Pathname.new filename
|
||||
version = BottleVersion.parse(path).to_s
|
||||
basename = path.basename.to_s
|
||||
basename.rpartition("-#{version}").first
|
||||
end
|
||||
|
||||
8
Library/Homebrew/test/test_bottle_versions.rb
Normal file
8
Library/Homebrew/test/test_bottle_versions.rb
Normal file
@ -0,0 +1,8 @@
|
||||
require 'testing_env'
|
||||
require 'bottle_version'
|
||||
|
||||
class BottleVersionParsingTests < Test::Unit::TestCase
|
||||
def assert_version_detected expected, path
|
||||
assert_equal expected, BottleVersion.parse(path).to_s
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user