ruby-clock 0.6.0 → 0.7.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +30 -2
- data/exe/clock +1 -1
- data/lib/ruby-clock/version.rb +1 -1
- data/lib/ruby-clock.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2681c0a4279cd09c1c12b8495148b426f3af51ed8620615441ad013f2e21e40a
|
4
|
+
data.tar.gz: db0aea19c254edf9007dd9d1f34a8d1d9616e864972187f1345857ae6ad4f4db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1461d0c51349a1d635dc85dfc54a691753b48be4fcba2b687257d415d74fb8ced8b9fe15471f7940212bfd1ebf82ed8df2ccb93519f769c5c4034c0cc748a762
|
7
|
+
data.tar.gz: c0120a55ef27d303c66d64f895d664f359cf0edc568fe7ddef6515e62079e99a3767b93ef1f75e83d6ca9971bec08b16fb51f34f8172d67e621045027acd3739
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -16,6 +16,7 @@ The clock process will respond to signals INT (^c at the command line) and
|
|
16
16
|
TERM (signal sent by environments such as Heroku and other PaaS's when shutting down).
|
17
17
|
In both cases, the clock will stop running jobs and give existing jobs 29 seconds
|
18
18
|
to stop before killing them.
|
19
|
+
You can change this number with `RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS` in the environment.
|
19
20
|
|
20
21
|
## Installation
|
21
22
|
|
@@ -55,6 +56,11 @@ To start your clock process:
|
|
55
56
|
|
56
57
|
bundle exec clock
|
57
58
|
|
59
|
+
To use a file other than Clockfile for job definitions, specify it.
|
60
|
+
This will ignore Clockfile and only read jobs from clocks/MyClockfile:
|
61
|
+
|
62
|
+
bundle exec clock clocks/MyClockfile
|
63
|
+
|
58
64
|
### Rails
|
59
65
|
|
60
66
|
Install the `clock` binstub and commit to your repo.
|
@@ -83,6 +89,20 @@ Add this line to your Procfile
|
|
83
89
|
clock: bundle exec rails runner bin/clock
|
84
90
|
```
|
85
91
|
|
92
|
+
You might have a main clock for general scheduled jobs, and then standalone ones
|
93
|
+
if your system has something where you want to monitor and adjust resources
|
94
|
+
for that work more precisely. Here, maybe the main clock needs a 2GB instance,
|
95
|
+
and the others each need 1GB all to themselves:
|
96
|
+
|
97
|
+
```
|
98
|
+
clock: bundle exec rails runner bin/clock
|
99
|
+
thing_checker: bundle exec rails runner bin/clock clocks/thing_checker.rb
|
100
|
+
thing_reporter: bundle exec rails runner bin/clock clocks/thing_reporter.rb
|
101
|
+
```
|
102
|
+
|
103
|
+
Because of this feature, do I regret using "Clockfile" instead of, say, "clock.rb"? Maybe.
|
104
|
+
|
105
|
+
|
86
106
|
## More Config and Capabilities
|
87
107
|
|
88
108
|
### Error Handling
|
@@ -118,7 +138,7 @@ schedule.every '1 second', name: 'my job' do |variable|
|
|
118
138
|
end
|
119
139
|
# => my job
|
120
140
|
|
121
|
-
schedule.every '1 day'
|
141
|
+
schedule.every '1 day' do |variable|
|
122
142
|
daily_things = Foo.setup_daily
|
123
143
|
daily_things.process
|
124
144
|
# TODO: figure out best time of day
|
@@ -126,7 +146,7 @@ end
|
|
126
146
|
# => daily_things.process
|
127
147
|
|
128
148
|
# n.b. ruby-clock isn't yet smart enough to remove trailing comments
|
129
|
-
schedule.every '1 week'
|
149
|
+
schedule.every '1 week' do |variable|
|
130
150
|
weekly_things = Foo.setup_weekly
|
131
151
|
weekly_things.process # does this work???!1~
|
132
152
|
end
|
@@ -168,6 +188,14 @@ so anything you can do on this instance, you can do in your Clockfile.
|
|
168
188
|
Perhaps in the future ruby-clock will add some easier specific configuration
|
169
189
|
capabilities for some things. Let me know if you have a request!
|
170
190
|
|
191
|
+
## Syntax highlighting for Clockfile
|
192
|
+
|
193
|
+
To tell github and maybe other systems to syntax highlight Clockfile, put this in a .gitattributes file:
|
194
|
+
|
195
|
+
```gitattributes
|
196
|
+
Clockfile linguist-language=Ruby
|
197
|
+
```
|
198
|
+
|
171
199
|
|
172
200
|
## License
|
173
201
|
|
data/exe/clock
CHANGED
data/lib/ruby-clock/version.rb
CHANGED
data/lib/ruby-clock.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rufus-scheduler'
|
|
4
4
|
module RubyClock
|
5
5
|
def shutdown
|
6
6
|
puts "Shutting down ruby-clock 🐈️ 👋"
|
7
|
-
Rufus::Scheduler.singleton.shutdown(wait: 29)
|
7
|
+
Rufus::Scheduler.singleton.shutdown(wait: ENV['RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS']&.to_i || 29)
|
8
8
|
end
|
9
9
|
|
10
10
|
def listen_to_signals
|
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: 0.
|
4
|
+
version: 0.7.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: 2021-
|
11
|
+
date: 2021-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rufus-scheduler
|
@@ -47,6 +47,7 @@ extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- ".gitignore"
|
50
|
+
- CHANGELOG.md
|
50
51
|
- Gemfile
|
51
52
|
- Gemfile.lock
|
52
53
|
- LICENSE.txt
|
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
80
|
- !ruby/object:Gem::Version
|
80
81
|
version: '0'
|
81
82
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.2.23
|
83
84
|
signing_key:
|
84
85
|
specification_version: 4
|
85
86
|
summary: A "clock" process for invoking ruby code within a persistent runtime
|