Skip to content

Commit

Permalink
Merge pull request #602 from CocoaPods/amorde/macos-platform
Browse files Browse the repository at this point in the history
Make initializing `Platform` with a string 'macos' behave the same as `Platform.macos`
  • Loading branch information
amorde authored Oct 24, 2019
2 parents 891b0fe + a0d8130 commit 088b3ae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* Extend `script_phase` DSL to support dependency file.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#579](https://github.com/CocoaPods/Core/pull/579)

* Make initializing `Platform` with the string 'macos' equivalent to calling `Platform.macos`
[Eric Amorde](https://github.com/amorde)
[#602](https://github.com/CocoaPods/Core/pull/602)

##### Bug Fixes

Expand Down
4 changes: 4 additions & 0 deletions lib/cocoapods-core/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def initialize(input, target = nil)
@symbolic_name = input.name
@deployment_target = input.deployment_target
else
# Allow `Platform.new('macos')` to be equivalent to `Platform.macos`
if input == 'macos'
input = 'osx'
end
@symbolic_name = input.to_sym
target = target[:deployment_target] if target.is_a?(Hash)
@deployment_target = Version.create(target)
Expand Down
10 changes: 8 additions & 2 deletions spec/platform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ module Pod
end

it 'can be initialized with a string symbolic name' do
Platform.new('ios')
@platform.name.should == :ios
platform = Platform.new('ios')
platform.name.should == :ios
end

it 'can be initialized with a string representing macOS' do
platform = Platform.new('macos')
platform.name.should == :osx
platform.string_name.should == 'macOS'
end

it 'exposes its name as string' do
Expand Down

0 comments on commit 088b3ae

Please sign in to comment.