chores_kit 0.2.0 → 0.2.1
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/Gemfile.lock +1 -1
- data/lib/chores_kit/chore.rb +19 -3
- data/lib/chores_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4053eb5fcc4a8164b279a8b02d90e26591d0de4d9323e7b5fb72b60191ddf80
|
4
|
+
data.tar.gz: 83d2a4bd1e7733959a93e6ef7c692df30ce32522d90a8f7f15c7bb10e2c14ae6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b589b5d8b022d16b092d6baa1005593ce11e7a0d7d60dd5e2e9ba4bbdb9c05e7091e2896bb7d1c2e31bfb43e188cc67ab1f315fe04afda4865c949f062aa4827
|
7
|
+
data.tar.gz: e92606e0da19c34defb5b17b1c2372cbb169dbfbe62f40bcdfb3605c8c1f2a5b62e973c5f533f4e81e5f3ac5e947b989cb617429ee26d208ce05ae4f1d491e1c
|
data/Gemfile.lock
CHANGED
data/lib/chores_kit/chore.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
2
4
|
require 'as-duration'
|
3
5
|
|
4
6
|
module ChoresKit
|
@@ -23,14 +25,28 @@ module ChoresKit
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def schedule(options)
|
28
|
+
raise "Couldn't parse start time from attributes" if options[:at].nil?
|
29
|
+
raise "Couldn't parse interval from attributes" unless options[:every].nil? || options[:every].is_a?(AS::Duration)
|
30
|
+
|
31
|
+
at_ltz = Time.parse(options[:at]) || Time.now
|
32
|
+
at_utc = Time.utc(*at_ltz) || Date.today.to_time.utc
|
33
|
+
|
26
34
|
@metadata[:schedule] = {
|
27
|
-
at:
|
28
|
-
every: options
|
35
|
+
at: at_utc,
|
36
|
+
every: options[:every]
|
29
37
|
}
|
30
38
|
end
|
31
39
|
|
32
40
|
def retry_failed(options)
|
33
|
-
|
41
|
+
raise "Couldn't parse retry interval from attributes" unless options[:wait].nil? || options[:wait].is_a?(AS::Duration)
|
42
|
+
|
43
|
+
wait = options[:wait] || 1.second
|
44
|
+
retries = options[:retries] || 1
|
45
|
+
|
46
|
+
@metadata[:retry_failed] = {
|
47
|
+
wait: wait,
|
48
|
+
retries: retries
|
49
|
+
}
|
34
50
|
end
|
35
51
|
|
36
52
|
# Tasks and dependencies
|
data/lib/chores_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chores_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lennard Timm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: as-duration
|