Skip to content

Commit

Permalink
Merge pull request #4 from kibenimatik/master
Browse files Browse the repository at this point in the history
Require option
  • Loading branch information
pitr committed Oct 2, 2012
2 parents 12397cc + 115f158 commit 5d4d056
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.markdown
Expand Up @@ -45,6 +45,7 @@ You can customize the sidekiq task via the following options:
* `concurrency`: the number of threads to include (defaults to `1`)
* `verbose`: whether to use verbose logging (defaults to `nil`)
* `stop_signal`: how to kill the process when restarting (defaults to `TERM`)
* `require`: location of rails application with workers or file to require (defaults to `nil`)


## Development
Expand Down
2 changes: 2 additions & 0 deletions lib/guard/sidekiq.rb
Expand Up @@ -16,6 +16,7 @@ class Sidekiq < Guard
# - :concurrency, e.g. 20
# - :verbose e.g. true
# - :stop_signal e.g. :TERM, :QUIT or :SIGQUIT
# - :require e.g. ./sidekiq_helper.rb
def initialize(watchers = [], options = {})
@options = options
@pid = nil
Expand Down Expand Up @@ -87,6 +88,7 @@ def cmd
command << "--verbose" if @options[:verbose]
command << "--environment #{@options[:environment]}" if @options[:environment]
command << "--timeout #{@options[:timeout]}" if @options[:timeout]
command << "--require #{@options[:require]}" if @options[:require]
command << "--concurrency #{@options[:concurrency]}"

command.join(' ')
Expand Down
5 changes: 5 additions & 0 deletions spec/guard/sidekiq_spec.rb
Expand Up @@ -44,6 +44,11 @@
obj.send(:cmd).should include '--verbose'
end

it 'should accept :require option' do
obj = Guard::Sidekiq.new [], :require => './sidekiq_helper.rb'
obj.send(:cmd).should include '--require ./sidekiq_helper.rb'
end

it 'should provide default options' do
obj = Guard::Sidekiq.new []
obj.send(:cmd).should include "--concurrency #{Guard::Sidekiq::DEFAULT_CONCURRENCY}"
Expand Down

0 comments on commit 5d4d056

Please sign in to comment.