pod cache list command print incorrect pod path
pod repo add PrivateSpecRepo https://github.com/tripleCC/PrivateSpecRepo.git git clone https://github.com/tripleCC/podTestLibrary.gitcd podTestLibrary/Examplepod installpod cache list podTestLibraryprint correct pod path
podTestLibrary:
- Version: 0.1.0
Type: Release
Spec: /Users/songruiwang/Library/Caches/CocoaPods/Pods/Specs/Release/podTestLibrary/0.1.podspec.json
Pod: /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-479bb
print incorrect pod path
podTestLibrary:
- Version: 0.1.0
Type: Release
Spec: /Users/songruiwang/Library/Caches/CocoaPods/Pods/Specs/Release/podTestLibrary/0.1.podspec.json
Pod: /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6
/Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6 directory isn't exist.
run cd /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6 :
cd: no such file or directory: /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6
run ls /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary :
0.1.0-479bb
CocoaPods : 1.5.3
Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
RubyGems : 2.6.14
Host : Mac OS X 10.14.2 (18C54)
Xcode : 10.1 (10B61)
Git : git version 2.17.2 (Apple Git-113)
Ruby lib dir : /Users/songruiwang/.rvm/rubies/ruby-2.4.1/lib
Repositories : 2dfire-cocoapods-spec - [email protected]:ios/cocoapods-spec.git @ fa31f0842e458a9dfe9b2acbe23f91da87421fdf
2dfire-cocoapods-spec-binary - [email protected]:ios/cocoapods-spec-binary.git @ 2d99f66237c8dff6857caba9f1048e976075d56c
2dfire-ios-cocoapods-spec - http://git.2dfire.net/ios/cocoapods-spec.git @ ec0cef93a7ddf476b9627b5d0cda6c6cf94aba5d
master - https://github.com/CocoaPods/Specs.git @ 2f0c5aa09d8467f048a80b92e972e465fbc30084
private - [email protected]:qingmu/cocoapods-spec.git @ 70bc386f7cd16f51f6d1dc901ca964fbbabea718
private-binary - [email protected]:qingmu/binary-cocoapods-spec.git @ b5240723ac6bf6a5413fae565dbfb492861e5d13
PrivateSpecRepo - https://github.com/tripleCC/PrivateSpecRepo.git @ efa5034567bc2edf9a68314d9934dba8261823bc
Executable Path: /Users/songruiwang/.rvm/gems/ruby-2.4.1/bin/pod
claide-plugins : 0.9.2
cocoapods-bin : 0.0.8
cocoapods-deintegrate : 1.0.2
cocoapods-dependencies : 1.0.0.beta.1
cocoapods-external-pod-sorter : 0.0.2
cocoapods-open : 0.0.8
cocoapods-packager : 1.5.0
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-tdfire-binary : 2.0.3
cocoapods-trunk : 1.3.1
cocoapods-try : 1.1.0
cocoapods_debug : 0.1.0
sample project link https://github.com/tripleCC/podTestLibrary.git
I found that CocoaPods generated the path of pod cache by podTestLibrary.podspec's checksum , but print the path which was generated by podTestLibrary.podspec.json's checksum.
the podspecs' checksum of podTestLibrary :
➜ Example git:(master) ✗ irb
2.4.1 :001 > require 'cocoapods'
=> true
2.4.1 :002 > Pod::Specification.from_file(Pathname.new('/Users/songruiwang/Library/Caches/CocoaPods/Pods/Specs/Release/podTestLibrary/0.1.podspec.json')).checksum
=> "beec68153b3753f9283eae5f8c84ca55e0fa34ff"
2.4.1 :003 >
Pod::Specification.from_file(Pathname.new('/Users/songruiwang/.cocoapods/repos/PrivateSpecRepo/podTestLibrary/0.1.0/podTestLibrary.podspec')).checksum
=> "479bb0f018b9bbc0704f53c15d31c6dca90f2366"
how about generating checksum by pretty JSON of the specification ?
# lib/cocoapods-core/specification.rb
def checksum
generate_checksum(to_pretty_json)
end
def file_checksum
generate_checksum(File.read(defined_in_file)) unless defined_in_file.nil?
end
def generate_checksum(string)
require 'digest'
checksum = Digest::SHA1.hexdigest(string)
checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
checksum
end
Most likely a bug yes
Isn't there a missing pod repo push here? I didn't think that Development pods went into the pod cache.
Most helpful comment
I found that CocoaPods generated the path of pod cache by podTestLibrary.podspec's checksum , but print the path which was generated by podTestLibrary.podspec.json's checksum.
the podspecs' checksum of podTestLibrary :
how about generating checksum by pretty JSON of the specification ?