Skip to content

Commit

Permalink
Merge pull request #6 from blocknotes/update_for_rails_61
Browse files Browse the repository at this point in the history
Update to support Rails 6.1
  • Loading branch information
blocknotes authored Apr 5, 2021
2 parents f2e9352 + 70b0819 commit 13a335c
Show file tree
Hide file tree
Showing 25 changed files with 179 additions and 75 deletions.
15 changes: 15 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fail_on_violations: true

eslint:
config_file: .eslintrc.json
enabled: true

jshint:
enabled: false

rubocop:
config_file: .rubocop.yml
version: 0.91.0

scss:
enabled: false
28 changes: 14 additions & 14 deletions active_storage_db.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ Gem::Specification.new do |spec|

spec.files = Dir["{app,config,db,lib}/**/*", 'MIT-LICENSE', 'Rakefile', 'README.md']

spec.add_dependency 'activestorage', '~> 6.0.0'
spec.add_dependency 'rails', '~> 6.0.0'
spec.add_dependency 'activestorage', '~> 6.0'
spec.add_dependency 'rails', '~> 6.0'

spec.add_development_dependency 'capybara', '~> 3.33.0'
spec.add_development_dependency 'database_cleaner-active_record', '~> 1.8.0'
spec.add_development_dependency 'factory_bot_rails', '~> 6.1.0'
spec.add_development_dependency 'mysql2', '~> 0.5.3'
spec.add_development_dependency 'pg', '~> 1.2.3'
spec.add_development_dependency 'pry', '~> 0.13.1'
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
spec.add_development_dependency 'rspec-rails', '~> 4.0.1'
spec.add_development_dependency 'rubocop', '~> 0.89.0'
spec.add_development_dependency 'rubocop-rspec', '~> 1.42.0'
spec.add_development_dependency 'selenium-webdriver', '~> 3.142.7'
spec.add_development_dependency 'simplecov', '~> 0.18.5'
spec.add_development_dependency 'capybara', '~> 3.33'
spec.add_development_dependency 'database_cleaner-active_record', '~> 1.8'
spec.add_development_dependency 'factory_bot_rails', '~> 6.1'
spec.add_development_dependency 'mysql2', '~> 0.5'
spec.add_development_dependency 'pg', '~> 1.2'
spec.add_development_dependency 'pry', '~> 0.13'
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
spec.add_development_dependency 'rspec-rails', '~> 4.0'
spec.add_development_dependency 'rubocop', '~> 0.89'
spec.add_development_dependency 'rubocop-rspec', '~> 1.42'
spec.add_development_dependency 'selenium-webdriver', '~> 3.142'
spec.add_development_dependency 'simplecov', '~> 0.18'
end
1 change: 0 additions & 1 deletion spec/dummy/.ruby-version

This file was deleted.

1 change: 0 additions & 1 deletion spec/dummy/.tool-versions

This file was deleted.

2 changes: 1 addition & 1 deletion spec/dummy/Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative 'config/application'
require_relative "config/application"

Rails.application.load_tasks
3 changes: 2 additions & 1 deletion spec/dummy/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
<html>
<head>
<title>Dummy</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= stylesheet_link_tag 'application', media: 'all' %>
<%= stylesheet_link_tag 'application', media: 'all' %>
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
require_relative "../config/boot"
require "rails/commands"
4 changes: 2 additions & 2 deletions spec/dummy/bin/rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
require_relative "../config/boot"
require "rake"
Rake.application.run
6 changes: 3 additions & 3 deletions spec/dummy/bin/setup
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
require 'fileutils'
require "fileutils"

# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
Expand All @@ -9,8 +9,8 @@ def system!(*args)
end

FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.

puts '== Installing dependencies =='
Expand Down
3 changes: 2 additions & 1 deletion spec/dummy/config.ru
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is used by Rack-based servers to start the application.

require_relative 'config/environment'
require_relative "config/environment"

run Rails.application
Rails.application.load_server
23 changes: 13 additions & 10 deletions spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
require_relative 'boot'
require_relative "boot"

require 'rails/all'
require "rails/all"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
require 'active_storage_db'
require "active_storage_db"

module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
config.load_defaults Rails::VERSION::STRING.to_f

# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
end
end

2 changes: 1 addition & 1 deletion spec/dummy/config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)

require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
2 changes: 1 addition & 1 deletion spec/dummy/config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Load the Rails application.
require_relative 'application'
require_relative "application"

# Initialize the Rails application.
Rails.application.initialize!
20 changes: 17 additions & 3 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 Down Expand Up @@ -39,6 +41,12 @@
# 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

Expand All @@ -54,9 +62,15 @@
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

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
end
18 changes: 13 additions & 5 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 Down Expand Up @@ -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 @@ -46,9 +48,9 @@
# 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 ]
Expand All @@ -73,11 +75,17 @@
# 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?
Expand Down
16 changes: 13 additions & 3 deletions 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 All @@ -6,8 +8,7 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

config.cache_classes = false
config.action_view.cache_template_loading = true
config.cache_classes = true

# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
Expand Down Expand Up @@ -44,6 +45,15 @@
# 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

# 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
@@ -1,7 +1,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"]
4 changes: 3 additions & 1 deletion spec/dummy/config/initializers/filter_parameter_logging.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,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
7 changes: 6 additions & 1 deletion spec/dummy/config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
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 }
port ENV.fetch("PORT") { 3000 }

# Specifies the `environment` that Puma will run in.
#
Expand Down
6 changes: 0 additions & 6 deletions spec/dummy/config/spring.rb

This file was deleted.

27 changes: 27 additions & 0 deletions spec/dummy/config/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,30 @@ local:

db:
service: DB

# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket

# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket

# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name

# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]
Loading

0 comments on commit 13a335c

Please sign in to comment.