fake_sqs 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/fake_sqs CHANGED
@@ -4,25 +4,24 @@ require 'fake_sqs'
4
4
  require 'fake_sqs/web_interface'
5
5
  require 'optparse'
6
6
 
7
- app = FakeSQS::WebInterface
7
+ options = { :port => 4567, :host => "0.0.0.0", :verbose => false }
8
8
 
9
9
  parser = OptionParser.new do |o|
10
10
 
11
11
  o.on "-p", "--port PORT", Integer, "Port to use (default: 4567)" do |port|
12
- app.set :port, port
12
+ options[:port] = port
13
13
  end
14
14
 
15
- o.on "-o", "--bind HOST", "Host to bind to (default: 0.0.0.0)" do |bind|
16
- app.set :bind, bind
15
+ o.on "-o", "--bind HOST", "Host to bind to (default: 0.0.0.0)" do |host|
16
+ options[:host] = host
17
17
  end
18
18
 
19
19
  o.on "-s", "--server SERVER", ['thin', 'mongrel', 'webrick'], "Server to use: thin, mongrel or webrick" do |server|
20
- app.set :server, server
20
+ options[:server] = server
21
21
  end
22
22
 
23
- o.on "-v", "--verbose", "Shows input parameters and output XML" do
24
- require 'fake_sqs/show_output'
25
- app.use FakeSQS::ShowOutput
23
+ o.on "-v", "--[no]-verbose", "Shows input parameters and output XML" do |verbose|
24
+ options[:verbose] = verbose
26
25
  end
27
26
 
28
27
  o.on_tail "--version", "Shows the version" do
@@ -38,4 +37,16 @@ parser = OptionParser.new do |o|
38
37
  end
39
38
 
40
39
  parser.parse!
40
+
41
+ app = FakeSQS::WebInterface
42
+
43
+ if options[:verbose]
44
+ require 'fake_sqs/show_output'
45
+ app.use FakeSQS::ShowOutput
46
+ end
47
+
48
+ app.set :port, options[:port]
49
+ app.set :bind, options[:host]
50
+ app.set :server, options[:server] if options[:server]
51
+ app.set :sqs, FakeSQS.server(port: options[:port], host: options[:host])
41
52
  app.run!
@@ -1,3 +1,3 @@
1
1
  module FakeSQS
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/spec/support/aws.rb CHANGED
@@ -17,7 +17,7 @@ class FakeServer
17
17
 
18
18
  attr_reader :url
19
19
 
20
- def initialize(url = "http://localhost:4567")
20
+ def initialize(url = "http://0.0.0.0:4567")
21
21
  @url = url
22
22
  end
23
23
 
@@ -42,7 +42,6 @@ class FakeServer
42
42
  @started = true
43
43
  @fake_sqs_thread = Thread.new {
44
44
  load File.expand_path('../../../bin/fake_sqs', __FILE__)
45
- Sinatra::Application.run!
46
45
  }
47
46
  wait_until_up
48
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-04 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra