Sha256: e092f8cb55c6295e23a0e166c48ae02eac7cfbd6ba59e0bb3f0a60bbdc37da12

Contents?: true

Size: 793 Bytes

Versions: 5

Compression:

Stored size: 793 Bytes

Contents

require 'optparse'

module Jackhammer
  class CLI
    attr_reader :logger, :opts

    def initialize(options = {})
      @logger = Logger.new $stderr
      @opts = { require: './config/environment' }.merge(options)
    end

    def parse(argv = ARGV)
      @parser = OptionParser.new do |o|
        o.on "-r", "--require PATH", "Location of application" do |arg|
          opts[:require] = arg
        end
      end
      @parser.banner = "jackhammer [options]"
      @parser.on_tail "-h", "--help", "Show help" do
        logger.info @parser
        exit
      end
      @parser.parse!(argv)
    end

    def run
      require opts[:require]
      Log.info "Booting up Jackhammer v#{VERSION}"
      server.start
    end

    def server
      Jackhammer.configuration.server
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jackhammer-1.5.1 lib/jackhammer/cli.rb
jackhammer-1.5.0 lib/jackhammer/cli.rb
jackhammer-1.5.0.rc lib/jackhammer/cli.rb
jackhammer-1.4.0 lib/jackhammer/cli.rb
jackhammer-1.3.7 lib/jackhammer/cli.rb