Sha256: 6d74fdda2b175da0bfda0bd305e0177abb73af105c844975436cb2713f4810b3

Contents?: true

Size: 885 Bytes

Versions: 2

Compression:

Stored size: 885 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

2 entries across 2 versions & 1 rubygems

Version Path
zeusd-0.2.5 bin/zeusd
zeusd-0.2.4 bin/zeusd