Sha256: f2fb161471d6230ca357c353ce045c7a78c755c6948db65066225b8ce49fd79b

Contents?: true

Size: 792 Bytes

Versions: 9

Compression:

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

9 entries across 9 versions & 1 rubygems

Version Path
jackhammer-1.3.6 lib/jackhammer/cli.rb
jackhammer-1.3.5 lib/jackhammer/cli.rb
jackhammer-1.3.4 lib/jackhammer/cli.rb
jackhammer-1.3.3 lib/jackhammer/cli.rb
jackhammer-1.3.2 lib/jackhammer/cli.rb
jackhammer-1.3.1 lib/jackhammer/cli.rb
jackhammer-1.3.0 lib/jackhammer/cli.rb
jackhammer-1.2.0 lib/jackhammer/cli.rb
jackhammer-1.1.0 lib/jackhammer/cli.rb