buoys 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/lib/buoys/buoy.rb +2 -2
  4. data/lib/buoys/version.rb +1 -1
  5. data/test/buoys_buoy_test.rb +12 -0
  6. data/test/dummy/Rakefile +1 -1
  7. data/test/dummy/app/assets/config/manifest.js +3 -1
  8. data/test/dummy/app/assets/javascripts/application.js +3 -1
  9. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  10. data/test/dummy/app/assets/stylesheets/application.css +3 -3
  11. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  12. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  13. data/test/dummy/app/controllers/application_controller.rb +0 -5
  14. data/test/dummy/app/helpers/application_helper.rb +0 -2
  15. data/test/dummy/app/jobs/application_job.rb +2 -0
  16. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  17. data/test/dummy/app/models/application_record.rb +3 -0
  18. data/test/dummy/app/models/item.rb +1 -1
  19. data/test/dummy/app/models/user.rb +1 -1
  20. data/test/dummy/app/views/layouts/application.html.erb +10 -9
  21. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  22. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  23. data/test/dummy/bin/bundle +1 -1
  24. data/test/dummy/bin/rails +1 -1
  25. data/test/dummy/bin/setup +20 -13
  26. data/test/dummy/bin/update +31 -0
  27. data/test/dummy/bin/yarn +11 -0
  28. data/test/dummy/config/application.rb +9 -21
  29. data/test/dummy/config/boot.rb +2 -4
  30. data/test/dummy/config/cable.yml +10 -0
  31. data/test/dummy/config/database.yml +1 -1
  32. data/test/dummy/config/environment.rb +1 -3
  33. data/test/dummy/config/environments/development.rb +31 -13
  34. data/test/dummy/config/environments/production.rb +31 -18
  35. data/test/dummy/config/environments/test.rb +10 -13
  36. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  37. data/test/dummy/config/initializers/assets.rb +6 -5
  38. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -2
  39. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  40. data/test/dummy/config/initializers/cookies_serializer.rb +2 -2
  41. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -2
  42. data/test/dummy/config/initializers/inflections.rb +0 -2
  43. data/test/dummy/config/initializers/mime_types.rb +0 -2
  44. data/test/dummy/config/initializers/wrap_parameters.rb +2 -4
  45. data/test/dummy/config/locales/en.yml +10 -0
  46. data/test/dummy/config/puma.rb +37 -0
  47. data/test/dummy/config/routes.rb +2 -2
  48. data/test/dummy/config/spring.rb +6 -0
  49. data/test/dummy/config/storage.yml +34 -0
  50. data/test/dummy/config.ru +2 -1
  51. data/test/dummy/db/development.sqlite3 +0 -0
  52. data/test/dummy/db/test.sqlite3 +0 -0
  53. data/test/dummy/log/development.log +105 -0
  54. data/test/dummy/log/test.log +396 -267
  55. data/test/dummy/package.json +5 -0
  56. data/test/dummy/public/404.html +6 -6
  57. data/test/dummy/public/422.html +6 -6
  58. data/test/dummy/public/500.html +6 -6
  59. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  60. data/test/dummy/public/apple-touch-icon.png +0 -0
  61. data/test/dummy/tmp/development_secret.txt +1 -0
  62. data/test/test_helper.rb +4 -5
  63. metadata +88 -49
  64. data/test/dummy/README.rdoc +0 -28
  65. data/test/dummy/config/initializers/session_store.rb +0 -5
  66. data/test/dummy/config/secrets.yml +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 321c8bdd2ac68a0d8a24753fface674fce13b5b296bd2b8d99f4ee6d3bfdd6b0
4
- data.tar.gz: 0d64eff7a89cc85217c63e1f9a393beef2beec553898d88f03fadaf64dbff23e
3
+ metadata.gz: 9e9c604499d92dd5cc1a735a47f15c4a25d96db6486c8d2528b4df5fc372da9c
4
+ data.tar.gz: 9f5920b1f5cbc085364d1c6baf23ad21f2467ec2ec3958f4a7d2f7a5b41db861
5
5
  SHA512:
6
- metadata.gz: 0fa4d65a2fbdd6aea846513f71298a13aa619af34c23c0e1aeb5b600e8962b29c4cc822d7863a1ad971560daf955c13e98ec4027702fbe58c2a5f271ff5c298b
7
- data.tar.gz: dac0727c1f97170d28ee61c57172e07a8627a3eec5f28cb3045bc866c01b5703d4a76878db73f5b5f6041f322c8bd440a8249167880eebf7ac70c0652f6c2cb7
6
+ metadata.gz: 4849d2279a185fc9a34c0326e21469ffad41a01195d287c2371023bdfc1a5d9c4f4a568e4ee2651d8490d445da380d48cc23fcb1153fdc828d39a09111ff8257
7
+ data.tar.gz: c6871638d0efadbb643cf81bf99e61ef7860aaf400b60a3ff29360f0b533c330c8c5b213dbf897b7e8221bbfabd9f0721e6e8cc319a11541bd591614d15f5f9e
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'bundler/setup'
3
5
  rescue LoadError
