ruby-clock 2.0.0.beta7 → 2.0.0.beta8

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: 0a64343fae81372c459f3ea52c8358f2b9425c16fdb354ba29eeff18cc836927
4
- data.tar.gz: cd17b15fcc7dcbdccc6e83dedab43316036a1b2a3a3cc143add9d7523586f4d2
3
+ metadata.gz: 315bcc30c6fc32c1676e452750d76e839b0123f19fe7512bbe6662ae72ee0ecc
4
+ data.tar.gz: a5831b721e9d99af3082cb31dd472f4e282d5665616f40694ba41def7250b907
5
5
  SHA512:
6
- metadata.gz: 9e07fe25a8ee147c0dfca4fb90904b5a2c4a79d4c0e59953a616466080a626d95a457a8efd1844e92bed7a130fd0ad15480beb4be9155ab3d7a3f903decf5024
7
- data.tar.gz: d8d40783de5f21398e1170f6bbfd9212fae1ba90a879aaec68002d433a9499455f6e506c968e8e040cce81f99e74991bba8c35a29e6ff94dd34b3dcd763f3c5d
6
+ metadata.gz: '0983e40393e4d273feddbcb53d67c0a8b2ccbb194439a16df9ddb1edaeedcf89f36338bffc80d8ffb44809500b3553cbc601c55275fcd4dba86d18b67ad57bf5'
7
+ data.tar.gz: 563039f0ea34927b4d6e1abd64db0f2ae086c44f37d03852d8ca510223e1ce0f57ebe275ce7059d704de3e29a1e7f33d1412b92ad4b7a5a7e4e6d5ec661e9605
data/CHANGELOG.md CHANGED
@@ -16,6 +16,7 @@
16
16
  and
17
17
  [terrapin#19](https://github.com/thoughtbot/terrapin/pull/19)
18
18
  for more info.
19
+ * `--environment-and-syntax-check` capability
19
20
 
20
21
  ### Anti-Features
21
22
  * ruby 3.0 is now the minimum version
data/README.md CHANGED
@@ -139,6 +139,17 @@ to another process or file. To change this behavior and have logs flush immediat
139
139
  add `$stdout.sync = true` to the top of your Clockfile.
140
140
 
141
141
 
142
+ #### Testing
143
+
144
+ You can use the `--environment-and-syntax-check` flag to load the app environment and check
145
+ Clockfile syntax without actually running jobs. This can be used to check if cron syntax
146
+ is valid during dev, or in automate tests.
147
+
148
+ ```ruby
149
+ # system returns true/false depending on 0/1 exit status of process
150
+ assert(system("bundle exec --environment-and-syntax-check clock/my_clockfile.rb"))
151
+ ```
152
+
142
153
  ## More Config and Capabilities
143
154
 
144
155
  ### Error Handling
@@ -151,7 +162,7 @@ error reports about problems while loading the Clockfile:
151
162
  on_error do |job, error|
152
163
  case job
153
164
  when String # this means there was a problem parsing the Clockfile while starting
154
- ErrorReporter.track_exception(error, tag: 'clock', severity: 'high')
165
+ ErrorReporter.track_exception(StandardError.new(error), tag: 'clock', severity: 'high')
155
166
  else
156
167
  ErrorReporter.track_exception(error, tag: 'clock', custom_attribute: {job_name: job.identifier})
157
168
  end
data/exe/clock CHANGED
@@ -9,8 +9,21 @@ RubyClock.instance.prepare_rake
9
9
  RubyClock.instance.schedule.pause
10
10
  RubyClock.instance.add_rails_executor_to_around_actions
11
11
 
12
+ clockfile = 'Clockfile'
13
+ check_syntax = false
14
+ case ARGV[0]
15
+ when '--environment-and-syntax-check'
16
+ check_syntax = true
17
+ case ARGV[1]
18
+ when String
19
+ clockfile = ARGV[1]
20
+ end
21
+ when String
22
+ clockfile = ARGV[0]
23
+ end
24
+
12
25
  begin
13
- load ARGV[0] || 'Clockfile'
26
+ load clockfile
14
27
  rescue => clockfile_error
15
28
  if RubyClock.instance.on_error
16
29
  RubyClock.instance.on_error.call("An error has occured while parsing the clockfile", clockfile_error)
@@ -21,4 +34,9 @@ end
21
34
 
22
35
  RubyClock.instance.ensure_around_trigger_has_not_been_redefined
23
36
  RubyClock.instance.freeze_around_actions
24
- RubyClock.instance.run_jobs
37
+
38
+ if check_syntax
39
+ puts "✨ Environment & Syntax OK ✨"
40
+ else
41
+ RubyClock.instance.run_jobs
42
+ end
@@ -1,3 +1,3 @@
1
1
  class RubyClock
2
- VERSION = "2.0.0.beta7"
2
+ VERSION = "2.0.0.beta8"
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.beta7
4
+ version: 2.0.0.beta8
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bachir