Class: Pod::Command::RepoHg::Remove

Inherits:
Pod::Command::RepoHg show all
Defined in:
lib/pod/command/repo_hg.rb

Overview

Repo removal should probably be pulled out, also pretty generic

Instance Method Summary collapse

Methods inherited from Pod::Command::RepoHg

#dir

Constructor Details

#initialize(argv) ⇒ Remove

Returns a new instance of Remove.



230
231
232
233
# File 'lib/pod/command/repo_hg.rb', line 230

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

Instance Method Details

#runObject



243
244
245
246
247
# File 'lib/pod/command/repo_hg.rb', line 243

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

#validate!Object



235
236
237
238
239
240
241
# File 'lib/pod/command/repo_hg.rb', line 235

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