resque-scheduler 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of resque-scheduler might be problematic. Click here for more details.

@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTM5YzMwMmUzNzYyNWJkMmY0MTJiOTc0MTIxMTA4MTBlNWY1ZWVmMw==
5
+ data.tar.gz: !binary |-
6
+ Zjc3ZTlmZWE5MDBjNGExYjkzZWEwZTk5NDMwYTI4NjIzNGJjM2Q5Ng==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ M2I1NDI0M2VmZGRkNTAyZTNjODJjNTI4YjRiN2QyYmIxMTk1ZDk5MjIzY2Jl
10
+ ZjJlMjE3MzM2MzFmMTA2ZWY3ZjdhMzY5NmQ3NWY0ODA5ZDE3ZDk4OWUzZmRh
11
+ MDhiZjUxZTJlZDdjZjdhYmU0NjRmMmE0NDg1YmE5ZjQ4MDA1YjE=
12
+ data.tar.gz: !binary |-
13
+ ZTFlN2RhYTljYzRjOTAyMzY2NzA2YTRiMzNiNWQwMDFmOGE3OThlZTUyZTVl
14
+ ODFkNDk3MDBiMmZhZmEyOTAwZDNkODgwNDQxMTEwNDRjM2QwNzk3OGI2OTYx
15
+ ZWU3NGIyMTA1Y2E2NWYwMWM1YjI2ZTkzOTdhNzhiYTJjYThlODU=
@@ -2,18 +2,21 @@
2
2
  # The point is for the user to remove these configuration records
3
3
  # one by one as the offences are removed from the code base.
4
4
 
5
- AccessControl:
6
- Enabled: false
7
-
8
5
  AlignParameters:
9
6
  Enabled: false
10
7
 
11
8
  AssignmentInCondition:
12
9
  Enabled: false
13
10
 
11
+ BracesAroundHashParameters:
12
+ Enabled: false
13
+
14
14
  CaseEquality:
15
15
  Enabled: false
16
16
 
17
+ ClassLength:
18
+ Enabled: false
19
+
17
20
  ClassVars:
18
21
  Enabled: false
19
22
 
@@ -26,12 +29,18 @@ ColonMethodCall:
26
29
  CommentAnnotation:
27
30
  Enabled: false
28
31
 
32
+ CyclomaticComplexity:
33
+ Enabled: false
34
+
29
35
  Documentation:
30
36
  Enabled: false
31
37
 
32
38
  EmptyLines:
33
39
  Enabled: false
34
40
 
41
+ EmptyLinesAroundBody:
42
+ Enabled: false
43
+
35
44
  Encoding:
36
45
  Enabled: false
37
46
 
@@ -1,4 +1,3 @@
1
- ---
2
1
  language: ruby
3
2
  rvm:
4
3
  - ree
@@ -8,3 +7,11 @@ script: bundle exec rake rubocop test
8
7
  notifications:
9
8
  email:
10
9
  recipients: daniel.buch+resque-scheduler@gmail.com
10
+ deploy:
11
+ provider: rubygems
12
+ api_key:
13
+ secure: dM97lL/jTu14mEHD2Ih/vQfZ8cWJWb+DQ8UKZjkD2JfYtvwEAlkPG9RrrDkSHb5qkYxG2VAhjyx/0MZJ0TsVL6wrLMC9gcJb3yomw2Sch2Noj68tEndiSUHnxrB9gKzbhHbjLQXDqYf4Hco9/PHHQp4piFPJhLzNZRehIuTJPcA=
14
+ gem: resque-scheduler
15
+ on:
16
+ tags: true
17
+ repo: resque/resque-scheduler
data/AUTHORS.md CHANGED
@@ -51,6 +51,7 @@ Resque Scheduler authors
51
51
  - Spring MC
52
52
  - Tim Liner
53
53
  - Tony Lewis
54
+ - Vincent Zhu
54
55
  - V Sreekanth
55
56
  - andreas
56
57
  - bbauer
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'yajl-ruby', '~> 0.8.2', :platforms => :mri, :group => :test
5
+ gem 'yajl-ruby', '>= 1.1.0', :platforms => :mri, :group => :test
data/HISTORY.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 2.3.0 (2013-11-07)
2
+
3
+ * Fix re-introduced `ThreadError` on Ruby 2
4
+ * **BREAKING CHANGE**: Added `RESQUE_SCHEDULER_INTERVAL` in place of `INTERVAL`
5
+ * Use `Float()` instead of `Integer()` to calculate poll sleep amount
6
+ * Upgraded dependence of Resque to support 1.25
7
+ * Add rufus scheduler `every` notice to README
8
+ * Use `Resque.validate` instead of custom `.validate_job!`
9
+ * Specify MIT license in gemspec
10
+
1
11
  ## 2.2.0 (2013-10-13)
2
12
 
3
13
  * Locking rufus-scheduler dependency to `~> 2.0`
data/README.md CHANGED
@@ -14,8 +14,8 @@ This table explains the version requirements for redis
14
14
 
15
15
  | resque-scheduler version | required redis version|
16
16
  |:-------------------------|----------------------:|
17
- | >= 2.0.0 | >= 2.2.0 |
18
- | >= 0.0.1 | >= 1.3 |
17
+ | ~> 2.0 | >= 3.0.0 |
18
+ | >= 0.0.1 | ~> 1.3 |
19
19
 
20
20
 
21
21
  Job scheduling is supported in two different way: Recurring (scheduled) and
@@ -207,6 +207,11 @@ clear_leaderboards_moderator:
207
207
  description: "This job will check Daemon every 30 seconds after 120 seconds after start"
