Sha256: 592a25d6aefcaaaad741e3e32e8a07039044ada257473b1c0a2a3df528d63879

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 Bytes

Contents

require 'thor'
require 'thin'

module Firehose
  class CLI < Thor
    desc "version", "display the current version"
    def version
      puts %[Firehose #{Firehose::VERSION} "#{Firehose::CODENAME}"]
    end

    desc "server", "starts the firehose server"
    method_option :port, :type => :numeric, :default => Firehose::Default::URI.port, :required => true, :aliases => '-p'
    method_option :host, :type => :string, :default => '0.0.0.0', :required => true, :aliases => '-h'

    def server
      server = Thin::Server.new(options[:host], options[:port]) do
        run Firehose::Rack::App.new
      end

      begin
        server.start!
      rescue
        Firehose.logger.error "#{e.message}: #{e.backtrace}"
        raise
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
firehose-0.1.1 lib/firehose/cli.rb