Skip to content

Commit cc54b7c

Browse files
authored
Merge pull request #85 from AlchemyCMS/test-with-rails-6
Test with rails 6
2 parents 4fe8f82 + a7e429f commit cc54b7c

12 files changed

Lines changed: 64 additions & 41 deletions

File tree

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
language: ruby
2-
dist: trusty
2+
dist: bionic
3+
services:
4+
- mysql
5+
addons:
6+
postgresql: "10"
37
sudo: false
48
cache: bundler
59
rvm:
6-
- 2.4.5
7-
- 2.5.5
8-
- 2.6.2
10+
- 2.5.5
11+
- 2.6.3
912
branches:
1013
only:
1114
- master

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ source "https://rubygems.org"
22

33
gemspec
44

5-
gem 'rails', ['>= 5.2.1.1', '< 5.3']
5+
gem 'rails', '~> 6.0.0'
66
gem 'alchemy_cms', github: 'AlchemyCMS/alchemy_cms', branch: 'master'
77
gem 'sassc-rails'
8+
gem 'awesome_nested_set', github: 'collectiveidea/awesome_nested_set'
89

910
unless ENV['CI']
1011
gem 'pry'

alchemy-devise.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121
s.add_development_dependency "capybara"
2222
s.add_development_dependency "factory_bot_rails"
2323
s.add_development_dependency "rspec-activemodel-mocks", "~> 1.0"
24-
s.add_development_dependency "rspec-rails", "~> 3.1"
24+
s.add_development_dependency "rspec-rails", "~> 4.0.0.beta2"
2525

2626
s.post_install_message =<<-MSG
2727
In order to complete the installation or the upgrade of Alchemy::Devise run:

spec/dummy/bin/setup

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env ruby
22
require 'fileutils'
3-
include FileUtils
43

54
# path to your application root.
65
APP_ROOT = File.expand_path('..', __dir__)
@@ -9,24 +8,22 @@ def system!(*args)
98
system(*args) || abort("\n== Command #{args} failed ==")
109
end
1110

12-
chdir APP_ROOT do
13-
# This script is a starting point to setup your application.
11+
FileUtils.chdir APP_ROOT do
12+
# This script is a way to setup or update your development environment automatically.
13+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
1414
# Add necessary setup steps to this file.
1515

1616
puts '== Installing dependencies =='
1717
system! 'gem install bundler --conservative'
1818
system('bundle check') || system!('bundle install')
1919

20-
# Install JavaScript dependencies if using Yarn
21-
# system('bin/yarn')
22-
2320
# puts "\n== Copying sample files =="
2421
# unless File.exist?('config/database.yml')
25-
# cp 'config/database.yml.sample', 'config/database.yml'
22+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
2623
# end
2724

2825
puts "\n== Preparing database =="
29-
system! 'bin/rails db:setup'
26+
system! 'bin/rails db:prepare'
3027

3128
puts "\n== Removing old logs and tempfiles =="
3229
system! 'bin/rails log:clear tmp:clear'

spec/dummy/config/application.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# require "active_storage/engine"
99
require "action_controller/railtie"
1010
require "action_mailer/railtie"
11+
# require "action_mailbox/engine"
12+
# require "action_text/engine"
1113
require "action_view/railtie"
1214
# require "action_cable/engine"
1315
require "sprockets/railtie"
@@ -21,7 +23,7 @@
2123
module Dummy
2224
class Application < Rails::Application
2325
# Initialize configuration defaults for originally generated Rails version.
24-
config.load_defaults 5.2
26+
config.load_defaults 6.0
2527

2628
# Settings in config/environments/* take precedence over those specified here.
2729
# Application configuration can go into files in config/initializers

spec/dummy/config/environments/development.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# Run rails dev:cache to toggle caching.
1717
if Rails.root.join('tmp', 'caching-dev.txt').exist?
1818
config.action_controller.perform_caching = true
19+
config.action_controller.enable_fragment_cache_logging = true
1920

