delayed_job_recurring 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/lib/delayed/recurring_job.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31eaad03c00e4ec8246938771205511f30d29643
|
4
|
+
data.tar.gz: f6857219f479453925c46b76ba7fe24382029f07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917e77a0ed5c0133f1c7c425479092a0927af8d47a191a6ae736c91fe8ef83b06933f5123fe5198c5e54389c4db438c4df1ac1040acbd9ae159c4d79284f8f69
|
7
|
+
data.tar.gz: 567894524a9a6a03459a4d2f1b549f32958702f914f8bfb8c7109fc1865ceaee82465ccc11fce0a6517f3da44c221cdcba2147dea65931648045cf24fc7c6916
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ so we put our task classes in `app/interactors`. You could also put them in `li
|
|
18
18
|
class MyTask
|
19
19
|
include Delayed::RecurringJob
|
20
20
|
run_every 1.day
|
21
|
-
run_at
|
21
|
+
run_at '11:00am'
|
22
22
|
timezone 'US/Pacific'
|
23
23
|
def perform
|
24
24
|
# Do some work here!
|
@@ -29,7 +29,7 @@ end
|
|
29
29
|
And schedule it. In a rails app, you might put this in an initializer:
|
30
30
|
|
31
31
|
```ruby
|
32
|
-
MyTask.schedule # run every day at 11am Pacific time (accounting for daylight savings)
|
32
|
+
MyTask.schedule! # run every day at 11am Pacific time (accounting for daylight savings)
|
33
33
|
```
|
34
34
|
|
35
35
|
## Advanced usage
|
@@ -37,13 +37,19 @@ MyTask.schedule # run every day at 11am Pacific time (accounting for daylight sa
|
|
37
37
|
### Passing options to schedule
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
MyTask.schedule(run_at:
|
40
|
+
MyTask.schedule(run_at: '12:00')
|
41
41
|
```
|
42
42
|
|
43
43
|
### Running at multiples times each day
|
44
44
|
|
45
45
|
```ruby
|
46
|
-
MyTask.schedule(run_every: 1.day, run_at: [
|
46
|
+
MyTask.schedule(run_every: 1.day, run_at: ['11:00', '6:00pm']
|
47
|
+
```
|
48
|
+
|
49
|
+
### Running on specific days of the week
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
MyTask.schedule(run_every: 1.week, run_at: ['sunday 8:00am', 'wednesday 8:00am'])
|
47
53
|
```
|
48
54
|
|
49
55
|
## Thanks!
|
@@ -23,6 +23,12 @@ module Delayed
|
|
23
23
|
|
24
24
|
# Schedule this "repeating" job
|
25
25
|
def schedule! options = {}
|
26
|
+
options = options.dup
|
27
|
+
|
28
|
+
if run_every = options.delete(:run_every)
|
29
|
+
options[:run_interval] = serialize_duration(run_every)
|
30
|
+
end
|
31
|
+
|
26
32
|
@schedule_options = options.reverse_merge(@schedule_options || {}).reverse_merge(
|
27
33
|
run_at: self.class.run_at,
|
28
34
|
timezone: self.class.timezone,
|
@@ -81,7 +87,10 @@ module Delayed
|
|
81
87
|
def parse_time(time, timezone)
|
82
88
|
case time
|
83
89
|
when String
|
84
|
-
get_timezone(timezone).parse(time)
|
90
|
+
time_with_zone = get_timezone(timezone).parse(time)
|
91
|
+
parts = Date._parse(time, false)
|
92
|
+
wday = parts.fetch(:wday, time_with_zone.wday)
|
93
|
+
time_with_zone + (wday - time_with_zone.wday).days
|
85
94
|
else
|
86
95
|
time
|
87
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_recurring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Novak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|