Sha256: f0cb3f65b55873804337ae647426f4f7e7f6eb7a273445b715bc8cdbdea0d09e

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

module JstdRunner
  class CLI

    def initialize(args)
      parse args
    end

    def run
      runner.run
    end

    private

    def parse(args)
      OptionParser.new { |op|
        op.banner = "Usage: #{File.basename $PROGRAM_NAME} [options]"
        op.separator ""

        op.on("-p", "--port PORT", Integer) do |port|
          runner.options[:port] = port
        end

        op.on("-x", "--vnc") do
          runner.options[:vnc] = true
        end

        op.on("-m", "--monitor INTERVAL", Integer) do |int|
          runner.options[:monitor_interval] = int
        end

        op.on("-b", "--browser BROWSER", String) do |browser|
          runner.options[:browser] = browser.to_sym
        end

        op.on("-d", "--daemonize LOGFILE", String) do |log|
          runner.options[:daemonize] = log
        end

        op.on("-n", "--notify email1,email2,email3", Array) do |emails|
          runner.options[:emails] = emails
        end

        op.on("-r", "--restart hour:minute") do |hour_minute|
          runner.options[:restart_at] = hour_minute
        end

        op.on('-t', '--traffic-log PATH') do |path|
          runner.options[:traffic_log] = path
        end

        op.on('-j', '--jar PATH') do |path|
          runner.options[:jar] = path
        end
      }.parse!(args)
    end

    def runner
      @runner ||= Runner.new
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jstd-runner-0.0.8 lib/jstd-runner/cli.rb
jstd-runner-0.0.7 lib/jstd-runner/cli.rb