Skip to content

Commit

Permalink
[Version] Stop parsing legacy HEAD versions
Browse files Browse the repository at this point in the history
It's been 2 years since they were removed, and this saves a regexp match on every version allocation
  • Loading branch information
segiddins authored and dnkoutso committed Jun 21, 2018
1 parent 3d7e494 commit 7bdb0e7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
7 changes: 0 additions & 7 deletions lib/cocoapods-core/version.rb
Expand Up @@ -43,14 +43,7 @@ class Version < Pod::Vendor::Gem::Version
# @param [String,Version] version
# A string representing a version, or another version.
#
# @todo Remove the `HEAD` code once everyone has migrated past 1.0.
#
def initialize(version)
if version.is_a?(String) && version =~ /HEAD based on (.*)/
CoreUI.warn "Ignoring obsolete HEAD specifier in `#{version}`"
version = Regexp.last_match[1]
end

raise ArgumentError, "Malformed version number string #{version}" unless
self.class.correct?(version)

Expand Down
7 changes: 0 additions & 7 deletions spec/dependency_spec.rb
Expand Up @@ -125,13 +125,6 @@ module Pod
dependency.requirement.as_list.should == ['= 1.23']
end

it 'warns with head information' do
dependency = Dependency.new('cocoapods', '> 1.0')
dependency.specific_version = Version.new('HEAD based on 1.23')
dependency.requirement.as_list.should == ['= 1.23']
CoreUI.warnings.should == 'Ignoring obsolete HEAD specifier in `HEAD based on 1.23`'
end

#--------------------------------------#

it 'preserves the external source on duplication' do
Expand Down
6 changes: 0 additions & 6 deletions spec/specification_spec.rb
Expand Up @@ -169,12 +169,6 @@ module Pod
version.should == Version.new('1.0')
end

it 'takes into account head information while returning the name and the version' do
name, version = Specification.name_and_version_from_string('libPusher (HEAD based on 1.0)')
name.should == 'libPusher'
version.should == Version.new('HEAD based on 1.0')
end

it 'takes into account the full name of the subspec returning the name and the version' do
string = 'RestKit/JSON (1.0)'
name = Specification.name_and_version_from_string(string).first
Expand Down
6 changes: 0 additions & 6 deletions spec/version_spec.rb
Expand Up @@ -13,12 +13,6 @@ module Pod
version.version.should == '1.2.3'
end

it 'initializes from a string containing head information' do
version = Version.new('HEAD based on 1.2.3')
version.version.should == '1.2.3'
CoreUI.warnings.should == 'Ignoring obsolete HEAD specifier in `HEAD based on 1.2.3`'
end

it 'serializes to a string' do
version = Version.new('1.2.3')
version.to_s.should == '1.2.3'
Expand Down

0 comments on commit 7bdb0e7

Please sign in to comment.