ruby-clock 1.0.0 → 2.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +39 -31
- data/example-app/Clockfile +7 -3
- data/example-rails-app/.gitattributes +9 -0
- data/example-rails-app/.gitignore +35 -0
- data/example-rails-app/.ruby-version +1 -0
- data/example-rails-app/Clockfile +23 -0
- data/example-rails-app/Gemfile +74 -0
- data/example-rails-app/README.md +12 -0
- data/example-rails-app/Rakefile +6 -0
- data/example-rails-app/app/assets/config/manifest.js +4 -0
- data/example-rails-app/app/assets/images/.keep +0 -0
- data/example-rails-app/app/assets/stylesheets/application.css +15 -0
- data/example-rails-app/app/channels/application_cable/channel.rb +4 -0
- data/example-rails-app/app/channels/application_cable/connection.rb +4 -0
- data/example-rails-app/app/controllers/application_controller.rb +2 -0
- data/example-rails-app/app/controllers/concerns/.keep +0 -0
- data/example-rails-app/app/helpers/application_helper.rb +2 -0
- data/example-rails-app/app/javascript/application.js +3 -0
- data/example-rails-app/app/javascript/controllers/application.js +9 -0
- data/example-rails-app/app/javascript/controllers/hello_controller.js +7 -0
- data/example-rails-app/app/javascript/controllers/index.js +11 -0
- data/example-rails-app/app/jobs/application_job.rb +7 -0
- data/example-rails-app/app/mailers/application_mailer.rb +4 -0
- data/example-rails-app/app/models/application_record.rb +3 -0
- data/example-rails-app/app/models/concerns/.keep +0 -0
- data/example-rails-app/app/models/example.rb +2 -0
- data/example-rails-app/app/views/layouts/application.html.erb +16 -0
- data/example-rails-app/app/views/layouts/mailer.html.erb +13 -0
- data/example-rails-app/app/views/layouts/mailer.text.erb +1 -0
- data/example-rails-app/bin/bundle +114 -0
- data/example-rails-app/bin/importmap +4 -0
- data/example-rails-app/bin/rails +4 -0
- data/example-rails-app/bin/rake +4 -0
- data/example-rails-app/bin/setup +33 -0
- data/example-rails-app/config/application.rb +22 -0
- data/example-rails-app/config/boot.rb +4 -0
- data/example-rails-app/config/cable.yml +11 -0
- data/example-rails-app/config/credentials.yml.enc +1 -0
- data/example-rails-app/config/database.yml +25 -0
- data/example-rails-app/config/environment.rb +5 -0
- data/example-rails-app/config/environments/development.rb +70 -0
- data/example-rails-app/config/environments/production.rb +93 -0
- data/example-rails-app/config/environments/test.rb +60 -0
- data/example-rails-app/config/importmap.rb +7 -0
- data/example-rails-app/config/initializers/assets.rb +12 -0
- data/example-rails-app/config/initializers/content_security_policy.rb +25 -0
- data/example-rails-app/config/initializers/filter_parameter_logging.rb +8 -0
- data/example-rails-app/config/initializers/inflections.rb +16 -0
- data/example-rails-app/config/initializers/permissions_policy.rb +11 -0
- data/example-rails-app/config/locales/en.yml +33 -0
- data/example-rails-app/config/puma.rb +43 -0
- data/example-rails-app/config/routes.rb +6 -0
- data/example-rails-app/config/storage.yml +34 -0
- data/example-rails-app/config.ru +6 -0
- data/example-rails-app/db/migrate/20221001175928_create_examples.rb +8 -0
- data/example-rails-app/db/schema.rb +19 -0
- data/example-rails-app/db/seeds.rb +7 -0
- data/example-rails-app/lib/assets/.keep +0 -0
- data/example-rails-app/lib/tasks/.keep +0 -0
- data/example-rails-app/log/.keep +0 -0
- data/example-rails-app/public/404.html +67 -0
- data/example-rails-app/public/422.html +67 -0
- data/example-rails-app/public/500.html +66 -0
- data/example-rails-app/public/apple-touch-icon-precomposed.png +0 -0
- data/example-rails-app/public/apple-touch-icon.png +0 -0
- data/example-rails-app/public/favicon.ico +0 -0
- data/example-rails-app/public/robots.txt +1 -0
- data/example-rails-app/storage/.keep +0 -0
- data/example-rails-app/test/application_system_test_case.rb +5 -0
- data/example-rails-app/test/channels/application_cable/connection_test.rb +11 -0
- data/example-rails-app/test/controllers/.keep +0 -0
- data/example-rails-app/test/fixtures/files/.keep +0 -0
- data/example-rails-app/test/helpers/.keep +0 -0
- data/example-rails-app/test/integration/.keep +0 -0
- data/example-rails-app/test/mailers/.keep +0 -0
- data/example-rails-app/test/models/.keep +0 -0
- data/example-rails-app/test/system/.keep +0 -0
- data/example-rails-app/test/test_helper.rb +13 -0
- data/example-rails-app/tmp/.keep +0 -0
- data/example-rails-app/tmp/pids/.keep +0 -0
- data/example-rails-app/tmp/storage/.keep +0 -0
- data/example-rails-app/vendor/.keep +0 -0
- data/example-rails-app/vendor/javascript/.keep +0 -0
- data/exe/clock +37 -5
- data/lib/ruby-clock/version.rb +2 -2
- data/lib/ruby-clock.rb +12 -2
- data/ruby-clock.gemspec +1 -1
- metadata +87 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fdfa3656f0ffbdf60b162a594809e29e9f0579cf3f5f52e98ffd857a811c348
|
4
|
+
data.tar.gz: f63dd579f2cd258f89f17666338ec9d433a63e2b93d0a400975ee6c1e61886fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 938ec658ba3837be8a90c49fdd8d2d6a050b1b6a19486bc2b10479e81370ed3fe5c0e4501293b02a2c8efcfe82d67974e887c2069270986f3398b89762c04707
|
7
|
+
data.tar.gz: c3376b79456a66c2b3c1eb5492b9a0429e69ece7b5207a73d2792c8830c33355c14dc622c2a37e8b6b8e2b9b27cdaaa4d0c83449e6e9c8aca3ae2538e2a90af0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
## 2.0.0 beta
|
2
|
+
|
3
|
+
* The way the [rails app reloader](https://guides.rubyonrails.org/threading_and_code_execution.html)
|
4
|
+
is implemented is now compatible with both rails 6 and 7
|
5
|
+
* The setup for rails is now less complicated
|
6
|
+
* RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS value is logged when starting
|
7
|
+
* Code reorganization so there are no unnecessary methods in top-level Kernel namespace
|
8
|
+
* DSL methods are now at the top-level namespace (`schedule.every` → `every`, `schedule.cron` → `cron`)
|
9
|
+
* error handler definition is now at the top-level namespace (`def schedule.on_error` → `on_error do`)
|
10
|
+
|
11
|
+
### Migrating from ruby-clock version 1 to version 2
|
12
|
+
|
13
|
+
* There is no longer a need to have a binstub in rails. You can delete bin/clock from your app.
|
14
|
+
* The invocations (in Procfile, or wherever else you start ruby-clock) should change from
|
15
|
+
|
16
|
+
bundle exec rails runner bin/clock
|
17
|
+
to
|
18
|
+
|
19
|
+
bundle exec clock
|
20
|
+
* Your existing Clockfile will still work, but you now have the option to use
|
21
|
+
`every`, `cron`, and `on_error` at the top-level, without referencing `schedule`.
|
22
|
+
See the readme for examples.
|
23
|
+
|
1
24
|
## 1.0.0
|
2
25
|
|
3
26
|
* make terrapin and posix-spawn gems optional
|
data/README.md
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
+
THESE ARE THE DOCS FOR VERSION 2.0.0.beta2
|
2
|
+
|
3
|
+
See version 1 docs here: https://github.com/jjb/ruby-clock/tree/v1.0.0
|
4
|
+
|
1
5
|
# ruby-clock
|
2
6
|
|
3
7
|
ruby-clock is a [job scheduler](https://en.wikipedia.org/wiki/Job_scheduler),
|
4
8
|
known by heroku as a [clock process](https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes).
|
5
9
|
In many cases it can replace the use of cron.
|
6
10
|
|
11
|
+
Why another ruby scheduler project? See
|
12
|
+
[this feature matrix of the space](https://docs.google.com/spreadsheets/d/148VMKY9iyOyUASYytSGiUJKvH0-O5Ri-3Cwr3S6DRPU/edit?usp=sharing).
|
13
|
+
Feel free to leave a comment with suggestions for changes or additions.
|
14
|
+
|
7
15
|
This gem is very small with very few lines of code. For all its scheduling capabilities,
|
8
16
|
it relies on the venerable [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler/).
|
9
17
|
rufus-scheduler
|
@@ -20,6 +28,8 @@ You can change this number with `RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS` in the enviro
|
|
20
28
|
|
21
29
|
## Installation
|
22
30
|
|
31
|
+
ruby >= 2.7 is required.
|
32
|
+
|
23
33
|
Add these lines to your application's Gemfile:
|
24
34
|
|
25
35
|
```ruby
|
@@ -37,17 +47,15 @@ Or install it yourself as:
|
|
37
47
|
## Usage
|
38
48
|
|
39
49
|
Create a file named Clockfile. This will hold your job definitions.
|
40
|
-
|
41
|
-
are the same as those of [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler/).
|
42
|
-
Read the rufus-scheduler documentation to see what you can do.
|
50
|
+
Define jobs like this:
|
43
51
|
|
44
52
|
```ruby
|
45
|
-
|
53
|
+
every('5 minutes') do
|
46
54
|
UserDataReports.generate
|
47
55
|
end
|
48
56
|
|
49
57
|
# do something every day, five minutes after midnight
|
50
|
-
|
58
|
+
cron '5 0 * * *' do
|
51
59
|
DailyActivitySummary.generate_and_send
|
52
60
|
end
|
53
61
|
```
|
@@ -63,13 +71,9 @@ This will ignore Clockfile and only read jobs from clocks/MyClockfile:
|
|
63
71
|
|
64
72
|
### Rails
|
65
73
|
|
66
|
-
Install the `clock` binstub and commit to your repo.
|
67
|
-
|
68
|
-
bundle binstubs ruby-clock
|
69
|
-
|
70
74
|
To run your clock process in your app's environment:
|
71
75
|
|
72
|
-
bundle exec
|
76
|
+
bundle exec clock
|
73
77
|
|
74
78
|
To get smarter database connection management (such as in the case of a database restart or upgrade,
|
75
79
|
and maybe other benefits) and code reloading in dev (app code, not the code in Clockfile itself),
|
@@ -78,6 +82,7 @@ jobs are automatically wrapped in the
|
|
78
82
|
This [may incur a performance impact for certain jobs](https://github.com/rails/rails/issues/43504),
|
79
83
|
I'm still exploring this.
|
80
84
|
|
85
|
+
|
81
86
|
#### ActiveRecord Query Cache
|
82
87
|
|
83
88
|
You may wish to
|
@@ -98,7 +103,7 @@ Require your app's code at the top of Clockfile:
|
|
98
103
|
|
99
104
|
```ruby
|
100
105
|
require_relative './lib/app.rb'
|
101
|
-
|
106
|
+
every('5 minutes') do
|
102
107
|
...
|
103
108
|
```
|
104
109
|
|
@@ -107,7 +112,7 @@ schedule.every('5 minutes') do
|
|
107
112
|
Add this line to your Procfile
|
108
113
|
|
109
114
|
```
|
110
|
-
clock: bundle exec
|
115
|
+
clock: bundle exec clock
|
111
116
|
```
|
112
117
|
|
113
118
|
You might have a main clock for general scheduled jobs, and then standalone ones
|
@@ -116,9 +121,9 @@ for that work more precisely. Here, maybe the main clock needs a 2GB instance,
|
|
116
121
|
and the others each need 1GB all to themselves:
|
117
122
|
|
118
123
|
```
|
119
|
-
clock: bundle exec
|
120
|
-
thing_checker: bundle exec
|
121
|
-
thing_reporter: bundle exec
|
124
|
+
clock: bundle exec clock
|
125
|
+
thing_checker: bundle exec clock clocks/thing_checker.rb
|
126
|
+
thing_reporter: bundle exec clock clocks/thing_reporter.rb
|
122
127
|
```
|
123
128
|
|
124
129
|
Because of this feature, do I regret using "Clockfile" instead of, say, "clock.rb"? Maybe.
|
@@ -140,7 +145,7 @@ You can catch and report errors raised in your jobs by defining an error catcher
|
|
140
145
|
the top of your Clockfile like this:
|
141
146
|
|
142
147
|
```ruby
|
143
|
-
|
148
|
+
on_error do |job, error|
|
144
149
|
ErrorReporter.track_exception(error)
|
145
150
|
end
|
146
151
|
```
|
@@ -156,7 +161,7 @@ to learn how to do this. Where the documentation references `s`, you should use
|
|
156
161
|
You can run shell commands in your jobs.
|
157
162
|
|
158
163
|
```ruby
|
159
|
-
|
164
|
+
every '1 day' do
|
160
165
|
shell('sh scripts/process_stuff.sh')
|
161
166
|
end
|
162
167
|
```
|
@@ -171,7 +176,7 @@ If you want to use other terrapin features, you can skip the `shell` command
|
|
171
176
|
and use terrapin directly:
|
172
177
|
|
173
178
|
```ruby
|
174
|
-
|
179
|
+
every '1 day' do
|
175
180
|
line = Terrapin::CommandLine.new('optimize_png', ":file")
|
176
181
|
Organization.with_new_logos.find_each do |o|
|
177
182
|
line.run(file: o.logo_file_path)
|
@@ -191,8 +196,8 @@ Until this is figured out, if you are concerned about jobs exiting inelegantly,
|
|
191
196
|
you may want to run your shell jobs in their own separate clock process.
|
192
197
|
|
193
198
|
```
|
194
|
-
bundle exec
|
195
|
-
bundle exec
|
199
|
+
bundle exec clock clocks/main_jobs.rb
|
200
|
+
bundle exec clock clocks/shell_jobs.rb
|
196
201
|
```
|
197
202
|
|
198
203
|
|
@@ -202,7 +207,7 @@ You can run tasks from within the persistent runtime of ruby-clock, without
|
|
202
207
|
needing to shell out and start another process.
|
203
208
|
|
204
209
|
```ruby
|
205
|
-
|
210
|
+
every '1 day' do
|
206
211
|
rake('reports:daily')
|
207
212
|
end
|
208
213
|
```
|
@@ -221,12 +226,12 @@ fallback is the line number of the job in Clockfile.
|
|
221
226
|
Some examples of jobs and their identifiers:
|
222
227
|
|
223
228
|
```ruby
|
224
|
-
|
229
|
+
every '1 second', name: 'my job' do
|
225
230
|
Foo.bar
|
226
231
|
end
|
227
232
|
# => my job
|
228
233
|
|
229
|
-
|
234
|
+
every '1 day' do
|
230
235
|
daily_things = Foo.setup_daily
|
231
236
|
daily_things.process
|
232
237
|
# TODO: figure out best time of day
|
@@ -234,7 +239,7 @@ end
|
|
234
239
|
# => daily_things.process
|
235
240
|
|
236
241
|
# n.b. ruby-clock isn't yet smart enough to remove trailing comments
|
237
|
-
|
242
|
+
every '1 week' do
|
238
243
|
weekly_things = Foo.setup_weekly
|
239
244
|
weekly_things.process # does this work???!1~
|
240
245
|
end
|
@@ -252,7 +257,7 @@ def schedule.on_post_trigger(job, trigger_time)
|
|
252
257
|
StatsTracker.increment('Clock: Job Executions')
|
253
258
|
end
|
254
259
|
|
255
|
-
|
260
|
+
every '10 seconds', name: 'thread stats' do
|
256
261
|
thread_usage = Hash.new(0)
|
257
262
|
schedule.work_threads(:active).each do |t|
|
258
263
|
thread_usage[t[:rufus_scheduler_job].identifier] += 1
|
@@ -267,14 +272,17 @@ schedule.every '10 seconds', name: 'thread stats' do
|
|
267
272
|
end
|
268
273
|
```
|
269
274
|
|
270
|
-
###
|
275
|
+
### Other rufus-scheduler Options
|
271
276
|
|
272
|
-
All rufus-scheduler options are set to defaults.
|
273
|
-
available in your Clockfile is
|
274
|
-
|
277
|
+
All [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler/) options are set to defaults.
|
278
|
+
There is a `schedule` variable available in your Clockfile, which is the singleton instance of `Rufus::Scheduler`.
|
279
|
+
ruby-clock methods such as `every` and `cron` are convenience methods which invoke `schedule.every`
|
280
|
+
and `schedule.cron`.
|
281
|
+
Anything you can do on this instance, you can do in your Clockfile.
|
282
|
+
See the rufus-scheduler documentation to see what you can do.
|
275
283
|
|
276
|
-
|
277
|
-
|
284
|
+
If you have ideas for rufus-scheduler features that can be brought in as
|
285
|
+
more abstract or default ruby-clock behavior, let me know!
|
278
286
|
|
279
287
|
## Syntax highlighting for Clockfile
|
280
288
|
|
data/example-app/Clockfile
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
-
|
1
|
+
on_error do |job, error|
|
2
2
|
raise error
|
3
3
|
end
|
4
4
|
|
5
|
-
|
5
|
+
every('2 seconds') do
|
6
6
|
puts "hello from a ruby-clock job"
|
7
7
|
end
|
8
8
|
|
9
|
-
|
9
|
+
every('2 seconds') do
|
10
10
|
shell 'say hello'
|
11
11
|
end
|
12
|
+
|
13
|
+
cron('*/10 * * * * *') do
|
14
|
+
puts "cron running on every 10th second #{Time.now}"
|
15
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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 any vendored files as having been vendored.
|
7
|
+
vendor/* linguist-vendored
|
8
|
+
|
9
|
+
Clockfile linguist-language=Ruby
|
@@ -0,0 +1,35 @@
|
|
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
|
+
/tmp/storage/*
|
29
|
+
!/tmp/storage/
|
30
|
+
!/tmp/storage/.keep
|
31
|
+
|
32
|
+
/public/assets
|
33
|
+
|
34
|
+
# Ignore master key for decrypting credentials and more.
|
35
|
+
/config/master.key
|
@@ -0,0 +1 @@
|
|
1
|
+
2.7.5
|
@@ -0,0 +1,23 @@
|
|
1
|
+
on_error do |job, error|
|
2
|
+
puts "An error has occurred: #{error.class}: #{error.message}"
|
3
|
+
end
|
4
|
+
|
5
|
+
every('2 seconds') do
|
6
|
+
puts "hello from a ruby-clock job"
|
7
|
+
end
|
8
|
+
|
9
|
+
every('2 seconds') do
|
10
|
+
shell 'say hello'
|
11
|
+
end
|
12
|
+
|
13
|
+
every('2 seconds') do
|
14
|
+
puts Example.count
|
15
|
+
end
|
16
|
+
|
17
|
+
every('2 seconds') do
|
18
|
+
raise "An error."
|
19
|
+
end
|
20
|
+
|
21
|
+
cron('*/10 * * * * *') do
|
22
|
+
puts "cron running on every 10th second #{Time.now}"
|
23
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
ruby "2.7.5"
|
5
|
+
|
6
|
+
gem 'ruby-clock', path: '../'
|
7
|
+
|
8
|
+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
9
|
+
gem "rails", "~> 7.0.4"
|
10
|
+
|
11
|
+
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
12
|
+
gem "sprockets-rails"
|
13
|
+
|
14
|
+
# Use sqlite3 as the database for Active Record
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
|
17
|
+
# Use the Puma web server [https://github.com/puma/puma]
|
18
|
+
gem "puma", "~> 5.0"
|
19
|
+
|
20
|
+
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
21
|
+
gem "importmap-rails"
|
22
|
+
|
23
|
+
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
24
|
+
gem "turbo-rails"
|
25
|
+
|
26
|
+
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
27
|
+
gem "stimulus-rails"
|
28
|
+
|
29
|
+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
30
|
+
gem "jbuilder"
|
31
|
+
|
32
|
+
# Use Redis adapter to run Action Cable in production
|
33
|
+
gem "redis", "~> 4.0"
|
34
|
+
|
35
|
+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
36
|
+
# gem "kredis"
|
37
|
+
|
38
|
+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
39
|
+
# gem "bcrypt", "~> 3.1.7"
|
40
|
+
|
41
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
42
|
+
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
|
43
|
+
|
44
|
+
# Reduces boot times through caching; required in config/boot.rb
|
45
|
+
gem "bootsnap", require: false
|
46
|
+
|
47
|
+
# Use Sass to process CSS
|
48
|
+
# gem "sassc-rails"
|
49
|
+
|
50
|
+
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
51
|
+
# gem "image_processing", "~> 1.2"
|
52
|
+
|
53
|
+
group :development, :test do
|
54
|
+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
55
|
+
gem "debug", platforms: %i[ mri mingw x64_mingw ]
|
56
|
+
end
|
57
|
+
|
58
|
+
group :development do
|
59
|
+
# Use console on exceptions pages [https://github.com/rails/web-console]
|
60
|
+
gem "web-console"
|
61
|
+
|
62
|
+
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
|
63
|
+
# gem "rack-mini-profiler"
|
64
|
+
|
65
|
+
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
66
|
+
# gem "spring"
|
67
|
+
end
|
68
|
+
|
69
|
+
group :test do
|
70
|
+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
71
|
+
gem "capybara"
|
72
|
+
gem "selenium-webdriver"
|
73
|
+
gem "webdrivers"
|
74
|
+
end
|
File without changes
|
@@ -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, if configured) 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
|
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
|
+
*/
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// Import and register all your controllers from the importmap under controllers/*
|
2
|
+
|
3
|
+
import { application } from "controllers/application"
|
4
|
+
|
5
|
+
// Eager load all controllers defined in the import map under controllers/**/*_controller
|
6
|
+
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
7
|
+
eagerLoadControllersFrom("controllers", application)
|
8
|
+
|
9
|
+
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
|
10
|
+
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
|
11
|
+
// lazyLoadControllersFrom("controllers", application)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>ExampleRailsApp</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
10
|
+
<%= javascript_importmap_tags %>
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<%= yield %>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|