Skip to content

Commit

Permalink
Merge pull request #1493 from Kapin/master
Browse files Browse the repository at this point in the history
Add pod repo remove [name] command
  • Loading branch information
fabiopelosin committed Oct 21, 2013
2 parents 29697f4 + 5e5e96f commit f7766cc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -16,6 +16,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Ulrik Damm](https://github.com/ulrikdamm)
[#1427](https://github.com/CocoaPods/CocoaPods/pull/1427)

* `pod repo` now support a `remove ['repo_name']` command.
[Joshua Kalpin](https://github.com/Kapin)
[#1493](https://github.com/CocoaPods/CocoaPods/issues/1493)
[#1484](https://github.com/CocoaPods/CocoaPods/issues/1484)

###### Bug Fixes

* The architecture is now set in the build settings of the user build
Expand Down
27 changes: 27 additions & 0 deletions lib/cocoapods/command/repo.rb
Expand Up @@ -133,6 +133,33 @@ def run

#-----------------------------------------------------------------------#

class Remove < Repo
self.summary = 'Remove a spec repo'

self.description = <<-DESC
Deletes the remote named `NAME` from the local spec-repos directory at `~/.cocoapods/repos/.`
DESC

self.arguments = 'NAME'

def initialize(argv)
@name = argv.shift_argument
super
end

def validate!
super
help! 'Deleting a repo needs a `NAME`.' unless @name
help! "repo #{@name} does not exist" unless File.directory?(dir)
end

def run
UI.section("Removing spec repo `#{@name}`") do
FileUtils.rm_rf(dir)
end
end
end

extend Executable
executable :git

Expand Down
7 changes: 7 additions & 0 deletions spec/functional/command/repo_spec.rb
Expand Up @@ -54,6 +54,13 @@ module Pod
run_command('repo', 'update', 'repo2')
(repo2 + 'README').read.should.include 'Updated'
end

it "removes a spec-repo" do
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
lambda { run_command('repo', 'remove', upstream) }.should.not.raise
File.directory?(test_repo_path + upstream).should.be.false?
end
end
end
end
2 changes: 1 addition & 1 deletion spec/unit/command_spec.rb
Expand Up @@ -12,11 +12,11 @@ module Pod
Command.parse(%w{ repo add }).should.be.instance_of Command::Repo::Add
Command.parse(%w{ repo lint }).should.be.instance_of Command::Repo::Lint
Command.parse(%w{ repo update }).should.be.instance_of Command::Repo::Update
Command.parse(%w{ repo remove }).should.be.instance_of Command::Repo::Remove
Command.parse(%w{ search }).should.be.instance_of Command::Search
Command.parse(%w{ setup }).should.be.instance_of Command::Setup
Command.parse(%w{ spec create }).should.be.instance_of Command::Spec::Create
Command.parse(%w{ spec lint }).should.be.instance_of Command::Spec::Lint
Command.parse(%w{ repo update }).should.be.instance_of Command::Repo::Update
Command.parse(%w{ init }).should.be.instance_of Command::Init
end
end
Expand Down

0 comments on commit f7766cc

Please sign in to comment.