Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue that sometimes caused Pod::Version instances to be serialized as a hash inside the :source hash #759

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

##### Bug Fixes

* None.

* Fix a bug when attempting to publish a Pod with `pod trunk push` in certain cases
[Eric Amorde](https://github.com/amorde)
[#729](https://github.com/CocoaPods/Core/pull/759)

## 1.14.1 (2023-10-26)

Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods-core/specification/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module JSONSupport
#
def to_json(*a)
require 'json'
to_hash.to_json(*a) << "\n"
JSON.dump(to_hash, *a) << "\n"
end

# @return [String] the pretty json representation of the specification.
Expand Down
27 changes: 27 additions & 0 deletions spec/specification/json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,33 @@ module Pod
JSON.parse(spec.to_json).should == expected
end

it 'serializes tags with Pod::Version correctly' do
spec = Specification.new(nil, 'BananaLib') do |spec|
spec.version = '1.0'
spec.version.class.should == Pod::Version
spec.source = {
:git => 'https://github.com/CocoaPods/CocoaPodsExampleLibrary.git',
:tag => spec.version,
}
end
expected = {
'name' => 'BananaLib',
'version' => '1.0',
'source' => {
'git' => 'https://github.com/CocoaPods/CocoaPodsExampleLibrary.git',
'tag' => '1.0',
},
'platforms' => {
'osx' => nil,
'ios' => nil,
'tvos' => nil,
'visionos'=> nil,
'watchos' => nil,
},
}
JSON.parse(spec.to_json).should == expected
end

it 'terminates the json representation with a new line' do
spec = Specification.new(nil, 'BananaLib')
spec.to_json.should.end_with "\n"
Expand Down