Sha256: bb85a15a63984532ec802184a958050f4b715109053acfcf3c56742804ffb43f

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 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
      }.parse!(args)
    end

    def runner
      @runner ||= Runner.new
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jstd-runner-0.0.6 lib/jstd-runner/cli.rb
jstd-runner-0.0.5 lib/jstd-runner/cli.rb
jstd-runner-0.0.4 lib/jstd-runner/cli.rb
jstd-runner-0.0.3 lib/jstd-runner/cli.rb