ruby-clock 2.0.0.beta5 → 2.0.0.beta7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/CHANGELOG.md +14 -7
  4. data/README.md +34 -8
  5. data/example-app/Clockfile +27 -7
  6. data/example-app/Gemfile +2 -1
  7. data/example-app/Gemfile.lock +3 -0
  8. data/example-rails-6-app/.browserslistrc +1 -0
  9. data/example-rails-6-app/.gitattributes +10 -0
  10. data/example-rails-6-app/.gitignore +40 -0
  11. data/example-rails-6-app/.ruby-version +1 -0
  12. data/{example-rails-app → example-rails-6-app}/Clockfile +1 -1
  13. data/example-rails-6-app/Gemfile +62 -0
  14. data/example-rails-6-app/Gemfile.lock +270 -0
  15. data/example-rails-6-app/README.md +24 -0
  16. data/example-rails-6-app/app/assets/config/manifest.js +2 -0
  17. data/example-rails-6-app/app/assets/stylesheets/application.css +15 -0
  18. data/example-rails-6-app/app/javascript/channels/consumer.js +6 -0
  19. data/example-rails-6-app/app/javascript/channels/index.js +5 -0
  20. data/example-rails-6-app/app/javascript/packs/application.js +13 -0
  21. data/example-rails-6-app/app/mailers/application_mailer.rb +4 -0
  22. data/example-rails-6-app/app/models/application_record.rb +3 -0
  23. data/{example-rails-app → example-rails-6-app}/app/models/example.rb +4 -4
  24. data/example-rails-6-app/app/views/layouts/application.html.erb +16 -0
  25. data/example-rails-6-app/babel.config.js +82 -0
  26. data/example-rails-6-app/bin/rails +5 -0
  27. data/example-rails-6-app/bin/rake +5 -0
  28. data/example-rails-6-app/bin/setup +36 -0
  29. data/example-rails-6-app/bin/spring +14 -0
  30. data/example-rails-6-app/bin/webpack +18 -0
  31. data/example-rails-6-app/bin/webpack-dev-server +18 -0
  32. data/example-rails-6-app/bin/yarn +17 -0
  33. data/example-rails-6-app/config/application.rb +22 -0
  34. data/example-rails-6-app/config/boot.rb +4 -0
  35. data/example-rails-6-app/config/cable.yml +10 -0
  36. data/example-rails-6-app/config/credentials.yml.enc +1 -0
  37. data/example-rails-6-app/config/database.yml +25 -0
  38. data/example-rails-6-app/config/environments/development.rb +76 -0
  39. data/example-rails-6-app/config/environments/production.rb +120 -0
  40. data/example-rails-6-app/config/environments/test.rb +60 -0
  41. data/example-rails-6-app/config/initializers/application_controller_renderer.rb +8 -0
  42. data/example-rails-6-app/config/initializers/assets.rb +14 -0
  43. data/example-rails-6-app/config/initializers/backtrace_silencers.rb +8 -0
  44. data/example-rails-6-app/config/initializers/content_security_policy.rb +30 -0
  45. data/example-rails-6-app/config/initializers/cookies_serializer.rb +5 -0
  46. data/example-rails-6-app/config/initializers/filter_parameter_logging.rb +6 -0
  47. data/example-rails-6-app/config/initializers/inflections.rb +16 -0
  48. data/example-rails-6-app/config/initializers/mime_types.rb +4 -0
  49. data/example-rails-6-app/config/initializers/wrap_parameters.rb +14 -0
  50. data/example-rails-6-app/config/locales/en.yml +33 -0
  51. data/example-rails-6-app/config/puma.rb +43 -0
  52. data/example-rails-6-app/config/routes.rb +3 -0
  53. data/example-rails-6-app/config/spring.rb +6 -0
  54. data/example-rails-6-app/config/storage.yml +34 -0
  55. data/example-rails-6-app/config/webpack/development.js +5 -0
  56. data/example-rails-6-app/config/webpack/environment.js +3 -0
  57. data/example-rails-6-app/config/webpack/production.js +5 -0
  58. data/example-rails-6-app/config/webpack/test.js +5 -0
  59. data/example-rails-6-app/config/webpacker.yml +92 -0
  60. data/example-rails-6-app/db/migrate/20221102224703_create_examples.rb +8 -0
  61. data/example-rails-6-app/db/schema.rb +20 -0
  62. data/example-rails-6-app/db/seeds.rb +7 -0
  63. data/example-rails-6-app/package.json +17 -0
  64. data/example-rails-6-app/postcss.config.js +12 -0
  65. data/example-rails-6-app/test/test_helper.rb +13 -0
  66. data/example-rails-6-app/yarn.lock +7108 -0
  67. data/example-rails-7-app/Clockfile +19 -0
  68. data/{example-rails-app → example-rails-7-app}/Gemfile +1 -1
  69. data/example-rails-7-app/Gemfile.lock +247 -0
  70. data/example-rails-7-app/Rakefile +6 -0
  71. data/example-rails-7-app/app/channels/application_cable/channel.rb +4 -0
  72. data/example-rails-7-app/app/channels/application_cable/connection.rb +4 -0
  73. data/example-rails-7-app/app/controllers/application_controller.rb +2 -0
  74. data/example-rails-7-app/app/helpers/application_helper.rb +2 -0
  75. data/example-rails-7-app/app/jobs/application_job.rb +7 -0
  76. data/example-rails-7-app/app/models/concerns/.keep +0 -0
  77. data/example-rails-7-app/app/models/example.rb +18 -0
  78. data/example-rails-7-app/app/views/layouts/mailer.html.erb +13 -0
  79. data/example-rails-7-app/app/views/layouts/mailer.text.erb +1 -0
  80. data/example-rails-7-app/bin/bundle +114 -0
  81. data/example-rails-7-app/config/environment.rb +5 -0
  82. data/example-rails-7-app/config/initializers/permissions_policy.rb +11 -0
  83. data/example-rails-7-app/config.ru +6 -0
  84. data/example-rails-7-app/lib/assets/.keep +0 -0
  85. data/example-rails-7-app/lib/tasks/.keep +0 -0
  86. data/example-rails-7-app/log/.keep +0 -0
  87. data/example-rails-7-app/public/404.html +67 -0
  88. data/example-rails-7-app/public/422.html +67 -0
  89. data/example-rails-7-app/public/500.html +66 -0
  90. data/example-rails-7-app/public/apple-touch-icon-precomposed.png +0 -0
  91. data/example-rails-7-app/public/apple-touch-icon.png +0 -0
  92. data/example-rails-7-app/public/favicon.ico +0 -0
  93. data/example-rails-7-app/public/robots.txt +1 -0
  94. data/example-rails-7-app/storage/.keep +0 -0
  95. data/example-rails-7-app/test/application_system_test_case.rb +5 -0
  96. data/example-rails-7-app/test/channels/application_cable/connection_test.rb +11 -0
  97. data/example-rails-7-app/test/controllers/.keep +0 -0
  98. data/example-rails-7-app/test/fixtures/files/.keep +0 -0
  99. data/example-rails-7-app/test/helpers/.keep +0 -0
  100. data/example-rails-7-app/test/integration/.keep +0 -0
  101. data/example-rails-7-app/test/mailers/.keep +0 -0
  102. data/example-rails-7-app/test/models/.keep +0 -0
  103. data/example-rails-7-app/test/system/.keep +0 -0
  104. data/example-rails-7-app/tmp/.keep +0 -0
  105. data/example-rails-7-app/tmp/pids/.keep +0 -0
  106. data/example-rails-7-app/tmp/storage/.keep +0 -0
  107. data/example-rails-7-app/vendor/.keep +0 -0
  108. data/example-rails-7-app/vendor/javascript/.keep +0 -0
  109. data/exe/clock +1 -0
  110. data/lib/ruby-clock/dsl.rb +16 -0
  111. data/lib/ruby-clock/shell.rb +4 -6
  112. data/lib/ruby-clock/version.rb +1 -1
  113. data/lib/ruby-clock.rb +0 -3
  114. data/lib/rufus_monkeypatch.rb +8 -1
  115. data/ruby-clock.gemspec +1 -1
  116. metadata +183 -86
  117. data/lib/ruby-clock/runners.rb +0 -23
  118. /data/{example-rails-app → example-rails-6-app}/Rakefile +0 -0
  119. /data/{example-rails-app → example-rails-6-app}/app/assets/images/.keep +0 -0
  120. /data/{example-rails-app → example-rails-6-app}/app/channels/application_cable/channel.rb +0 -0
  121. /data/{example-rails-app → example-rails-6-app}/app/channels/application_cable/connection.rb +0 -0
  122. /data/{example-rails-app → example-rails-6-app}/app/controllers/application_controller.rb +0 -0
  123. /data/{example-rails-app → example-rails-6-app}/app/controllers/concerns/.keep +0 -0
  124. /data/{example-rails-app → example-rails-6-app}/app/helpers/application_helper.rb +0 -0
  125. /data/{example-rails-app → example-rails-6-app}/app/jobs/application_job.rb +0 -0
  126. /data/{example-rails-app → example-rails-6-app}/app/models/concerns/.keep +0 -0
  127. /data/{example-rails-app → example-rails-6-app}/app/views/layouts/mailer.html.erb +0 -0
  128. /data/{example-rails-app → example-rails-6-app}/app/views/layouts/mailer.text.erb +0 -0
  129. /data/{example-rails-app → example-rails-6-app}/bin/bundle +0 -0
  130. /data/{example-rails-app → example-rails-6-app}/config/environment.rb +0 -0
  131. /data/{example-rails-app → example-rails-6-app}/config/initializers/permissions_policy.rb +0 -0
  132. /data/{example-rails-app → example-rails-6-app}/config.ru +0 -0
  133. /data/{example-rails-app → example-rails-6-app}/lib/assets/.keep +0 -0
  134. /data/{example-rails-app → example-rails-6-app}/lib/tasks/.keep +0 -0
  135. /data/{example-rails-app → example-rails-6-app}/log/.keep +0 -0
  136. /data/{example-rails-app → example-rails-6-app}/public/404.html +0 -0
  137. /data/{example-rails-app → example-rails-6-app}/public/422.html +0 -0
  138. /data/{example-rails-app → example-rails-6-app}/public/500.html +0 -0
  139. /data/{example-rails-app → example-rails-6-app}/public/apple-touch-icon-precomposed.png +0 -0
  140. /data/{example-rails-app → example-rails-6-app}/public/apple-touch-icon.png +0 -0
  141. /data/{example-rails-app → example-rails-6-app}/public/favicon.ico +0 -0
  142. /data/{example-rails-app → example-rails-6-app}/public/robots.txt +0 -0
  143. /data/{example-rails-app → example-rails-6-app}/storage/.keep +0 -0
  144. /data/{example-rails-app → example-rails-6-app}/test/application_system_test_case.rb +0 -0
  145. /data/{example-rails-app → example-rails-6-app}/test/channels/application_cable/connection_test.rb +0 -0
  146. /data/{example-rails-app → example-rails-6-app}/test/controllers/.keep +0 -0
  147. /data/{example-rails-app → example-rails-6-app}/test/fixtures/files/.keep +0 -0
  148. /data/{example-rails-app → example-rails-6-app}/test/helpers/.keep +0 -0
  149. /data/{example-rails-app → example-rails-6-app}/test/integration/.keep +0 -0
  150. /data/{example-rails-app → example-rails-6-app}/test/mailers/.keep +0 -0
  151. /data/{example-rails-app → example-rails-6-app}/test/models/.keep +0 -0
  152. /data/{example-rails-app → example-rails-6-app}/test/system/.keep +0 -0
  153. /data/{example-rails-app → example-rails-6-app}/tmp/.keep +0 -0
  154. /data/{example-rails-app → example-rails-6-app}/tmp/pids/.keep +0 -0
  155. /data/{example-rails-app/tmp/storage → example-rails-6-app/vendor}/.keep +0 -0
  156. /data/{example-rails-app → example-rails-7-app}/.gitattributes +0 -0
  157. /data/{example-rails-app → example-rails-7-app}/.gitignore +0 -0
  158. /data/{example-rails-app → example-rails-7-app}/.ruby-version +0 -0
  159. /data/{example-rails-app → example-rails-7-app}/README.md +0 -0
  160. /data/{example-rails-app → example-rails-7-app}/app/assets/config/manifest.js +0 -0
  161. /data/{example-rails-app/vendor → example-rails-7-app/app/assets/images}/.keep +0 -0
  162. /data/{example-rails-app → example-rails-7-app}/app/assets/stylesheets/application.css +0 -0
  163. /data/{example-rails-app/vendor/javascript → example-rails-7-app/app/controllers/concerns}/.keep +0 -0
  164. /data/{example-rails-app → example-rails-7-app}/app/javascript/application.js +0 -0
  165. /data/{example-rails-app → example-rails-7-app}/app/javascript/controllers/application.js +0 -0
  166. /data/{example-rails-app → example-rails-7-app}/app/javascript/controllers/hello_controller.js +0 -0
  167. /data/{example-rails-app → example-rails-7-app}/app/javascript/controllers/index.js +0 -0
  168. /data/{example-rails-app → example-rails-7-app}/app/mailers/application_mailer.rb +0 -0
  169. /data/{example-rails-app → example-rails-7-app}/app/models/application_record.rb +0 -0
  170. /data/{example-rails-app → example-rails-7-app}/app/views/layouts/application.html.erb +0 -0
  171. /data/{example-rails-app → example-rails-7-app}/bin/importmap +0 -0
  172. /data/{example-rails-app → example-rails-7-app}/bin/rails +0 -0
  173. /data/{example-rails-app → example-rails-7-app}/bin/rake +0 -0
  174. /data/{example-rails-app → example-rails-7-app}/bin/setup +0 -0
  175. /data/{example-rails-app → example-rails-7-app}/config/application.rb +0 -0
  176. /data/{example-rails-app → example-rails-7-app}/config/boot.rb +0 -0
  177. /data/{example-rails-app → example-rails-7-app}/config/cable.yml +0 -0
  178. /data/{example-rails-app → example-rails-7-app}/config/credentials.yml.enc +0 -0
  179. /data/{example-rails-app → example-rails-7-app}/config/database.yml +0 -0
  180. /data/{example-rails-app → example-rails-7-app}/config/environments/development.rb +0 -0
  181. /data/{example-rails-app → example-rails-7-app}/config/environments/production.rb +0 -0
  182. /data/{example-rails-app → example-rails-7-app}/config/environments/test.rb +0 -0
  183. /data/{example-rails-app → example-rails-7-app}/config/importmap.rb +0 -0
  184. /data/{example-rails-app → example-rails-7-app}/config/initializers/assets.rb +0 -0
  185. /data/{example-rails-app → example-rails-7-app}/config/initializers/content_security_policy.rb +0 -0
  186. /data/{example-rails-app → example-rails-7-app}/config/initializers/filter_parameter_logging.rb +0 -0
  187. /data/{example-rails-app → example-rails-7-app}/config/initializers/inflections.rb +0 -0
  188. /data/{example-rails-app → example-rails-7-app}/config/locales/en.yml +0 -0
  189. /data/{example-rails-app → example-rails-7-app}/config/puma.rb +0 -0
  190. /data/{example-rails-app → example-rails-7-app}/config/routes.rb +0 -0
  191. /data/{example-rails-app → example-rails-7-app}/config/storage.yml +0 -0
  192. /data/{example-rails-app → example-rails-7-app}/db/migrate/20221001175928_create_examples.rb +0 -0
  193. /data/{example-rails-app → example-rails-7-app}/db/schema.rb +0 -0
  194. /data/{example-rails-app → example-rails-7-app}/db/seeds.rb +0 -0
  195. /data/{example-rails-app → example-rails-7-app}/test/test_helper.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4030e34d3273a3b96cabaa879b0d52965ff35e9ad13afebcb8932b9244512836