data/lib/buoys/buoy.rb CHANGED
@@ -40,8 +40,8 @@ module Buoys
40
40
  end
41
41
  alias parent pre_buoy
42
42
 
43
- def method_missing(method, *args, &block)
44
- context.send(method, *args, &block)
43
+ def method_missing(method, *args, **kwargs, &block)
44
+ context.send(method, *args, **kwargs, &block)
45
45
  end
46
46
  end
47
47
  end
data/lib/buoys/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Buoys
4
- VERSION = '2.0.1'.freeze
4
+ VERSION = '2.0.2'.freeze
5
5
  end
@@ -33,4 +33,16 @@ class BuoysBuoyTest < ActiveSupport::TestCase
33
33
  assert_equal links[0].text, 'Account'
34
34
  assert_equal links[0].url, 'http://example.com/account'
35
35
  end
36
+
37
+ test 'delegate unknown methods to view context' do
38
+ def @view_context.hello(arg, kwarg:, &block)
39
+ [arg, kwarg, block]
40
+ end
41
+
42
+ arg, kwarg, block = Buoys::Buoy.new(@view_context, :account).hello('hello', kwarg: ',') { 'world' }
43
+
44
+ assert_equal arg, 'hello'
45
+ assert_equal kwarg, ','
46
+ assert_equal block.call, 'world'
47
+ end
36
48
  end
data/test/dummy/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require File.expand_path('../config/application', __FILE__)
4
+ require_relative 'config/application'
5
5
 
6
6
  Rails.application.load_tasks
@@ -1 +1,3 @@
1
- {}
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -5,9 +5,11 @@
5
5
  // or any plugin's 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
- // compiled file.
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
9
  //
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
+ //= require rails-ujs
14
+ //= require activestorage
13
15
  //= require_tree .
@@ -0,0 +1,13 @@
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.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
@@ -6,9 +6,9 @@
6
6
  * or any plugin's 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
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
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
12
  *
13
13
  *= require_tree .
14
14
  *= require_self
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -1,7 +1,2 @@
1
- # frozen_string_literal: true
2
-
3
1
  class ApplicationController < ActionController::Base
4
- # Prevent CSRF attacks by raising an exception.
5
- # For APIs, you may want to use :null_session instead.
6
- protect_from_forgery with: :exception
7
2
  end
@@ -1,4 +1,2 @@
1
- # frozen_string_literal: true
2
-
3
1
  module ApplicationHelper
4
2
  end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -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,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Item < ActiveRecord::Base
3
+ class Item < ApplicationRecord
4
4
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class User < ActiveRecord::Base
3
+ class User < ApplicationRecord
4
4
  end
@@ -1,14 +1,15 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
10
7
 
11
- <%= yield %>
8
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
+ <%= javascript_include_tag 'application' %>
10
+ </head>
12
11
 
13
- </body>
12
+ <body>
13
+ <%= yield %>
14
+ </body>
14
15
  </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
  load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
data/test/dummy/bin/setup CHANGED
@@ -1,29 +1,36 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
2
+ require 'fileutils'
3
+ include FileUtils
3
4
 
4
5
  # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+ APP_ROOT = File.expand_path('..', __dir__)
6
7
 
7
- Dir.chdir APP_ROOT do
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
8
13
  # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
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')
10
19
 
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
14
22
 
15
23
  # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
24
+ # unless File.exist?('config/database.yml')
25
+ # cp 'config/database.yml.sample', 'config/database.yml'
18
26
  # end
19
27
 
20
28
  puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
29
+ system! 'bin/rails db:setup'
22
30
 
23
31
  puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
32
+ system! 'bin/rails log:clear tmp:clear'
26
33
 
27
34
  puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
35
+ system! 'bin/rails restart'
29
36
  end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a way to update your development environment automatically.
14
+ # Add necessary update 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 if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ puts "\n== Updating database =="
24
+ system! 'bin/rails db:migrate'
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! 'bin/rails log:clear tmp:clear'
28
+
29
+ puts "\n== Restarting application server =="
30
+ system! 'bin/rails restart'
31
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ begin
5
+ exec "yarnpkg", *ARGV
6
+ rescue Errno::ENOENT
7
+ $stderr.puts "Yarn executable was not detected in the system."
8
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
+ exit 1
10
+ end
11
+ end
@@ -1,31 +1,19 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path('../boot', __FILE__)
1
+ require_relative 'boot'
4
2
 
