Sha256: f5b673f7727a2eb5f2f5ddbbe6e529dbb7bf741897c24d35dfb3c20bf0318e34

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 Bytes

Contents

require "thor"
require "zeusd"

class ZeusdCLI < Thor
  class_option :verbose,  :type => :boolean,  :aliases => :v
  class_option :block,    :type => :boolean,  :aliases => :b
  class_option :cwd,      :type => :string

  desc "start", "Start the daemon."
  def start
    daemon.start!(:block => options[:block])
  end

  desc "restart", "Restart the daemon."
  def restart
    daemon.restart!(:block => options[:block])
  end

  desc "stop", "Stop the daemon."
  def stop
    daemon.stop!
  end

  desc "tail", "Tail the daemon's log."
  method_option :follow, :type => :boolean, :aliases => :f
  def tail
    cmd = "tail#{options[:follow] ? ' -f' : ''} -n 25 #{daemon.log_file.to_path}"
    puts "\n\n[Zeusd] exec(#{cmd})\n\n"
    exec(cmd)
  end

  protected

  def daemon
    Zeusd::Daemon.new(:verbose => options[:verbose], :cwd => options[:cwd])
  end

end

ZeusdCLI.start(ARGV)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zeusd-0.2.3 bin/zeusd
zeusd-0.2.1 bin/zeusd
zeusd-0.2.0 bin/zeusd
zeusd-0.1.1 bin/zeusd
zeusd-0.1.0 bin/zeusd