guard-sidekiq 0.0.9 → 0.0.11

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.0.11
2
+
3
+ * Can now specify a `:logfile` option.
4
+
5
+ ## 0.0.10
6
+
7
+ * Added ability to specify an array of `:queue`
8
+
1
9
  ## 0.0.9
2
10
 
3
11
  * Add `require` option.
data/README.markdown CHANGED
@@ -40,7 +40,8 @@ being active.
40
40
  You can customize the sidekiq task via the following options:
41
41
 
42
42
  * `environment`: the rails environment to run the workers in (defaults to `nil`)
43
- * `queue`: the sidekiq queue to run (defaults to `default`)
43
+ * `queue`: the sidekiq queue to run (defaults to `default`). Can supply a list of queues here.
44
+ * `logfile`: sidekiq defaults to logging to STDOUT. Can specify a file to log to instead.
44
45
  * `timeout`: shutdown timeout
45
46
  * `concurrency`: the number of threads to include (defaults to `1`)
46
47
  * `verbose`: whether to use verbose logging (defaults to `nil`)
@@ -89,5 +90,6 @@ I hacked this together from the `guard-delayed` gem for use with Resque. All cre
89
90
  ## Guard::Sidekiq Authors
90
91
  Mark Bolusmjak
91
92
  Pitr Vernigorov
93
+ [David Parry](https://github.com/suranyami)
92
94
 
93
95
  Replaces "rescue" with "sidekiq"
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'sidekiq'
17
17
 
18
18
  s.add_development_dependency 'bundler'
19
+ s.add_development_dependency 'rb-fsevent'
19
20
  s.add_development_dependency 'rake'
20
21
  s.add_development_dependency 'rspec', '~> 2.5.0'
21
22
  s.add_development_dependency 'guard-rspec', '>= 0.2.0'
data/lib/guard/sidekiq.rb CHANGED
@@ -16,6 +16,7 @@ module Guard
16
16
  # - :concurrency, e.g. 20
17
17
  # - :verbose e.g. true
18
18
  # - :stop_signal e.g. :TERM, :QUIT or :SIGQUIT
19
+ # - :logfile e.g. log/sidekiq.log (defaults to STDOUT)
19
20
  # - :require e.g. ./sidekiq_helper.rb
20
21
  def initialize(watchers = [], options = {})
21
22
  @options = options
@@ -79,11 +80,17 @@ module Guard
79
80
 
80
81
  private
81
82
 
83
+ def queue_params
84
+ params = @options[:queue]
85
+ params = [params] unless params.is_a? Array
86
+ params.collect {|param| "--queue #{param}"}.join(" ")
87
+ end
88
+
82
89
  def cmd
83
90
  command = ['bundle exec sidekiq']
84
91
 
85
- # trace setting
86
- command << "--queue #{@options[:queue]}" if @options[:queue]
92
+ command << "--logfile #{@options[:logfile]}" if @options[:logfile]
93
+ command << queue_params if @options[:queue]
87
94
  command << "-C #{@options[:config]}" if @options[:config]
88
95
  command << "--verbose" if @options[:verbose]
89
96
  command << "--environment #{@options[:environment]}" if @options[:environment]
@@ -1,7 +1,7 @@
1
1
  ### Guard::Sidekiq
2
2
  # available options:
3
3
  # - :verbose
4
- # - :queue (defaults to "default")
4
+ # - :queue (defaults to "default") can be an array
5
5
  # - :concurrency (defaults to 1)
6
6
  # - :timeout
7
7
  # - :environment (corresponds to RAILS_ENV for the Sidekiq worker)
@@ -2,7 +2,7 @@ module Guard
2
2
  module SidekiqVersion
3
3
  MAJOR = 0 # api
4
4
  MINOR = 0 # features
5
- PATCH = 9 # bug fixes
5
+ PATCH = 11 # bug fixes
6
6
  BUILD = nil # beta, rc1, etc
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -3,18 +3,33 @@ require 'spec_helper'
3
3
  describe Guard::Sidekiq do
4
4
  describe 'start' do
5
5
 
6
- it 'should accept :environment option' do
6
+ it 'accepts :environment option' do
7
7
  environment = :foo
8
8
 
9
9
  obj = Guard::Sidekiq.new [], :environment => environment
10
10
  obj.send(:cmd).should include "--environment #{environment}"
11
11
  end
12
12
 
13
- it 'should accept :queue option' do
14
- queue = :foo
13
+ it 'accepts :logfile option' do
14
+ logfile = 'log/sidekiq.log'
15
+ obj = Guard::Sidekiq.new [], :logfile => logfile
16
+ obj.send(:cmd).should include "--logfile #{logfile}"
17
+ end
18
+
19
+ describe 'with :queue option' do
20
+ it 'accepts one queue' do
21
+ queue = :foo
22
+
23
+ obj = Guard::Sidekiq.new [], :queue => queue
24
+ obj.send(:cmd).should include "--queue #{queue}"
25
+ end
26
+
27
+ it 'accepts array of :queue options' do
28
+ queue = ['foo,4', 'default']
15
29
 
16
- obj = Guard::Sidekiq.new [], :queue => queue
17
- obj.send(:cmd).should include "--queue #{queue}"
30
+ obj = Guard::Sidekiq.new [], :queue => queue
31
+ obj.send(:cmd).should include "--queue #{queue.first} --queue #{queue.last}"
32
+ end
18
33
  end
19
34
 
20
35
  it 'should accept :timeout option' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-02 00:00:00.000000000 Z
13
+ date: 2013-01-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: guard
@@ -60,6 +60,22 @@ dependencies:
60
60
  - - ! '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: rb-fsevent
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
63
79
  - !ruby/object:Gem::Dependency
64
80
  name: rake
65
81
  requirement: !ruby/object:Gem::Requirement
@@ -157,12 +173,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
173
  - - ! '>='
158
174
  - !ruby/object:Gem::Version
159
175
  version: '0'
176
+ segments:
177
+ - 0
178
+ hash: 3362156540621315414
160
179
  required_rubygems_version: !ruby/object:Gem::Requirement
161
180
  none: false
162
181
  requirements:
163
182
  - - ! '>='
164
183
  - !ruby/object:Gem::Version
165
184
  version: '0'
185
+ segments:
186
+ - 0
187
+ hash: 3362156540621315414
166
188
  requirements: []
167
189
  rubyforge_project:
168
190
  rubygems_version: 1.8.23