Skip to content
Browse files

[Repo remove] Handle file permission errors

Fixes #1778
  • Loading branch information...
1 parent 5a6c839 commit a3ec49e2bc33651f5bf4a4ee687568adc61c6c12 @kylef kylef committed
Showing with 16 additions and 0 deletions.
  1. +6 −0 CHANGELOG.md
  2. +2 −0 lib/cocoapods/command/repo.rb
  3. +8 −0 spec/functional/command/repo_spec.rb
View
6 CHANGELOG.md
@@ -19,6 +19,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
* Improves `pod init` to save Xcode project file in Podfile when one was supplied.
[Kyle Fuller](https://github.com/kylef)
+###### Bug Fixes
+
+* Fixes a bug with `pod repo remove` silently handling permission errors.
+ [Kyle Fuller](https://github.com/kylef)
+ #1778
+
## 0.29.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0)
View
2 lib/cocoapods/command/repo.rb
@@ -163,6 +163,8 @@ def validate!
super
help! 'Deleting a repo needs a `NAME`.' unless @name
help! "repo #{@name} does not exist" unless File.directory?(dir)
+ help! "You do not have permission to delete the #{@name} repository." \
+ "Perhaps try prefixing this command with sudo." unless File.writable?(dir)
end
def run
View
8 spec/functional/command/repo_spec.rb
@@ -104,6 +104,14 @@ module Pod
lambda { run_command('repo', 'remove', 'nonexistant') }.should.raise CLAide::Help
end
+ it "complains if we do not have permission" do
+ File.stubs(:writable?).returns(false)
+ upstream = SpecHelper.temporary_directory + 'upstream'
+ FileUtils.cp_r(test_repo_path, upstream)
+ lambda { run_command('repo', 'remove', upstream) }.should.raise CLAide::Help
+ FileUtils.rm_rf(upstream)
+ end
+
it "removes a spec-repo" do
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)

0 comments on commit a3ec49e

Please sign in to comment.
Something went wrong with that request. Please try again.