railties 5.0.7.2 → 5.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +77 -567
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.rdoc +3 -3
  5. data/README.rdoc +1 -1
  6. data/exe/rails +2 -2
  7. data/lib/rails.rb +18 -18
  8. data/lib/rails/all.rb +1 -1
  9. data/lib/rails/api/generator.rb +28 -0
  10. data/lib/rails/api/task.rb +54 -42
  11. data/lib/rails/app_loader.rb +9 -9
  12. data/lib/rails/application.rb +30 -35
  13. data/lib/rails/application/bootstrap.rb +13 -7
  14. data/lib/rails/application/configuration.rb +30 -53
  15. data/lib/rails/application/default_middleware_stack.rb +3 -5
  16. data/lib/rails/application/finisher.rb +16 -7
  17. data/lib/rails/application/routes_reloader.rb +16 -1
  18. data/lib/rails/application_controller.rb +10 -10
  19. data/lib/rails/backtrace_cleaner.rb +5 -5
  20. data/lib/rails/cli.rb +7 -5
  21. data/lib/rails/code_statistics.rb +16 -17
  22. data/lib/rails/code_statistics_calculator.rb +3 -3
  23. data/lib/rails/command.rb +111 -0
  24. data/lib/rails/command/actions.rb +42 -0
  25. data/lib/rails/command/base.rb +149 -0
  26. data/lib/rails/command/behavior.rb +123 -0
  27. data/lib/rails/command/environment_argument.rb +34 -0
  28. data/lib/rails/commands.rb +2 -4
  29. data/lib/rails/commands/application/application_command.rb +29 -0
  30. data/lib/rails/commands/console/console_command.rb +89 -0
  31. data/lib/rails/commands/dbconsole/dbconsole_command.rb +155 -0
  32. data/lib/rails/commands/destroy/destroy_command.rb +21 -0
  33. data/lib/rails/commands/generate/generate_command.rb +23 -0
  34. data/lib/rails/commands/help/USAGE +15 -0
  35. data/lib/rails/commands/help/help_command.rb +13 -0
  36. data/lib/rails/commands/new/new_command.rb +15 -0
  37. data/lib/rails/commands/plugin/plugin_command.rb +43 -0
  38. data/lib/rails/commands/rake/rake_command.rb +49 -0
  39. data/lib/rails/commands/runner/USAGE +17 -0
  40. data/lib/rails/commands/runner/runner_command.rb +46 -0
  41. data/lib/rails/commands/secrets/USAGE +52 -0
  42. data/lib/rails/commands/secrets/secrets_command.rb +36 -0
  43. data/lib/rails/commands/server/server_command.rb +177 -0
  44. data/lib/rails/commands/test/test_command.rb +20 -0
  45. data/lib/rails/commands/version/version_command.rb +9 -0
  46. data/lib/rails/configuration.rb +7 -7
  47. data/lib/rails/console/app.rb +4 -4
  48. data/lib/rails/dev_caching.rb +8 -8
  49. data/lib/rails/engine.rb +62 -63
  50. data/lib/rails/engine/commands.rb +6 -13
  51. data/lib/rails/engine/configuration.rb +2 -2
  52. data/lib/rails/gem_version.rb +3 -3
  53. data/lib/rails/generators.rb +229 -313
  54. data/lib/rails/generators/actions.rb +20 -21
  55. data/lib/rails/generators/actions/create_migration.rb +24 -25
  56. data/lib/rails/generators/active_model.rb +3 -3
  57. data/lib/rails/generators/app_base.rb +123 -93
  58. data/lib/rails/generators/base.rb +32 -33
  59. data/lib/rails/generators/css/assets/assets_generator.rb +1 -1
  60. data/lib/rails/generators/erb.rb +14 -14
  61. data/lib/rails/generators/erb/controller/controller_generator.rb +1 -1
  62. data/lib/rails/generators/erb/mailer/mailer_generator.rb +12 -12
  63. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +3 -3
  64. data/lib/rails/generators/generated_attribute.rb +27 -27
  65. data/lib/rails/generators/js/assets/assets_generator.rb +1 -1
  66. data/lib/rails/generators/migration.rb +8 -8
  67. data/lib/rails/generators/model_helpers.rb +2 -2
  68. data/lib/rails/generators/named_base.rb +56 -56
  69. data/lib/rails/generators/rails/app/app_generator.rb +98 -81
  70. data/lib/rails/generators/rails/app/templates/Gemfile +7 -2
  71. data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
  72. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +6 -4
  73. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.js +1 -1
  74. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +2 -2
  75. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -1
  76. data/lib/rails/generators/rails/app/templates/bin/{setup → setup.tt} +6 -0
  77. data/lib/rails/generators/rails/app/templates/bin/{update → update.tt} +2 -1
  78. data/lib/rails/generators/rails/app/templates/bin/yarn +9 -0
  79. data/lib/rails/generators/rails/app/templates/config/cable.yml +1 -0
  80. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +1 -0
  81. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +1 -0
  82. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +1 -0
  83. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +2 -1
  84. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +1 -0
  85. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +1 -0
  86. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +2 -2
  87. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -0
  88. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +1 -1
  89. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +1 -1
  90. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +1 -1
  91. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +10 -1
  92. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -1
  93. data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb +4 -6
  94. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +8 -3
  95. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt +6 -5
  96. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +10 -0
  97. data/lib/rails/generators/rails/app/templates/config/puma.rb +16 -7
  98. data/lib/rails/generators/rails/app/templates/config/secrets.yml +12 -2
  99. data/lib/rails/generators/rails/app/templates/gitignore +5 -1
  100. data/lib/rails/generators/rails/app/templates/package.json +5 -0
  101. data/lib/rails/generators/rails/app/templates/public/404.html +6 -6
  102. data/lib/rails/generators/rails/app/templates/public/422.html +6 -6
  103. data/lib/rails/generators/rails/app/templates/public/500.html +6 -6
  104. data/lib/rails/generators/rails/app/templates/public/robots.txt +0 -4
  105. data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb +5 -0
  106. data/lib/rails/generators/rails/app/templates/test/test_helper.rb +0 -1
  107. data/lib/rails/generators/rails/assets/assets_generator.rb +10 -10
  108. data/lib/rails/generators/rails/controller/controller_generator.rb +15 -12
  109. data/lib/rails/generators/rails/encrypted_secrets/encrypted_secrets_generator.rb +66 -0
  110. data/lib/rails/generators/rails/encrypted_secrets/templates/config/secrets.yml.enc +3 -0
  111. data/lib/rails/generators/rails/generator/generator_generator.rb +2 -3
  112. data/lib/rails/generators/rails/helper/helper_generator.rb +1 -1
  113. data/lib/rails/generators/rails/model/model_generator.rb +1 -1
  114. data/lib/rails/generators/rails/plugin/plugin_generator.rb +21 -26
  115. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -0
  116. data/lib/rails/generators/rails/plugin/templates/bin/test.tt +3 -9
  117. data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb +5 -0
  118. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +0 -3
  119. data/lib/rails/generators/rails/resource/resource_generator.rb +2 -2
  120. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +5 -1
  121. data/lib/rails/generators/rails/scaffold/templates/scaffold.css +4 -8
  122. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +2 -3
  123. data/lib/rails/generators/rails/system_test/USAGE +10 -0
  124. data/lib/rails/generators/rails/system_test/system_test_generator.rb +7 -0
  125. data/lib/rails/generators/rails/task/task_generator.rb +1 -2
  126. data/lib/rails/generators/resource_helpers.rb +13 -10
  127. data/lib/rails/generators/test_case.rb +5 -6
  128. data/lib/rails/generators/test_unit.rb +1 -1
  129. data/lib/rails/generators/test_unit/controller/controller_generator.rb +3 -3
  130. data/lib/rails/generators/test_unit/generator/generator_generator.rb +3 -3
  131. data/lib/rails/generators/test_unit/helper/helper_generator.rb +1 -1
  132. data/lib/rails/generators/test_unit/integration/integration_generator.rb +2 -2
  133. data/lib/rails/generators/test_unit/job/job_generator.rb +3 -3
  134. data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +5 -5
  135. data/lib/rails/generators/test_unit/model/model_generator.rb +3 -4
  136. data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +2 -2
  137. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +3 -3
  138. data/lib/rails/generators/test_unit/system/system_generator.rb +17 -0
  139. data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb +5 -0
  140. data/lib/rails/generators/test_unit/system/templates/system_test.rb +9 -0
  141. data/lib/rails/generators/testing/assertions.rb +4 -4
  142. data/lib/rails/generators/testing/behaviour.rb +20 -21
  143. data/lib/rails/info.rb +20 -20
  144. data/lib/rails/info_controller.rb +15 -15
  145. data/lib/rails/initializable.rb +6 -2
  146. data/lib/rails/mailers_controller.rb +11 -11
  147. data/lib/rails/paths.rb +4 -5
  148. data/lib/rails/plugin/test.rb +7 -0
  149. data/lib/rails/rack/logger.rb +44 -46
  150. data/lib/rails/railtie.rb +41 -38
  151. data/lib/rails/railtie/configurable.rb +6 -6
  152. data/lib/rails/railtie/configuration.rb +1 -1
  153. data/lib/rails/ruby_version_check.rb +1 -1
  154. data/lib/rails/secrets.rb +111 -0
  155. data/lib/rails/source_annotation_extractor.rb +15 -9
  156. data/lib/rails/tasks.rb +3 -2
  157. data/lib/rails/tasks/annotations.rake +3 -3
  158. data/lib/rails/tasks/dev.rake +2 -2
  159. data/lib/rails/tasks/engine.rake +4 -4
  160. data/lib/rails/tasks/framework.rake +4 -18
  161. data/lib/rails/tasks/initializers.rake +1 -1
  162. data/lib/rails/tasks/log.rake +14 -10
  163. data/lib/rails/tasks/middleware.rake +1 -1
  164. data/lib/rails/tasks/misc.rake +10 -10
  165. data/lib/rails/tasks/restart.rake +4 -4
  166. data/lib/rails/tasks/routes.rake +3 -12
  167. data/lib/rails/tasks/statistics.rake +3 -3
  168. data/lib/rails/tasks/tmp.rake +7 -7
  169. data/lib/rails/tasks/yarn.rake +11 -0
  170. data/lib/rails/templates/rails/mailers/email.html.erb +4 -1
  171. data/lib/rails/test_help.rb +28 -10
  172. data/lib/rails/test_unit/line_filtering.rb +69 -3
  173. data/lib/rails/test_unit/minitest_plugin.rb +139 -0
  174. data/lib/rails/test_unit/railtie.rb +2 -1
  175. data/lib/rails/test_unit/reporter.rb +3 -8
  176. data/lib/rails/test_unit/test_requirer.rb +28 -0
  177. data/lib/rails/test_unit/testing.rake +19 -14
  178. data/lib/rails/version.rb +1 -1
  179. data/lib/rails/welcome_controller.rb +1 -1
  180. metadata +53 -30
  181. data/lib/minitest/rails_plugin.rb +0 -49
  182. data/lib/rails/commands/application.rb +0 -17
  183. data/lib/rails/commands/commands_tasks.rb +0 -180
  184. data/lib/rails/commands/console.rb +0 -68
  185. data/lib/rails/commands/console_helper.rb +0 -34
  186. data/lib/rails/commands/dbconsole.rb +0 -173
  187. data/lib/rails/commands/destroy.rb +0 -11
  188. data/lib/rails/commands/generate.rb +0 -13
  189. data/lib/rails/commands/plugin.rb +0 -23
  190. data/lib/rails/commands/rake_proxy.rb +0 -41
  191. data/lib/rails/commands/runner.rb +0 -71
  192. data/lib/rails/commands/server.rb +0 -163
  193. data/lib/rails/commands/test.rb +0 -10
  194. data/lib/rails/engine/commands_tasks.rb +0 -118
  195. data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +0 -3
  196. data/lib/rails/rack/debugger.rb +0 -3
  197. data/lib/rails/test_unit/runner.rb +0 -141
