ruby-clock 2.0.0.beta9 → 2.0.0

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: 20fc4e914b706c818238f8d45a6d81ff650e18ae8fe90b47a9f818e28871bbc6
4
+ data.tar.gz: b0d23fded8dfd9981bedcfcaf9300376c615f53ce782a6f9e1a807b3e054c324
5
5
  SHA512:
6
- metadata.gz: f8067434425e00d84371aa7242d78ebf9a24f355e2f13ec1cba79e7140301d2902b4bf2902237023b277ebfd876c88761b4cdc15de33df8225837ab074bb1781
7
- data.tar.gz: 93eb07e47f6a8ec2cad4f7916090bb2f310657cca5bae3adef090e7a08f2de7d9b4af62f9e6649e1ab35eb5b2fc81d4a2063971bea6b37e3759473cd722ea47a
6
+ metadata.gz: 840663b99bf1d803274dc28d7b72882958b1e99fd93b7039fe249192fcb510b07fd894b5e5b404de1153a53095763bd0aaaf1c0a16f20b225187477a3887fab9
7
+ data.tar.gz: 7ba7a882f7e6cb6ed115d88769d433d835e9b8782c5e9272436ff28956594cd9d8ae995ea54e59e86fbf3daf4848b0eca30a60b20933a16401d0f21cbb6e24a4
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 2.0.0 beta
1
+ ## 2.0.0
2
2
 
3
3
  ### Features
4
4
  * The way the [rails app reloader](https://guides.rubyonrails.org/threading_and_code_execution.html)
@@ -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
@@ -29,7 +30,6 @@
29
30
  * Code reorganization so there are no unnecessary methods in top-level `Kernel` namespace
30
31
  * top-level DSL methods are now implemented with refinements, so they don't polute other code
31
32
 
32
-
33
33
  ### Migrating from ruby-clock version 1 to version 2
34
34
  * The minimum ruby version is 3.0
35
35
  * The top of every Clockfile must begin with `using RubyClock::DSL`
@@ -38,8 +38,8 @@
38
38
  * Your existing Clockfile with `schedule.foo` invocations will still work, but you now have the option to use
39
39
  `every`, `cron`, and `on_error` at the top-level, without referencing `schedule`.
40
40
  * You now have the option of catching and reporting errors encountered when parsing the Clockfile.
41
- * There is no longer a need to have a binstub in rails. You can delete bin/clock from your app.
42
41
  * remove the `posix-spawn` gem from your project
42
+ * There is no longer a need to have a binstub in rails. You can delete bin/clock from your app.
43
43
  * The invocations (in Procfile, or wherever else you start ruby-clock) should change from
44
44
 
45
45
  bundle exec rails runner bin/clock
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,26 @@ 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
+ ## install go
175
+ brew install go # homebrew
176
+ sudo port install go # macports
177
+
178
+ ## install cronv https://github.com/takumakanari/cronv#go-install
179
+ go install -v github.com/takumakanari/cronv/cronv@0.4.5
180
+
181
+ ## generate dummy crontab
182
+ bundle exec clock --generate-dummy-crontab Clockfile ../clock/daily.rb ../clock/weekly.rb > dummycron.txt
183
+ ## IMPORTANT: open dummycron.txt in an editor and remove the boot startup message cruft from the top
184
+ cat dummycron.txt | ~/go/bin/cronv --duration=1d --title='Clock Jobs' --width=50 -o ./my_cron_schedule.html
185
+ open my_cron_schedule.html
186
+ ```
167
187
 
168
188
  ## More Config and Capabilities
169
189
 
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"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bachir
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-25 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rufus-scheduler
@@ -272,9 +272,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
272
272
  version: 3.0.0
273
273
  required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  requirements:
275
- - - ">"
275
+ - - ">="
276
276
  - !ruby/object:Gem::Version
277
- version: 1.3.1
277
+ version: '0'
278
278
  requirements: []
279
279
  rubygems_version: 3.3.7
280
280
  signing_key: