class Epi::Cli::Command

Attributes

args[R]

Public Class Methods

new(args) click to toggle source
# File lib/epi/cli/command.rb, line 18
def initialize(args)
  @args = args
end
run(command, args) click to toggle source
# File lib/epi/cli/command.rb, line 7
def self.run(command, args)
  const_name = command.camelize.to_sym
  if Commands.const_defined? const_name
    klass = Commands.const_get const_name
    return klass.new(args).run if Class === klass && klass < self
  end
  raise Exceptions::Fatal, "Unknown command. Run `epi help` for help."
end

Public Instance Methods

need_root!() click to toggle source
# File lib/epi/cli/command.rb, line 22
def need_root!
  process = Epi::Daemon.process
  raise Exceptions::Fatal, 'You need root privileges to manage this daemon' if
      process && process.was_alive? && process.root? && !Epi.root?
end