4
- data.tar.gz: dd6b624f190797e3daa9e1481ed27e1347d56df0df4a76a7e3855890eff51ef1
3
+ metadata.gz: 0a64343fae81372c459f3ea52c8358f2b9425c16fdb354ba29eeff18cc836927
4
+ data.tar.gz: cd17b15fcc7dcbdccc6e83dedab43316036a1b2a3a3cc143add9d7523586f4d2
5
5
  SHA512:
6
- metadata.gz: 052a4b986dc7ad4665b446ec5adb2c371aaddc4e503696b6127a977357ea2c3d6c9cd3e3a28b4cca4c8e90cfc0c3cae5c311d55c16f8d7ba11c0d130f7b2c4a2
7
- data.tar.gz: 43eab7d34b9259380a9c5939fbca53d98cf17dcaa89ab10f9d57343f64fea9dccdd495554d144fef3929f48d561eb327d652e170476be184ea80de96c8d06bf1
6
+ metadata.gz: 9e07fe25a8ee147c0dfca4fb90904b5a2c4a79d4c0e59953a616466080a626d95a457a8efd1844e92bed7a130fd0ad15480beb4be9155ab3d7a3f903decf5024
7
+ data.tar.gz: d8d40783de5f21398e1170f6bbfd9212fae1ba90a879aaec68002d433a9499455f6e506c968e8e040cce81f99e74991bba8c35a29e6ff94dd34b3dcd763f3c5d
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
- Gemfile.lock
1
+ /Gemfile.lock
2
2
  /.bundle/
3
3
  /.yardoc
4
4
  /_yardoc/
data/CHANGELOG.md CHANGED
@@ -6,28 +6,35 @@
6
6
  * RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS value is logged when starting
7
7
  * DSL methods are now at the top-level namespace (`schedule.every` → `every`, `schedule.cron` → `cron`)
8
8
  * Error handler definition is now at the top-level namespace (`def schedule.on_error` → `on_error do`)
9
- * Around callbacks now have a top-level namespace method. `def schedule.around_trigger` → `around_action` - see readme
10
- * Multiple around callbacks can be consecutively assigned - no need to put all behavior into one action
11
- * Errors encountered when loading Clockfile (such as incorrect cron syntaxt)
9
+ * Around callbacks now have a top-level namespace method. `def schedule.around_trigger` → `around_action do`
10
+ * Multiple around callbacks can be consecutively assigned - no need to put all behavior into one method
11
+ * Errors encountered when loading Clockfile (such as incorrect cron syntax)
12
12
  will be reported to the error handler
13
+ * The automatic identifier generator will now ignore `}` and `end` lines
14
+ * posix-spawn is no longer used. In ruby 3, native `Process.spawn` is more performant. See
15
+ [posix-spawn#90](https://github.com/rtomayko/posix-spawn/issues/90)
16
+ and
17
+ [terrapin#19](https://github.com/thoughtbot/terrapin/pull/19)
18
+ for more info.
13
19
 
14
20
  ### Anti-Features
15
- * rake and shell runners are no longer top-level (`shell` → `RubyClock::Runners.shell`, `rake` → `RubyClock::Runners.rake`)
21
+ * ruby 3.0 is now the minimum version
16
22
 
17
23
  ### Code Improvements
18
24
  * The code which implements the rails reloader/executor is now less complicated
19
25
  * Code reorganization so there are no unnecessary methods in top-level Kernel namespace
26
+ * top-level DSL methods are now implemented with refinements, so they don't polute other code
20
27
 
21
28
 
22
29
  ### Migrating from ruby-clock version 1 to version 2
23
30
 
31
+ * The minimum ruby version is 3.0
24
32
  * The top of every Clockfile must begin with `using RubyClock::DSL`
25
- * rake and shell runners must be invoked like so: `RubyClock::Runners.rake`, `RubyClock::Runners.shell`, etc.
26
33
  * If you have an existing `def schedule.around_trigger`, you will need to change it to use the new
27
34
  `around_action` method.
28
- * Your existing Clockfile will still work, but you now have the option to use
35
+ * Your existing Clockfile with `schedule.foo` invocations will still work, but you now have the option to use
29
36
  `every`, `cron`, and `on_error` at the top-level, without referencing `schedule`.
30
- See the readme for examples.
37
+ * You now have the option of catching and reporting errors encountered when parsing the Clockfile.
31
38
  * There is no longer a need to have a binstub in rails. You can delete bin/clock from your app.
32
39
  * The invocations (in Procfile, or wherever else you start ruby-clock) should change from
33
40
 
data/README.md CHANGED
@@ -28,7 +28,7 @@ You can change this number with `RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS` in the enviro
28
28
 
29
29
  ## Installation
30
30
 
31
- ruby >= 2.7 is required.
31
+ ruby >= 3.0 is required.
32
32
 
33
33
  Add these lines to your application's Gemfile:
34
34
 
@@ -92,7 +92,7 @@ You may wish to
92
92
  for your jobs. You can do so with the around trigger:
93
93
 
94
94
  ```ruby
95
- around_action(job_proc)
95
+ around_action do |job_proc|
96
96
  ActiveRecord::Base.uncached do
97
97
  job_proc.call
98
98
  end
@@ -200,20 +200,46 @@ instead of `around_action`.
200
200
  Read [the rufus-scheduler documentation](https://github.com/jmettraux/rufus-scheduler/#callbacks)
201
201
  to learn how to do this. Where the documentation references `s`, you should use `schedule`.
202
202
 
203
+ ### Variables
204
+
205
+ Like all rufus-scheduler features,
206
+ [local variables](https://github.com/jmettraux/rufus-scheduler/#--key-has_key-keys-values-and-entries)
207
+ can be defined per job. These can be used
208
+ in various ways, notably accessible by around actions and error handlers.
209
+
210
+ ```ruby
211
+ cron '5 0 * * *', locals: { app_area: 'reports' } do
212
+ DailyActivitySummary.generate_and_send
213
+ end
214
+
215
+ around_action do |job_proc, job_info|
216
+ StatsTracker.increment("#{job_info[:app_area]} jobs")
217
+ job_proc.call
218
+ end
219
+ on_error do |job, error|
220
+ case job
221
+ when String # this means there was a problem parsing the Clockfile while starting
222
+ ErrorReporter.track_exception(error, tag: ['clock', job[:app_area]], severity: 'high')
223
+ else
224
+ ErrorReporter.track_exception(error, tag: ['clock', job[:app_area]], custom_attribute: {job_name: job.identifier})
225
+ end
226
+ end
227
+ ```
228
+
203
229
  ### Shell commands
204
230
 
205
231
  You can run shell commands in your jobs.
206
232
 
207
233
  ```ruby
208
234
  every '1 day' do
209
- RubyClock::Runners.shell('sh scripts/process_stuff.sh')
235
+ shell('sh scripts/process_stuff.sh')
210
236
  end
211
237
  ```
212
238
 
213
239
  By default they will be run with
214
240
  [ruby backticks](https://livebook.manning.com/concept/ruby/backtick).
215
241
  For better performance, install the [terrapin](https://github.com/thoughtbot/terrapin)
216
- and [posix-spawn](https://github.com/rtomayko/posix-spawn) gems.
242
+ gem.
217
243
 
218
244
  `shell` is a convenience method which just passes the string on.
219
245
  If you want to use other terrapin features, you can skip the `shell` command
@@ -252,12 +278,12 @@ needing to shell out and start another process.
252
278
 
253
279
  ```ruby
254
280
  every '1 day' do
255
- RubyClock::Runners.rake('reports:daily')
281
+ rake('reports:daily')
256
282
  end
257
283
  ```
258
284
 
259
- There is also `RubyClock::Runners.rake_execute` and `RubyClock::Runners.rake_async`.
260
- See [the code](https://github.com/jjb/ruby-clock/blob/main/lib/rake.rb)
285
+ There are also `rake_execute` and `rake_async`.
286
+ See [the code](https://github.com/jjb/ruby-clock/blob/main/lib/ruby-clock/rake.rb)
261
287
  and [this article](https://code.jjb.cc/running-rake-tasks-from-within-ruby-on-rails-code) for more info.
262
288
 
263
289
  ### Job Identifier
@@ -295,7 +321,7 @@ This can be used for keeping track of job behavior in logs or a
295
321
  stats tracker. For example:
296
322
 
297
323
  ```ruby
298
- around_action(job_proc, job_info)
324
+ around_action do |job_proc, job_info|
299
325
  trigger_time = Time.now
300
326
  job_proc.call
301
327
  duration = Time.now-trigger_time.to_t
@@ -14,7 +14,7 @@ end
14
14
  # end
15
15
 
16
16
  around_action do |job_proc, job_info|
17
- puts "before1 #{job_info.class}"
17
+ puts "before1 #{job_info.class} #{job_info.identifier}"
18
18
  job_proc.call
19
19
  puts "after1"
20
20
  end
@@ -30,11 +30,11 @@ every('2 seconds') do
30
30
  end
31
31
 
32
32
  every('2 seconds') do
33
- RubyClock::Runners.shell 'say hello'
33
+ shell 'say hello'
34
34
  end
35
35
 
36
36
  every('2 seconds') do
37
- raise "🐈️ this error is expected, to test the error catcher"
37
+ raise "😅 this error is expected, to test the error catcher"
38
38
  end
39
39
 
40
40
  cron('*/10 * * * * *') do
@@ -42,17 +42,37 @@ cron('*/10 * * * * *') do
42
42
  end
43
43
 
44
44
  every('2 seconds') do
45
- if defined?(schedule)
46
- raise "💥 we do not expect the ruby-clock DSL to be available inside a job, but it is"
45
+ if !defined?(schedule)
46
+ raise "💥 we expect the ruby-clock DSL to be available inside a job, but it is not"
47
+ else
48
+ puts '✅'
47
49
  end
48
50
  end
49
51
 
50
52
  every('2 seconds') do
51
- if defined?(shell) || defined?(rake)
52
- puts "💥 we do not expect runners to be available inside a job, but it is"
53
+ if !defined?(shell) || !defined?(rake)
54
+ puts "💥 we expect runners to be available inside a job, but they are not"
55
+ else
56
+ puts '✅'
53
57
  end
54
58
  end
55
59
 
56
60
  # def schedule.around_trigger(job_info, &job_proc)
57
61
  # puts "ruby-clock 1-style around trigger!"
58
62
  # end
63
+
64
+ every('2 seconds', blocking: true) do
65
+ begin
66
+
67
+ 1.times {
68
+ begin
69
+ puts "hello from a stress test for the autonamer"
70
+ end
71
+
72
+ }
73
+ # this is a comment!
74
+
75
+ end
76
+ # another comment
77
+
78
+ end
data/example-app/Gemfile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ ruby '>= 3.0'
6
+
5
7
  gem 'ruby-clock', path: '../'
6
8
  # gem 'terrapin'
7
- # gem 'posix-spawn'
@@ -28,5 +28,8 @@ PLATFORMS
28
28
  DEPENDENCIES
29
29
  ruby-clock!
30
30
 
31
+ RUBY VERSION
32
+ ruby 3.1.2p20
33
+
31
34
  BUNDLED WITH
32
35
  2.3.8
@@ -0,0 +1 @@
1
+ defaults
@@ -0,0 +1,10 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ # Mark the database schema as having been generated.
4
+ db/schema.rb linguist-generated
5
+
6
+ # Mark the yarn lockfile as having been generated.
7
+ yarn.lock linguist-generated
8
+
9
+ # Mark any vendored files as having been vendored.
10
+ vendor/* linguist-vendored
@@ -0,0 +1,40 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+ # Ignore uploaded files in development.
26
+ /storage/*
27
+ !/storage/.keep
28
+
29
+ /public/assets
30
+ .byebug_history
31
+
32
+ # Ignore master key for decrypting credentials and more.
33
+ /config/master.key
34
+
35
+ /public/packs
36
+ /public/packs-test
37
+ /node_modules
38
+ /yarn-error.log
39
+ yarn-debug.log*
40
+ .yarn-integrity
@@ -0,0 +1 @@
1
+ 3.1.2
@@ -15,5 +15,5 @@ every('2 seconds') do
15
15
  end
16
16
 
17
17
  every('2 seconds') do
18
- RubyClock::Runners.rake 'about'
18
+ rake 'about'
19
19
  end
@@ -0,0 +1,62 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby '>= 3.0'
5
+
6
+ gem 'ruby-clock', path: '../', require: false
7
+
8
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
9
+ gem 'rails', '~> 6.1.7'
10
+ # Use sqlite3 as the database for Active Record
11
+ gem 'sqlite3', '~> 1.4'
12
+ # Use Puma as the app server
13
+ gem 'puma', '~> 5.0'
14
+ # Use SCSS for stylesheets
15
+ gem 'sass-rails', '>= 6'
16
+ # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
17
+ gem 'webpacker', '~> 5.0'
18
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
19
+ gem 'turbolinks', '~> 5'
20
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
21
+ gem 'jbuilder', '~> 2.7'
22
+ # Use Redis adapter to run Action Cable in production
23
+ # gem 'redis', '~> 4.0'
24
+ # Use Active Model has_secure_password
25
+ # gem 'bcrypt', '~> 3.1.7'
26
+
27
+ # Use Active Storage variant
28
+ # gem 'image_processing', '~> 1.2'
29
+
30
+ # Reduces boot times through caching; required in config/boot.rb
31
+ gem 'bootsnap', '>= 1.4.4', require: false
32
+
33
+ group :development, :test do
34
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
35
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
36
+ end
37
+
38
+ group :development do
39
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
40
+ gem 'web-console', '>= 4.1.0'
41
+ # Display performance information such as SQL time and flame graphs for each request in your browser.
42
+ # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
43
+ gem 'rack-mini-profiler', '~> 2.0'
44
+ gem 'listen', '~> 3.3'
45
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
46
+ gem 'spring'
47
+ end
48
+
49
+ group :test do
50
+ # Adds support for Capybara system testing and selenium driver
51
+ gem 'capybara', '>= 3.26'
52
+ gem 'selenium-webdriver', '>= 4.0.0.rc1'
53
+ # Easy installation and use of web drivers to run system tests with browsers
54
+ gem 'webdrivers'
55
+ end
56
+
57
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
58
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
59
+
60
+ gem 'net-smtp'
61
+ gem 'net-pop'
62
+ gem 'net-imap'
@@ -0,0 +1,270 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ ruby-clock (2.0.0.beta5)
5
+ method_source
6
+ rufus-scheduler (~> 3.8)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (6.1.7)
12
+ actionpack (= 6.1.7)
13
+ activesupport (= 6.1.7)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (6.1.7)
17
+ actionpack (= 6.1.7)
18
+ activejob (= 6.1.7)
19
+ activerecord (= 6.1.7)
20
+ activestorage (= 6.1.7)
21
+ activesupport (= 6.1.7)
22
+ mail (>= 2.7.1)
23
+ actionmailer (6.1.7)
24
+ actionpack (= 6.1.7)
25
+ actionview (= 6.1.7)
26
+ activejob (= 6.1.7)
27
+ activesupport (= 6.1.7)
28
+ mail (~> 2.5, >= 2.5.4)
29
+ rails-dom-testing (~> 2.0)
30
+ actionpack (6.1.7)
31
+ actionview (= 6.1.7)
32
+ activesupport (= 6.1.7)
33
+ rack (~> 2.0, >= 2.0.9)
34
+ rack-test (>= 0.6.3)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
+ actiontext (6.1.7)
38
+ actionpack (= 6.1.7)
39
+ activerecord (= 6.1.7)
40
+ activestorage (= 6.1.7)
41
+ activesupport (= 6.1.7)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (6.1.7)
44
+ activesupport (= 6.1.7)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (6.1.7)
50
+ activesupport (= 6.1.7)
51
+ globalid (>= 0.3.6)
52
+ activemodel (6.1.7)
53
+ activesupport (= 6.1.7)
54
+ activerecord (6.1.7)
55
+ activemodel (= 6.1.7)
56
+ activesupport (= 6.1.7)
57
+ activestorage (6.1.7)
58
+ actionpack (= 6.1.7)
59
+ activejob (= 6.1.7)
60
+ activerecord (= 6.1.7)
61
+ activesupport (= 6.1.7)
62
+ marcel (~> 1.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (6.1.7)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ zeitwerk (~> 2.3)
70
+ addressable (2.8.1)
71
+ public_suffix (>= 2.0.2, < 6.0)
72
+ bindex (0.8.1)
73
+ bootsnap (1.13.0)
74
+ msgpack (~> 1.2)
75
+ builder (3.2.4)
76
+ byebug (11.1.3)
77
+ capybara (3.37.1)
78
+ addressable
79
+ matrix
80
+ mini_mime (>= 0.1.3)
81
+ nokogiri (~> 1.8)
82
+ rack (>= 1.6.0)
83
+ rack-test (>= 0.6.3)
84
+ regexp_parser (>= 1.5, < 3.0)
85
+ xpath (~> 3.2)
86
+ childprocess (4.1.0)
87
+ concurrent-ruby (1.1.10)
88
+ crass (1.0.6)
89
+ digest (3.1.0)
90
+ erubi (1.11.0)
91
+ et-orbi (1.2.7)
92
+ tzinfo
93
+ ffi (1.15.5)
94
+ fugit (1.7.1)
95
+ et-orbi (~> 1, >= 1.2.7)
96
+ raabro (~> 1.4)
97
+ globalid (1.0.0)
98
+ activesupport (>= 5.0)
99
+ i18n (1.12.0)
100
+ concurrent-ruby (~> 1.0)
101
+ jbuilder (2.11.5)
102
+ actionview (>= 5.0.0)
103
+ activesupport (>= 5.0.0)
104
+ listen (3.7.1)
105
+ rb-fsevent (~> 0.10, >= 0.10.3)
106
+ rb-inotify (~> 0.9, >= 0.9.10)
107
+ loofah (2.19.0)
108
+ crass (~> 1.0.2)
109
+ nokogiri (>= 1.5.9)
110
+ mail (2.7.1)
111
+ mini_mime (>= 0.1.1)
112
+ marcel (1.0.2)
113
+ matrix (0.4.2)
114
+ method_source (1.0.0)
115
+ mini_mime (1.1.2)
116
+ mini_portile2 (2.8.0)
117
+ minitest (5.16.3)
118
+ msgpack (1.6.0)
119
+ net-imap (0.3.1)
120
+ net-protocol
121
+ net-pop (0.1.2)
122
+ net-protocol
123
+ net-protocol (0.1.3)
124
+ timeout
125
+ net-smtp (0.3.1)
126
+ digest
127
+ net-protocol
128
+ timeout
129
+ nio4r (2.5.8)
130
+ nokogiri (1.13.9)
131
+ mini_portile2 (~> 2.8.0)
132
+ racc (~> 1.4)
133
+ nokogiri (1.13.9-arm64-darwin)
134
+ racc (~> 1.4)
135
+ public_suffix (5.0.0)
136
+ puma (5.6.5)
137
+ nio4r (~> 2.0)
138
+ raabro (1.4.0)
139
+ racc (1.6.0)
140
+ rack (2.2.4)
141
+ rack-mini-profiler (2.3.4)
142
+ rack (>= 1.2.0)
143
+ rack-proxy (0.7.4)
144
+ rack
145
+ rack-test (2.0.2)
146
+ rack (>= 1.3)
147
+ rails (6.1.7)
148
+ actioncable (= 6.1.7)
149
+ actionmailbox (= 6.1.7)
150
+ actionmailer (= 6.1.7)
151
+ actionpack (= 6.1.7)
152
+ actiontext (= 6.1.7)
153
+ actionview (= 6.1.7)
154
+ activejob (= 6.1.7)
155
+ activemodel (= 6.1.7)
156
+ activerecord (= 6.1.7)
157
+ activestorage (= 6.1.7)
158
+ activesupport (= 6.1.7)
159
+ bundler (>= 1.15.0)
160
+ railties (= 6.1.7)
161
+ sprockets-rails (>= 2.0.0)
162
+ rails-dom-testing (2.0.3)
163
+ activesupport (>= 4.2.0)
164
+ nokogiri (>= 1.6)
165
+ rails-html-sanitizer (1.4.3)
166
+ loofah (~> 2.3)
167
+ railties (6.1.7)
168
+ actionpack (= 6.1.7)
169
+ activesupport (= 6.1.7)
170
+ method_source
171
+ rake (>= 12.2)
172
+ thor (~> 1.0)
173
+ rake (13.0.6)
174
+ rb-fsevent (0.11.2)
175
+ rb-inotify (0.10.1)
176
+ ffi (~> 1.0)
177
+ regexp_parser (2.6.0)
178
+ rexml (3.2.5)
179
+ rubyzip (2.3.2)
180
+ rufus-scheduler (3.8.2)
181
+ fugit (~> 1.1, >= 1.1.6)
182
+ sass-rails (6.0.0)
183
+ sassc-rails (~> 2.1, >= 2.1.1)
184
+ sassc (2.4.0)
185
+ ffi (~> 1.9)
186
+ sassc-rails (2.1.2)
187
+ railties (>= 4.0.0)
188
+ sassc (>= 2.0)
189
+ sprockets (> 3.0)
190
+ sprockets-rails
191
+ tilt
192
+ selenium-webdriver (4.5.0)
193
+ childprocess (>= 0.5, < 5.0)
194
+ rexml (~> 3.2, >= 3.2.5)
195
+ rubyzip (>= 1.2.2, < 3.0)
196
+ websocket (~> 1.0)
197
+ semantic_range (3.0.0)
198
+ spring (4.1.0)
199
+ sprockets (4.1.1)
200
+ concurrent-ruby (~> 1.0)
201
+ rack (> 1, < 3)
202
+ sprockets-rails (3.4.2)
203
+ actionpack (>= 5.2)
204
+ activesupport (>= 5.2)
205
+ sprockets (>= 3.0.0)
206
+ sqlite3 (1.5.3)
207
+ mini_portile2 (~> 2.8.0)
208
+ sqlite3 (1.5.3-arm64-darwin)
209
+ thor (1.2.1)
210
+ tilt (2.0.11)
211
+ timeout (0.3.0)
212
+ turbolinks (5.2.1)
213
+ turbolinks-source (~> 5.2)
214
+ turbolinks-source (5.2.0)
215
+ tzinfo (2.0.5)
216
+ concurrent-ruby (~> 1.0)
217
+ web-console (4.2.0)
218
+ actionview (>= 6.0.0)
219
+ activemodel (>= 6.0.0)
220
+ bindex (>= 0.4.0)
221
+ railties (>= 6.0.0)
222
+ webdrivers (5.2.0)
223
+ nokogiri (~> 1.6)
224
+ rubyzip (>= 1.3.0)
225
+ selenium-webdriver (~> 4.0)
226
+ webpacker (5.4.3)
227
+ activesupport (>= 5.2)
228
+ rack-proxy (>= 0.6.1)
229
+ railties (>= 5.2)
230
+ semantic_range (>= 2.3.0)
231
+ websocket (1.2.9)
232
+ websocket-driver (0.7.5)
233
+ websocket-extensions (>= 0.1.0)
234
+ websocket-extensions (0.1.5)
235
+ xpath (3.2.0)
236
+ nokogiri (~> 1.8)
237
+ zeitwerk (2.6.4)
238
+
239
+ PLATFORMS
240
+ arm64-darwin-21
241
+ ruby
242
+
243
+ DEPENDENCIES
244
+ bootsnap (>= 1.4.4)
245
+ byebug
246
+ capybara (>= 3.26)
247
+ jbuilder (~> 2.7)
248
+ listen (~> 3.3)
249
+ net-imap
250
+ net-pop
251
+ net-smtp
252
+ puma (~> 5.0)
253
+ rack-mini-profiler (~> 2.0)
254
+ rails (~> 6.1.7)
255
+ ruby-clock!
256
+ sass-rails (>= 6)
257
+ selenium-webdriver (>= 4.0.0.rc1)
258
+ spring
259
+ sqlite3 (~> 1.4)
260
+ turbolinks (~> 5)
261
+ tzinfo-data
262
+ web-console (>= 4.1.0)
263
+ webdrivers
264
+ webpacker (~> 5.0)
265
+
266
+ RUBY VERSION
267
+ ruby 3.1.2p20
268
+
269
+ BUNDLED WITH
270
+ 2.3.10
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */