schedule_job 1.0.5 → 1.0.6

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
  SHA256:
3
- metadata.gz: 887f7a67ad740ea939e3c585534e820ad03d85695d07a74b26390c4300a8cb04
4
- data.tar.gz: d61192e8ac1ba8b74f62de780b4b000d4b235aeb13f202d24e374f381f7c65ba
3
+ metadata.gz: 5a0f470384777a45f805dc1ff41c9f6386db8378c509eec95b647a577f43e06e
4
+ data.tar.gz: 9fa202bc1743951f7a2e350c379a1d0d79e0a5f2926fad5aa3c9393be042287d
5
5
  SHA512:
6
- metadata.gz: 86af048f9a4e1c2e50f9c7a63ffbe483fd5c8ffbda9ec521b5c7d2c39a8a6228367e239f0ab347d3c681a2fbbf03918691e3cbf95d67cbf5c256b8439e2dbfe3
7
- data.tar.gz: 7866e34e5591ed82159cc81a268166562f07e50033998cee9ff0000baeafd92772df00a7ed3953a6e50f8d627f64fb636898bd432fe460f7099a958f7c078ae5
6
+ metadata.gz: ddd20ca47d699cf56bd6e653a84065fe45c10133fd716af28fc092e2550deffe9a5465041e21ee287a3f4e9bfb34a9cdb14dd642ee5db1b3a807b6430fd9da28
7
+ data.tar.gz: 2e268c4aaa999e4c75df56aa0d4396a0269d9064cc9c46498598c0a5a0086ac1fe7e809cf243b8ddb2df98020b13fde6f6d40fd076e43ad440dc518918dadf81
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- schedule_job (1.0.4)
4
+ schedule_job (1.0.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -82,14 +82,18 @@ module ScheduleJob
82
82
  puts "Scheduling: #{job.to_s}"
83
83
  install_cron_job(job)
84
84
  end
85
- puts "Next three runs:"
86
- cron_parser = CronParser.new(job.schedule_spec)
87
- first_run_time = cron_parser.next(Time.now)
88
- second_run_time = cron_parser.next(first_run_time)
89
- third_run_time = cron_parser.next(second_run_time)
90
- puts "1. #{first_run_time}"
91
- puts "2. #{second_run_time}"
92
- puts "3. #{third_run_time}"
85
+
86
+ cron_parser = CronParser.new(job.schedule_spec) rescue nil
87
+ if cron_parser
88
+ puts "Next three runs:"
89
+ first_run_time = cron_parser.next(Time.now)
90
+ second_run_time = cron_parser.next(first_run_time)
91
+ third_run_time = cron_parser.next(second_run_time)
92
+
93
+ puts "1. #{first_run_time}"
94
+ puts "2. #{second_run_time}"
95
+ puts "3. #{third_run_time}"
96
+ end
93
97
  end
94
98
 
95
99
  def install_cron_job(job)
@@ -161,14 +165,14 @@ module ScheduleJob
161
165
  hour = next_moment.hour
162
166
  day = next_moment.day
163
167
  schedule_spec = case duration_unit_of_time
164
- when "m"
165
- "*/#{duration_quantity} * * * *"
166
- when "h"
167
- "#{minute} */#{duration_quantity} * * *"
168
- when "d"
169
- "#{minute} #{hour} */#{duration_quantity} * *"
170
- when "M"
171
- "#{minute} #{hour} #{day} */#{duration_quantity} *"
168
+ when "m"
169
+ "*/#{duration_quantity} * * * *"
170
+ when "h"
171
+ "#{minute} */#{duration_quantity} * * *"
172
+ when "d"
173
+ "#{minute} #{hour} */#{duration_quantity} * *"
174
+ when "M"
175
+ "#{minute} #{hour} #{day} */#{duration_quantity} *"
172
176
  end
173
177
  self.new(schedule_spec, command)
174
178
  end
@@ -218,7 +222,23 @@ module ScheduleJob
218
222
  end
219
223
 
220
224
  def to_s
221
- schedule = Cronex::ExpressionDescriptor.new(@schedule_spec).description
225
+ schedule = case @schedule_spec
226
+ when "@reboot"
227
+ "at every reboot"
228
+ when "@yearly", "@annually"
229
+ "every year"
230
+ when "@monthly"
231
+ "every month"
232
+ when "@weekly"
233
+ "every week"
234
+ when "@daily"
235
+ "every day"
236
+ when "@hourly"
237
+ "every hour"
238
+ else
239
+ Cronex::ExpressionDescriptor.new(@schedule_spec).description
240
+ end
241
+
222
242
  # str = "#{@command} #{schedule} (line #{@line_number}, pos #{@pos_offset})"
223
243
  str = "#{@command} #{schedule}"
224
244
  end
@@ -1,3 +1,3 @@
1
1
  module ScheduleJob
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schedule_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ellis