Skip to content

Commit

Permalink
Rails 6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmolnar committed Aug 20, 2019
1 parent 76d1a8d commit 18dbec7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
language: ruby
rvm:
- 2.5.1
- 2.4.4
- 2.3.7
- 2.2.10
- 2.5.3
- 2.6.0
services:
- postgresql
addons:
postgresql: 9.6
env:
- DB=postgresql
before_install:
- cp spec/config.travis.yml spec/config.yml
- psql -c 'create database textacular_test' -U postgres
- psql -c 'create database textacular_test' -U postgres -h localhost
script:
- bundle exec rake db:migrate
- bundle exec rake
Expand All @@ -17,3 +19,4 @@ gemfile:
- gemfiles/activerecord-5.0.gemfile
- gemfiles/activerecord-5.1.gemfile
- gemfiles/activerecord-5.2.gemfile
- gemfiles/activerecord-6.0.gemfile
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ source 'https://rubygems.org'

gemspec

gem 'activerecord', '~> 5.2.x'
git 'git://github.com/rails/rails.git', branch: 'master' do
gem 'activerecord'
end
14 changes: 10 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ namespace :db do

desc 'Run the test database migrations'
task :up => :'db:connect' do
migrations = if ActiveRecord.version.version >= '5.2'
ActiveRecord::Migration.new.migration_context.migrations
if ActiveRecord.version >= Gem::Version.new('6.0.0')
context = ActiveRecord::Migration.new.migration_context
migrations = context.migrations
schema_migration = context.schema_migration
elsif ActiveRecord.version >= Gem::Version.new('5.2')
migrations = ActiveRecord::Migration.new.migration_context.migrations
schema_migration = nil
else
ActiveRecord::Migrator.migrations('db/migrate')
migrations = ActiveRecord::Migrator.migrations('db/migrate')
schema_migration = nil
end
ActiveRecord::Migrator.new(:up, migrations, nil).migrate
ActiveRecord::Migrator.new(:up, migrations, schema_migration).migrate
end

desc 'Reverse the test database migrations'
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/activerecord-5.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source 'https://rubygems.org'

gemspec :path=>"../"

gem 'activerecord', '< 6.0', '>= 5.2'
gem 'activerecord', '< 6.0.0', '>= 5.2.0'
5 changes: 5 additions & 0 deletions gemfiles/activerecord-6.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gemspec :path=>"../"

gem 'activerecord', '< 6.1', '>= 6.0.0'
2 changes: 1 addition & 1 deletion textacular.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'pry-doc'
s.add_development_dependency 'byebug'

s.add_dependency('activerecord', [">= 5.0", "< 6.0"])
s.add_dependency('activerecord', [">= 5.0", "< 6.1"])
end

0 comments on commit 18dbec7

Please sign in to comment.