ruby-clock 0.6.0 → 0.7.0

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: e0fec8d8c66e1783260e73fad69f39572677871d722d1c62437c94741452340e
4
- data.tar.gz: 03e5b84ef4cd5277da5623173ca70887dc3aac0296445e573459050341376b78
3
+ metadata.gz: 2681c0a4279cd09c1c12b8495148b426f3af51ed8620615441ad013f2e21e40a
4
+ data.tar.gz: db0aea19c254edf9007dd9d1f34a8d1d9616e864972187f1345857ae6ad4f4db
5
5
  SHA512:
6
- metadata.gz: 70134452766d69a5dbebc795cc31babb56ac14b6363aa6416379600fb6fa0546ccc9b131a17342b1376a101acc89ae746a1f9f19795274224a72e9291f9f6eba
7
- data.tar.gz: 4aeb5e68d8108f40e10c11b4ea9fe4a3ad390ba4652afcc4e71cbc11c8c49b36be3f4c8b762f17eda1cffc488f1d5b803388bfb5f3e219962c289dd581549f81
6
+ metadata.gz: 1461d0c51349a1d635dc85dfc54a691753b48be4fcba2b687257d415d74fb8ced8b9fe15471f7940212bfd1ebf82ed8df2ccb93519f769c5c4034c0cc748a762
7
+ data.tar.gz: c0120a55ef27d303c66d64f895d664f359cf0edc568fe7ddef6515e62079e99a3767b93ef1f75e83d6ca9971bec08b16fb51f34f8172d67e621045027acd3739
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 0.7.0
2
+
3
+ * ability to specify the name of the file with job definitions, e.g. `bundle exec clock clocks/MyClockfile`
4
+ * ability to specify the amount of time ruby-clock will wait before forcing threads to shut down
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', name: 'my job' do |variable|
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', name: 'my job' do |variable|
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
@@ -19,6 +19,6 @@ include RubyClock
19
19
 
20
20
  listen_to_signals
21
21
 
22
- load 'Clockfile'
22
+ load ARGV[0] || 'Clockfile'
23
23
 
24
24
  run_jobs
@@ -1,3 +1,3 @@
1
1
  module RubyClock
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
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.6.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-07-14 00:00:00.000000000 Z
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.1.6
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