Skip to content

Commit

Permalink
Rails 6.0 beta support
Browse files Browse the repository at this point in the history
Changes:

1. Fixes to the multi-threaded collection renderer.
2. Removes dev dependency on `factory_bot_rails`, instead using plain
   `factory_bot` (as we don't need reloading support anyway).
3. Uses git versions of `roadie-rails` and `rspec-rails` for Rails 6
   beta for now.

Fixes #801
Refs #800
  • Loading branch information
glebm committed Mar 31, 2019
1 parent 7781837 commit 91fd567
Show file tree
Hide file tree
Showing 14 changed files with 226 additions and 106 deletions.
82 changes: 59 additions & 23 deletions .travis.yml
@@ -1,22 +1,71 @@
language: ruby
dist: xenial
sudo: false
rvm:
- 2.3.8

addons:
apt:
packages:
- chromium-browser

before_install:
# Rails 4.x requires bundler version < 2.0.
- >
if [[ $BUNDLE_GEMFILE == "${PWD}/spec/gemfiles/rails_4_2.gemfile" ]]; then
"find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
gem install bundler --version='~> 1.17'
bundler --version
fi
- script/travis-downgrade-bundler-on-old-rails.sh

matrix:
include:
- gemfile: spec/gemfiles/rails_4_2.gemfile
rvm: 2.3.8
env: DB=sqlite3
- gemfile: spec/gemfiles/rails_4_2.gemfile
rvm: 2.3.8
env: DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
services: mysql
- gemfile: spec/gemfiles/rails_4_2.gemfile
rvm: 2.3.8
env: DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
services: postgresql
- gemfile: spec/gemfiles/rails_5_0.gemfile
rvm: 2.3.8
env: DB=sqlite3
- gemfile: spec/gemfiles/rails_5_0.gemfile
rvm: 2.3.8
env: DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
services: mysql
- gemfile: spec/gemfiles/rails_5_0.gemfile
rvm: 2.3.8
env: DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
services: postgresql
- gemfile: spec/gemfiles/rails_5_1.gemfile
rvm: 2.3.8
env: DB=sqlite3
- gemfile: spec/gemfiles/rails_5_1.gemfile
rvm: 2.3.8
env: DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
services: mysql
- gemfile: spec/gemfiles/rails_5_1.gemfile
rvm: 2.3.8
env: DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
services: postgresql
- gemfile: spec/gemfiles/rails_5_2.gemfile
rvm: 2.3.8
env: DB=sqlite3
- gemfile: spec/gemfiles/rails_5_2.gemfile
rvm: 2.3.8
env: DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
services: mysql
- gemfile: spec/gemfiles/rails_5_2.gemfile
rvm: 2.3.8
env: DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
services: postgresql
- gemfile: spec/gemfiles/rails_6_0.gemfile
rvm: 2.5.5
env: DB=sqlite3
- gemfile: spec/gemfiles/rails_6_0.gemfile
rvm: 2.5.5
env: DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
services: mysql
- gemfile: spec/gemfiles/rails_6_0.gemfile
rvm: 2.5.5
env: DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
services: postgresql

cache:
bundler: true
Expand All @@ -28,23 +77,10 @@ cache:
- spec/dummy/tmp/cache/onebox-views

bundler_args: --path ../../vendor/bundle --without debug
gemfile:
- spec/gemfiles/rails_4_2.gemfile
- spec/gemfiles/rails_5_0.gemfile
- spec/gemfiles/rails_5_1.gemfile
- spec/gemfiles/rails_5_2.gemfile
env:
matrix:
# Username and password from http://docs.travis-ci.com/user/database-setup/
- DB=sqlite3
- DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
- DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
global:
- COVERAGE=1
- TRAVIS=1
services:
- postgresql
- mysql

before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
Expand Down
15 changes: 11 additions & 4 deletions Gemfile
Expand Up @@ -2,14 +2,21 @@

source 'https://rubygems.org'

# Rails 5
gem 'rails', '~> 5.2.2'
gem 'rails', '~> 6.0.0.beta3'
gem 'rails-i18n', '~> 6.0.0.beta1'

# https://github.com/rails/rails/blob/v5.2.2/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L12
gem 'sqlite3', '~> 1.3.6'
# https://github.com/rails/rails/blob/v6.0.0.beta3/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L12
gem 'sqlite3', '~> 1.3', '>= 1.3.6'

group :test do
gem 'rails-controller-testing'

# https://github.com/rspec/rspec-rails/issues/2103
gem 'rspec-rails', git: 'https://github.com/rspec/rspec-rails', branch: '4-0-dev'
gem 'rspec-core', git: 'https://github.com/rspec/rspec-core'
gem 'rspec-mocks', git: 'https://github.com/rspec/rspec-mocks'
gem 'rspec-support', git: 'https://github.com/rspec/rspec-support'
gem 'rspec-expectations', git: 'https://github.com/rspec/rspec-expectations'
end

gemspec
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/thredded/post_common.rb
Expand Up @@ -23,7 +23,7 @@ module PostCommon
result = all
ActiveRecord::Associations::Preloader.new.preload(
result.map(&:postable), :first_post,
Thredded::Post.where(<<~SQL.delete("\n"))
unscoped.where(<<~SQL.delete("\n"))
#{posts_table_name}.created_at = (
SELECT MAX(p2.created_at) from #{posts_table_name} p2 WHERE p2.postable_id = #{posts_table_name}.postable_id)
SQL
Expand Down
10 changes: 8 additions & 2 deletions db/upgrade_migrations/20170125033319_upgrade_v0_9_to_v0_10.rb
Expand Up @@ -4,10 +4,16 @@

class UpgradeV09ToV010 < Thredded::BaseMigration
def up
remove_foreign_key :thredded_messageboard_users, :thredded_messageboards
if respond_to?(:foreign_key_exists?)
if foreign_key_exists?(:thredded_messageboard_users, :thredded_messageboards)
remove_foreign_key :thredded_messageboard_users, :thredded_messageboards
end
if foreign_key_exists?(:thredded_messageboard_users, :thredded_user_details)
remove_foreign_key :thredded_messageboard_users, :thredded_user_details
end
end
add_foreign_key :thredded_messageboard_users, :thredded_messageboards,
column: :thredded_messageboard_id, on_delete: :cascade
remove_foreign_key :thredded_messageboard_users, :thredded_user_details
add_foreign_key :thredded_messageboard_users, :thredded_user_details,
column: :thredded_user_detail_id, on_delete: :cascade

Expand Down
13 changes: 8 additions & 5 deletions heroku.gemfile
@@ -1,13 +1,13 @@
# frozen_string_literal: true

source 'https://rubygems.org'
ruby '2.5.3'
ruby '2.5.5'

gem 'thredded', path: File.dirname(__FILE__)

gem 'mustache'

gem 'rails', '~> 5.2.0'
gem 'rails', '~> 6.0.0.beta3'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
Expand All @@ -16,12 +16,15 @@ gem 'uglifier'
gem 'puma'
gem 'pg'
gem 'rails_email_preview', '>= 2.2.1'
gem 'roadie-rails'

# https://github.com/Mange/roadie-rails/pull/88
gem 'roadie-rails', git: 'https://github.com/glebm/roadie-rails', branch: 'patch-2'

gem 'turbolinks'
gem 'rails-i18n'
gem 'rails-i18n', '~> 6.0.0.beta1'
gem 'kaminari-i18n'
gem 'http_accept_language'
gem 'factory_bot_rails'
gem 'factory_bot'
gem 'faker', '>= 1.6.2'
gem 'twemoji'

Expand Down

0 comments on commit 91fd567

Please sign in to comment.