Commit 05698a86 authored by Joshua Kalpin's avatar Joshua Kalpin

Add pod repo remove [name] command

Deletes the repo named in the command.
parent 29697f42
......@@ -133,6 +133,33 @@ module Pod
#-----------------------------------------------------------------------#
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
......
......@@ -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
......@@ -16,7 +16,7 @@ module Pod
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{ repo remove }).should.be.instance_of Command::Repo::Remove
Command.parse(%w{ init }).should.be.instance_of Command::Init
end
end
......
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