Skip to content

Commit 3e4ec04

Browse files
authored
Merge pull request #83 from ojab/rails-6
rails-6 support
2 parents 567ace9 + 24d5bc6 commit 3e4ec04

File tree

8 files changed

+53
-7
lines changed

8 files changed

+53
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/Gemfile.lock
22
/gemfiles/*.lock
3+
/gemfiles/.bundle
34
/*.gem
45
/pkg
56
/tmp

.travis.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
sudo: false
22
language: ruby
3+
services:
4+
- mysql
5+
- postgresql
36
env: DB_CONFIG=travis
47
rvm:
58
- 2.3.8
@@ -9,11 +12,18 @@ gemfile:
912
- gemfiles/activerecord_5.0.gemfile
1013
- gemfiles/activerecord_5.1.gemfile
1114
- gemfiles/activerecord_5.2.gemfile
15+
- gemfiles/activerecord_6.0.gemfile
1216
- gemfiles/activerecord_edge.gemfile
1317
matrix:
1418
exclude:
19+
- gemfile: gemfiles/activerecord_6.0.gemfile
20+
rvm: 2.3.8
21+
- gemfile: gemfiles/activerecord_6.0.gemfile
22+
rvm: 2.4.5
1523
- gemfile: gemfiles/activerecord_edge.gemfile
16-
rvm: 2.3.7
24+
rvm: 2.3.8
25+
- gemfile: gemfiles/activerecord_edge.gemfile
26+
rvm: 2.4.5
1727
allow_failures:
1828
- gemfile: gemfiles/activerecord_edge.gemfile
1929
bundler_args: --without development

Appraisals

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@ appraise "activerecord-5.2" do
1919
gem "sqlite3", "~> 1.3.6"
2020
end
2121

22+
appraise "activerecord-6.0" do
23+
gem "activerecord", "~> 6.0.0"
24+
gem "mysql2", "~> 0.4.10"
25+
gem "pg", ">= 0.18", "< 2.0"
26+
gem "sqlite3", "~> 1.4.0"
27+
end
28+
2229
appraise "activerecord-edge" do
2330
gem "arel", github: "rails/arel"
2431
gem "activerecord", github: "rails/rails"
2532
gem "mysql2", "~> 0.4.10"
2633
gem "pg", ">= 0.18", "< 2.0"
27-
gem "sqlite3", "~> 1.3.6"
34+
gem "sqlite3", "~> 1.4.0"
2835
end

gemfiles/activerecord_6.0.gemfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activerecord", "~> 6.0.0"
6+
gem "mysql2", "~> 0.4.10"
7+
gem "pg", ">= 0.18", "< 2.0"
8+
gem "sqlite3", "~> 1.4.0"
9+
10+
group :development do
11+
gem "appraisal"
12+
gem "byebug"
13+
end
14+
15+
group :test do
16+
gem "rake", "~> 10.0"
17+
gem "rspec", "~> 2.14.0"
18+
end
19+
20+
gemspec path: "../"

gemfiles/activerecord_edge.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ gem "arel", :github => "rails/arel"
66
gem "activerecord", :github => "rails/rails"
77
gem "mysql2", "~> 0.4.10"
88
gem "pg", ">= 0.18", "< 2.0"
9-
gem "sqlite3", "~> 1.3.6"
9+
gem "sqlite3", "~> 1.4.0"
1010

1111
group :development do
1212
gem "appraisal"

hairtrigger.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
2020

2121
s.files = %w(LICENSE.txt Rakefile README.md) + Dir['lib/**/*.rb'] + Dir['lib/**/*.rake']
2222

23-
s.add_dependency 'activerecord', '>= 5.0', '< 6.0'
23+
s.add_dependency 'activerecord', '>= 5.0', '< 7'
2424
s.add_dependency 'ruby_parser', '~> 3.10'
2525
s.add_dependency 'ruby2ruby', '~> 2.4'
2626
end

lib/hair_trigger.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,19 @@ def models
4040

4141
def migrator
4242
version = ActiveRecord::VERSION::STRING
43-
if version >= "5.2."
43+
if version >= "6.0."
44+
migrations = ActiveRecord::MigrationContext.new(migration_path, ActiveRecord::SchemaMigration).migrations
45+
elsif version >= "5.2."
4446
migrations = ActiveRecord::MigrationContext.new(migration_path).migrations
4547
else # version >= "4.0."
4648
migrations = ActiveRecord::Migrator.migrations(migration_path)
4749
end
4850

49-
ActiveRecord::Migrator.new(:up, migrations)
51+
if version >= "6.0."
52+
ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration)
53+
else
54+
ActiveRecord::Migrator.new(:up, migrations)
55+
end
5056
end
5157

5258
def current_migrations(options = {})

spec/spec_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def initialize_db
7575

7676
def migrate_db
7777
ActiveRecord::Migration.verbose = false
78-
if ActiveRecord::VERSION::STRING >= "5.2"
78+
if ActiveRecord::VERSION::STRING >= "6.0"
79+
ActiveRecord::MigrationContext.new(HairTrigger.migration_path, ActiveRecord::SchemaMigration).migrate
80+
elsif ActiveRecord::VERSION::STRING >= "5.2"
7981
ActiveRecord::MigrationContext.new(HairTrigger.migration_path).migrate
8082
else
8183
ActiveRecord::Migrator.migrate(HairTrigger.migration_path)

0 commit comments

Comments
 (0)