Commit a3ec49e2 authored by Kyle Fuller's avatar Kyle Fuller

[Repo remove] Handle file permission errors

Fixes #1778
parent 5a6c8391
...@@ -19,6 +19,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -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. * Improves `pod init` to save Xcode project file in Podfile when one was supplied.
[Kyle Fuller](https://github.com/kylef) [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 ## 0.29.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0)
......
...@@ -163,6 +163,8 @@ module Pod ...@@ -163,6 +163,8 @@ module Pod
super super
help! 'Deleting a repo needs a `NAME`.' unless @name help! 'Deleting a repo needs a `NAME`.' unless @name
help! "repo #{@name} does not exist" unless File.directory?(dir) 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 end
def run def run
......
...@@ -104,6 +104,14 @@ module Pod ...@@ -104,6 +104,14 @@ module Pod
lambda { run_command('repo', 'remove', 'nonexistant') }.should.raise CLAide::Help lambda { run_command('repo', 'remove', 'nonexistant') }.should.raise CLAide::Help
end 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 it "removes a spec-repo" do
upstream = SpecHelper.temporary_directory + 'upstream' upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream) FileUtils.cp_r(test_repo_path, upstream)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment