stateful_models 0.0.1

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.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +6 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +181 -0
  5. data/lib/generators/has_states/install/install_generator.rb +25 -0
  6. data/lib/generators/has_states/install/templates/create_has_states_states.rb.erb +17 -0
  7. data/lib/generators/has_states/install/templates/initializer.rb.erb +42 -0
  8. data/lib/has_states/callback.rb +58 -0
  9. data/lib/has_states/configuration/model_configuration.rb +48 -0
  10. data/lib/has_states/configuration/state_type_configuration.rb +15 -0
  11. data/lib/has_states/configuration.rb +83 -0
  12. data/lib/has_states/railtie.rb +8 -0
  13. data/lib/has_states/state.rb +41 -0
  14. data/lib/has_states/stateable.rb +22 -0
  15. data/lib/has_states/version.rb +5 -0
  16. data/lib/has_states.rb +24 -0
  17. data/spec/dummy/Gemfile +40 -0
  18. data/spec/dummy/Gemfile.lock +286 -0
  19. data/spec/dummy/README.md +24 -0
  20. data/spec/dummy/Rakefile +8 -0
  21. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  22. data/spec/dummy/app/jobs/application_job.rb +9 -0
  23. data/spec/dummy/app/models/application_record.rb +5 -0
  24. data/spec/dummy/app/models/company.rb +3 -0
  25. data/spec/dummy/app/models/user.rb +3 -0
  26. data/spec/dummy/bin/brakeman +9 -0
  27. data/spec/dummy/bin/dev +4 -0
  28. data/spec/dummy/bin/docker-entrypoint +14 -0
  29. data/spec/dummy/bin/rails +6 -0
  30. data/spec/dummy/bin/rake +6 -0
  31. data/spec/dummy/bin/rubocop +10 -0
  32. data/spec/dummy/bin/setup +36 -0
  33. data/spec/dummy/bin/thrust +7 -0
  34. data/spec/dummy/config/application.rb +27 -0
  35. data/spec/dummy/config/boot.rb +5 -0
  36. data/spec/dummy/config/credentials.yml.enc +1 -0
  37. data/spec/dummy/config/database.yml +37 -0
  38. data/spec/dummy/config/environment.rb +7 -0
  39. data/spec/dummy/config/environments/development.rb +54 -0
  40. data/spec/dummy/config/environments/production.rb +69 -0
  41. data/spec/dummy/config/environments/test.rb +44 -0
  42. data/spec/dummy/config/initializers/cors.rb +18 -0
  43. data/spec/dummy/config/initializers/filter_parameter_logging.rb +10 -0
  44. data/spec/dummy/config/initializers/inflections.rb +18 -0
  45. data/spec/dummy/config/locales/en.yml +31 -0
  46. data/spec/dummy/config/master.key +1 -0
  47. data/spec/dummy/config/puma.rb +43 -0
  48. data/spec/dummy/config/routes.rb +12 -0
  49. data/spec/dummy/config.ru +8 -0
  50. data/spec/dummy/db/migrate/20241221171423_create_test_models.rb +15 -0
  51. data/spec/dummy/db/migrate/20241221183116_create_has_states_tables.rb +19 -0
  52. data/spec/dummy/db/schema.rb +40 -0
  53. data/spec/dummy/db/seeds.rb +11 -0
  54. data/spec/dummy/log/development.log +142 -0
  55. data/spec/dummy/log/test.log +16652 -0
  56. data/spec/dummy/public/robots.txt +1 -0
  57. data/spec/dummy/storage/development.sqlite3 +0 -0
  58. data/spec/dummy/storage/test.sqlite3 +0 -0
  59. data/spec/dummy/tmp/local_secret.txt +1 -0
  60. data/spec/factories/has_states.rb +19 -0
  61. data/spec/generators/has_states/install_generator_spec.rb +27 -0
  62. data/spec/generators/tmp/config/initializers/has_states.rb +42 -0
  63. data/spec/generators/tmp/db/migrate/20241223020432_create_has_states_states.rb +17 -0
  64. data/spec/has_states/callback_spec.rb +92 -0
  65. data/spec/has_states/configuration_spec.rb +161 -0
  66. data/spec/has_states/state_spec.rb +264 -0
  67. data/spec/has_states_spec.rb +52 -0
  68. data/spec/rails_helper.rb +18 -0
  69. data/spec/spec_helper.rb +16 -0
  70. data/spec/support/database_cleaner.rb +17 -0
  71. data/spec/support/factory_bot.rb +8 -0
  72. data/spec/support/shoulda_matchers.rb +10 -0
  73. data/spec/tmp/config/initializers/has_states.rb +12 -0
  74. data/spec/tmp/db/migrate/20241223004024_create_has_states_states.rb +20 -0
  75. metadata +122 -0
