lita-timing 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7563312feb0cf2b62113e5b00fc961003df49a44
4
- data.tar.gz: 85f81eda81053e75e6ee5c046a91b69386005743
3
+ metadata.gz: 553d03731956c326637841ddc55936139e7bc02b
4
+ data.tar.gz: ce10999b17c7d30d24828c90efe5a351226e2d39
5
5
  SHA512:
6
- metadata.gz: d25d45d905f4644867fb5cf9cba13fc0b71091d4ed4be279a4e53f20e3181c53340e8b04144680380dc1b169adcf6de3fcaed897ead1730ad69a75edee9ada96
7
- data.tar.gz: 885654b5eccf38ff096511072fdf3fa446a8044f4cf0a977d4c68aea935db100361bba431d2bc63c015f483db61d0fb206338da3d602146f44d93a6c7765cb45
6
+ metadata.gz: 947a912b8c5a5c1b45c44b5d1b3cab266f54b70a805f5c16210c858b20a036d616059777b7a77c31c7320c310b8330b0478aa1659df68dc324eedcf1c1af7e5a
7
+ data.tar.gz: db59bb6c17180f84620eca4cde2104ef59ba4ede8ef2c42074bf2d6f21e589657ae809a7680d641a15189fe844ede3b573ad250f4f6a7d606eb2c9b5571df127
@@ -18,7 +18,7 @@ module Lita
18
18
  next_run = calc_next_daily_run(time, days, last_run_at)
19
19
  if next_run < Time.now
20
20
  yield
21
- @redis.set(@name, Time.now.to_i, ex: ONE_WEEK_IN_SECONDS * 2)
21
+ set_last_run_at
22
22
  end
23
23
  end
24
24
  end
@@ -29,7 +29,7 @@ module Lita
29
29
  next_run = calc_next_weekly_run(time, day, last_run_at)
30
30
  if next_run < Time.now
31
31
  yield
32
- @redis.set(@name, Time.now.to_i, ex: ONE_WEEK_IN_SECONDS * 2)
32
+ set_last_run_at
33
33
  end
34
34
  end
35
35
  end
@@ -64,7 +64,12 @@ module Lita
64
64
 
65
65
  def get_last_run_at
66
66
  value = @redis.get(@name)
67
- value ? Time.at(value.to_i).utc : Time.now.utc
67
+ value ? Time.at(value.to_i).utc : set_last_run_at
68
+ end
69
+
70
+ def set_last_run_at(time = Time.now.utc)
71
+ @redis.set(@name, time.to_i, ex: ONE_WEEK_IN_SECONDS * 2)
72
+ time
68
73
  end
69
74
  end
70
75
  end
@@ -22,7 +22,7 @@ module Lita
22
22
  end
23
23
 
24
24
  def self.extract_hours_and_minutes(string)
25
- _, hours, minutes = *string.match(/\A(\d\d):(\d\d)\Z/)
25
+ _, hours, minutes = *string.match(/\A(\d{1,2}):(\d{2})\Z/)
26
26
  if hours.nil? || minutes.nil?
27
27
  raise ArgumentError, "time should be HH:MM"
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-timing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Healy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2017-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.5.1
106
+ rubygems_version: 2.6.11
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Utilities for time related tasks in lita