208
208
  ```
209
209
 
210
+ IMPORTANT: Rufus `every` syntax will calculate jobs scheduling time starting from the moment of deploy,
211
+ resulting in resetting schedule time on every deploy, so it's probably a good idea to use it only for
212
+ frequent jobs (like every 10-30 minutes), otherwise - when you use something like `every 20h` and deploy once-twice per day -
213
+ it will schedule the job for 20 hours from deploy, resulting in a job to never be run.
214
+
210
215
  NOTE: Six parameter cron's are also supported (as they supported by
211
216
  rufus-scheduler which powers the resque-scheduler process). This allows you
212
217
  to schedule jobs per second (ie: `"30 * * * * *"` would fire a job every 30
@@ -411,10 +416,15 @@ Resque::Scheduler.logfile = nil # that means, all messages go to STDOUT
411
416
 
412
417
  ### Polling frequency
413
418
 
414
- You can pass an INTERVAL option which is a integer representing the polling frequency.
415
- The default is 5 seconds, but for a semi-active app you may want to use a smaller (integer) value.
419
+ You can pass a `RESQUE_SCHEDULER_INTERVAL` option which is an integer or float
420
+ representing the polling frequency. The default is 5 seconds, but for a
421
+ semi-active app you may want to use a smaller value.
422
+
423
+ $ RESQUE_SCHEDULER_INTERVAL=1 rake resque:scheduler
416
424
 
417
- $ INTERVAL=1 rake resque:scheduler
425
+ **NOTE** This value was previously `INTERVAL` but was renamed to
426
+ `RESQUE_SCHEDULER_INTERVAL` to avoid clashing with the interval Resque
427
+ uses for its jobs.
418
428
 
419
429
  ### Plagiarism alert
420
430
 
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ end
25
25
  desc 'Run rubocop'
26
26
  task :rubocop do
27
27
  unless RUBY_VERSION < '1.9'
28
- sh('rubocop --config .rubocop.yml --format simple') { |r, _| r || abort }
28
+ sh('rubocop --format simple') { |ok, _| ok || abort }
29
29
  end
30
30
  end
31
31
 
@@ -220,7 +220,7 @@ module Resque
220
220
  args = job_config['args'] || job_config[:args]
221
221
 
222
222
  klass_name = job_config['class'] || job_config[:class]
223
- klass = Resque.constantize(klass_name) rescue klass_name
223
+ klass = ResqueScheduler::Util.constantize(klass_name) rescue klass_name
224
224
 
225
225
  params = args.is_a?(Hash) ? [args] : Array(args)
226
226
  queue = job_config['queue'] || job_config[:queue] || Resque.queue_from_class(klass)
@@ -230,7 +230,7 @@ module Resque
230
230
  # job class can not be constantized (via a requeue call from the web perhaps), fall
231
231
  # back to enqueing normally via Resque::Job.create.
232
232
  begin
233
- Resque.constantize(job_klass).scheduled(queue, klass_name, *params)
233
+ ResqueScheduler::Util.constantize(job_klass).scheduled(queue, klass_name, *params)
234
234
  rescue NameError
235
235
  # Note that the custom job class (job_config['custom_job_class']) is the one enqueued
236
236
  Resque::Job.create(queue, job_klass, *params)
@@ -313,8 +313,11 @@ module Resque
313
313
  @shutdown = true
314
314
 
315
315
  if @sleeping
316
- Resque.clean_schedules
317
- Thread.new { release_master_lock! }
316
+ thread = Thread.new do
317
+ Resque.clean_schedules
318
+ release_master_lock!
319
+ end
320
+ thread.join
318
321
  exit
319
322
  end
320
323
  end
@@ -14,7 +14,7 @@ module Resque
14
14
 
15
15
  # Attempts to acquire the lock. Returns true if successfully acquired.
16
16
  def acquire!
17
- raise NotImplementedError
17
+ fail NotImplementedError
18
18
  end
19
19
 
20
20
  def value
@@ -23,7 +23,7 @@ module Resque
23
23
 
24
24
  # Returns true if you currently hold the lock.
25
25
  def locked?
26
- raise NotImplementedError
26
+ fail NotImplementedError
27
27
  end
28
28
 
29
29
  # Releases the lock.
@@ -31,7 +31,7 @@ module Resque
31
31
  Resque.redis.del(key) == 1
32
32
  end
33
33
 
34
- private
34
+ private
35
35
 
36
36
  # Extends the lock by `timeout` seconds.
37
37
  def extend_lock!
@@ -20,7 +20,7 @@ module Resque
20
20
  ).to_i == 1
21
21
  end
22
22
 
23
- private
23
+ private
24
24
 
25
25
  def locked_sha(refresh = false)
26
26
  @locked_sha = nil if refresh
@@ -1,4 +1,3 @@
1
-
2
1
  # ### Locking the scheduler process
3
2
  #
4
3
  # There are two places in resque-scheduler that need to be synchonized
@@ -69,7 +68,7 @@ module Resque
69
68
  master_lock.release!
70
69
  end
71
70
 
72
- private
71
+ private
73
72
 
74
73
  def build_master_lock
75
74
  if supports_lua?
@@ -1,11 +1,11 @@
1
1
  require 'rubygems'
2
2
  require 'resque'
3
3
  require 'resque_scheduler/version'
4
+ require 'resque_scheduler/util'
4
5
  require 'resque/scheduler'
5
6
  require 'resque_scheduler/plugin'
6
7
 
7
8
  module ResqueScheduler
8
-
9
9
  #
10
10
  # Accepts a new schedule configuration of the form:
11
11
  #
@@ -132,7 +132,7 @@ module ResqueScheduler
132
132
  # for queueing. Until timestamp is in the past, the job will
133
133
  # sit in the schedule list.
134
134
  def enqueue_at(timestamp, klass, *args)
135
- validate_job!(klass)
135
+ validate(klass)
136
136
  enqueue_at_with_queue(queue_from_class(klass), timestamp, klass, *args)
137
137
  end
138
138
 
@@ -330,16 +330,6 @@ module ResqueScheduler
330
330
  end
331
331
  end
332
332
 
333
- def validate_job!(klass)
334
- if klass.to_s.empty?
335
- raise Resque::NoClassError.new("Jobs must be given a class.")
336
- end
337
-
338
- unless queue_from_class(klass)
339
- raise Resque::NoQueueError.new("Jobs must be placed onto a queue.")
340
- end
341
- end
342
-
343
333
  def prepare_schedule(schedule_hash)
344
334
  prepared_hash = {}
345
335
  schedule_hash.each do |name, job_spec|
@@ -349,7 +339,6 @@ module ResqueScheduler
349
339
  end
350
340
  prepared_hash
351
341
  end
352
-
353
342
  end
354
343
 
355
344
  Resque.extend ResqueScheduler
@@ -1,6 +1,5 @@
1
1
  require 'resque_scheduler'
2
2
  require 'resque/server'
3
-
4
3
  # Extend Resque::Server to add tabs
5
4
  module ResqueScheduler
6
5
 
@@ -16,7 +15,7 @@ module ResqueScheduler
16
15
  end
17
16
 
18
17
  def queue_from_class_name(class_name)
19
- Resque.queue_from_class(Resque.constantize(class_name))
18
+ Resque.queue_from_class(ResqueScheduler::Util.constantize(class_name))
20
19
  end
21
20
  end
22
21
 
@@ -50,7 +49,7 @@ module ResqueScheduler
50
49
  config_args = config_args.merge(submitted_args)
51
50
 
52
51
  # Insert the args hash into config and queue the resque job
53
- config = config.merge({'args' => config_args})
52
+ config = config.merge('args' => config_args)
54
53
  Resque::Scheduler.enqueue_from_config(config)
55
54
  redirect u("/overview")
56
55
  end
@@ -25,7 +25,7 @@ namespace :resque do
25
25
  Resque::Scheduler.dynamic = true if ENV['DYNAMIC_SCHEDULE']
26
26
  Resque::Scheduler.verbose = true if ENV['VERBOSE']
27
27
  Resque::Scheduler.logfile = ENV['LOGFILE'] if ENV['LOGFILE']
28
- Resque::Scheduler.poll_sleep_amount = Integer(ENV['INTERVAL']) if ENV['INTERVAL']
28
+ Resque::Scheduler.poll_sleep_amount = Float(ENV['RESQUE_SCHEDULER_INTERVAL']) if ENV['RESQUE_SCHEDULER_INTERVAL']
29
29
  Resque::Scheduler.run
30
30
  end
31
31
 
@@ -0,0 +1,34 @@
1
+ module ResqueScheduler
2
+ class Util
3
+ # In order to upgrade to resque(1.25) which has deprecated following methods ,
4
+ # we just added these usefull helpers back to use in Resque Scheduler.
5
+ # refer to: https://github.com/resque/resque-scheduler/pull/273
6
+
7
+ def self.constantize(camel_cased_word)
8
+ camel_cased_word = camel_cased_word.to_s
9
+
10
+ if camel_cased_word.include?('-')
11
+ camel_cased_word = classify(camel_cased_word)
12
+ end
13
+
14
+ names = camel_cased_word.split('::')
15
+ names.shift if names.empty? || names.first.empty?
16
+
17
+ constant = Object
18
+ names.each do |name|
19
+ args = Module.method(:const_get).arity != 1 ? [false] : []
20
+
21
+ if constant.const_defined?(name, *args)
22
+ constant = constant.const_get(name)
23
+ else
24
+ constant = constant.const_missing(name)
25
+ end
26
+ end
27
+ constant
28
+ end
29
+
30
+ def self.classify(dashed_word)
31
+ dashed_word.split('-').each { |part| part[0] = part[0].chr.upcase }.join
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module ResqueScheduler
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{Light weight job scheduling on top of Resque.
14
14
  Adds methods enqueue_at/enqueue_in to schedule jobs in the future.
15
15
  Also supports queueing jobs on a fixed, cron-like schedule.}
16
+ spec.license = 'MIT'
16
17
 
17
18
  spec.files = `git ls-files`.split("\n")
18
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -27,6 +28,6 @@ Gem::Specification.new do |spec|
27
28
  spec.add_development_dependency 'rubocop' unless RUBY_VERSION < '1.9'
28
29
 
29
30
  spec.add_runtime_dependency 'redis', '>= 3.0.0'
30
- spec.add_runtime_dependency 'resque', ['>= 1.20.0', '< 1.25']
31
+ spec.add_runtime_dependency 'resque', '~> 1.25'
31
32
  spec.add_runtime_dependency 'rufus-scheduler', '~> 2.0'
32
33
  end
@@ -9,7 +9,7 @@ context "DelayedQueue" do
9
9
 
10
10
  test "enqueue_at adds correct list and zset" do
11
11
  timestamp = Time.now + 1
12
- encoded_job = Resque.encode({:class => SomeIvarJob.to_s, :args => ["path"], :queue => Resque.queue_from_class(SomeIvarJob)})
12
+ encoded_job = Resque.encode(:class => SomeIvarJob.to_s, :args => ["path"], :queue => Resque.queue_from_class(SomeIvarJob))
13
13
 
14
14
  assert_equal(0, Resque.redis.llen("delayed:#{timestamp.to_i}").to_i, "delayed queue should be empty to start")
15
15
  assert_equal(0, Resque.redis.scard("timestamps:#{encoded_job}"), "job timestamps set should be empty to start")
@@ -37,7 +37,7 @@ context "DelayedQueue" do
37
37
 
38
38
  test "enqueue_at with queue adds correct list and zset and queue" do
39
39
  timestamp = Time.now + 1
40
- encoded_job = Resque.encode({:class => SomeIvarJob.to_s, :args => ["path"], :queue => 'critical'})
40
+ encoded_job = Resque.encode(:class => SomeIvarJob.to_s, :args => ["path"], :queue => 'critical')
41
41
 
42
42
  assert_equal(0, Resque.redis.llen("delayed:#{timestamp.to_i}").to_i, "delayed queue should be empty to start")
43
43
  assert_equal(0, Resque.redis.scard("timestamps:#{encoded_job}"), "job timestamps set should be empty to start")
@@ -66,7 +66,7 @@ context "DelayedQueue" do
66
66
 
67
67
  test "a job in the future doesn't come out" do
68
68
  timestamp = Time.now + 600 # 10 minutes from now (in the future, shouldn't come out)
69
- encoded_job = Resque.encode({:class => SomeIvarJob.to_s, :args => ["path"], :queue => Resque.queue_from_class(SomeIvarJob)})
69
+ encoded_job = Resque.encode(:class => SomeIvarJob.to_s, :args => ["path"], :queue => Resque.queue_from_class(SomeIvarJob))
70
70
 
71
71
  assert_equal(0, Resque.redis.llen("delayed:#{timestamp.to_i}").to_i, "delayed queue should be empty to start")
72
72
  assert_equal(0, Resque.redis.scard("timestamps:#{encoded_job}"), "job timestamps set should be empty to start")
@@ -95,7 +95,7 @@ context "DelayedQueue" do
95
95
 
96
96
  test "enqueue_at and enqueue_in are equivelent" do
97
97
  timestamp = Time.now + 60
98
- encoded_job = Resque.encode({:class => SomeIvarJob.to_s, :args => ["path"], :queue => Resque.queue_from_class(SomeIvarJob)})
98
+ encoded_job = Resque.encode(:class => SomeIvarJob.to_s, :args => ["path"], :queue => Resque.queue_from_class(SomeIvarJob))
99
99
 
100
100
  Resque.enqueue_at(timestamp, SomeIvarJob, "path")
101
101
  Resque.enqueue_in(timestamp - Time.now, SomeIvarJob, "path")
@@ -267,7 +267,7 @@ context "DelayedQueue" do
267
267
 
268
268
  test "remove_delayed removes job and returns the count" do
269
269
  t = Time.now + 120
270
- encoded_job = Resque.encode({:class => SomeIvarJob.to_s, :args => [], :queue => Resque.queue_from_class(SomeIvarJob)})
270
+ encoded_job = Resque.encode(:class => SomeIvarJob.to_s, :args => [], :queue => Resque.queue_from_class(SomeIvarJob))
271
271
  Resque.enqueue_at(t, SomeIvarJob)
272
272
 
273
273
  assert_equal(1, Resque.remove_delayed(SomeIvarJob))
@@ -358,9 +358,6 @@ context "DelayedQueue" do
358
358
  end
359
359
 
360
360
  test "invalid job class" do
361
- assert_raise Resque::NoClassError do
362
- Resque.enqueue_in(10, nil)
363
- end
364
361
  assert_raise Resque::NoQueueError do
365
362
  Resque.enqueue_in(10, String) # string serves as invalid Job class
366
363
  end
@@ -12,8 +12,22 @@ end
12
12
  context "on GET to /schedule with scheduled jobs" do
13
13
  setup do
14
14
  ENV['rails_env'] = 'production'
15
- Resque.schedule = {'some_ivar_job' => {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp", 'rails_env' => 'production'},
16
- 'some_other_job' => {'every' => ['5m'], 'queue' => 'high', 'class' => 'SomeOtherJob', 'args' => {'b' => 'blah'}}}
15
+ Resque.schedule = {
16
+ 'some_ivar_job' => {
17
+ 'cron' => "* * * * *",
18
+ 'class' => 'SomeIvarJob',
19
+ 'args' => "/tmp",
20
+ 'rails_env' => 'production'
21
+ },
22
+ 'some_other_job' => {
23
+ 'every' => ['5m'],
24
+ 'queue' => 'high',
25
+ 'class' => 'SomeOtherJob',
26
+ 'args' => {
27
+ 'b' => 'blah'
28
+ }
29
+ }
30
+ }
17
31
  Resque::Scheduler.load_schedule!
18
32
  get "/schedule"
19
33
  end
@@ -34,14 +48,18 @@ end
34
48
  def resque_schedule
35
49
  {
36
50
  'job_without_params' => {
37
- 'cron' => "* * * * *",
51
+ 'cron' => '* * * * *',
38
52
  'class' => 'JobWithoutParams',
39
- 'args' => {"host" => 'localhost'},
53
+ 'args' => {
54
+ 'host' => 'localhost'
55
+ },
40
56
  'rails_env' => 'production'},
41
57
  'job_with_params' => {
42
- 'cron' => "* * * * *",
58
+ 'cron' => '* * * * *',
43
59
  'class' => 'JobWithParams',
44
- 'args' => {"host" => 'localhost'},
60
+ 'args' => {
61
+ 'host' => 'localhost'
62
+ },
45
63
  'parameters' => {
46
64
  'log_level' => {
47
65
  'description' => 'The level of logging',
@@ -99,8 +117,8 @@ context "POST /schedule/requeue_with_params" do
99
117
  log_level = 'error'
100
118
 
101
119
  job_config = Resque.schedule[job_name]
102
- args = job_config['args'].merge({'log_level' => log_level})
103
- job_config = job_config.merge({'args' => args})
120
+ args = job_config['args'].merge('log_level' => log_level)
121
+ job_config = job_config.merge('args' => args)
104
122
 
105
123
  Resque::Scheduler.stubs(:enqueue_from_config).once.with(job_config)
106
124
 
@@ -60,7 +60,7 @@ context "Resque::Scheduler" do
60
60
 
61
61
  Resque.redis.del(:schedules)
62
62
  Resque.redis.hset(:schedules, "some_ivar_job2", Resque.encode(
63
- {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/2"}
63
+ 'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/2"
64
64
  ))
65
65
 
66
66
  Resque::Scheduler.reload_schedule!
@@ -232,7 +232,7 @@ context "Resque::Scheduler" do
232
232
 
233
233
  test "get_schedule returns a schedule" do
234
234
  Resque.redis.hset(:schedules, "some_ivar_job2", Resque.encode(
235
- {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/33"}
235
+ 'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/33"
236
236
  ))
237
237
  assert_equal({'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/33"},
238
238
  Resque.get_schedule("some_ivar_job2"))
@@ -240,7 +240,7 @@ context "Resque::Scheduler" do
240
240
 
241
241
  test "remove_schedule removes a schedule" do
242
242
  Resque.redis.hset(:schedules, "some_ivar_job3", Resque.encode(
243
- {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/44"}
243
+ 'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/44"
244
244
  ))
245
245
  Resque.remove_schedule("some_ivar_job3")
246
246
  assert_equal nil, Resque.redis.hget(:schedules, "some_ivar_job3")
@@ -28,7 +28,7 @@ class RedisInstance
28
28
  RedisInstance.stop!
29
29
  end
30
30
  else
31
- raise "Failed to start Redis on port #{port}."
31
+ fail "Failed to start Redis on port #{port}."
32
32
  end
33
33
 
34
34
  @running = true
@@ -47,7 +47,7 @@ class RedisInstance
47
47
  @running
48
48
  end
49
49
 
50
- private
50
+ private
51
51
 
52
52
  def wait_for_redis_boot
53
53
  Timeout::timeout(10) do
@@ -84,6 +84,14 @@ class SomeRealClass
84
84
  end
85
85
  end
86
86
 
87
+ class JobWithParams
88
+ def self.perform(*args)
89
+ @args = args
90
+ end
91
+ end
92
+
93
+ JobWithoutParams = Class.new(JobWithParams)
94
+
87
95
  def nullify_logger
88
96
  Resque::Scheduler.mute = nil
89
97
  Resque::Scheduler.verbose = nil
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
5
- prerelease:
4
+ version: 2.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ben VandenBos
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-03 00:00:00.000000000 Z
11
+ date: 2013-11-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: mocha
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rack-test
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rubocop
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: redis
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,29 +97,20 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: resque
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: 1.20.0
118
- - - <
101
+ - - ~>
119
102
  - !ruby/object:Gem::Version
120
103
  version: '1.25'
121
104
  type: :runtime
122
105
  prerelease: false
123
106
  version_requirements: !ruby/object:Gem::Requirement
124
- none: false
125
107
  requirements:
126
- - - ! '>='
127
- - !ruby/object:Gem::Version
128
- version: 1.20.0
129
- - - <
108
+ - - ~>
130
109
  - !ruby/object:Gem::Version
131
110
  version: '1.25'
132
111
  - !ruby/object:Gem::Dependency
133
112
  name: rufus-scheduler
134
113
  requirement: !ruby/object:Gem::Requirement
135
- none: false
136
114
  requirements:
137
115
  - - ~>
138
116
  - !ruby/object:Gem::Version
@@ -140,7 +118,6 @@ dependencies:
140
118
  type: :runtime
141
119
  prerelease: false
142
120
  version_requirements: !ruby/object:Gem::Requirement
143
- none: false
144
121
  requirements:
145
122
  - - ~>
146
123
  - !ruby/object:Gem::Version
@@ -179,6 +156,7 @@ files:
179
156
  - lib/resque_scheduler/server/views/requeue-params.erb
180
157
  - lib/resque_scheduler/server/views/scheduler.erb
181
158
  - lib/resque_scheduler/tasks.rb
159
+ - lib/resque_scheduler/util.rb
182
160
  - lib/resque_scheduler/version.rb
183
161
  - resque-scheduler.gemspec
184
162
  - script/migrate_to_timestamps_set.rb
@@ -194,28 +172,28 @@ files:
194
172
  - test/support/redis_instance.rb
195
173
  - test/test_helper.rb
196
174
  homepage: http://github.com/resque/resque-scheduler
197
- licenses: []
175
+ licenses:
176
+ - MIT
177
+ metadata: {}
198
178
  post_install_message:
199
179
  rdoc_options: []
200
180
  require_paths:
201
181
  - - lib
202
182
  required_ruby_version: !ruby/object:Gem::Requirement
203
- none: false
204
183
  requirements:
205
184
  - - ! '>='
206
185
  - !ruby/object:Gem::Version
207
186
  version: '0'
208
187
  required_rubygems_version: !ruby/object:Gem::Requirement
209
- none: false
210
188
  requirements:
211
189
  - - ! '>='
212
190
  - !ruby/object:Gem::Version
213
191
  version: '0'
214
192
  requirements: []
215
193
  rubyforge_project:
216
- rubygems_version: 1.8.23
194
+ rubygems_version: 2.0.3
217
195
  signing_key:
218
- specification_version: 3
196
+ specification_version: 4
219
197
  summary: Light weight job scheduling on top of Resque
220
198
  test_files:
221
199
  - test/delayed_queue_test.rb