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 +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +12 -1
- data/exe/clock +20 -2
- data/lib/ruby-clock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 315bcc30c6fc32c1676e452750d76e839b0123f19fe7512bbe6662ae72ee0ecc
|
4
|
+
data.tar.gz: a5831b721e9d99af3082cb31dd472f4e282d5665616f40694ba41def7250b907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0983e40393e4d273feddbcb53d67c0a8b2ccbb194439a16df9ddb1edaeedcf89f36338bffc80d8ffb44809500b3553cbc601c55275fcd4dba86d18b67ad57bf5'
|
7
|
+
data.tar.gz: 563039f0ea34927b4d6e1abd64db0f2ae086c44f37d03852d8ca510223e1ce0f57ebe275ce7059d704de3e29a1e7f33d1412b92ad4b7a5a7e4e6d5ec661e9605
|
data/CHANGELOG.md
CHANGED
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
|
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
|
-
|
37
|
+
|
38
|
+
if check_syntax
|
39
|
+
puts "✨ Environment & Syntax OK ✨"
|
40
|
+
else
|
41
|
+
RubyClock.instance.run_jobs
|
42
|
+
end
|
data/lib/ruby-clock/version.rb
CHANGED