Sha256: a6ed2e1311b4bbf21136e3a81146b97889b433c21b35f2c3d68187edb481e0e9

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

module Foreground
  class CLI
    include Mixlib::CLI

    option :pid_file,
      :short => '-p FILE',
      :long  => '--pid_file FILE',
      :description => 'PID file for the daemon',
      :required => true

    option :command,
      :short => '-c COMMAND',
      :long  => '--command COMMAND',
      :description => 'Daemon command line',
      :required => true

    option :timeout,
      :short => '-t SECONDS',
      :long  => '--timeout SECONDS',
      :description => 'Timeout for the daemon to generate a valid PID file',
      :required => false,
      :default => 2,
      :proc => Proc.new { |t| t.to_i }

    class << self
      def run(argv=ARGV)
        new.run(argv)
      end
    end

    def run(argv)
      cmd = parse_options(argv)
      Foreground.config = config
      Daemon.run(config[:command], config[:pid_file])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreground-0.1.0 lib/foreground/cli.rb