Sha256: ef9cf820706fecca79e7b453928467d4c0be518b9962e9379d67feca7412b6f0

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

#!/usr/bin/env ruby

require 'reel'

options = {}

parser = OptionParser.new do |opts|
  opts.on "-p", "--port PORT", Integer,
  "Define what port TCP port to bind to (default: 3000)" do |arg|
    options[:port] = arg
  end

  opts.on "-a", "--address HOST",
  "bind to HOST address (default: 0.0.0.0)" do |arg|
    options[:host] = arg
  end

  opts.on "-q", "--quiet", "Quiet down the output" do
    options[:quiet] = true
  end

  opts.on "-e", "--environment ENVIRONMENT",
  "The environment to run the Rack app on (default: development)" do |arg|
    options[:environment] = arg
  end

  opts.on "-t", "--threads NUM", Integer,
  "The number of worker threads (default: 10)" do |arg|
    options[:workers] = arg
  end

  opts.on "-r", "--rackup FILE",
  "Load Rack config from this file (default: config.ru)" do |arg|
    options[:rackup] = arg
  end
end

parser.banner = "reel <options> <rackup file>"

parser.on_tail "-h", "--help", "Show help" do
  puts parser
  exit 1
end

parser.parse(ARGV)

if ARGV.last =~ /\.ru$/
  options[:rackup] = @argv.shift
end

handler = Rack::Handler::Reel.new(options)

Reel::Logger.info "A Reel good HTTP server!"
Reel::Logger.info "Listening on #{handler[:host]}:#{handler[:port]}"

handler.start

sleep

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reel-0.2.0 bin/reel
reel-0.2.0.pre bin/reel