5
3
  require 'rails/all'
6
4
 
7
5
  Bundler.require(*Rails.groups)
8
- require 'buoys'
6
+ require "buoys"
9
7
 
10
8
  module Dummy
11
9
  class Application < Rails::Application
12
- # Settings in config/environments/* take precedence over those specified here.
13
- # Application configuration should go into files in config/initializers
14
- # -- all .rb files in that directory are automatically loaded.
15
-
16
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
17
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
18
- # config.time_zone = 'Central Time (US & Canada)'
10
+ # Initialize configuration defaults for originally generated Rails version.
11
+ config.load_defaults 5.2
19
12
 
20
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
21
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
22
- # config.i18n.default_locale = :de
23
- config.i18n.default_locale = :en
24
-
25
- # Do not swallow errors in after_commit/after_rollback callbacks.
26
- if Gem::Version.new(Rails.version) >= Gem::Version.new('4.2.0') &&
27
- Gem::Version.new(Rails.version) <= Gem::Version.new('5.0.0')
28
- config.active_record.raise_in_transactional_callbacks = true
29
- end
13
+ # Settings in config/environments/* take precedence over those specified here.
14
+ # Application configuration can go into files in config/initializers
15
+ # -- all .rb files in that directory are automatically loaded after loading
16
+ # the framework and any gems in your application.
30
17
  end
31
18
  end
19
+
@@ -1,7 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
5
3
 
6
4
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
7
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
5
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: dummy_production
@@ -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:
@@ -1,7 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Load the Rails application.
4
- require File.expand_path('../application', __FILE__)
2
+ require_relative 'application'
5
3
 
6
4
  # Initialize the Rails application.
7
5
  Rails.application.initialize!
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  Rails.application.configure do
4
2
  # Settings specified here will take precedence over those in config/application.rb.
5
3
 
@@ -11,33 +9,53 @@ Rails.application.configure do
11
9
  # Do not eager load code on boot.
12
10
  config.eager_load = false
13
11
 
14
- # Show full error reports and disable caching.
15
- config.consider_all_requests_local = true
16
- config.action_controller.perform_caching = false
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ # Run rails dev:cache to toggle caching.
17
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
18
+ config.action_controller.perform_caching = true
19
+
20
+ config.cache_store = :memory_store
21
+ config.public_file_server.headers = {
22
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23
+ }
24
+ else
25
+ config.action_controller.perform_caching = false
26
+
27
+ config.cache_store = :null_store
28
+ end
29
+
30
+ # Store uploaded files on the local file system (see config/storage.yml for options)
31
+ config.active_storage.service = :local
17
32
 
18
33
  # Don't care if the mailer can't send.
19
34
  config.action_mailer.raise_delivery_errors = false
20
35
 
36
+ config.action_mailer.perform_caching = false
37
+
21
38
  # Print deprecation notices to the Rails logger.
22
39
  config.active_support.deprecation = :log
23
40
 
24
41
  # Raise an error on page load if there are pending migrations.
25
42
  config.active_record.migration_error = :page_load
26
43
 
44
+ # Highlight code that triggered database queries in logs.
45
+ config.active_record.verbose_query_logs = true
46
+
27
47
  # Debug mode disables concatenation and preprocessing of assets.
28
48
  # This option may cause significant delays in view rendering with a large
29
49
  # number of complex assets.
30
50
  config.assets.debug = true
31
51
 
32
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
33
- # yet still be able to expire them through the digest params.
34
- config.assets.digest = true
35
-
36
- # Adds additional error checking when serving assets at runtime.
37
- # Checks for improperly declared sprockets dependencies.
38
- # Raises helpful error messages.
39
- config.assets.raise_runtime_errors = true
52
+ # Suppress logger output for asset requests.
53
+ config.assets.quiet = true
40
54
 
41
55
  # Raises error for missing translations
42
56
  # config.action_view.raise_on_missing_translations = true
57
+
58
+ # Use an evented file watcher to asynchronously detect changes in source code,
59
+ # routes, locales, etc. This feature depends on the listen gem.
60
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
43
61
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  Rails.application.configure do
4
2
  # Settings specified here will take precedence over those in config/application.rb.
5
3
 
@@ -16,15 +14,13 @@ Rails.application.configure do
16
14
  config.consider_all_requests_local = false
17
15
  config.action_controller.perform_caching = true
