Class: Pod::Command::Repo::Remove

Inherits:
Pod::Command::Repo show all
Defined in:
lib/cocoapods/command/repo/remove.rb

Instance Method Summary collapse

Methods inherited from Pod::Command::Repo

#dir

Methods included from Executable

#executable, execute_command, which

Methods inherited from Pod::Command

#ensure_master_spec_repo_exists!, options, report_error, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Remove

Returns a new instance of Remove.



15
16
17
18
# File 'lib/cocoapods/command/repo/remove.rb', line 15

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

Instance Method Details

#runObject



28
29
30
31
32
# File 'lib/cocoapods/command/repo/remove.rb', line 28

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

#validate!Object



20
21
22
23
24
25
26
# File 'lib/cocoapods/command/repo/remove.rb', line 20

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