@@ -31,7 +31,12 @@ end
31
31
  <% if RUBY_ENGINE == 'ruby' -%>
32
32
  group :development, :test do
33
33
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
34
- gem 'byebug', platform: :mri
34
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
35
+ <%- unless options.skip_system_test? || options.api? -%>
36
+ # Adds support for Capybara system testing and selenium driver
37
+ gem 'capybara', '~> 2.7.0'
38
+ gem 'selenium-webdriver'
39
+ <%- end -%>
35
40
  end
36
41
 
37
42
  group :development do
@@ -44,7 +49,7 @@ group :development do
44
49
  <%- end -%>
45
50
  <%- end -%>
46
51
  <% if depend_on_listen? -%>
47
- gem 'listen', '~> 3.0.5'
52
+ gem 'listen', '>= 3.0.5', '< 3.2'
48
53
  <% end -%>
49
54
  <% if spring_install? -%>
50
55
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
@@ -1,6 +1,4 @@
1
- <% unless options.api? -%>
2
1
  //= link_tree ../images
3
- <% end -%>
4
2
  <% unless options.skip_javascript -%>
5
3
  //= link_directory ../javascripts .js
6
4
  <% end -%>
@@ -1,8 +1,8 @@
1
1
  // This is a manifest file that'll be compiled into application.js, which will include all the files
2
2
  // listed below.
3
3
  //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
5
+ // vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
8
  // compiled file. JavaScript code in this file should be added after the last require_* statement.
@@ -11,9 +11,11 @@
11
11
  // about supported directives.
12
12
  //
13
13
  <% unless options[:skip_javascript] -%>
14
+ <% if options[:javascript] -%>
14
15
  //= require <%= options[:javascript] %>
15
- //= require <%= options[:javascript] %>_ujs
16
- <% if gemfile_entries.any? { |m| m.name == "turbolinks" } -%>
16
+ <% end -%>
17
+ //= require rails-ujs
18
+ <% unless options[:skip_turbolinks] -%>
17
19
  //= require turbolinks
18
20
  <% end -%>
19
21
  <% end -%>
@@ -1,5 +1,5 @@
1
1
  // Action Cable provides the framework to deal with WebSockets in Rails.
2
- // You can generate new channels where WebSocket features live using the rails generate channel command.
2
+ // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3
3
  //
4
4
  //= require action_cable
5
5
  //= require_self
@@ -2,8 +2,8 @@
2
2
  * This is a manifest file that'll be compiled into application.css, which will include all the files
3
3
  * listed below.
4
4
  *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
5
+ * Any CSS and SCSS 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
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
9
  * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
@@ -7,7 +7,7 @@
7
7
  <%- if options[:skip_javascript] -%>
8
8
  <%%= stylesheet_link_tag 'application', media: 'all' %>
9
9
  <%- else -%>
10
- <%- if gemfile_entries.any? { |m| m.name == 'turbolinks' } -%>
10
+ <%- unless options[:skip_turbolinks] -%>
11
11
  <%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
12
12
  <%%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
13
13
  <%- else -%>
@@ -16,7 +16,12 @@ chdir APP_ROOT do
16
16
  puts '== Installing dependencies =='
17
17
  system! 'gem install bundler --conservative'
18
18
  system('bundle check') || system!('bundle install')
19
+ <% unless options[:skip_yarn] %>
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
19
22
 
23
+ <% end %>
24
+ <% unless options.skip_active_record -%>
20
25
  # puts "\n== Copying sample files =="
21
26
  # unless File.exist?('config/database.yml')
22
27
  # cp 'config/database.yml.sample', 'config/database.yml'
@@ -24,6 +29,7 @@ chdir APP_ROOT do
24
29
 
25
30
  puts "\n== Preparing database =="
26
31
  system! 'bin/rails db:setup'
32
+ <% end -%>
27
33
 
28
34
  puts "\n== Removing old logs and tempfiles =="
29
35
  system! 'bin/rails log:clear tmp:clear'
@@ -16,9 +16,10 @@ chdir APP_ROOT do
16
16
  puts '== Installing dependencies =='
17
17
  system! 'gem install bundler --conservative'
18
18
  system('bundle check') || system!('bundle install')
19
-
19
+ <% unless options.skip_active_record -%>
20
20
  puts "\n== Updating database =="
21
21
  system! 'bin/rails db:migrate'
22
+ <% end -%>
22
23
 
23
24
  puts "\n== Removing old logs and tempfiles =="
24
25
  system! 'bin/rails log:clear tmp:clear'
@@ -0,0 +1,9 @@
1
+ VENDOR_PATH = File.expand_path('..', __dir__)
2
+ Dir.chdir(VENDOR_PATH) do
3
+ begin
4
+ exec "yarnpkg #{ARGV.join(" ")}"
5
+ rescue Errno::ENOENT
6
+ puts "Yarn executable was not detected in the system."
7
+ puts "Download Yarn at https://yarnpkg.com/en/docs/install"
8
+ end
9
+ end
@@ -7,3 +7,4 @@ test:
7
7
  production:
8
8
  adapter: redis
9
9
  url: redis://localhost:6379/1
10
+ channel_prefix: <%= app_name %>_production
@@ -8,6 +8,7 @@
8
8
  #
9
9
  default: &default
10
10
  adapter: frontbase
11
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
11
12
  host: localhost
12
13
  username: <%= app_name %>
13
14
  password: ''
@@ -34,6 +34,7 @@
34
34
  #
35
35
  default: &default
36
36
  adapter: ibm_db
37
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
37
38
  username: db2inst1
38
39
  password:
39
40
  #schema: db2inst1
@@ -38,6 +38,7 @@
38
38
 
39
39
  default: &default
40
40
  adapter: jdbc
41
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
41
42
  username: <%= app_name %>
42
43
  password:
43
44
  driver:
@@ -1,4 +1,4 @@
1
- # MySQL. Versions 5.0 and up are supported.
1
+ # MySQL. Versions 5.1.10 and up are supported.
2
2
  #
3
3
  # Install the MySQL driver:
4
4
  # gem install activerecord-jdbcmysql-adapter
@@ -11,6 +11,7 @@
11
11
  #
12
12
  default: &default
13
13
  adapter: mysql
14
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
14
15
  username: root
15
16
  password:
16
17
  host: localhost
@@ -6,6 +6,7 @@
6
6
  default: &default
7
7
  adapter: postgresql
8
8
  encoding: unicode
9
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
9
10
 
10
11
  development:
11
12
  <<: *default
@@ -6,6 +6,7 @@
6
6
  #
7
7
  default: &default
8
8
  adapter: sqlite3
9
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
9
10
 
10
11
  development:
11
12
  <<: *default
@@ -1,4 +1,4 @@
1
- # MySQL. Versions 5.0 and up are supported.
1
+ # MySQL. Versions 5.1.10 and up are supported.
2
2
  #
3
3
  # Install the MySQL driver
4
4
  # gem install mysql2
@@ -12,7 +12,7 @@
12
12
  default: &default
13
13
  adapter: mysql2
14
14
  encoding: utf8
15
- pool: 5
15
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
16
16
  username: root
17
17
  password:
18
18
  <% if mysql_socket -%>
@@ -18,6 +18,7 @@
18
18
  #
19
19
  default: &default
20
20
  adapter: oracle
21
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
21
22
  username: <%= app_name %>
22
23
  password:
23
24
 
@@ -17,7 +17,7 @@
17
17
  default: &default
18
18
  adapter: postgresql
19
19
  encoding: unicode
20
- # For details on connection pooling, see rails configuration guide
20
+ # For details on connection pooling, see Rails configuration guide
21
21
  # http://guides.rubyonrails.org/configuring.html#database-pooling
22
22
  pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23
23
 
@@ -6,7 +6,7 @@
6
6
  #
7
7
  default: &default
8
8
  adapter: sqlite3
9
- pool: 5
9
+ pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
10
  timeout: 5000
11
11
 
12
12
  development:
@@ -18,7 +18,7 @@ Rails.application.configure do
18
18
 
19
19
  config.cache_store = :memory_store
20
20
  config.public_file_server.headers = {
21
- 'Cache-Control' => 'public, max-age=172800'
21
+ 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
22
22
  }
23
23
  else
24
24
  config.action_controller.perform_caching = false
@@ -14,13 +14,22 @@ Rails.application.configure do
14
14
  config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
+ # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
18
+ # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
19
+ # `config/secrets.yml.key`.
20
+ config.read_encrypted_secrets = true
21
+
17
22
  # Disable serving static files from the `/public` folder by default since
18
23
  # Apache or NGINX already handles this.
19
24
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
20
25
 
21
26
  <%- unless options.skip_sprockets? -%>
27
+ <%- if options.skip_javascript? -%>
28
+ # Compress CSS.
29
+ <%- else -%>
22
30
  # Compress JavaScripts and CSS.
23
31
  config.assets.js_compressor = :uglifier
32
+ <%- end -%>
24
33
  # config.assets.css_compressor = :sass
25
34
 
26
35
  # Do not fallback to assets pipeline if a precompiled asset is missed.
@@ -84,7 +93,7 @@ Rails.application.configure do
84
93
  if ENV["RAILS_LOG_TO_STDOUT"].present?
85
94
  logger = ActiveSupport::Logger.new(STDOUT)
86
95
  logger.formatter = config.log_formatter
87
- config.logger = ActiveSupport::TaggedLogging.new(logger)
96
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
88
97
  end
89
98
  <%- unless options.skip_active_record? -%>
90
99
 
@@ -15,7 +15,7 @@ Rails.application.configure do
15
15
  # Configure public file server for tests with Cache-Control for performance.
16
16
  config.public_file_server.enabled = true
17
17
  config.public_file_server.headers = {
18
- 'Cache-Control' => 'public, max-age=3600'
18
+ 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
19
19
  }
20
20
 
21
21
  # Show full error reports and disable caching.
@@ -1,8 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # ActiveSupport::Reloader.to_prepare do
4
- # ApplicationController.renderer.defaults.merge!(
5
- # http_host: 'example.org',
6
- # https: false
7
- # )
8
- # end
3
+ # ApplicationController.renderer.defaults.merge!(
4
+ # http_host: 'example.org',
5
+ # https: false
6
+ # )
@@ -3,9 +3,14 @@
3
3
  # Version of your assets, change this if you want to expire all your assets.
4
4
  Rails.application.config.assets.version = '1.0'
5
5
 
6
- # Add additional assets to the asset load path
6
+ # Add additional assets to the asset load path.
7
7
  # Rails.application.config.assets.paths << Emoji.images_path
8
+ <%- unless options[:skip_yarn] -%>
9
+ # Add Yarn node_modules folder to the asset load path.
10
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
11
+ <%- end -%>
8
12
 
9
13
  # Precompile additional assets.
10
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
- # Rails.application.config.assets.precompile += %w( search.js )
14
+ # application.js, application.css, and all non-JS/CSS in the app/assets
15
+ # folder are already added.
16
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -7,8 +7,6 @@
7
7
  #
8
8
  <%- end -%>
9
9
  # Read the Guide for Upgrading Ruby on Rails for more info on each option.
10
-
11
- Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
12
10
  <%- unless options[:api] -%>
13
11
 
14
12
  # Enable per-form CSRF tokens. Previous versions had false.
@@ -26,11 +24,14 @@ ActiveSupport.to_time_preserves_timezone = <%= options[:update] ? false : true %
26
24
  # Require `belongs_to` associations by default. Previous versions had false.
27
25
  Rails.application.config.active_record.belongs_to_required_by_default = <%= options[:update] ? false : true %>
28
26
  <%- end -%>
