Sha256: 95030cfd0a92f25f96a9d4ac497b41bff36bea35561bd54c140ccf8f511b1b74

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env ruby

require 'fake_sqs'
require 'optparse'

options = { :port => 4567, :host => "0.0.0.0", :verbose => false }

parser = OptionParser.new do |o|

  o.on "-p", "--port PORT", Integer, "Port to use (default: 4567)" do |port|
    options[:port] = port
  end

  o.on "-o", "--bind HOST", "Host to bind to (default: 0.0.0.0)" do |host|
    options[:host] = host
  end

  o.on "-s", "--server SERVER", ['thin', 'mongrel', 'webrick'], "Server to use: thin, mongrel or webrick" do |server|
    options[:server] = server
  end

  o.on "-v", "--[no]-verbose", "Shows input parameters and output XML" do |verbose|
    options[:verbose] = verbose
  end

  o.on_tail "--version", "Shows the version" do
    puts "fake_sqs version #{FakeSQS::VERSION}"
    exit
  end

  o.on_tail "-h", "--help", "Shows this help page" do
    puts o
    exit
  end

end

parser.parse!

app = FakeSQS::WebInterface

if options[:verbose]
  require 'fake_sqs/show_output'
  app.use FakeSQS::ShowOutput
end

app.set :port, options[:port]
app.set :bind, options[:host]
app.set :server, options[:server] if options[:server]
server = FakeSQS.server(port: options[:port], host: options[:host])
app.set :api, FakeSQS.api(server: server)
app.run!

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fake_sqs-0.0.4 bin/fake_sqs