Skip to content

Commit

Permalink
Merge pull request #2047 from robinboening/rails_6_1
Browse files Browse the repository at this point in the history
Add Rails 6.1 support
  • Loading branch information
tvdeyen committed Sep 12, 2021
2 parents a47099a + ac63b67 commit f309703
Show file tree
Hide file tree
Showing 23 changed files with 165 additions and 70 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
matrix:
rails:
- '6.0'
- '6.1'
ruby:
- '2.6.6'
- '2.7.2'
- '3.0.0'
- '2.6.8'
- '2.7.4'
- '3.0.2'
database:
- mysql
- postgresql
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source "https://rubygems.org"

gemspec

rails_version = ENV.fetch("RAILS_VERSION", 6.0).to_f
rails_version = ENV.fetch("RAILS_VERSION", 6.1).to_f
gem "rails", "~> #{rails_version}.0"

if ENV["DB"].nil? || ENV["DB"] == "sqlite"
Expand Down
2 changes: 1 addition & 1 deletion alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
activesupport
railties
].each do |rails_gem|
gem.add_runtime_dependency rails_gem, [">= 6.0", "< 6.1"]
gem.add_runtime_dependency rails_gem, [">= 6.0", "< 6.2"]
end

gem.add_runtime_dependency "active_model_serializers", ["~> 0.10.0"]
Expand Down
2 changes: 2 additions & 0 deletions spec/dummy/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
# This file is used by Rack-based servers to start the application.

require_relative "config/environment"

run Rails.application
Rails.application.load_server
2 changes: 1 addition & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
if config.respond_to?(:load_defaults)
config.load_defaults ENV["RAILS_VERSION"] || 6.0
config.load_defaults ENV["RAILS_VERSION"] || 6.1
end

# Settings in config/environments/* take precedence over those specified here.
Expand Down
4 changes: 3 additions & 1 deletion spec/dummy/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ postgresql: &postgresql
defaults: &defaults
pool: 5
timeout: 5000
host: <%= ENV['DB_HOST'] || "localhost" %>
<% if ENV['DB_HOST'] %>
host: <%= ENV['DB_HOST'] %>
<% end %>
<<: *<%= ENV['DB'] || "sqlite" %>

development:
Expand Down
30 changes: 21 additions & 9 deletions spec/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require "active_support/core_ext/integer/time"

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

Expand All @@ -14,13 +16,13 @@

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
if Rails.root.join("tmp", "caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true

config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
"Cache-Control" => "public, max-age=#{2.days.to_i}",
}
else
config.action_controller.perform_caching = false
Expand All @@ -36,13 +38,17 @@
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise

# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

if ActiveRecord::Base.respond_to?(:verbose_query_logs=)
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
end
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
Expand All @@ -53,11 +59,17 @@
config.assets.quiet = true

# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
# config.i18n.raise_on_missing_translations = true

# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true

# 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.hosts << "alchemy.test"

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
end
28 changes: 18 additions & 10 deletions spec/dummy/config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "active_support/core_ext/integer/time"

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand All @@ -11,7 +13,7 @@
config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
Expand All @@ -20,7 +22,7 @@

# 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?
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?

# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
Expand All @@ -29,7 +31,7 @@
config.assets.compile = false

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# config.asset_host = 'http://assets.example.com'

# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
Expand All @@ -38,12 +40,12 @@
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
config.log_tags = [:request_id]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store
Expand All @@ -65,17 +67,23 @@
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify

# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log

# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

# Use a different logger for distributed setups.
# require 'syslog/logger'
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
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.
Expand Down
13 changes: 12 additions & 1 deletion spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "active_support/core_ext/integer/time"

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
Expand Down Expand Up @@ -40,8 +42,17 @@
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise

# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []

# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
# config.i18n.raise_on_missing_translations = true

config.active_job.queue_adapter = :test

# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
end
7 changes: 4 additions & 3 deletions spec/dummy/config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }

# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
23 changes: 10 additions & 13 deletions spec/dummy/config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https

# Specify URI for violation reports
# policy.report_uri "/csp-violation-report-endpoint"
if Rails.env.development?
policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035"
end
end
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end

# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
Expand Down
4 changes: 3 additions & 1 deletion spec/dummy/config/initializers/filter_parameter_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
# Be sure to restart your server when you modify this file.

# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
11 changes: 11 additions & 0 deletions spec/dummy/config/initializers/permissions_policy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# end
43 changes: 43 additions & 0 deletions spec/dummy/config/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Puma can serve each request in a thread from an internal thread pool.
# 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.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count

# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }

# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }

# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }

# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
14 changes: 7 additions & 7 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
Expand Down Expand Up @@ -33,7 +33,7 @@
t.integer "essence_id", null: false
t.integer "element_id", null: false
t.index ["element_id"], name: "index_alchemy_contents_on_element_id"
t.index ["essence_type", "essence_id"], name: "index_alchemy_contents_on_essence_type_and_essence_id", unique: true
t.index ["essence_type", "essence_id"], name: "index_alchemy_contents_on_essence", unique: true
end

create_table "alchemy_elements", force: :cascade do |t|
Expand Down Expand Up @@ -64,7 +64,7 @@
end

create_table "alchemy_essence_audios", force: :cascade do |t|
t.integer "attachment_id"
t.bigint "attachment_id"
t.boolean "controls", default: true, null: false
t.boolean "autoplay", default: false
t.boolean "loop", default: false, null: false
Expand Down Expand Up @@ -158,7 +158,7 @@
end

create_table "alchemy_essence_videos", force: :cascade do |t|
t.integer "attachment_id"
t.bigint "attachment_id"
t.string "width"
t.string "height"
t.boolean "allow_fullscreen", default: true, null: false
Expand All @@ -178,13 +178,13 @@
end

create_table "alchemy_ingredients", force: :cascade do |t|
t.integer "element_id", null: false
t.bigint "element_id", null: false
t.string "type", null: false
t.string "role", null: false
t.text "value"
t.json "data"
t.string "related_object_type"
t.integer "related_object_id"
t.bigint "related_object_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["element_id", "role"], name: "index_alchemy_ingredients_on_element_id_and_role", unique: true
Expand Down

0 comments on commit f309703

Please sign in to comment.