Skip to content

Commit 89957eb

Browse files
committed
fix config loading for Resque::CLI and update documentation
1 parent 2e4b7ce commit 89957eb

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,21 @@ Resque workers respond to a few different signals:
175175

176176
## Configuration
177177

178-
You can configure Resque via a `.resque` file in the root of your project:
178+
You can configure Resque via a YAML `.resque` file in the root of your project:
179179

180180
```
181-
--queues=high,med,low
182-
--require='some_context.rb'
183-
--pid_file='tmp/pids/resque.pid'
184-
--interval=1
185-
--daemon=true
186-
--timeout=5
187-
--graceful_term=false
181+
queues: 'high,med,low'
182+
require: 'some_context.rb'
183+
pid_file: 'tmp/pids/resque.pid'
184+
interval: 1
185+
daemon: true
186+
timeout: 5
187+
graceful_term: false
188188
```
189189

190-
These act just like you passed them in to `bin/resque work`.
190+
Then pass the configuration to the resque CLI: `bin/resque work -c='./.resque'`.
191191

192-
You can also configure Resque via `.configure`:
192+
You can also configure Resque via `Resque.configure`:
193193

194194
```ruby
195195
Resque.configure do |config|

lib/resque/cli.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ class CLI < Thor
88
class_option :config, :aliases => ["-c"], :type => :string
99
class_option :redis, :aliases => ["-R"], :type => :string
1010

11-
def initialize(args = [], opts = [], config = {})
11+
def initialize(args = [], opts = {}, config = {})
1212
super(args, opts, config)
1313

1414
if options[:config] && File.exists?(options[:config])
15-
@options = YAML.load_file(options[:config]).symbolize_keys.merge(@options.symbolize_keys)
15+
config_options = YAML.load_file(options[:config]).symbolize_keys
16+
@options = @options.symbolize_keys.merge(config_options)
1617
end
1718

1819
Resque.redis = options[:redis] || "localhost:6379/resque"

0 commit comments

Comments
 (0)