Sha256: 23db053f81f86794438c07ba0fc6b72d08ba7daa1252f1941f8a0d777a04964c

Contents?: true

Size: 899 Bytes

Versions: 2

Compression:

Stored size: 899 Bytes

Contents

require 'rack'

module Dugway
  module Cli
    class Server < Thor::Group
      include Thor::Actions
      
      class_option :host,
        :type    => :string,
        :aliases => '-h',
        :default => '0.0.0.0',
        :desc    => 'The host address to bind to'
      
      class_option :port,
        :type    => :numeric,
        :aliases => '-p',
        :default => 9292,
        :desc    => "The port address to bind to"

      class_option :daemonize,
        :type    => :boolean,
        :aliases => '-d',
        :default => false,
        :desc    => "Run daemonized in the background"
      
      def start
        Rack::Server.start({
          :config => File.join(Dir.pwd, 'config.ru'),
          :environment => 'none',
          :Host => options[:host],
          :Port => options[:port],
          :daemonize => options[:daemonize]
        })
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dugway-0.5.1 lib/dugway/cli/server.rb
dugway-0.5.0 lib/dugway/cli/server.rb