ruby-clock 2.0.0.beta4 → 2.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/CHANGELOG.md +6 -4
  4. data/README.md +31 -5
  5. data/example-app/Clockfile +14 -6
  6. data/example-app/Gemfile +2 -0
  7. data/example-app/Gemfile.lock +4 -1
  8. data/example-rails-6-app/.browserslistrc +1 -0
  9. data/example-rails-6-app/.gitattributes +10 -0
  10. data/example-rails-6-app/.gitignore +40 -0
  11. data/example-rails-6-app/.ruby-version +1 -0
  12. data/{example-rails-app → example-rails-6-app}/Clockfile +1 -1
  13. data/example-rails-6-app/Gemfile +62 -0
  14. data/example-rails-6-app/Gemfile.lock +270 -0
  15. data/example-rails-6-app/README.md +24 -0
  16. data/{example-rails-app → example-rails-6-app}/Rakefile +0 -0
  17. data/example-rails-6-app/app/assets/config/manifest.js +2 -0
  18. data/{example-rails-app → example-rails-6-app}/app/assets/images/.keep +0 -0
  19. data/example-rails-6-app/app/assets/stylesheets/application.css +15 -0
  20. data/{example-rails-app → example-rails-6-app}/app/channels/application_cable/channel.rb +0 -0
  21. data/{example-rails-app → example-rails-6-app}/app/channels/application_cable/connection.rb +0 -0
  22. data/{example-rails-app → example-rails-6-app}/app/controllers/application_controller.rb +0 -0
  23. data/{example-rails-app → example-rails-6-app}/app/controllers/concerns/.keep +0 -0
  24. data/{example-rails-app → example-rails-6-app}/app/helpers/application_helper.rb +0 -0
  25. data/example-rails-6-app/app/javascript/channels/consumer.js +6 -0
  26. data/example-rails-6-app/app/javascript/channels/index.js +5 -0
  27. data/example-rails-6-app/app/javascript/packs/application.js +13 -0
  28. data/{example-rails-app → example-rails-6-app}/app/jobs/application_job.rb +0 -0
  29. data/example-rails-6-app/app/mailers/application_mailer.rb +4 -0
  30. data/example-rails-6-app/app/models/application_record.rb +3 -0
  31. data/{example-rails-app → example-rails-6-app}/app/models/concerns/.keep +0 -0
  32. data/{example-rails-app → example-rails-6-app}/app/models/example.rb +4 -4
  33. data/example-rails-6-app/app/views/layouts/application.html.erb +16 -0
  34. data/{example-rails-app → example-rails-6-app}/app/views/layouts/mailer.html.erb +0 -0
  35. data/{example-rails-app → example-rails-6-app}/app/views/layouts/mailer.text.erb +0 -0
  36. data/example-rails-6-app/babel.config.js +82 -0
  37. data/{example-rails-app → example-rails-6-app}/bin/bundle +0 -0
  38. data/example-rails-6-app/bin/rails +5 -0
  39. data/example-rails-6-app/bin/rake +5 -0
  40. data/example-rails-6-app/bin/setup +36 -0
  41. data/example-rails-6-app/bin/spring +14 -0
  42. data/example-rails-6-app/bin/webpack +18 -0
  43. data/example-rails-6-app/bin/webpack-dev-server +18 -0
  44. data/example-rails-6-app/bin/yarn +17 -0
  45. data/example-rails-6-app/config/application.rb +22 -0
  46. data/example-rails-6-app/config/boot.rb +4 -0
  47. data/example-rails-6-app/config/cable.yml +10 -0
  48. data/example-rails-6-app/config/credentials.yml.enc +1 -0
  49. data/example-rails-6-app/config/database.yml +25 -0
  50. data/{example-rails-app → example-rails-6-app}/config/environment.rb +0 -0
  51. data/example-rails-6-app/config/environments/development.rb +76 -0
  52. data/example-rails-6-app/config/environments/production.rb +120 -0
  53. data/example-rails-6-app/config/environments/test.rb +60 -0
  54. data/example-rails-6-app/config/initializers/application_controller_renderer.rb +8 -0
  55. data/example-rails-6-app/config/initializers/assets.rb +14 -0
  56. data/example-rails-6-app/config/initializers/backtrace_silencers.rb +8 -0
  57. data/example-rails-6-app/config/initializers/content_security_policy.rb +30 -0
  58. data/example-rails-6-app/config/initializers/cookies_serializer.rb +5 -0
  59. data/example-rails-6-app/config/initializers/filter_parameter_logging.rb +6 -0
  60. data/example-rails-6-app/config/initializers/inflections.rb +16 -0
  61. data/example-rails-6-app/config/initializers/mime_types.rb +4 -0
  62. data/{example-rails-app → example-rails-6-app}/config/initializers/permissions_policy.rb +0 -0
  63. data/example-rails-6-app/config/initializers/wrap_parameters.rb +14 -0
  64. data/example-rails-6-app/config/locales/en.yml +33 -0
  65. data/example-rails-6-app/config/puma.rb +43 -0
  66. data/example-rails-6-app/config/routes.rb +3 -0
  67. data/example-rails-6-app/config/spring.rb +6 -0
  68. data/example-rails-6-app/config/storage.yml +34 -0
  69. data/example-rails-6-app/config/webpack/development.js +5 -0
  70. data/example-rails-6-app/config/webpack/environment.js +3 -0
  71. data/example-rails-6-app/config/webpack/production.js +5 -0
  72. data/example-rails-6-app/config/webpack/test.js +5 -0
  73. data/example-rails-6-app/config/webpacker.yml +92 -0
  74. data/{example-rails-app → example-rails-6-app}/config.ru +0 -0
  75. data/example-rails-6-app/db/migrate/20221102224703_create_examples.rb +8 -0
  76. data/example-rails-6-app/db/schema.rb +20 -0
  77. data/example-rails-6-app/db/seeds.rb +7 -0
  78. data/{example-rails-app → example-rails-6-app}/lib/assets/.keep +0 -0
  79. data/{example-rails-app → example-rails-6-app}/lib/tasks/.keep +0 -0
  80. data/{example-rails-app → example-rails-6-app}/log/.keep +0 -0
  81. data/example-rails-6-app/package.json +17 -0
  82. data/example-rails-6-app/postcss.config.js +12 -0
  83. data/{example-rails-app → example-rails-6-app}/public/404.html +0 -0
  84. data/{example-rails-app → example-rails-6-app}/public/422.html +0 -0
  85. data/{example-rails-app → example-rails-6-app}/public/500.html +0 -0
  86. data/{example-rails-app → example-rails-6-app}/public/apple-touch-icon-precomposed.png +0 -0
  87. data/{example-rails-app → example-rails-6-app}/public/apple-touch-icon.png +0 -0
  88. data/{example-rails-app → example-rails-6-app}/public/favicon.ico +0 -0
  89. data/{example-rails-app → example-rails-6-app}/public/robots.txt +0 -0
  90. data/{example-rails-app → example-rails-6-app}/storage/.keep +0 -0
  91. data/{example-rails-app → example-rails-6-app}/test/application_system_test_case.rb +0 -0
  92. data/{example-rails-app → example-rails-6-app}/test/channels/application_cable/connection_test.rb +0 -0
  93. data/{example-rails-app → example-rails-6-app}/test/controllers/.keep +0 -0
  94. data/{example-rails-app → example-rails-6-app}/test/fixtures/files/.keep +0 -0
  95. data/{example-rails-app → example-rails-6-app}/test/helpers/.keep +0 -0
  96. data/{example-rails-app → example-rails-6-app}/test/integration/.keep +0 -0
  97. data/{example-rails-app → example-rails-6-app}/test/mailers/.keep +0 -0
  98. data/{example-rails-app → example-rails-6-app}/test/models/.keep +0 -0
  99. data/{example-rails-app → example-rails-6-app}/test/system/.keep +0 -0
  100. data/example-rails-6-app/test/test_helper.rb +13 -0
  101. data/{example-rails-app → example-rails-6-app}/tmp/.keep +0 -0
  102. data/{example-rails-app → example-rails-6-app}/tmp/pids/.keep +0 -0
  103. data/{example-rails-app/tmp/storage → example-rails-6-app/vendor}/.keep +0 -0
  104. data/example-rails-6-app/yarn.lock +7108 -0
  105. data/{example-rails-app → example-rails-7-app}/.gitattributes +0 -0
  106. data/{example-rails-app → example-rails-7-app}/.gitignore +0 -0
  107. data/{example-rails-app → example-rails-7-app}/.ruby-version +0 -0
  108. data/example-rails-7-app/Clockfile +19 -0
  109. data/{example-rails-app → example-rails-7-app}/Gemfile +1 -1
  110. data/example-rails-7-app/Gemfile.lock +247 -0
  111. data/{example-rails-app → example-rails-7-app}/README.md +0 -0
  112. data/example-rails-7-app/Rakefile +6 -0
  113. data/{example-rails-app → example-rails-7-app}/app/assets/config/manifest.js +0 -0
  114. data/{example-rails-app/vendor → example-rails-7-app/app/assets/images}/.keep +0 -0
  115. data/{example-rails-app → example-rails-7-app}/app/assets/stylesheets/application.css +0 -0
  116. data/example-rails-7-app/app/channels/application_cable/channel.rb +4 -0
  117. data/example-rails-7-app/app/channels/application_cable/connection.rb +4 -0
  118. data/example-rails-7-app/app/controllers/application_controller.rb +2 -0
  119. data/{example-rails-app/vendor/javascript → example-rails-7-app/app/controllers/concerns}/.keep +0 -0
  120. data/example-rails-7-app/app/helpers/application_helper.rb +2 -0
  121. data/{example-rails-app → example-rails-7-app}/app/javascript/application.js +0 -0
  122. data/{example-rails-app → example-rails-7-app}/app/javascript/controllers/application.js +0 -0
  123. data/{example-rails-app → example-rails-7-app}/app/javascript/controllers/hello_controller.js +0 -0
  124. data/{example-rails-app → example-rails-7-app}/app/javascript/controllers/index.js +0 -0
  125. data/example-rails-7-app/app/jobs/application_job.rb +7 -0
  126. data/{example-rails-app → example-rails-7-app}/app/mailers/application_mailer.rb +0 -0
  127. data/{example-rails-app → example-rails-7-app}/app/models/application_record.rb +0 -0
  128. data/example-rails-7-app/app/models/concerns/.keep +0 -0
  129. data/example-rails-7-app/app/models/example.rb +18 -0
  130. data/{example-rails-app → example-rails-7-app}/app/views/layouts/application.html.erb +0 -0
  131. data/example-rails-7-app/app/views/layouts/mailer.html.erb +13 -0
  132. data/example-rails-7-app/app/views/layouts/mailer.text.erb +1 -0
  133. data/example-rails-7-app/bin/bundle +114 -0
  134. data/{example-rails-app → example-rails-7-app}/bin/importmap +0 -0
  135. data/{example-rails-app → example-rails-7-app}/bin/rails +0 -0
  136. data/{example-rails-app → example-rails-7-app}/bin/rake +0 -0
  137. data/{example-rails-app → example-rails-7-app}/bin/setup +0 -0
  138. data/{example-rails-app → example-rails-7-app}/config/application.rb +0 -0
  139. data/{example-rails-app → example-rails-7-app}/config/boot.rb +0 -0
  140. data/{example-rails-app → example-rails-7-app}/config/cable.yml +0 -0
  141. data/{example-rails-app → example-rails-7-app}/config/credentials.yml.enc +0 -0
  142. data/{example-rails-app → example-rails-7-app}/config/database.yml +0 -0
  143. data/example-rails-7-app/config/environment.rb +5 -0
  144. data/{example-rails-app → example-rails-7-app}/config/environments/development.rb +0 -0
  145. data/{example-rails-app → example-rails-7-app}/config/environments/production.rb +0 -0
  146. data/{example-rails-app → example-rails-7-app}/config/environments/test.rb +0 -0
  147. data/{example-rails-app → example-rails-7-app}/config/importmap.rb +0 -0
  148. data/{example-rails-app → example-rails-7-app}/config/initializers/assets.rb +0 -0
  149. data/{example-rails-app → example-rails-7-app}/config/initializers/content_security_policy.rb +0 -0
  150. data/{example-rails-app → example-rails-7-app}/config/initializers/filter_parameter_logging.rb +0 -0
  151. data/{example-rails-app → example-rails-7-app}/config/initializers/inflections.rb +0 -0
  152. data/example-rails-7-app/config/initializers/permissions_policy.rb +11 -0
  153. data/{example-rails-app → example-rails-7-app}/config/locales/en.yml +0 -0
  154. data/{example-rails-app → example-rails-7-app}/config/puma.rb +0 -0
  155. data/{example-rails-app → example-rails-7-app}/config/routes.rb +0 -0
  156. data/{example-rails-app → example-rails-7-app}/config/storage.yml +0 -0
  157. data/example-rails-7-app/config.ru +6 -0
  158. data/{example-rails-app → example-rails-7-app}/db/migrate/20221001175928_create_examples.rb +0 -0
  159. data/{example-rails-app → example-rails-7-app}/db/schema.rb +0 -0
  160. data/{example-rails-app → example-rails-7-app}/db/seeds.rb +0 -0
  161. data/example-rails-7-app/lib/assets/.keep +0 -0
  162. data/example-rails-7-app/lib/tasks/.keep +0 -0
  163. data/example-rails-7-app/log/.keep +0 -0
  164. data/example-rails-7-app/public/404.html +67 -0
  165. data/example-rails-7-app/public/422.html +67 -0
  166. data/example-rails-7-app/public/500.html +66 -0
  167. data/example-rails-7-app/public/apple-touch-icon-precomposed.png +0 -0
  168. data/example-rails-7-app/public/apple-touch-icon.png +0 -0
  169. data/example-rails-7-app/public/favicon.ico +0 -0
  170. data/example-rails-7-app/public/robots.txt +1 -0
  171. data/example-rails-7-app/storage/.keep +0 -0
  172. data/example-rails-7-app/test/application_system_test_case.rb +5 -0
  173. data/example-rails-7-app/test/channels/application_cable/connection_test.rb +11 -0
  174. data/example-rails-7-app/test/controllers/.keep +0 -0
  175. data/example-rails-7-app/test/fixtures/files/.keep +0 -0
  176. data/example-rails-7-app/test/helpers/.keep +0 -0
  177. data/example-rails-7-app/test/integration/.keep +0 -0
  178. data/example-rails-7-app/test/mailers/.keep +0 -0
  179. data/example-rails-7-app/test/models/.keep +0 -0
  180. data/example-rails-7-app/test/system/.keep +0 -0
  181. data/{example-rails-app → example-rails-7-app}/test/test_helper.rb +0 -0
  182. data/example-rails-7-app/tmp/.keep +0 -0
  183. data/example-rails-7-app/tmp/pids/.keep +0 -0
  184. data/example-rails-7-app/tmp/storage/.keep +0 -0
  185. data/example-rails-7-app/vendor/.keep +0 -0
  186. data/example-rails-7-app/vendor/javascript/.keep +0 -0
  187. data/exe/clock +2 -0
  188. data/lib/ruby-clock/around_actions.rb +13 -0
  189. data/lib/ruby-clock/dsl.rb +16 -0
  190. data/lib/ruby-clock/version.rb +1 -1
  191. data/lib/ruby-clock.rb +1 -4
  192. data/ruby-clock.gemspec +1 -1
  193. metadata +182 -85
  194. data/lib/ruby-clock/runners.rb +0 -23
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,17 +1,17 @@
1
1
  class Example < ApplicationRecord
