watership 0.9.0pre2 → 0.9.0pre4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ab2aa84c3b1fc75f0d40c4dbc584a62f77d15dcd
4
- data.tar.gz: e470d7772c919cb3e9cc66471e1508af63da9816
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjdhOGViYzhhYWQ3NWYzY2IxYjY4ZTVhZDM1MjNmZTAyODg1Mjk0MA==
5
+ data.tar.gz: !binary |-
6
+ YWFkNzk2Y2M1YTllZWE5N2Y3MTFiODkxMDYzMDZlMWQ1ZjIxZWVkYQ==
5
7
  SHA512:
6
- metadata.gz: 4b312c70595fca078dd5d642be1f81dd4cd978ddedad51bf2627208939a2ae04f8964beb1f74201874925676ce1e3f63d1d98deaf6a2b0d08d2bcba18ab009c2
7
- data.tar.gz: c4f84bac066267b2d55343e0500628825e557298ddf95f38717e57561027ae857e3478a9f214eef9e3330b8b0ce0a9294a5c50cc9008beeffe61c4e54dfad910
8
+ metadata.gz: !binary |-
9
+ Y2RhNmQwZWNjNjM2OTQ5MDZhYTQ2YmQwZjBjNzM0OWJlYzU3ODhlZDI2ZWYw
10
+ MzJmMDAwODNjNWYxMzk2NDU4YTg4MTMwOGRlNDE1NTAxOTU5MjU4MWIzMjBh
11
+ YzAxMzc2NmMyOTE4YmQ0Y2Q1ZThlNDcwNDY1YTdjNzc0MWZjMWI=
12
+ data.tar.gz: !binary |-
13
+ ZjExNGMxNWI0NDczZGQ5NTdhMThiM2U2NTEwOGU0YjI4OWFiZmI0OTFlMGEw
14
+ MzM0MDM4ZjJmZWM5Y2RiYWU5Y2JkZjcxY2NlNDgwOGY3Yjc2NTk1YjA2MGQ3
15
+ N2YzMmExNGYwODM1NTgzN2M3MDE4NjljMzUzYTY5ZWFiYWUwNGI=
@@ -1,19 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  ENV["LIBRATO_AUTORUN"] = "1"
4
- concurrency = Integer(ENV.fetch("WORKER_CONCURRENCY", "2"))
5
- ENV["DB_POOL"] = (concurrency + 1).to_s
6
- require File.expand_path('config/environment', Dir.pwd)
7
- require "watership/consumer"
8
- url = ENV.fetch("CONSUMER_AMQP_URI")
9
4
 
10
- require 'optparse'
5
+ require "optparse"
6
+
11
7
  options = {}
8
+
12
9
  OptionParser.new do |opts|
13
10
  opts.banner = "Usage: watership-consume [options]"
14
11
 
15
- opts.on("-c", "--class class", "Consumer class to use") do |v|
16
- options[:class] = v
12
+ opts.on("-r", "--run class", "Camelcased name of the consumer class to run/use") do |v|
13
+ options[:run] = v
17
14
  end
18
15
 
19
16
  opts.on("-b", "--bind binding", "Bind to a queue (with routing key after /)") do |v|
@@ -25,11 +22,40 @@ OptionParser.new do |opts|
25
22
  options[:bind] = v
26
23
  end
27
24
  end
25
+
26
+ opts.on("-c", "--concurrency concurrency", "Amount of concurrent consumers/threads") do |v|
27
+ options[:concurrency] = v.to_i
28
+ end
29
+
30
+ opts.on("-u", "--amqp-uri uri", "URI string of the AMQP server to consume from") do |v|
31
+ options[:uri] = v
32
+ end
33
+
34
+ opts.on("-p", "--db-pool dbpool", "Amount of open database connections") do |v|
35
+ options[:pool] = v.to_i
36
+ end
28
37
  end.parse!
29
38
 
30
- puts options.inspect
39
+ unless options[:concurrency].to_i > 0
40
+ options[:concurrency] = Integer(ENV.fetch("WORKER_CONCURRENCY", "2"))
41
+ end
42
+
43
+ ENV["DB_POOL"] = if options[:pool].to_i > 0
44
+ options[:pool].to_s
45
+ else
46
+ (options[:concurrency] + 1).to_s
47
+ end
48
+
49
+ require File.expand_path("config/environment", Dir.pwd)
50
+ require "watership/consumer"
51
+
52
+ unless options[:uri]
53
+ options[:uri] = ENV.fetch("CONSUMER_AMQP_URI")
54
+ end
31
55
 
32
- consumer = Watership::Consumer.new(options[:class].constantize, url, concurrency: concurrency)
56
+ consumer = Watership::Consumer.new(
57
+ options[:run].constantize, options[:uri], concurrency: options[:concurrency]
58
+ )
33
59
 
34
60
  if options[:bind]
35
61
  args = if options[:routing_key]
@@ -1,3 +1,3 @@
1
1
  module Watership
2
- VERSION = '0.9.0pre2'
2
+ VERSION = "0.9.0pre4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watership
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0pre2
4
+ version: 0.9.0pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Scofield
@@ -14,56 +14,56 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bunny
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Wrapper around Bunny to better handle connection issues
@@ -74,7 +74,7 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - ".gitignore"
77
+ - .gitignore
78
78
  - CHANGELOG.md
79
79
  - Gemfile
80
80
  - LICENSE.txt
@@ -96,12 +96,12 @@ require_paths:
96
96
  - lib
97
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">="
99
+ - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ">"
104
+ - - ! '>'
105
105
  - !ruby/object:Gem::Version
106
106
  version: 1.3.1
107
107
  requirements: []