ruby-clock 2.0.0.beta9 → 2.0.0.beta10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc7625ea594c3028d9503ad7c1013b7888c776a51bf5853ada639cef1b9d754c
4
- data.tar.gz: 6c3d8841a45cd336a108c334b94e35441200885b2329ac6dbf39751dd32b8451
3
+ metadata.gz: 0f773f1b873c6048b24cb6c78769c809fd3008c0316463071633086aa572f853
4
+ data.tar.gz: 28de0953617822f2473cecebdac1ab308420231670073db0d4458d89d527e3ee
5
5
  SHA512:
6
- metadata.gz: f8067434425e00d84371aa7242d78ebf9a24f355e2f13ec1cba79e7140301d2902b4bf2902237023b277ebfd876c88761b4cdc15de33df8225837ab074bb1781
7
- data.tar.gz: 93eb07e47f6a8ec2cad4f7916090bb2f310657cca5bae3adef090e7a08f2de7d9b4af62f9e6649e1ab35eb5b2fc81d4a2063971bea6b37e3759473cd722ea47a
6
+ metadata.gz: e4d94f375285033a0ca49ed535b29f0768adac1efa83f4c63a67090f866aa2a1f72b4a0159c746d99bf765c8c5b7f308daff090be0e2b671518d8fe67cf3b63e
7
+ data.tar.gz: 693519be98311aff6e24aae1c61cf908f710049a6854886264f100dc844f8436b3ba58f0ab1bd9b6d6a5bf3f5916383d744ce9390dbb582bdd70f4c6dab03936
data/CHANGELOG.md CHANGED
@@ -20,6 +20,7 @@
20
20
  * job slugs based on job identifier, e.g. "Widget Co. Weekly Reports" -> "widget-co-weekly-reports"
21
21
  * `--check-slug-uniqueness`
22
22
  * `--environment-and-syntax-check`
23
+ * `--generate-dummy-crontab` to facilitate visualization with cronv
23
24
 
24
25
  ### Anti-Features
25
26
  * ruby 3.0 is now the minimum version
data/README.md CHANGED
@@ -33,7 +33,7 @@ ruby >= 3.0 is required.
33
33
  Add these lines to your application's Gemfile:
34
34
 
35
35
  ```ruby
36
- gem 'ruby-clock', '2.0.0.beta9'
36
+ gem 'ruby-clock', '2.0.0.beta10'
37
37
  ```
38
38
 
39
39
  And then execute:
@@ -164,6 +164,18 @@ assert(system("bundle exec --check-slug-uniqueness")) # loads Clockfile
164
164
  assert(system("bundle exec --check-slug-uniqueness clock/weekly.rb clock/daily.rb")) # load specific files
165
165
  ```
166
166
 
167
+ #### Visualization with cronv
168
+
169
+ Using the `--generate-dummy-crontab` flag you can visualize your schedule with [cronv](https://github.com/takumakanari/cronv).
170
+ For your jobs with cron-style schedules, it will generate a dummy crontab file that can be ingested by cronv.
171
+ For your jobs with "Every X seconds" schedules, a comment will be made in the file and they will not be vizualized.
172
+
173
+ ```console
174
+ bundle exec clock --generate-dummy-crontab Clockfile ../clock/daily.rb ../clock/weekly.rb > dummycron.txt
175
+ ## IMPORTANT: open dummycron.txt in an editor and remove the boot startup message cruft from the top
176
+ cat dummycron.txt | /Users/your-username/go/bin/cronv -d 1d -o ./my_cron_schedule.html
177
+ open dummycron
178
+ ```
167
179
 
168
180
  ## More Config and Capabilities
169
181
 
data/exe/clock CHANGED
@@ -11,12 +11,15 @@ RubyClock.instance.add_rails_executor_to_around_actions
11
11
 
12
12
  check_syntax = false
13
13
  check_slug_uniqueness = false
14
+ generate_dummy_crontab = false
14
15
  if '--' == ARGV[0][0..1]
15
16
  case ARGV[0]
16
17
  when '--environment-and-syntax-check'
17
18
  check_syntax = true
18
19
  when '--check-slug-uniqueness'
19
20
  check_slug_uniqueness = true
21
+ when '--generate-dummy-crontab'
22
+ generate_dummy_crontab = true
20
23
  else
21
24
  raise 'unknown option'
22
25
  end
@@ -67,6 +70,16 @@ elsif check_slug_uniqueness
67
70
  else
68
71
  puts "✨ All Slugs Are Unique ✨"
69
72
  end
73
+ elsif generate_dummy_crontab
74
+ text = ''
75
+ RubyClock.instance.schedule.jobs.each do |j|
76
+ if j.respond_to?(:cron_line)
77
+ text << "#{j.cron_line.original} #{j.slug}\n"
78
+ else
79
+ text << "# every-#{j.frequency}-seconds #{j.slug}\n"
80
+ end
81
+ end
82
+ puts text
70
83
  else
71
84
  RubyClock.instance.run_jobs
72
85
  end
@@ -1,3 +1,3 @@
1
1
  class RubyClock
2
- VERSION = "2.0.0.beta9"
2
+ VERSION = "2.0.0.beta10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-clock
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta9
4
+ version: 2.0.0.beta10
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bachir