2021
config.cache_store = :memory_store
2122
config.public_file_server.headers = {
@@ -27,9 +28,6 @@
2728
config.cache_store = :null_store
2829
end
2930

30-
# Store uploaded files on the local file system (see config/storage.yml for options)
31-
# config.active_storage.service = :local
32-
3331
# Don't care if the mailer can't send.
3432
config.action_mailer.raise_delivery_errors = false
3533

@@ -52,7 +50,7 @@
5250
# Suppress logger output for asset requests.
5351
config.assets.quiet = true
5452

55-
# Raises error for missing translations
53+
# Raises error for missing translations.
5654
# config.action_view.raise_on_missing_translations = true
5755

5856
# Use an evented file watcher to asynchronously detect changes in source code,

spec/dummy/config/environments/production.rb

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,19 @@
2222
# Apache or NGINX already handles this.
2323
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
2424

25-
# Compress JavaScripts and CSS.
26-
config.assets.js_compressor = :uglifier
25+
# Compress CSS using a preprocessor.
2726
# config.assets.css_compressor = :sass
2827

2928
# Do not fallback to assets pipeline if a precompiled asset is missed.
3029
config.assets.compile = false
3130

32-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
33-
3431
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
3532
# config.action_controller.asset_host = 'http://assets.example.com'
3633

3734
# Specifies the header that your server uses for sending files.
3835
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
3936
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
4037

41-
# Store uploaded files on the local file system (see config/storage.yml for options)
42-
# config.active_storage.service = :local
43-
4438
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
4539
# config.force_ssl = true
4640

@@ -54,9 +48,9 @@
5448
# Use a different cache store in production.
5549
# config.cache_store = :mem_cache_store
5650

57-
# Use a real queuing backend for Active Job (and separate queues per environment)
51+
# Use a real queuing backend for Active Job (and separate queues per environment).
5852
# config.active_job.queue_adapter = :resque
59-
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
53+
# config.active_job.queue_name_prefix = "dummy_production"
6054

6155
config.action_mailer.perform_caching = false
6256

@@ -86,4 +80,25 @@
8680

8781
# Do not dump schema after migrations.
8882
config.active_record.dump_schema_after_migration = false
83+
84+
# Inserts middleware to perform automatic connection switching.
85+
# The `database_selector` hash is used to pass options to the DatabaseSelector
86+
# middleware. The `delay` is used to determine how long to wait after a write
87+
# to send a subsequent read to the primary.
88+
#
89+
# The `database_resolver` class is used by the middleware to determine which
90+
# database is appropriate to use based on the time delay.
91+
#
92+
# The `database_resolver_context` class is used by the middleware to set
93+
# timestamps for the last write to the primary. The resolver uses the context
94+
# class timestamps to determine how long to wait before reading from the
95+
# replica.
96+
#
97+
# By default Rails will store a last write timestamp in the session. The
98+
# DatabaseSelector middleware is designed as such you can define your own
99+
# strategy for connection switching and pass that into the middleware through
100+
# these configuration options.
101+
# config.active_record.database_selector = { delay: 2.seconds }
102+
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
103+
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
89104
end

spec/dummy/config/environments/test.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
# The test environment is used exclusively to run your application's
2+
# test suite. You never need to work with it otherwise. Remember that
3+
# your test database is "scratch space" for the test suite and is wiped
4+
# and recreated between test runs. Don't rely on the data there!
5+
16
Rails.application.configure do
27
# Settings specified here will take precedence over those in config/application.rb.
38

4-
# The test environment is used exclusively to run your application's
5-
# test suite. You never need to work with it otherwise. Remember that
6-
# your test database is "scratch space" for the test suite and is wiped
7-
# and recreated between test runs. Don't rely on the data there!
89
config.cache_classes = true
910

1011
# Do not eager load code on boot. This avoids loading your whole application
@@ -21,6 +22,7 @@
2122
# Show full error reports and disable caching.
2223
config.consider_all_requests_local = true
2324
config.action_controller.perform_caching = false
25+
config.cache_store = :null_store
2426

2527
# Raise exceptions instead of rendering exception templates.
2628
config.action_dispatch.show_exceptions = false
@@ -38,6 +40,6 @@
3840
# Print deprecation notices to the stderr.
3941
config.active_support.deprecation = :stderr
4042

41-
# Raises error for missing translations
43+
# Raises error for missing translations.
4244
# config.action_view.raise_on_missing_translations = true
4345
end

spec/dummy/config/initializers/assets.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
# Add additional assets to the asset load path.
77
# Rails.application.config.assets.paths << Emoji.images_path
8-
# Add Yarn node_modules folder to the asset load path.
9-
Rails.application.config.assets.paths << Rails.root.join('node_modules')
108

119
# Precompile additional assets.
1210
# application.js, application.css, and all non-JS/CSS in the app/assets

spec/dummy/config/initializers/content_security_policy.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
# If you are using UJS then enable automatic nonce generation
2020
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
2121

22+
# Set the nonce only to specific directives
23+
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
24+
2225
# Report CSP violations to a specified URI
2326
# For further information see the following documentation:
2427
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only

0 commit comments

Comments
 (0)