18
16
 
19
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
20
- # Add `rack-cache` to your Gemfile before enabling this.
21
- # For large-scale production use, consider using a caching reverse proxy like
22
- # NGINX, varnish or squid.
23
- # config.action_dispatch.rack_cache = true
17
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19
+ # config.require_master_key = true
24
20
 
25
21
  # Disable serving static files from the `/public` folder by default since
26
22
  # Apache or NGINX already handles this.
27
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
23
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
24
 
29
25
  # Compress JavaScripts and CSS.
30
26
  config.assets.js_compressor = :uglifier
@@ -33,16 +29,23 @@ Rails.application.configure do
33
29
  # Do not fallback to assets pipeline if a precompiled asset is missed.
34
30
  config.assets.compile = false
35
31
 
36
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
37
- # yet still be able to expire them through the digest params.
38
- config.assets.digest = true
39
-
40
32
  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
41
33
 
34
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
35
+ # config.action_controller.asset_host = 'http://assets.example.com'
36
+
42
37
  # Specifies the header that your server uses for sending files.
43
38
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
44
39
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
45
40
 
41
+ # Store uploaded files on the local file system (see config/storage.yml for options)
42
+ config.active_storage.service = :local
43
+
44
+ # Mount Action Cable outside main process or domain
45
+ # config.action_cable.mount_path = nil
46
+ # config.action_cable.url = 'wss://example.com/cable'
47
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
48
+
46
49
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
47
50
  # config.force_ssl = true
48
51
 
@@ -51,16 +54,16 @@ Rails.application.configure do
51
54
  config.log_level = :debug
52
55
 
53
56
  # Prepend all log lines with the following tags.
54
- # config.log_tags = [ :subdomain, :uuid ]
55
-
56
- # Use a different logger for distributed setups.
57
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
57
+ config.log_tags = [ :request_id ]
58
58
 
59
59
  # Use a different cache store in production.
60
60
  # config.cache_store = :mem_cache_store
61
61
 
62
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
63
- # config.action_controller.asset_host = 'http://assets.example.com'
62
+ # Use a real queuing backend for Active Job (and separate queues per environment)
63
+ # config.active_job.queue_adapter = :resque
64
+ # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
65
+
66
+ config.action_mailer.perform_caching = false
64
67
 
65
68
  # Ignore bad email addresses and do not raise email delivery errors.
66
69
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -76,6 +79,16 @@ Rails.application.configure do
76
79
  # Use default logging formatter so that PID and timestamp are not suppressed.
77
80
  config.log_formatter = ::Logger::Formatter.new
78
81
 
82
+ # Use a different logger for distributed setups.
83
+ # require 'syslog/logger'
84
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
85
+
86
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
87
+ logger = ActiveSupport::Logger.new(STDOUT)
88
+ logger.formatter = config.log_formatter
89
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
90
+ end
91
+
79
92
  # Do not dump schema after migrations.
80
93
  config.active_record.dump_schema_after_migration = false
81
94
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  Rails.application.configure do
4
2
  # Settings specified here will take precedence over those in config/application.rb.
5
3
 
@@ -14,14 +12,11 @@ Rails.application.configure do
14
12
  # preloads Rails for running tests, you may have to set it to true.
15
13
  config.eager_load = false
16
14
 
17
- # Configure static file server for tests with Cache-Control for performance.
18
- if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0.0')
19
- config.public_file_server.enabled = true
20
- config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
21
- else
22
- config.serve_static_files = true
23
- config.static_cache_control = 'public, max-age=3600'
24
- end
15
+ # Configure public file server for tests with Cache-Control for performance.
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = {
18
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19
+ }
25
20
 
26
21
  # Show full error reports and disable caching.
27
22
  config.consider_all_requests_local = true
@@ -33,14 +28,16 @@ Rails.application.configure do
33
28
  # Disable request forgery protection in test environment.
34
29
  config.action_controller.allow_forgery_protection = false
35
30
 
31
+ # Store uploaded files on the local file system in a temporary directory
32
+ config.active_storage.service = :test
33
+
34
+ config.action_mailer.perform_caching = false
35
+
36
36
  # Tell Action Mailer not to deliver emails to the real world.
37
37
  # The :test delivery method accumulates sent emails in the
38
38
  # ActionMailer::Base.deliveries array.
39
39
  config.action_mailer.delivery_method = :test
40
40
 
41
- # Randomize the order test cases are executed.
42
- config.active_support.test_order = :random
43
-
44
41
  # Print deprecation notices to the stderr.
45
42
  config.active_support.deprecation = :stderr
46
43
 
@@ -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