Class: Pod::Command::RepoArt::Remove

Inherits:
Pod::Command::RepoArt show all
Defined in:
lib/pod/command/repo_art/remove.rb

Constant Summary

Constants inherited from Pod::Command::RepoArt

UTIL

Instance Method Summary collapse

Methods inherited from Pod::Command::RepoArt

#init

Constructor Details

#initialize(argv) ⇒ Remove

Returns a new instance of Remove.



15
16
17
18
19
# File 'lib/pod/command/repo_art/remove.rb', line 15

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

Instance Method Details

#repo_dir_rootObject



35
36
37
# File 'lib/pod/command/repo_art/remove.rb', line 35

def repo_dir_root
  "#{@repos_art_dir}/#{@name}"
end

#runObject



29
30
31
32
33
# File 'lib/pod/command/repo_art/remove.rb', line 29

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

#validate!Object



21
22
23
24
25
26
27
# File 'lib/pod/command/repo_art/remove.rb', line 21

def validate!
  super
  help! 'Deleting a repo needs a `NAME`.' unless @name
  help! "repo #{@name} does not exist" unless File.directory?(repo_dir_root)
  help! "You do not have permission to delete the #{@name} repository." \
        'Perhaps try prefixing this command with sudo.' unless File.writable?(repo_dir_root)
end