diff --git a/CHANGELOG.md b/CHANGELOG.md index 228a2b9..bd12481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,9 @@ ##### Bug Fixes -* None. - +* Improve handling of users not having access to their netrc file. + [Orta Therox](https://github.com/orta) + [CocoaPods#5411](https://github.com/CocoaPods/CocoaPods/issues/5411) ## 1.0.0 (2016-05-10) diff --git a/lib/pod/command/trunk.rb b/lib/pod/command/trunk.rb index 523fb32..43ee084 100644 --- a/lib/pod/command/trunk.rb +++ b/lib/pod/command/trunk.rb @@ -87,12 +87,17 @@ def json(response) end def netrc - @@netrc ||= Netrc.read + begin + @@netrc ||= Netrc.read + rescue Errno::ENOENT => e + UI.warn 'CocoaPods could not access your ~/.netrc file, '\ + 'please ensure you have read access to it.' + end end def token - ENV['COCOAPODS_TRUNK_TOKEN'] || - (netrc['trunk.cocoapods.org'] && netrc['trunk.cocoapods.org'].password) + ENV['COCOAPODS_TRUNK_TOKEN'] || + (netrc['trunk.cocoapods.org'] && netrc['trunk.cocoapods.org'].password) end def default_headers