diff --git a/Gemfile b/Gemfile index e0dbd1f9..6e531d1e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' ruby '2.6.5' -gem 'rails', '5.0.7.2' +gem 'rails', '5.1.7' gem 'rake', '>= 10' gem 'pg', '~> 0.11' gem 'sprockets-rails', require: 'sprockets/railtie' diff --git a/Gemfile.lock b/Gemfile.lock index b0f615a1..9060228b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,27 +1,27 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.7.2) - actionpack (= 5.0.7.2) - nio4r (>= 1.2, < 3.0) + actioncable (5.1.7) + actionpack (= 5.1.7) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) + actionmailer (5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.7.2) - actionview (= 5.0.7.2) - activesupport (= 5.0.7.2) + actionpack (5.1.7) + actionview (= 5.1.7) + activesupport (= 5.1.7) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.7.2) - activesupport (= 5.0.7.2) + actionview (5.1.7) + activesupport (= 5.1.7) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) activeadmin (1.4.3) @@ -36,16 +36,16 @@ GEM ransack (>= 1.8.7) sass (~> 3.1) sprockets (< 4.1) - activejob (5.0.7.2) - activesupport (= 5.0.7.2) + activejob (5.1.7) + activesupport (= 5.1.7) globalid (>= 0.3.6) - activemodel (5.0.7.2) - activesupport (= 5.0.7.2) - activerecord (5.0.7.2) - activemodel (= 5.0.7.2) - activesupport (= 5.0.7.2) - arel (~> 7.0) - activesupport (5.0.7.2) + activemodel (5.1.7) + activesupport (= 5.1.7) + activerecord (5.1.7) + activemodel (= 5.1.7) + activesupport (= 5.1.7) + arel (~> 8.0) + activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -55,7 +55,7 @@ GEM arbre (1.3.0) activesupport (>= 3.0.0, < 6.1) ruby2_keywords (>= 0.0.2, < 1.0) - arel (7.1.4) + arel (8.0.0) bcrypt (3.1.16) builder (3.2.4) byebug (11.1.3) @@ -130,7 +130,7 @@ GEM eco-source execjs eco-source (1.1.0.rc.1) - erubis (2.7.0) + erubi (1.9.0) execjs (2.7.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -219,19 +219,19 @@ GEM puma (5.0.2) nio4r (~> 2.0) rack (2.2.3) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.7.2) - actioncable (= 5.0.7.2) - actionmailer (= 5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) - activemodel (= 5.0.7.2) - activerecord (= 5.0.7.2) - activesupport (= 5.0.7.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.1.7) + actioncable (= 5.1.7) + actionmailer (= 5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) + activemodel (= 5.1.7) + activerecord (= 5.1.7) + activesupport (= 5.1.7) bundler (>= 1.3.0) - railties (= 5.0.7.2) + railties (= 5.1.7) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -243,9 +243,9 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (5.0.7.2) - actionpack (= 5.0.7.2) - activesupport (= 5.0.7.2) + railties (5.1.7) + actionpack (= 5.1.7) + activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -360,7 +360,7 @@ DEPENDENCIES pry-byebug pry-rails puma - rails (= 5.0.7.2) + rails (= 5.1.7) rails_12factor rake (>= 10) rspec-rails (~> 4.0) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 99139f1e..15388ded 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,6 @@ class ApplicationController < ActionController::Base protect_from_forgery - before_filter :ensure_domain + before_action :ensure_domain APP_DOMAIN = 'cincyrb.com' def ensure_domain diff --git a/bin/setup b/bin/setup index e620b4da..78c4e861 100755 --- a/bin/setup +++ b/bin/setup @@ -18,6 +18,10 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # cp 'config/database.yml.sample', 'config/database.yml' diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 00000000..c2bacef8 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index e96a92cf..9a6172e5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,11 +8,11 @@ module Cincirb class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.1 + # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - - # Do not swallow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true end end diff --git a/config/cable.yml b/config/cable.yml index 0bbde6f7..8a813a93 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -7,3 +7,9 @@ test: production: adapter: redis url: redis://localhost:6379/1 + channel_prefix: cincirb_production + +staging: + adapter: redis + url: redis://localhost:6379/1 + channel_prefix: cincirb_staging diff --git a/config/environments/development.rb b/config/environments/development.rb index e64889cd..5187e221 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,7 +18,7 @@ config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=172800' + 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" } else config.action_controller.perform_caching = false @@ -50,5 +50,5 @@ # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. - # config.file_watcher = ActiveSupport::EventedFileUpdateChecker + config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index 913fda6e..65b0d1d0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,6 +14,11 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = true + # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? @@ -78,7 +83,7 @@ if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) + config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 913fda6e..65b0d1d0 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -14,6 +14,11 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = true + # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? @@ -78,7 +83,7 @@ if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) + config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. diff --git a/config/environments/test.rb b/config/environments/test.rb index 30587ef6..8e5cbde5 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -15,7 +15,7 @@ # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=3600' + 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" } # Show full error reports and disable caching. diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 01ef3e66..4b828e80 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,9 +3,12 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' -# Add additional assets to the asset load path +# Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -# Rails.application.config.assets.precompile += %w( search.js ) +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/mail.rb b/config/initializers/mail.rb index 44e62e90..918a52b0 100644 --- a/config/initializers/mail.rb +++ b/config/initializers/mail.rb @@ -1,9 +1,9 @@ ActionMailer::Base.smtp_settings = { - :address => 'smtp.sendgrid.net', - :port => '587', - :authentication => :plain, - :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_PASSWORD'], - :domain => 'cincyrb.com' + address: 'smtp.sendgrid.net', + port: '587', + authentication: :plain, + user_name: ENV['SENDGRID_USERNAME'], + password: ENV['SENDGRID_PASSWORD'], + domain: 'cincyrb.com' } ActionMailer::Base.delivery_method = :smtp diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb new file mode 100644 index 00000000..9010abd5 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Unknown asset fallback will return the path passed in when the given +# asset is not present in the asset pipeline. +# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/locales/en.yml b/config/locales/en.yml index 06539571..decc5a85 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,16 @@ # # This would use the information in config/locales/es.yml. # +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. diff --git a/config/puma.rb b/config/puma.rb index c7f311f8..1e19380d 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,13 +1,13 @@ # Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers a minimum and maximum. +# The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum, this matches the default thread size of Active Record. +# and maximum; this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads threads_count, threads_count -# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # port ENV.fetch("PORT") { 3000 } @@ -32,16 +32,25 @@ # # preload_app! +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker -# process is booted this block will be run, if you are using `preload_app!` -# option you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, Ruby +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby # cannot share connections between processes. # # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end +# # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart diff --git a/config/secrets.yml b/config/secrets.yml index 1bcfe932..bceb3194 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -10,17 +10,26 @@ # Make sure the secrets in this file are kept private # if you're sharing your code publicly. +# Shared secrets are available across all environments. + +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + development: secret_key_base: 53210391d4acb335a5a6f1b8f394758022eb52c7a8fe9e3086b72b22e68ff2ae1672a57ac9e46b9c05e25fffef5b9ffbe520cb62d9c011e7e0f686adfbe06c90 test: secret_key_base: 2849ddbc0719f6995d7bd77e9709e4c5345d8434fcba38d88850fb2054c27b1bcb96e304d2963fac7abf1feba923faeccb52fa928166f32ad9faca193d72fc41 -# Do not keep production secrets in the repository, -# instead read values from the environment. +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. -staging: +production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> -production: +staging: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/vendor/cache/actioncable-5.0.7.2.gem b/vendor/cache/actioncable-5.0.7.2.gem deleted file mode 100644 index 2a569250..00000000 Binary files a/vendor/cache/actioncable-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/actioncable-5.1.7.gem b/vendor/cache/actioncable-5.1.7.gem new file mode 100644 index 00000000..d10cd121 Binary files /dev/null and b/vendor/cache/actioncable-5.1.7.gem differ diff --git a/vendor/cache/actionmailer-5.0.7.2.gem b/vendor/cache/actionmailer-5.0.7.2.gem deleted file mode 100644 index 59161414..00000000 Binary files a/vendor/cache/actionmailer-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/actionmailer-5.1.7.gem b/vendor/cache/actionmailer-5.1.7.gem new file mode 100644 index 00000000..7d2279cb Binary files /dev/null and b/vendor/cache/actionmailer-5.1.7.gem differ diff --git a/vendor/cache/actionpack-5.0.7.2.gem b/vendor/cache/actionpack-5.0.7.2.gem deleted file mode 100644 index 87877f8d..00000000 Binary files a/vendor/cache/actionpack-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/actionpack-5.1.7.gem b/vendor/cache/actionpack-5.1.7.gem new file mode 100644 index 00000000..55da4996 Binary files /dev/null and b/vendor/cache/actionpack-5.1.7.gem differ diff --git a/vendor/cache/actionview-5.0.7.2.gem b/vendor/cache/actionview-5.0.7.2.gem deleted file mode 100644 index 72099a08..00000000 Binary files a/vendor/cache/actionview-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/actionview-5.1.7.gem b/vendor/cache/actionview-5.1.7.gem new file mode 100644 index 00000000..204bdf5c Binary files /dev/null and b/vendor/cache/actionview-5.1.7.gem differ diff --git a/vendor/cache/activejob-5.0.7.2.gem b/vendor/cache/activejob-5.0.7.2.gem deleted file mode 100644 index 82fb5371..00000000 Binary files a/vendor/cache/activejob-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/activejob-5.1.7.gem b/vendor/cache/activejob-5.1.7.gem new file mode 100644 index 00000000..2a9ecdaa Binary files /dev/null and b/vendor/cache/activejob-5.1.7.gem differ diff --git a/vendor/cache/activemodel-5.0.7.2.gem b/vendor/cache/activemodel-5.0.7.2.gem deleted file mode 100644 index 334d2775..00000000 Binary files a/vendor/cache/activemodel-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/activemodel-5.1.7.gem b/vendor/cache/activemodel-5.1.7.gem new file mode 100644 index 00000000..d158e897 Binary files /dev/null and b/vendor/cache/activemodel-5.1.7.gem differ diff --git a/vendor/cache/activerecord-5.0.7.2.gem b/vendor/cache/activerecord-5.0.7.2.gem deleted file mode 100644 index 9a788ab6..00000000 Binary files a/vendor/cache/activerecord-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/activerecord-5.1.7.gem b/vendor/cache/activerecord-5.1.7.gem new file mode 100644 index 00000000..9d955856 Binary files /dev/null and b/vendor/cache/activerecord-5.1.7.gem differ diff --git a/vendor/cache/activesupport-5.0.7.2.gem b/vendor/cache/activesupport-5.0.7.2.gem deleted file mode 100644 index 6e160aaf..00000000 Binary files a/vendor/cache/activesupport-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/activesupport-5.1.7.gem b/vendor/cache/activesupport-5.1.7.gem new file mode 100644 index 00000000..f49aefaf Binary files /dev/null and b/vendor/cache/activesupport-5.1.7.gem differ diff --git a/vendor/cache/arel-7.1.4.gem b/vendor/cache/arel-7.1.4.gem deleted file mode 100644 index 0298aa8f..00000000 Binary files a/vendor/cache/arel-7.1.4.gem and /dev/null differ diff --git a/vendor/cache/arel-8.0.0.gem b/vendor/cache/arel-8.0.0.gem new file mode 100644 index 00000000..ab78122e Binary files /dev/null and b/vendor/cache/arel-8.0.0.gem differ diff --git a/vendor/cache/erubi-1.9.0.gem b/vendor/cache/erubi-1.9.0.gem new file mode 100644 index 00000000..e169e658 Binary files /dev/null and b/vendor/cache/erubi-1.9.0.gem differ diff --git a/vendor/cache/erubis-2.7.0.gem b/vendor/cache/erubis-2.7.0.gem deleted file mode 100644 index 4acd2e76..00000000 Binary files a/vendor/cache/erubis-2.7.0.gem and /dev/null differ diff --git a/vendor/cache/rack-test-0.6.3.gem b/vendor/cache/rack-test-0.6.3.gem deleted file mode 100644 index 914afe94..00000000 Binary files a/vendor/cache/rack-test-0.6.3.gem and /dev/null differ diff --git a/vendor/cache/rack-test-1.1.0.gem b/vendor/cache/rack-test-1.1.0.gem new file mode 100644 index 00000000..3fb2d3a8 Binary files /dev/null and b/vendor/cache/rack-test-1.1.0.gem differ diff --git a/vendor/cache/rails-5.0.7.2.gem b/vendor/cache/rails-5.0.7.2.gem deleted file mode 100644 index a48d5ebb..00000000 Binary files a/vendor/cache/rails-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/rails-5.1.7.gem b/vendor/cache/rails-5.1.7.gem new file mode 100644 index 00000000..aa0102a4 Binary files /dev/null and b/vendor/cache/rails-5.1.7.gem differ diff --git a/vendor/cache/railties-5.0.7.2.gem b/vendor/cache/railties-5.0.7.2.gem deleted file mode 100644 index 7c607500..00000000 Binary files a/vendor/cache/railties-5.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/railties-5.1.7.gem b/vendor/cache/railties-5.1.7.gem new file mode 100644 index 00000000..e934881c Binary files /dev/null and b/vendor/cache/railties-5.1.7.gem differ