2
2
  def self.check_for_global_method
3
3
  if defined?(schedule)
4
- raise "💥 Oh no, the ruby-clock DSL is in the global environment! 💥"
4
+ "💥 Oh no, the ruby-clock DSL is in the global environment! 💥"
5
5
  else
6
- "🦝"
6
+ ""
7
7
  end
8
8
  end
9
9
 
10
10
  def self.check_for_runner
11
11
  if defined?(shell) || defined?(rake)
12
- raise "💥 Oh no, the runners got included in the global environment! 💥"
12
+ "💥 Oh no, the runners got included in the global environment! 💥"
13
13
  else
14
- "🐅"
14
+ ""
15
15
  end
16
16
  end
17
17
 
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ExampleRails6App</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', media: 'all', 'data-turbolinks-track': 'reload' %>
10
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
11
+ </head>
12
+
13
+ <body>
14
+ <%= yield %>
15
+ </body>
16
+ </html>
@@ -0,0 +1,82 @@
1
+ module.exports = function(api) {
2
+ var validEnv = ['development', 'test', 'production']
3
+ var currentEnv = api.env()
4
+ var isDevelopmentEnv = api.env('development')
5
+ var isProductionEnv = api.env('production')
6
+ var isTestEnv = api.env('test')
7
+
8
+ if (!validEnv.includes(currentEnv)) {
9
+ throw new Error(
10
+ 'Please specify a valid `NODE_ENV` or ' +
11
+ '`BABEL_ENV` environment variables. Valid values are "development", ' +
12
+ '"test", and "production". Instead, received: ' +
13
+ JSON.stringify(currentEnv) +
14
+ '.'
15
+ )
16
+ }
17
+
18
+ return {
19
+ presets: [
20
+ isTestEnv && [
21
+ '@babel/preset-env',
22
+ {
23
+ targets: {
24
+ node: 'current'
25
+ }
26
+ }
27
+ ],
28
+ (isProductionEnv || isDevelopmentEnv) && [
29
+ '@babel/preset-env',
30
+ {
31
+ forceAllTransforms: true,
32
+ useBuiltIns: 'entry',
33
+ corejs: 3,
34
+ modules: false,
35
+ exclude: ['transform-typeof-symbol']
36
+ }
37
+ ]
38
+ ].filter(Boolean),
39
+ plugins: [
40
+ 'babel-plugin-macros',
41
+ '@babel/plugin-syntax-dynamic-import',
42
+ isTestEnv && 'babel-plugin-dynamic-import-node',
43
+ '@babel/plugin-transform-destructuring',
44
+ [
45
+ '@babel/plugin-proposal-class-properties',
46
+ {
47
+ loose: true
48
+ }
49
+ ],
50
+ [
51
+ '@babel/plugin-proposal-object-rest-spread',
52
+ {
53
+ useBuiltIns: true
54
+ }
55
+ ],
56
+ [
57
+ '@babel/plugin-proposal-private-methods',
58
+ {
59
+ loose: true
60
+ }
61
+ ],
62
+ [
63
+ '@babel/plugin-proposal-private-property-in-object',
64
+ {
65
+ loose: true
66
+ }
67
+ ],
68
+ [
69
+ '@babel/plugin-transform-runtime',
70
+ {
71
+ helpers: false
72
+ }
73
+ ],
74
+ [
75
+ '@babel/plugin-transform-regenerator',
76
+ {
77
+ async: false
78
+ }
79
+ ]
80
+ ].filter(Boolean)
81
+ }
82
+ }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ load File.expand_path("spring", __dir__)
3
+ APP_PATH = File.expand_path('../config/application', __dir__)
4
+ require_relative "../config/boot"
5
+ require "rails/commands"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ load File.expand_path("spring", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rake"
5
+ Rake.application.run
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path('..', __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies
21
+ system! 'bin/yarn'
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:prepare'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
3
+ gem "bundler"
4
+ require "bundler"
5
+
6
+ # Load Spring without loading other gems in the Gemfile, for speed.
7
+ Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
8
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
9
+ gem "spring", spring.version
10
+ require "spring/binstub"
11
+ rescue Gem::LoadError
12
+ # Ignore when Spring is not installed.
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
+
6
+ require "pathname"
7
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8
+ Pathname.new(__FILE__).realpath)
9
+
10
+ require "bundler/setup"
11
+
12
+ require "webpacker"
13
+ require "webpacker/webpack_runner"
14
+
15
+ APP_ROOT = File.expand_path("..", __dir__)
16
+ Dir.chdir(APP_ROOT) do
17
+ Webpacker::WebpackRunner.run(ARGV)
18
+ end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
+
6
+ require "pathname"
7
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8
+ Pathname.new(__FILE__).realpath)
9
+
10
+ require "bundler/setup"
11
+
12
+ require "webpacker"
13
+ require "webpacker/dev_server_runner"
14
+
15
+ APP_ROOT = File.expand_path("..", __dir__)
16
+ Dir.chdir(APP_ROOT) do
17
+ Webpacker::DevServerRunner.run(ARGV)
18
+ end
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
5
+ select { |dir| File.expand_path(dir) != __dir__ }.
6
+ product(["yarn", "yarn.cmd", "yarn.ps1"]).
7
+ map { |dir, file| File.expand_path(file, dir) }.
8
+ find { |file| File.executable?(file) }
9
+
10
+ if yarn
11
+ exec yarn, *ARGV
12
+ else
13
+ $stderr.puts "Yarn executable was not detected in the system."
14
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
15
+ exit 1
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "boot"
2
+
3
+ require "rails/all"
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
8
+
9
+ module ExampleRails6App
10
+ class Application < Rails::Application
11
+ # Initialize configuration defaults for originally generated Rails version.
12
+ config.load_defaults 6.1
13
+
14
+ # Configuration for the application, engines, and railties goes here.
15
+ #
16
+ # These settings can be overridden in specific environments using the files
17
+ # in config/environments, which are processed later.
18
+ #
19
+ # config.time_zone = "Central Time (US & Canada)"
20
+ # config.eager_load_paths << Rails.root.join("extras")
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
4
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: example_rails_6_app_production
@@ -0,0 +1 @@
1
+ h7M8SfdZSqhsIQYIRv1H5oaWJ52KshfyNwNOsQnDPJmGMtLxe0AJEKK03qFyU6+hX4hEP3/lWD2xPPYKazRjA+Z8J5Mm1pm05Lwl7RCjqhyYnjS6K1+JqSJ9CfTtmzJ++4MvIIWMXUacrCkbxPYHxUHd/DAieJ91QTvpqvpVFNbEmeWfGvFKTPHXe6KNqhKKGiNSwnIFv3yRYpkRqWoarxir43+Kw8uttnxeTSfcVEYOOukSzBnjYsyEbBweUoMjvibTdgMurVigo2j+8n2IkJXLAohVqcsClQoLXmI2DslHvn7B4GxY+pYUK9Nk2aDeo+s/XVVHBqc2YUuNFf8MPC8CaWagEGmM8R9uSBpsFLSDxGOXG7ATjA//DhutEWUXL7K60uokEpulCdL7QqknhDyeJoCIkmKA0Wxx--807WY2XsducHkq5/--b4dn9OIn7+Ud8iLw0l4ZVw==
@@ -0,0 +1,25 @@
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: db/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: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,76 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded any time
7
+ # it changes. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = true
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ # Run rails dev:cache to toggle caching.
19
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
20
+ config.action_controller.perform_caching = true
21
+ config.action_controller.enable_fragment_cache_logging = true
22
+
23
+ config.cache_store = :memory_store
24
+ config.public_file_server.headers = {
25
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
26
+ }
27
+ else
28
+ config.action_controller.perform_caching = false
29
+
30
+ config.cache_store = :null_store
31
+ end
32
+
33
+ # Store uploaded files on the local file system (see config/storage.yml for options).
34
+ config.active_storage.service = :local
35
+
36
+ # Don't care if the mailer can't send.
37
+ config.action_mailer.raise_delivery_errors = false
38
+
39
+ config.action_mailer.perform_caching = false
40
+
41
+ # Print deprecation notices to the Rails logger.
42
+ config.active_support.deprecation = :log
43
+
44
+ # Raise exceptions for disallowed deprecations.
45
+ config.active_support.disallowed_deprecation = :raise
46
+
47
+ # Tell Active Support which deprecation messages to disallow.
48
+ config.active_support.disallowed_deprecation_warnings = []
49
+
50
+ # Raise an error on page load if there are pending migrations.
51
+ config.active_record.migration_error = :page_load
52
+
53
+ # Highlight code that triggered database queries in logs.
54
+ config.active_record.verbose_query_logs = true
55
+
56
+ # Debug mode disables concatenation and preprocessing of assets.
57
+ # This option may cause significant delays in view rendering with a large
58
+ # number of complex assets.
59
+ config.assets.debug = true
60
+
61
+ # Suppress logger output for asset requests.
62
+ config.assets.quiet = true
63
+
64
+ # Raises error for missing translations.
65
+ # config.i18n.raise_on_missing_translations = true
66
+
67
+ # Annotate rendered view with file names.
68
+ # config.action_view.annotate_rendered_view_with_filenames = true
69
+
70
+ # Use an evented file watcher to asynchronously detect changes in source code,
71
+ # routes, locales, etc. This feature depends on the listen gem.
72
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
73
+
74
+ # Uncomment if you wish to allow Action Cable access from any origin.
75
+ # config.action_cable.disable_request_forgery_protection = true
76
+ end
@@ -0,0 +1,120 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Code is not reloaded between requests.
7
+ config.cache_classes = true
8
+
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
16
+ config.consider_all_requests_local = false
17
+ config.action_controller.perform_caching = true
18
+
19
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+ # Compress CSS using a preprocessor.
28
+ # config.assets.css_compressor = :sass
29
+
30
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
31
+ config.assets.compile = false
32
+
33
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
34
+ # config.asset_host = 'http://assets.example.com'
35
+
36
+ # Specifies the header that your server uses for sending files.
37
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
38
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
39
+
40
+ # Store uploaded files on the local file system (see config/storage.yml for options).
41
+ config.active_storage.service = :local
42
+
43
+ # Mount Action Cable outside main process or domain.
44
+ # config.action_cable.mount_path = nil
45
+ # config.action_cable.url = 'wss://example.com/cable'
46
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
47
+
48
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
49
+ # config.force_ssl = true
50
+
51
+ # Include generic and useful information about system operation, but avoid logging too much
52
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
53
+ config.log_level = :info
54
+
55
+ # Prepend all log lines with the following tags.
56
+ config.log_tags = [ :request_id ]
57
+
58
+ # Use a different cache store in production.
59
+ # config.cache_store = :mem_cache_store
60
+
61
+ # Use a real queuing backend for Active Job (and separate queues per environment).
62
+ # config.active_job.queue_adapter = :resque
63
+ # config.active_job.queue_name_prefix = "example_rails_6_app_production"
64
+
65
+ config.action_mailer.perform_caching = false
66
+
67
+ # Ignore bad email addresses and do not raise email delivery errors.
68
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
69
+ # config.action_mailer.raise_delivery_errors = false
70
+
71
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
72
+ # the I18n.default_locale when a translation cannot be found).
73
+ config.i18n.fallbacks = true
74
+
75
+ # Send deprecation notices to registered listeners.
76
+ config.active_support.deprecation = :notify
77
+
78
+ # Log disallowed deprecations.
79
+ config.active_support.disallowed_deprecation = :log
80
+
81
+ # Tell Active Support which deprecation messages to disallow.
82
+ config.active_support.disallowed_deprecation_warnings = []
83
+
84
+ # Use default logging formatter so that PID and timestamp are not suppressed.
85
+ config.log_formatter = ::Logger::Formatter.new
86
+
87
+ # Use a different logger for distributed setups.
88
+ # require "syslog/logger"
89
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
90
+
91
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
92
+ logger = ActiveSupport::Logger.new(STDOUT)
93
+ logger.formatter = config.log_formatter
94
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
95
+ end
96
+
97
+ # Do not dump schema after migrations.
98
+ config.active_record.dump_schema_after_migration = false
99
+
100
+ # Inserts middleware to perform automatic connection switching.
101
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
102
+ # middleware. The `delay` is used to determine how long to wait after a write
103
+ # to send a subsequent read to the primary.
104
+ #
105
+ # The `database_resolver` class is used by the middleware to determine which
106
+ # database is appropriate to use based on the time delay.
107
+ #
108
+ # The `database_resolver_context` class is used by the middleware to set
109
+ # timestamps for the last write to the primary. The resolver uses the context
110
+ # class timestamps to determine how long to wait before reading from the
111
+ # replica.
112
+ #
113
+ # By default Rails will store a last write timestamp in the session. The
114
+ # DatabaseSelector middleware is designed as such you can define your own
115
+ # strategy for connection switching and pass that into the middleware through
116
+ # these configuration options.
117
+ # config.active_record.database_selector = { delay: 2.seconds }
118
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
119
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
120
+ end
@@ -0,0 +1,60 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+
8
+ Rails.application.configure do
9
+ # Settings specified here will take precedence over those in config/application.rb.
10
+
11
+ config.cache_classes = false
12
+ config.action_view.cache_template_loading = true
13
+
14
+ # Do not eager load code on boot. This avoids loading your whole application
15
+ # just for the purpose of running a single test. If you are using a tool that
16
+ # preloads Rails for running tests, you may have to set it to true.
17
+ config.eager_load = false
18
+
19
+ # Configure public file server for tests with Cache-Control for performance.
20
+ config.public_file_server.enabled = true
21
+ config.public_file_server.headers = {
22
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
23
+ }
24
+
25
+ # Show full error reports and disable caching.
26
+ config.consider_all_requests_local = true
27
+ config.action_controller.perform_caching = false
28
+ config.cache_store = :null_store
29
+
30
+ # Raise exceptions instead of rendering exception templates.
31
+ config.action_dispatch.show_exceptions = false
32
+
33
+ # Disable request forgery protection in test environment.
34
+ config.action_controller.allow_forgery_protection = false
35
+
36
+ # Store uploaded files on the local file system in a temporary directory.
37
+ config.active_storage.service = :test
38
+
39
+ config.action_mailer.perform_caching = false
40
+
41
+ # Tell Action Mailer not to deliver emails to the real world.
42
+ # The :test delivery method accumulates sent emails in the
43
+ # ActionMailer::Base.deliveries array.
44
+ config.action_mailer.delivery_method = :test
45
+
46
+ # Print deprecation notices to the stderr.
47
+ config.active_support.deprecation = :stderr
48
+
49
+ # Raise exceptions for disallowed deprecations.
50
+ config.active_support.disallowed_deprecation = :raise
51
+
52
+ # Tell Active Support which deprecation messages to disallow.
53
+ config.active_support.disallowed_deprecation_warnings = []
54
+
55
+ # Raises error for missing translations.
56
+ # config.i18n.raise_on_missing_translations = true
57
+
58
+ # Annotate rendered view with file names.
59
+ # config.action_view.annotate_rendered_view_with_filenames = true
60
+ end
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # ActiveSupport::Reloader.to_prepare do
4
+ # ApplicationController.renderer.defaults.merge!(
5
+ # http_host: 'example.org',
6
+ # https: false
7
+ # )
8
+ # end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path.
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+ # Add Yarn node_modules folder to the asset load path.
9
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
7
+ # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
8
+ Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
@@ -0,0 +1,30 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy
4
+ # For further information see the following documentation
5
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
+
7
+ # Rails.application.config.content_security_policy do |policy|
8
+ # policy.default_src :self, :https
9
+ # policy.font_src :self, :https, :data
10
+ # policy.img_src :self, :https, :data
11
+ # policy.object_src :none
12
+ # policy.script_src :self, :https
13
+ # policy.style_src :self, :https
14
+ # # If you are using webpack-dev-server then specify webpack-dev-server host
15
+ # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
16
+
17
+ # # Specify URI for violation reports
18
+ # # policy.report_uri "/csp-violation-report-endpoint"
19
+ # end
20
+
21
+ # If you are using UJS then enable automatic nonce generation
22
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
23
+
24
+ # Set the nonce only to specific directives
25
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
26
+
27
+ # Report CSP violations to a specified URI
28
+ # For further information see the following documentation:
29
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
30
+ # Rails.application.config.content_security_policy_report_only = true