29
-
30
- # Do not halt callback chains when a callback returns false. Previous versions had true.
31
- ActiveSupport.halt_callback_chains_on_return_false = <%= options[:update] ? true : false %>
32
27
  <%- unless options[:update] -%>
33
28
 
34
29
  # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
35
30
  Rails.application.config.ssl_options = { hsts: { subdomains: true } }
36
31
  <%- end -%>
32
+ <%- unless options[:skip_sprockets] -%>
33
+
34
+ # Unknown asset fallback will return the path passed in when the given
35
+ # asset is not present in the asset pipeline.
36
+ Rails.application.config.assets.unknown_asset_fallback = <%= options[:update] ? true : false %>
37
+ <%- end -%>
@@ -16,6 +16,16 @@
16
16
  #
17
17
  # This would use the information in config/locales/es.yml.
18
18
  #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
19
29
  # To learn more, please read the Rails Internationalization guide
20
30
  # available at http://guides.rubyonrails.org/i18n.html.
21
31
 
@@ -1,13 +1,13 @@
1
1
  # Puma can serve each request in a thread from an internal thread pool.
2
- # The `threads` method setting takes two numbers a minimum and maximum.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
3
  # Any libraries that use thread pools should be configured to match
4
4
  # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
- # and maximum, this matches the default thread size of Active Record.
5
+ # and maximum; this matches the default thread size of Active Record.
6
6
  #
7
- threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
8
  threads threads_count, threads_count
9
9
 
10
- # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
11
  #
12
12
  port ENV.fetch("PORT") { 3000 }
13
13
 
@@ -32,16 +32,25 @@ environment ENV.fetch("RAILS_ENV") { "development" }
32
32
  #
33
33
  # preload_app!
34
34
 
35
+ # If you are preloading your application and using Active Record, it's
36
+ # recommended that you close any connections to the database before workers
37
+ # are forked to prevent connection leakage.
38
+ #
39
+ # before_fork do
40
+ # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41
+ # end
42
+
35
43
  # The code in the `on_worker_boot` will be called if you are using
36
44
  # clustered mode by specifying a number of `workers`. After each worker
37
- # process is booted this block will be run, if you are using `preload_app!`
38
- # option you will want to use this block to reconnect to any threads
39
- # or connections that may have been created at application boot, Ruby
45
+ # process is booted, this block will be run. If you are using the `preload_app!`
46
+ # option, you will want to use this block to reconnect to any threads
47
+ # or connections that may have been created at application boot, as Ruby
40
48
  # cannot share connections between processes.
41
49
  #
42
50
  # on_worker_boot do
43
51
  # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
44
52
  # end
53
+ #
45
54
 
46
55
  # Allow puma to be restarted by `rails restart` command.
47
56
  plugin :tmp_restart
@@ -10,13 +10,23 @@
10
10
  # Make sure the secrets in this file are kept private
11
11
  # if you're sharing your code publicly.
12
12
 
13
+ # Shared secrets are available across all environments.
14
+
15
+ shared:
16
+ api_key: 123
17
+
18
+ # Environmental secrets are only available for that specific environment.
19
+
13
20
  development:
14
21
  secret_key_base: <%= app_secret %>
15
22
 
16
23
  test:
17
24
  secret_key_base: <%= app_secret %>
18
25
 
19
- # Do not keep production secrets in the repository,
20
- # instead read values from the environment.
26
+ # Do not keep production secrets in the unencrypted secrets file.
27
+ # Instead, either read values from the environment.
28
+ # Or, use `bin/rails secrets:setup` to configure encrypted secrets
29
+ # and move the `production:` environment over there.
30
+
21
31
  production:
22
32
  secret_key_base: <%%= ENV["SECRET_KEY_BASE"] %>
@@ -21,5 +21,9 @@
21
21
  !/tmp/.keep
22
22
  <% end -%>
23
23
 
24
- # Ignore Byebug command history file.
24
+ <% unless options[:skip_yarn] -%>
25
+ /node_modules
26
+ /yarn-error.log
27
+
28
+ <% end -%>
25
29
  .byebug_history