class Object
Public Instance Methods
get_hosts(filter)
click to toggle source
# File lib/ghost/cli/task/list.rb, line 32 def get_hosts(filter) hosts = if filter filter = $1 if filter =~ %r|^/(.*)/$| Ghost.store.find(/#{filter}/i) else Ghost.store.all end end
overview()
click to toggle source
# File lib/ghost/cli/task/help.rb, line 13 def overview puts "USAGE: ghost <task> [<args>]" puts "" puts "The ghost tasks are:" tasks_to_show do |name, desc| puts " #{name} #{desc}" end puts "" puts "See 'ghost help <task>' for more information on a specific task." end
perform(host, ip = nil)
click to toggle source
# File lib/ghost/cli/task/add.rb, line 3 def perform(host, ip = nil) host = Ghost::Host.new(*[host, ip].compact) Ghost.store.add(host) puts "[Adding] #{host.name} -> #{host.ip}" rescue Ghost::Host::NotResolvable abort "Unable to resolve IP address for target host #{ip.inspect}." end
tasks()
click to toggle source
# File lib/ghost/cli/task/help.rb, line 30 def tasks tasks_by_name.values.uniq end
tasks_by_name()
click to toggle source
# File lib/ghost/cli/task/help.rb, line 26 def tasks_by_name Ghost::Cli.tasks end
tasks_to_show() { |name.ljust(size), desc| ... }
click to toggle source
# File lib/ghost/cli/task/help.rb, line 34 def tasks_to_show size = tasks.map { |t| t.name.length }.max tasks.sort_by(&:name).each do |task| next unless task.desc yield task.name.ljust(size), task.desc end end