shoryuken 2.1.1 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +5 -8
  3. data/.rubocop.yml +8 -2
  4. data/.travis.yml +6 -0
  5. data/CHANGELOG.md +167 -0
  6. data/Gemfile +2 -0
  7. data/README.md +16 -155
  8. data/Rakefile +0 -1
  9. data/bin/cli/base.rb +40 -0
  10. data/bin/cli/sqs.rb +204 -0
  11. data/bin/shoryuken +55 -9
  12. data/examples/default_worker.rb +1 -1
  13. data/lib/shoryuken/client.rb +3 -15
  14. data/lib/shoryuken/default_worker_registry.rb +10 -6
  15. data/lib/shoryuken/environment_loader.rb +60 -57
  16. data/lib/shoryuken/fetcher.rb +21 -51
  17. data/lib/shoryuken/launcher.rb +77 -23
  18. data/lib/shoryuken/logging.rb +0 -5
  19. data/lib/shoryuken/manager.rb +54 -205
  20. data/lib/shoryuken/message.rb +4 -13
  21. data/lib/shoryuken/middleware/chain.rb +1 -18
  22. data/lib/shoryuken/middleware/server/auto_delete.rb +3 -8
  23. data/lib/shoryuken/middleware/server/auto_extend_visibility.rb +16 -17
  24. data/lib/shoryuken/middleware/server/exponential_backoff_retry.rb +37 -22
  25. data/lib/shoryuken/middleware/server/timing.rb +2 -2
  26. data/lib/shoryuken/options.rb +196 -0
  27. data/lib/shoryuken/polling/base.rb +67 -0
  28. data/lib/shoryuken/polling/strict_priority.rb +77 -0
  29. data/lib/shoryuken/polling/weighted_round_robin.rb +66 -0
  30. data/lib/shoryuken/processor.rb +27 -25
  31. data/lib/shoryuken/queue.rb +28 -9
  32. data/lib/shoryuken/runner.rb +131 -0
  33. data/lib/shoryuken/util.rb +1 -9
  34. data/lib/shoryuken/version.rb +1 -1
  35. data/lib/shoryuken/worker.rb +9 -1
  36. data/lib/shoryuken.rb +47 -157
  37. data/shoryuken.gemspec +7 -7
  38. data/spec/integration/launcher_spec.rb +15 -8
  39. data/spec/shoryuken/client_spec.rb +2 -45
  40. data/spec/shoryuken/default_worker_registry_spec.rb +12 -10
  41. data/spec/shoryuken/environment_loader_spec.rb +54 -0
  42. data/spec/shoryuken/fetcher_spec.rb +27 -46
  43. data/spec/shoryuken/manager_spec.rb +80 -93
  44. data/spec/shoryuken/middleware/chain_spec.rb +0 -24
  45. data/spec/shoryuken/middleware/server/auto_delete_spec.rb +2 -2
  46. data/spec/shoryuken/middleware/server/auto_extend_visibility_spec.rb +7 -3
  47. data/spec/shoryuken/middleware/server/exponential_backoff_retry_spec.rb +56 -33
  48. data/spec/shoryuken/middleware/server/timing_spec.rb +5 -3
  49. data/spec/shoryuken/options_spec.rb +100 -0
  50. data/spec/shoryuken/polling/strict_priority_spec.rb +140 -0
  51. data/spec/shoryuken/polling/weighted_round_robin_spec.rb +99 -0
  52. data/spec/shoryuken/processor_spec.rb +20 -37
  53. data/spec/shoryuken/queue_spec.rb +72 -26
  54. data/spec/shoryuken/{cli_spec.rb → runner_spec.rb} +11 -26
  55. data/spec/shoryuken_spec.rb +1 -48
  56. data/spec/spec_helper.rb +14 -20
  57. data/test_workers/endless_interruptive_worker.rb +41 -0
  58. data/test_workers/endless_uninterruptive_worker.rb +44 -0
  59. metadata +39 -34
  60. data/lib/shoryuken/aws_config.rb +0 -64
  61. data/lib/shoryuken/cli.rb +0 -215
  62. data/lib/shoryuken/sns_arn.rb +0 -27
  63. data/lib/shoryuken/topic.rb +0 -17
  64. data/spec/shoryuken/sns_arn_spec.rb +0 -42
  65. data/spec/shoryuken/topic_spec.rb +0 -32
  66. data/spec/shoryuken_endpoint.yml +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 767009617d3e6954d4b1bec86f33811fdfd6c4e0
4
- data.tar.gz: 578e87e222d8f980a72981f75ae57a7ad6a5275f
3
+ metadata.gz: 942ccdeaca0a94e766b82fa40da9ed091b703ea2
4
+ data.tar.gz: f94a089b56ed37b5db2752ccf418c667fae31b6d
5
5
  SHA512:
6
- metadata.gz: 6c8493dc99b8b11ee02e7c5ae1d51acf499e60b0ba1b94c2202b40d7e36f4ea3d1ea03ab9f5d2570e7943d87f4cd2b0c54940c62b12c08903f83584967897203
7
- data.tar.gz: b04c12cd3ef6efe7ac4ca4a8ab3f6011bee687aa5053db2ed0fd03205d32e76a3cd45809a4aa8e75e8b7f50d311334dd43aa698cc25e366019ddc9d932bd8a94
6
+ metadata.gz: 67c92d3af6c4063f42afe07a3f56c32b847bd1bc76d80f4f9f46cc2aa48d3e7bf82213f4d98fe229265ce9b1387a3649652863f019e73aeb0d809b1a03c5ca4d
7
+ data.tar.gz: 1215eca9e669975edb70fa43855122e6f25c6e54452771ba26435f7e8df37684be20516037e1419a3e7d93a14773231387f471cc2ff8a03eb838f1e52f2c144d
data/.codeclimate.yml CHANGED
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  engines:
3
- brakeman:
4
- enabled: true
5
- bundler-audit:
3
+ reek:
6
4
  enabled: true
7
5
  duplication:
8
6
  enabled: true
@@ -11,13 +9,12 @@ engines:
11
9
  - ruby
12
10
  fixme:
13
11
  enabled: true
14
- reek:
15
- enabled: true
16
12
  rubocop:
17
13
  enabled: true
14
+ config:
15
+ file: .rubocop.yml
18
16
  ratings:
19
17
  paths:
20
18
  - "**.rb"
21
- # exclude_paths:
22
- # - "**/vendor/**/*"
23
- # - "*/spec/**/*"
19
+ exclude_paths:
20
+ - spec/
data/.rubocop.yml CHANGED
@@ -1,9 +1,12 @@
1
- LineLength:
2
- Max: 120
1
+ AllCops:
2
+ TargetRubyVersion: 2.0
3
3
 
4
4
  Style/SignalException:
5
5
  Enabled: false
6
6
 
7
+ Style/DoubleNegation:
8
+ Enabled: false
9
+
7
10
  Style/SpaceAroundEqualsInParameterDefault:
8
11
  Enabled: false
9
12
 
@@ -28,6 +31,9 @@ Metrics/ClassLength:
28
31
  Metrics/ParameterLists:
29
32
  Enabled: false
30
33
 
34
+ Metrics/LineLength:
35
+ Max: 130
36
+
31
37
  Metrics/MethodLength :
32
38
  Enabled: false
33
39
 
data/.travis.yml CHANGED
@@ -3,6 +3,8 @@ rvm:
3
3
  - 2.0.0
4
4
  - 2.1.0
5
5
  - 2.2.0
6
+ - 2.3.3
7
+ - 2.4.1
6
8
 
7
9
  notifications:
8
10
  email:
@@ -14,3 +16,7 @@ before_install:
14
16
  - gem update bundler
15
17
  after_success:
16
18
  - bundle exec codeclimate-test-reporter
19
+
20
+ addons:
21
+ code_climate:
22
+ repo_token: 7709fd21981bb9d2658647a66d959415a1029a83f1c199573828797944f26c52
data/CHANGELOG.md CHANGED
@@ -1,8 +1,175 @@
1
+ ## [v3.1.3] - 2017-07-11
2
+
3
+ - Add queue prefixing support for groups
4
+ - [#405](https://github.com/phstc/shoryuken/pull/405)
5
+
6
+ - Remove dead code
7
+ - [#402](https://github.com/phstc/shoryuken/pull/402)
8
+
9
+ ## [v3.1.2] - 2017-07-06
10
+
11
+ - Fix stack level too deep on Ubuntu
12
+ - [#400](https://github.com/phstc/shoryuken/pull/400)
13
+
14
+ ## [v3.1.1] - 2017-07-05
15
+
16
+ - Reduce log verbosity introduced in 3.1.0
17
+ - [#397](https://github.com/phstc/shoryuken/pull/397)
18
+
19
+ - Try to prevent stack level too deep on Ubuntu
20
+ - [#396](https://github.com/phstc/shoryuken/pull/396)
21
+
22
+ ## [v3.1.0] - 2017-07-02
23
+
24
+ - Add shoryuken sqs delete command
25
+ - [#395](https://github.com/phstc/shoryuken/pull/395)
26
+
27
+ - Add processing groups support; Concurrency per queue support
28
+ - [#389](https://github.com/phstc/shoryuken/pull/389)
29
+
30
+ - Terminate Shoryuken if the fetcher crashes
31
+ - [#389](https://github.com/phstc/shoryuken/pull/389)
32
+
33
+ ## [v3.0.11] - 2017-06-24
34
+
35
+ - Add shoryuken sqs create command
36
+ - [#388](https://github.com/phstc/shoryuken/pull/388)
37
+
38
+ ## [v3.0.10] - 2017-06-24
39
+
40
+ - Allow aws sdk v3
41
+ - [#381](https://github.com/phstc/shoryuken/pull/381)
42
+
43
+ - Allow configuring Rails via the config file
44
+ - [#387](https://github.com/phstc/shoryuken/pull/387)
45
+
46
+ ## [v3.0.9] - 2017-06-05
47
+
48
+ - Allow configuring queue URLs instead of names
49
+ - [#378](https://github.com/phstc/shoryuken/pull/378)
50
+
51
+ ## [v3.0.8] - 2017-06-02
52
+
53
+ - Fix miss handling empty batch fetches
54
+ - [#376](https://github.com/phstc/shoryuken/pull/376)
55
+
56
+ - Various minor styling changes :lipstick:
57
+ - [#373](https://github.com/phstc/shoryuken/pull/373)
58
+
59
+ - Logout when batch delete returns any failure
60
+ - [#371](https://github.com/phstc/shoryuken/pull/371)
61
+
62
+ ## [v3.0.7] - 2017-05-18
63
+
64
+ - Trigger events for dispatch
65
+ - [#362](https://github.com/phstc/shoryuken/pull/362)
66
+
67
+ - Log (warn) exponential backoff tries
68
+ - [#365](https://github.com/phstc/shoryuken/pull/365)
69
+
70
+ - Fix displaying of long queue names in `shoryuken sqs ls`
71
+ - [#366](https://github.com/phstc/shoryuken/pull/366)
72
+
73
+ ## [v3.0.6] - 2017-04-11
74
+
75
+ - Fix delay option type
76
+ - [#356](https://github.com/phstc/shoryuken/pull/356)
77
+
78
+ ## [v3.0.5] - 2017-04-09
79
+
80
+ - Pause endless dispatcher to avoid CPU overload
81
+ - [#354](https://github.com/phstc/shoryuken/pull/354)
82
+
83
+ - Auto log processor errors
84
+ - [#355](https://github.com/phstc/shoryuken/pull/355)
85
+
86
+ - Add a delay as a CLI param
87
+ - [#350](https://github.com/phstc/shoryuken/pull/350)
88
+
89
+ - Add `sqs purge` command. See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_PurgeQueue.html
90
+ - [#344](https://github.com/phstc/shoryuken/pull/344)
91
+
92
+ ## [v3.0.4] - 2017-03-24
93
+
94
+ - Add `sqs purge` command. See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_PurgeQueue.html
95
+ - [#344](https://github.com/phstc/shoryuken/pull/344)
96
+
97
+ - Fix "Thread exhaustion" error. This issue was most noticed when using long polling. @waynerobinson :beers: for pairing up on this.
98
+ - [#345](https://github.com/phstc/shoryuken/pull/345)
99
+
100
+ ## [v3.0.3] - 2017-03-19
101
+
102
+ - Update `sqs` CLI commands to use `get_queue_url` when appropriated
103
+ - [#341](https://github.com/phstc/shoryuken/pull/341)
104
+
105
+ ## [v3.0.2] - 2017-03-19
106
+
107
+ - Fix custom SQS client initialization
108
+ - [#335](https://github.com/phstc/shoryuken/pull/335)
109
+
110
+ ## [v3.0.1] - 2017-03-13
111
+
112
+ - Fix commands sqs mv and dump `options.delete` checker
113
+ - [#332](https://github.com/phstc/shoryuken/pull/332)
114
+
115
+ ## [v3.0.0] - 2017-03-12
116
+
117
+ - Replace Celluloid with Concurrent Ruby
118
+ - [#291](https://github.com/phstc/shoryuken/pull/291)
119
+
120
+ - Remove AWS configuration from Shoryuken. Now AWS should be configured from outside. Check [this](https://github.com/phstc/shoryuken/wiki/Configure-the-AWS-Client) for more details
121
+ - [#317](https://github.com/phstc/shoryuken/pull/317)
122
+
123
+ - Remove deprecation warnings
124
+ - [#326](https://github.com/phstc/shoryuken/pull/326)
125
+
126
+ - Allow dynamic adding queues
127
+ - [#322](https://github.com/phstc/shoryuken/pull/322)
128
+
129
+ - Support retry_intervals passed in as a lambda. Auto coerce intervals into integer
130
+ - [#329](https://github.com/phstc/shoryuken/pull/329)
131
+
132
+ - Add SQS commands `shoryuken help sqs`, such as `ls`, `mv`, `dump` and `requeue`
133
+ - [#330](https://github.com/phstc/shoryuken/pull/330)
134
+
135
+ ## [v2.1.3] - 2017-01-27
136
+
137
+ - Show a warn message when batch isn't supported
138
+ - [#302](https://github.com/phstc/shoryuken/pull/302)
139
+
140
+ - Require Celluloid ~> 17
141
+ - [#305](https://github.com/phstc/shoryuken/pull/305)
142
+
143
+ - Fix excessive logging when 0 messages found
144
+ - [#307](https://github.com/phstc/shoryuken/pull/307)
145
+
146
+ ## [v2.1.2] - 2016-12-22
147
+
148
+ - Fix loading `logfile` from shoryuken.yml
149
+ - [#296](https://github.com/phstc/shoryuken/pull/296)
150
+
151
+ - Add support for Strict priority polling (pending documentation)
152
+ - [#288](https://github.com/phstc/shoryuken/pull/288)
153
+
154
+ - Add `test_workers` for end-to-end testing supporting
155
+ - [#286](https://github.com/phstc/shoryuken/pull/286)
156
+
157
+ - Update README documenting `configure_client` and `configure_server`
158
+ - [#283](https://github.com/phstc/shoryuken/pull/283)
159
+
160
+ - Fix memory leak caused by async tracking busy threads
161
+ - [#289](https://github.com/phstc/shoryuken/pull/289)
162
+
163
+ - Refactor fetcher, polling strategy and manager
164
+ - [#284](https://github.com/phstc/shoryuken/pull/284)
165
+
1
166
  ## [v2.1.1] - 2016-12-05
167
+
2
168
  - Fix aws deprecation warning message
3
169
  - [#279](https://github.com/phstc/shoryuken/pull/279)
4
170
 
5
171
  ## [v2.1.0] - 2016-12-03
172
+
6
173
  - Fix celluloid "running in BACKPORTED mode" warning
7
174
  - [#260](https://github.com/phstc/shoryuken/pull/260)
8
175
 
data/Gemfile CHANGED
@@ -4,7 +4,9 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
+ gem 'activejob'
7
8
  gem 'codeclimate-test-reporter', require: nil
8
9
  gem 'simplecov'
9
10
  gem 'multi_xml'
11
+ gem 'httparty'
10
12
  end
data/README.md CHANGED
@@ -1,46 +1,27 @@
1
1
  # Shoryuken
2
2
 
3
- ![](shoryuken.jpg)
3
+ ![Shoryuken](shoryuken.jpg)
4
4
 
5
- Shoryuken _sho-ryu-ken_ is a super-efficient [AWS SQS](https://aws.amazon.com/sqs/) thread-based message processor.
5
+ Shoryuken _sho-ryu-ken_ is a super-efficient [Amazon SQS](https://aws.amazon.com/sqs/) thread-based message processor.
6
6
 
7
7
  [![Build Status](https://travis-ci.org/phstc/shoryuken.svg)](https://travis-ci.org/phstc/shoryuken)
8
8
  [![Code Climate](https://codeclimate.com/github/phstc/shoryuken/badges/gpa.svg)](https://codeclimate.com/github/phstc/shoryuken)
9
9
 
10
10
  ## Key features
11
11
 
12
- ### Load balancing
13
-
14
- Yeah, Shoryuken load balances the messages consumption!
15
-
16
- Given this configuration:
17
-
18
- ```yaml
19
- concurrency: 25
20
- delay: 25
21
- queues:
22
- - [high_priority, 6]
23
- - [default, 2]
24
- - [low_priority, 1]
25
- ```
26
-
27
- And supposing all the queues are full of messages, the configuration above will make Shoryuken to process `high_priority` 3 times more than `default` and 6 times more than `low_priority`,
28
- splitting the work among the `concurrency: 25` available processors.
29
-
30
- If `high_priority` gets empty, Shoryuken will keep using the 25 processors, but only to process `default` (2 times more than `low_priority`) and `low_priority`.
31
-
32
- If `high_priority` receives a new message, Shoryuken will smoothly increase back the `high_priority` weight one by one until it reaches the weight of 6 again, which is the maximum configured for `high_priority`.
33
-
34
- If all queues get empty, all processors will be changed to the waiting state and the queues will be checked every `delay: 25`. If any queue receives a new message, Shoryuken will start processing again. [Check the delay option documentation for more information](https://github.com/phstc/shoryuken/wiki/Shoryuken-options#delay).
35
-
36
-
37
- ### Fetch in batches
38
-
39
- To be even more performant and cost effective, Shoryuken fetches SQS messages in batches, so a single SQS request can fetch up to 10 messages.
12
+ - [Rails Active Job](https://github.com/phstc/shoryuken/wiki/Rails-Integration-Active-Job)
13
+ - [Queue Load balancing](https://github.com/phstc/shoryuken/wiki/Shoryuken-options#load-balancing)
14
+ - [Concurrency per queue](https://github.com/phstc/shoryuken/wiki/Processing-Groups)
15
+ - [Long Polling](https://github.com/phstc/shoryuken/wiki/Long-Polling)
16
+ - [Batch processing](https://github.com/phstc/shoryuken/wiki/Worker-options#batch)
17
+ - [Auto extend visibility timeout](https://github.com/phstc/shoryuken/wiki/Worker-options#auto_visibility_timeout)
18
+ - [Exponential backoff](https://github.com/phstc/shoryuken/wiki/Worker-options#retry_intervals)
19
+ - [Middleware support](https://github.com/phstc/shoryuken/wiki/Middleware)
20
+ - Amazon SQS CLI. See `shoryuken help sqs`
40
21
 
41
22
  ## Requirements
42
23
 
43
- Ruby 2.0 or greater. Ruby 1.9 is no longer supported.
24
+ Ruby 2.0 or greater.
44
25
 
45
26
  ## Installation
46
27
 
@@ -50,139 +31,19 @@ Add this line to your application's Gemfile:
50
31
  gem 'shoryuken'
51
32
  ```
52
33
 
53
- Or to get the latest updates:
54
-
55
- ```ruby
56
- gem 'shoryuken', github: 'phstc/shoryuken', branch: 'master'
57
- ```
58
-
59
34
  And then execute:
60
35
 
61
- $ bundle
62
-
63
- Or install it yourself as:
64
-
65
- $ gem install shoryuken
66
-
67
- ## Usage
68
-
69
- ### Worker class
70
-
71
- ```ruby
72
- class MyWorker
73
- include Shoryuken::Worker
74
-
75
- shoryuken_options queue: 'default', auto_delete: true
76
- # shoryuken_options queue: ->{ "#{ENV['environment']}_default" }
77
-
78
- # shoryuken_options body_parser: :json
79
- # shoryuken_options body_parser: ->(sqs_msg){ REXML::Document.new(sqs_msg.body) }
80
- # shoryuken_options body_parser: JSON
81
-
82
- def perform(sqs_msg, body)
83
- puts body
84
- end
85
- end
86
- ```
87
-
88
- [Check the Worker options documention](https://github.com/phstc/shoryuken/wiki/Worker-options).
89
-
90
- ### Sending a message
91
-
92
- [Check the Sending a message documentation](https://github.com/phstc/shoryuken/wiki/Sending-a-message)
93
-
94
- ### Middleware
95
-
96
- ```ruby
97
- class MyMiddleware
98
- def call(worker_instance, queue, sqs_msg, body)
99
- puts 'Before work'
100
- yield
101
- puts 'After work'
102
- end
103
- end
104
- ```
105
-
106
- [Check the Middleware documentation](https://github.com/phstc/shoryuken/wiki/Middleware).
107
-
108
- ### Configuration (worker side)
109
-
110
- Sample configuration file `shoryuken.yml`.
111
-
112
- ```yaml
113
- aws:
114
- access_key_id: ... # or <%= ENV['AWS_ACCESS_KEY_ID'] %>
115
- secret_access_key: ... # or <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
116
- region: us-east-1 # or <%= ENV['AWS_REGION'] %>
117
- receive_message: # See http://docs.aws.amazon.com/sdkforruby/api/Aws/SQS/Client.html#receive_message-instance_method
118
- # wait_time_seconds: N # The number of seconds to wait for new messages when polling. Defaults to the #wait_time_seconds defined on the queue
119
- attribute_names:
120
- - ApproximateReceiveCount
121
- - SentTimestamp
122
- concurrency: 25 # The number of allocated threads to process messages. Default 25
123
- delay: 25 # The delay in seconds to pause a queue when it's empty. Default 0
124
- queues:
125
- - [high_priority, 6]
126
- - [default, 2]
127
- - [low_priority, 1]
128
- ```
129
-
130
- The ```aws``` section is used to configure both the Aws objects used by Shoryuken internally, and also to set up some Shoryuken-specific config. The Shoryuken-specific keys are listed below, and you can expect any other key defined in that block to be passed on untouched to ```Aws::SQS::Client#initialize```:
131
-
132
- - ```account_id``` is used when generating SNS ARNs
133
- - ```sns_endpoint``` can be used to explicitly override the SNS endpoint
134
- - ```sqs_endpoint``` can be used to explicitly override the SQS endpoint
135
- - ```receive_message``` can be used to define the options passed to the http://docs.aws.amazon.com/sdkforruby/api/Aws/SQS/Client.html#receive_message-instance_method
136
-
137
- The ```sns_endpoint``` and ```sqs_endpoint``` Shoryuken-specific options will also fallback to the environment variables ```AWS_SNS_ENDPOINT``` and ```AWS_SQS_ENDPOINT``` respectively, if they are set.
138
-
139
- ### Configuration (producer side)
140
-
141
- 'Producer' processes need permissions to put messages into SQS. There are a few ways:
142
-
143
- * Ensure the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` env vars are set.
144
- * Create a `~/.aws/credentials` file.
145
- * Set `Aws.config[:credentials]` from Ruby code (e.g. in a Rails initializer)
146
- * Use the Instance Profiles feature. The IAM role of the targeted machine must have an adequate SQS Policy.
147
-
148
- Note that storing your credentials into Amazon instances represents a security risk. Instance Profiles tends to be the best choice.
149
-
150
- You can read about these in more detail [here](http://docs.aws.amazon.com/sdkforruby/api/Aws/SQS/Client.html).
151
-
152
- ### Rails Integration
153
-
154
- [Check the Rails Integration Active Job documention](https://github.com/phstc/shoryuken/wiki/Rails-Integration-Active-Job).
155
-
156
- ### Start Shoryuken
157
-
158
36
  ```shell
159
- bundle exec shoryuken -r worker.rb -C shoryuken.yml
37
+ $ bundle
160
38
  ```
161
39
 
162
- Other options:
163
-
164
- ```bash
165
- shoryuken --help
166
-
167
- shoryuken [options]
168
- -c, --concurrency INT Processor threads to use
169
- -d, --daemon Daemonize process
170
- -q, --queue QUEUE[,WEIGHT]... Queues to process with optional weights
171
- -r, --require [PATH|DIR] Location of the worker
172
- -C, --config PATH Path to YAML config file
173
- -R, --rails Attempts to load the containing Rails project
174
- -L, --logfile PATH Path to writable logfile
175
- -P, --pidfile PATH Path to pidfile
176
- -v, --verbose Print more verbose output
177
- -V, --version Print version and exit
178
- -h, --help Show help
179
- ...
180
- ```
40
+ ## Usage
181
41
 
42
+ Check the [Getting Started](https://github.com/phstc/shoryuken/wiki/Getting-Started) page.
182
43
 
183
44
  ## More Information
184
45
 
185
- For more information on advanced topics such as signals (shutdown), ActiveJob integration, and so on please check the [Shoryuken Wiki](https://github.com/phstc/shoryuken/wiki).
46
+ For more information check the [wiki page](https://github.com/phstc/shoryuken/wiki).
186
47
 
187
48
  ## Credits
188
49
 
data/Rakefile CHANGED
@@ -10,7 +10,6 @@ end
10
10
  desc 'Open Shoryuken pry console'
11
11
  task :console do
12
12
  require 'pry'
13
- require 'celluloid/current'
14
13
  require 'shoryuken'
15
14
 
16
15
  config_file = File.join File.expand_path('..', __FILE__), 'shoryuken.yml'
data/bin/cli/base.rb ADDED
@@ -0,0 +1,40 @@
1
+ # rubocop:disable Metrics/BlockLength
2
+ module Shoryuken
3
+ module CLI
4
+ class Base < Thor
5
+ no_commands do
6
+ def print_table(entries)
7
+ column_sizes = print_columns_size(entries)
8
+
9
+ entries.map do |entry|
10
+ puts entry.map.with_index { |e, i| print_format_column(e, column_sizes[i]) }.join
11
+ end
12
+ end
13
+
14
+ def print_columns_size(entries)
15
+ column_sizes = Hash.new(0)
16
+
17
+ entries.each do |entry|
18
+ entry.each_with_index do |e, i|
19
+ e = e.to_s
20
+ column_sizes[i] = e.size if column_sizes[i] < e.size
21
+ end
22
+ end
23
+
24
+ column_sizes
25
+ end
26
+
27
+ def print_format_column(column, size)
28
+ size_with_padding = size + 4
29
+ column = column.to_s.ljust(size_with_padding)
30
+ column
31
+ end
32
+
33
+ def fail_task(msg, quit = true)
34
+ say "[FAIL] #{msg}", :red
35
+ exit(1) if quit
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end