@@ -0,0 +1,286 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ has_state (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (8.0.1)
10
+ actionpack (= 8.0.1)
11
+ activesupport (= 8.0.1)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ zeitwerk (~> 2.6)
15
+ actionmailbox (8.0.1)
16
+ actionpack (= 8.0.1)
17
+ activejob (= 8.0.1)
18
+ activerecord (= 8.0.1)
19
+ activestorage (= 8.0.1)
20
+ activesupport (= 8.0.1)
21
+ mail (>= 2.8.0)
22
+ actionmailer (8.0.1)
23
+ actionpack (= 8.0.1)
24
+ actionview (= 8.0.1)
25
+ activejob (= 8.0.1)
26
+ activesupport (= 8.0.1)
27
+ mail (>= 2.8.0)
28
+ rails-dom-testing (~> 2.2)
29
+ actionpack (8.0.1)
30
+ actionview (= 8.0.1)
31
+ activesupport (= 8.0.1)
32
+ nokogiri (>= 1.8.5)
33
+ rack (>= 2.2.4)
34
+ rack-session (>= 1.0.1)
35
+ rack-test (>= 0.6.3)
36
+ rails-dom-testing (~> 2.2)
37
+ rails-html-sanitizer (~> 1.6)
38
+ useragent (~> 0.16)
39
+ actiontext (8.0.1)
40
+ actionpack (= 8.0.1)
41
+ activerecord (= 8.0.1)
42
+ activestorage (= 8.0.1)
43
+ activesupport (= 8.0.1)
44
+ globalid (>= 0.6.0)
45
+ nokogiri (>= 1.8.5)
46
+ actionview (8.0.1)
47
+ activesupport (= 8.0.1)
48
+ builder (~> 3.1)
49
+ erubi (~> 1.11)
50
+ rails-dom-testing (~> 2.2)
51
+ rails-html-sanitizer (~> 1.6)
52
+ activejob (8.0.1)
53
+ activesupport (= 8.0.1)
54
+ globalid (>= 0.3.6)
55
+ activemodel (8.0.1)
56
+ activesupport (= 8.0.1)
57
+ activerecord (8.0.1)
58
+ activemodel (= 8.0.1)
59
+ activesupport (= 8.0.1)
60
+ timeout (>= 0.4.0)
61
+ activestorage (8.0.1)
62
+ actionpack (= 8.0.1)
63
+ activejob (= 8.0.1)
64
+ activerecord (= 8.0.1)
65
+ activesupport (= 8.0.1)
66
+ marcel (~> 1.0)
67
+ activesupport (8.0.1)
68
+ base64
69
+ benchmark (>= 0.3)
70
+ bigdecimal
71
+ concurrent-ruby (~> 1.0, >= 1.3.1)
72
+ connection_pool (>= 2.2.5)
73
+ drb
74
+ i18n (>= 1.6, < 2)
75
+ logger (>= 1.4.2)
76
+ minitest (>= 5.1)
77
+ securerandom (>= 0.3)
78
+ tzinfo (~> 2.0, >= 2.0.5)
79
+ uri (>= 0.13.1)
80
+ base64 (0.2.0)
81
+ bcrypt_pbkdf (1.1.1)
82
+ bcrypt_pbkdf (1.1.1-arm64-darwin)
83
+ bcrypt_pbkdf (1.1.1-x86_64-darwin)
84
+ benchmark (0.4.0)
85
+ bigdecimal (3.1.8)
86
+ brakeman (6.2.2)
87
+ racc
88
+ builder (3.3.0)
89
+ concurrent-ruby (1.3.4)
90
+ connection_pool (2.4.1)
91
+ crass (1.0.6)
92
+ date (3.4.1)
93
+ debug (1.10.0)
94
+ irb (~> 1.10)
95
+ reline (>= 0.3.8)
96
+ dotenv (3.1.7)
97
+ drb (2.2.1)
98
+ ed25519 (1.3.0)
99
+ erubi (1.13.1)
100
+ et-orbi (1.2.11)
101
+ tzinfo
102
+ fugit (1.11.1)
103
+ et-orbi (~> 1, >= 1.2.11)
104
+ raabro (~> 1.4)
105
+ globalid (1.2.1)
106
+ activesupport (>= 6.1)
107
+ i18n (1.14.6)
108
+ concurrent-ruby (~> 1.0)
109
+ io-console (0.8.0)
110
+ irb (1.14.3)
111
+ rdoc (>= 4.0.0)
112
+ reline (>= 0.4.2)
113
+ kamal (2.4.0)
114
+ activesupport (>= 7.0)
115
+ base64 (~> 0.2)
116
+ bcrypt_pbkdf (~> 1.0)
117
+ concurrent-ruby (~> 1.2)
118
+ dotenv (~> 3.1)
119
+ ed25519 (~> 1.2)
120
+ net-ssh (~> 7.3)
121
+ sshkit (>= 1.23.0, < 2.0)
122
+ thor (~> 1.3)
123
+ zeitwerk (>= 2.6.18, < 3.0)
124
+ logger (1.6.4)
125
+ loofah (2.23.1)
126
+ crass (~> 1.0.2)
127
+ nokogiri (>= 1.12.0)
128
+ mail (2.8.1)
129
+ mini_mime (>= 0.1.1)
130
+ net-imap
131
+ net-pop
132
+ net-smtp
133
+ marcel (1.0.4)
134
+ mini_mime (1.1.5)
135
+ minitest (5.25.4)
136
+ net-imap (0.5.3)
137
+ date
138
+ net-protocol
139
+ net-pop (0.1.2)
140
+ net-protocol
141
+ net-protocol (0.2.2)
142
+ timeout
143
+ net-scp (4.0.0)
144
+ net-ssh (>= 2.6.5, < 8.0.0)
145
+ net-sftp (4.0.0)
146
+ net-ssh (>= 5.0.0, < 8.0.0)
147
+ net-smtp (0.5.0)
148
+ net-protocol
149
+ net-ssh (7.3.0)
150
+ nio4r (2.7.4)
151
+ nokogiri (1.17.2-aarch64-linux)
152
+ racc (~> 1.4)
153
+ nokogiri (1.17.2-arm-linux)
154
+ racc (~> 1.4)
155
+ nokogiri (1.17.2-arm64-darwin)
156
+ racc (~> 1.4)
157
+ nokogiri (1.17.2-x86-linux)
158
+ racc (~> 1.4)
159
+ nokogiri (1.17.2-x86_64-darwin)
160
+ racc (~> 1.4)
161
+ nokogiri (1.17.2-x86_64-linux)
162
+ racc (~> 1.4)
163
+ ostruct (0.6.1)
164
+ psych (5.2.2)
165
+ date
166
+ stringio
167
+ puma (6.5.0)
168
+ nio4r (~> 2.0)
169
+ raabro (1.4.0)
170
+ racc (1.8.1)
171
+ rack (3.1.8)
172
+ rack-session (2.0.0)
173
+ rack (>= 3.0.0)
174
+ rack-test (2.1.0)
175
+ rack (>= 1.3)
176
+ rackup (2.2.1)
177
+ rack (>= 3)
178
+ rails (8.0.1)
179
+ actioncable (= 8.0.1)
180
+ actionmailbox (= 8.0.1)
181
+ actionmailer (= 8.0.1)
182
+ actionpack (= 8.0.1)
183
+ actiontext (= 8.0.1)
184
+ actionview (= 8.0.1)
185
+ activejob (= 8.0.1)
186
+ activemodel (= 8.0.1)
187
+ activerecord (= 8.0.1)
188
+ activestorage (= 8.0.1)
189
+ activesupport (= 8.0.1)
190
+ bundler (>= 1.15.0)
191
+ railties (= 8.0.1)
192
+ rails-dom-testing (2.2.0)
193
+ activesupport (>= 5.0.0)
194
+ minitest
195
+ nokogiri (>= 1.6)
196
+ rails-html-sanitizer (1.6.2)
197
+ loofah (~> 2.21)
198
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
199
+ railties (8.0.1)
200
+ actionpack (= 8.0.1)
201
+ activesupport (= 8.0.1)
202
+ irb (~> 1.13)
203
+ rackup (>= 1.0.0)
204
+ rake (>= 12.2)
205
+ thor (~> 1.0, >= 1.2.2)
206
+ zeitwerk (~> 2.6)
207
+ rake (13.2.1)
208
+ rdoc (6.10.0)
209
+ psych (>= 4.0.0)
210
+ reline (0.6.0)
211
+ io-console (~> 0.5)
212
+ securerandom (0.4.1)
213
+ solid_cache (1.0.6)
214
+ activejob (>= 7.2)
215
+ activerecord (>= 7.2)
216
+ railties (>= 7.2)
217
+ solid_queue (1.1.0)
218
+ activejob (>= 7.1)
219
+ activerecord (>= 7.1)
220
+ concurrent-ruby (>= 1.3.1)
221
+ fugit (~> 1.11.0)
222
+ railties (>= 7.1)
223
+ thor (~> 1.3.1)
224
+ sqlite3 (2.4.1-aarch64-linux-gnu)
225
+ sqlite3 (2.4.1-aarch64-linux-musl)
226
+ sqlite3 (2.4.1-arm-linux-gnu)
227
+ sqlite3 (2.4.1-arm-linux-musl)
228
+ sqlite3 (2.4.1-arm64-darwin)
229
+ sqlite3 (2.4.1-x86-linux-gnu)
230
+ sqlite3 (2.4.1-x86-linux-musl)
231
+ sqlite3 (2.4.1-x86_64-darwin)
232
+ sqlite3 (2.4.1-x86_64-linux-gnu)
233
+ sqlite3 (2.4.1-x86_64-linux-musl)
234
+ sshkit (1.23.2)
235
+ base64
236
+ net-scp (>= 1.1.2)
237
+ net-sftp (>= 2.1.2)
238
+ net-ssh (>= 2.8.0)
239
+ ostruct
240
+ stringio (3.1.2)
241
+ thor (1.3.2)
242
+ thruster (0.1.9)
243
+ thruster (0.1.9-aarch64-linux)
244
+ thruster (0.1.9-arm64-darwin)
245
+ thruster (0.1.9-x86_64-darwin)
246
+ thruster (0.1.9-x86_64-linux)
247
+ timeout (0.4.3)
248
+ tzinfo (2.0.6)
249
+ concurrent-ruby (~> 1.0)
250
+ uri (1.0.2)
251
+ useragent (0.16.11)
252
+ websocket-driver (0.7.6)
253
+ websocket-extensions (>= 0.1.0)
254
+ websocket-extensions (0.1.5)
255
+ zeitwerk (2.7.1)
256
+
257
+ PLATFORMS
258
+ aarch64-linux
259
+ aarch64-linux-gnu
260
+ aarch64-linux-musl
261
+ arm-linux
262
+ arm-linux-gnu
263
+ arm-linux-musl
264
+ arm64-darwin
265
+ x86-linux
266
+ x86-linux-gnu
267
+ x86-linux-musl
268
+ x86_64-darwin
269
+ x86_64-linux-gnu
270
+ x86_64-linux-musl
271
+
272
+ DEPENDENCIES
273
+ brakeman
274
+ debug
275
+ has_state!
276
+ kamal
277
+ puma (>= 5.0)
278
+ rails (~> 8.0.1)
279
+ solid_cache
280
+ solid_queue
281
+ sqlite3 (>= 2.1)
282
+ thruster
283
+ tzinfo-data
284
+
285
+ BUNDLED WITH
286
+ 2.6.1
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
+
6
+ require_relative 'config/application'
7
+
8
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::API
4
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ # Automatically retry jobs that encountered a deadlock
5
+ # retry_on ActiveRecord::Deadlocked
6
+
7
+ # Most jobs are safe to ignore if the underlying records are no longer available
8
+ # discard_on ActiveJob::DeserializationError
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ primary_abstract_class
5
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Company < ApplicationRecord; end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ class User < ApplicationRecord; end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'rubygems'
5
+ require 'bundler/setup'
6
+
7
+ ARGV.unshift('--ensure-latest')
8
+
9
+ load Gem.bin_path('brakeman', 'brakeman')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ exec './bin/rails', 'server', *ARGV
@@ -0,0 +1,14 @@
1
+ #!/bin/bash -e
2
+
3
+ # Enable jemalloc for reduced memory usage and latency.
4
+ if [ -z "${LD_PRELOAD+x}" ]; then
5
+ LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
6
+ export LD_PRELOAD
7
+ fi
8
+
9
+ # If running the rails server then create or migrate existing database
10
+ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
11
+ ./bin/rails db:prepare
12
+ fi
13
+
14
+ exec "${@}"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ APP_PATH = File.expand_path('../config/application', __dir__)
5
+ require_relative '../config/boot'
6
+ require 'rails/commands'
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../config/boot'
5
+ require 'rake'
6
+ Rake.application.run
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'rubygems'
5
+ require 'bundler/setup'
6
+
7
+ # explicit rubocop config increases performance slightly while avoiding config confusion.
8
+ ARGV.unshift('--config', File.expand_path('../.rubocop.yml', __dir__))
9
+
10
+ load Gem.bin_path('rubocop', 'rubocop')
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fileutils'
5
+
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args, exception: true)
10
+ end
11
+
12
+ FileUtils.chdir APP_ROOT do
13
+ # This script is a way to set up or update your development environment automatically.
14
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
15
+ # Add necessary setup steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?("config/database.yml")
22
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! 'bin/rails db:prepare'
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! 'bin/rails log:clear tmp:clear'
30
+
31
+ unless ARGV.include?('--skip-server')
32
+ puts "\n== Starting development server =="
33
+ $stdout.flush # flush the output before exec(2) so that it displays
34
+ exec 'bin/dev'
35
+ end
36
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'rubygems'
5
+ require 'bundler/setup'
6
+
7
+ load Gem.bin_path('thruster', 'thrust')
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails'
6
+
7
+ # Pick the frameworks you want:
8
+ require 'active_model/railtie'
9
+ require 'active_record/railtie'
10
+ require 'action_controller/railtie'
11
+
12
+ # Require the gems listed in Gemfile, including any gems
13
+ # you've limited to :test, :development, or :production.
14
+ Bundler.require(*Rails.groups)
15
+
16
+ Bundler.require(*Rails.groups)
17
+ require 'has_states'
18
+
19
+ module Dummy
20
+ class Application < Rails::Application
21
+ config.load_defaults Rails::VERSION::STRING.to_f
22
+
23
+ # For compatibility with applications that use this config
24
+ config.action_controller.include_all_helpers = false
25
+ config.api_only = false
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
+
5
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1 @@
1
+ vmOmINHq7bJj1FHsrVmFX71HX0/WnquEOXY4wkZxVR3ZAXj1ldv0Edjc8RbQ28uO5k6BMPlLptwqmsEQ5t1cJhhsL57G+DJf3VYnPkJmO7BYwZx/u0vENfmc4yy7u/nCWyTznpR6OVcPUDCQAmWdEwPGjPOya3+wPW4kMV5Fv9wMUqAFJElXLkrmR9LTxnSTd9AJx6lxNIWACGga/7lfayXcln4cwWP/tFM8eX8OaBzKWpsgDH16W0nxLeTqtMbPbmrtfDBwjAkplxQPRhIV5flUWEFQ/dbRFP7KbFt3qeG5AL+/e4KdZbeRw4lDkK1xfV/fRgoSGjCP1PU6Cq8b8V/fyykbERqb3773Bl3736ANHLcJyDHTYQcque3haAu7UbzQcQ4XpHNKfGFODN/RxytWGvo2b62WspZ72O8CIIDcRXt/jMFrC5xNb03iT2tGmi5/50aLKSzMEAdjsb1nIP7nG949C3aeb/1FbQOrVcATdIH1MYrH8jgB--ascdYp/R50fY6srg--7y8YySI8auWbFGy4sG1Log==
@@ -0,0 +1,37 @@
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem "sqlite3"
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: storage/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: storage/test.sqlite3
22
+
23
+
24
+ # Store production database in the storage/ directory, which by default
25
+ # is mounted as a persistent Docker volume in config/deploy.yml.
26
+ production:
27
+ primary:
28
+ <<: *default
29
+ database: storage/production.sqlite3
30
+ cache:
31
+ <<: *default
32
+ database: storage/production_cache.sqlite3
33
+ migrations_paths: db/cache_migrate
34
+ queue:
35
+ <<: *default
36
+ database: storage/production_queue.sqlite3
37
+ migrations_paths: db/queue_migrate
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # Make code changes take effect immediately without server restart.
9
+ config.enable_reloading = true
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable server timing.
18
+ config.server_timing = true
19
+
20
+ # Enable/disable Action Controller caching. By default Action Controller caching is disabled.
21
+ # Run rails dev:cache to toggle Action Controller caching.
22
+ if Rails.root.join('tmp/caching-dev.txt').exist?
23
+ config.public_file_server.headers = { 'cache-control' => "public, max-age=#{2.days.to_i}" }
24
+ else
25
+ config.action_controller.perform_caching = false
26
+ end
27
+
28
+ # Change to :null_store to avoid any caching.
29
+ config.cache_store = :memory_store
30
+
31
+ # Print deprecation notices to the Rails logger.
32
+ config.active_support.deprecation = :log
33
+
34
+ # Raise an error on page load if there are pending migrations.
35
+ config.active_record.migration_error = :page_load
36
+
37
+ # Highlight code that triggered database queries in logs.
38
+ config.active_record.verbose_query_logs = true
39
+
40
+ # Append comments with runtime information tags to SQL queries in logs.
41
+ config.active_record.query_log_tags_enabled = true
42
+
43
+ # Raises error for missing translations.
44
+ # config.i18n.raise_on_missing_translations = true
45
+
46
+ # Annotate rendered view with file names.
47
+ config.action_view.annotate_rendered_view_with_filenames = true
48
+
49
+ # Raise error when a before_action's only/except options reference missing actions.
50
+ config.action_controller.raise_on_missing_callback_actions = true
51
+
52
+ # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
53
+ # config.generators.apply_rubocop_autocorrect_after_generate!
54
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # Code is not reloaded between requests.
9
+ config.enable_reloading = false
10
+
11
+ # Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
12
+ config.eager_load = true
13
+
14
+ # Full error reports are disabled.
15
+ config.consider_all_requests_local = false
16
+
17
+ # Cache assets for far-future expiry since they are all digest stamped.
18
+ config.public_file_server.headers = { 'cache-control' => "public, max-age=#{1.year.to_i}" }
19
+
20
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
21
+ # config.asset_host = "http://assets.example.com"
22
+
23
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
24
+ config.assume_ssl = true
25
+
26
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
27
+ config.force_ssl = true
28
+
29
+ # Skip http-to-https redirect for the default health check endpoint.
30
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
31
+
32
+ # Log to STDOUT with the current request id as a default log tag.
33
+ config.log_tags = [:request_id]
34
+ config.logger = ActiveSupport::TaggedLogging.logger($stdout)
35
+
36
+ # Change to "debug" to log everything (including potentially personally-identifiable information!)
37
+ config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
38
+
39
+ # Prevent health checks from clogging up the logs.
40
+ config.silence_healthcheck_path = '/up'
41
+
42
+ # Don't log any deprecations.
43
+ config.active_support.report_deprecations = false
44
+
45
+ # Replace the default in-process memory cache store with a durable alternative.
46
+ # config.cache_store = :mem_cache_store
47
+
48
+ # Replace the default in-process and non-durable queuing backend for Active Job.
49
+ # config.active_job.queue_adapter = :resque
50
+
51
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
52
+ # the I18n.default_locale when a translation cannot be found).
53
+ config.i18n.fallbacks = true
54
+
55
+ # Do not dump schema after migrations.
56
+ config.active_record.dump_schema_after_migration = false
57
+
58
+ # Only use :id for inspections in production.
59
+ config.active_record.attributes_for_inspect = [:id]
60
+
61
+ # Enable DNS rebinding protection and other `Host` header attacks.
62
+ # config.hosts = [
63
+ # "example.com", # Allow requests from example.com
64
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
65
+ # ]
66
+ #
67
+ # Skip DNS rebinding protection for the default health check endpoint.
68
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
69
+ end