Class: Pkgpurge::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/pkgpurge/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failureObject



6
7
8
# File 'lib/pkgpurge/cli.rb', line 6

def self.exit_on_failure
  true
end

Instance Method Details

#ls(path) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/pkgpurge/cli.rb', line 11

def ls(path)
  root = Receipt.new(path).root

  Entry.traverse_entry_with_path(root, "/") do |entry, path|
    report path, "%o" % entry.mode, entry.uid, entry.gid, entry.size, entry.checksum
  end
end

#ls_purge(path) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/pkgpurge/cli.rb', line 39

def ls_purge(path)
  root = Receipt.new(path).root

  traverse_purge_entry_with_path(root, "/") do |entry, path|
    if verify_entry(entry, path, options).empty?
      puts path
      true
    else
      false
    end
  end
end

#verify(path) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pkgpurge/cli.rb', line 22

def verify(path)
  root = Receipt.new(path).root

  valid = true
  Entry.traverse_entry_with_path(root, "/") do |entry, path|
    verify_entry(entry, path, options).each do |modification|
      report path, *modification
      valid = false
    end
  end

  exit(false) unless valid
end