Skip to content

Commit 8326cc7

Browse files
authored
Add rails 6.0 config to travis (lynndylanhurley#1366)
* Add rails 6.0 config to travis * Exclude Travis Rails 6.0 checks for Ruby below 2.5 * Updates tests to be compatible with Rails 6 Rails 6 no longer generates migration with id: :uuid, so I changed the range of two ifs in tests and everything goes well now. * Add Ruby 2.7.0 to Travis * Exclude travis test for Ruby 2.7.0 with Rails 4.2 Ruby 2.7 comes with Bundler 2 which is not compatible with Rails 4 * Add to Travis test for rails 6 + mongoid 7 * Downgrade mongoid-locker for rails 6 gemfile * Allow to change primary key type for Rails 6
1 parent 880a249 commit 8326cc7

File tree

5 files changed

+145
-44
lines changed

5 files changed

+145
-44
lines changed

.travis.yml

+51-40
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ rvm:
1111
- 2.4.7
1212
- 2.5.6
1313
- 2.6.4
14+
- 2.7.0
1415

1516
gemfile:
1617
- gemfiles/rails_4_2.gemfile
1718
- gemfiles/rails_5_0.gemfile
1819
- gemfiles/rails_5_1.gemfile
1920
- gemfiles/rails_5_2.gemfile
21+
- gemfiles/rails_6_0.gemfile
2022

2123
env:
2224
global:
@@ -28,51 +30,60 @@ env:
2830

2931
matrix:
3032
include:
31-
- rvm: 2.3.8
32-
gemfile: gemfiles/rails_4_2_mongoid_5.gemfile
33-
env: DEVISE_TOKEN_AUTH_ORM=mongoid
34-
- rvm: 2.3.8
35-
gemfile: gemfiles/rails_5_1_mongoid_6.gemfile
36-
env: DEVISE_TOKEN_AUTH_ORM=mongoid
37-
- rvm: 2.4.7
38-
gemfile: gemfiles/rails_5_1_mongoid_7.gemfile
39-
env: DEVISE_TOKEN_AUTH_ORM=mongoid
40-
- rvm: 2.5.6
41-
gemfile: gemfiles/rails_5_2_mongoid_6.gemfile
42-
env: DEVISE_TOKEN_AUTH_ORM=mongoid
43-
- rvm: 2.5.6
44-
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
45-
env: DEVISE_TOKEN_AUTH_ORM=mongoid
46-
- rvm: 2.6.4
47-
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
48-
env: DEVISE_TOKEN_AUTH_ORM=mongoid
49-
- name: Code Climate Test Coverage
50-
rmv: 2.5.6
51-
env:
52-
- CC_TEST_REPORTER_ID=44d7688de8e1b567b4af25ec5083c2cc0a355ab911192a7cbefd1ea25b2ffd3d
53-
- GEMFILE_AR=gemfiles/rails_5_1.gemfile
54-
- GEMFILE_MONGOID=gemfiles/rails_5_1_mongoid_7.gemfile
55-
script:
56-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
57-
- chmod +x ./cc-test-reporter
58-
- ./cc-test-reporter before-build
59-
# with ActiveRecord
60-
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_AR
61-
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake --trace db:migrate
62-
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake
63-
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.active_record.json coverage/.resultset.json
64-
# with Mongoid
65-
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_MONGOID
66-
- BUNDLE_GEMFILE=$GEMFILE_MONGOID DEVISE_TOKEN_AUTH_ORM=mongoid bundle exec rake
67-
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.mongoid.json coverage/.resultset.json
68-
# merge test results
69-
- if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then
33+
- rvm: 2.3.8
34+
gemfile: gemfiles/rails_4_2_mongoid_5.gemfile
35+
env: DEVISE_TOKEN_AUTH_ORM=mongoid
36+
- rvm: 2.3.8
37+
gemfile: gemfiles/rails_5_1_mongoid_6.gemfile
38+
env: DEVISE_TOKEN_AUTH_ORM=mongoid
39+
- rvm: 2.4.7
40+
gemfile: gemfiles/rails_5_1_mongoid_7.gemfile
41+
env: DEVISE_TOKEN_AUTH_ORM=mongoid
42+
- rvm: 2.5.6
43+
gemfile: gemfiles/rails_5_2_mongoid_6.gemfile
44+
env: DEVISE_TOKEN_AUTH_ORM=mongoid
45+
- rvm: 2.5.6
46+
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
47+
env: DEVISE_TOKEN_AUTH_ORM=mongoid
48+
- rvm: 2.6.4
49+
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
50+
env: DEVISE_TOKEN_AUTH_ORM=mongoid
51+
- rvm: 2.7.0
52+
gemfile: gemfiles/rails_6_0_mongoid_7.gemfile
53+
env: DEVISE_TOKEN_AUTH_ORM=mongoid
54+
- name: Code Climate Test Coverage
55+
rvm: 2.5.6
56+
env:
57+
- CC_TEST_REPORTER_ID=44d7688de8e1b567b4af25ec5083c2cc0a355ab911192a7cbefd1ea25b2ffd3d
58+
- GEMFILE_AR=gemfiles/rails_5_1.gemfile
59+
- GEMFILE_MONGOID=gemfiles/rails_5_1_mongoid_7.gemfile
60+
script:
61+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
62+
- chmod +x ./cc-test-reporter
63+
- ./cc-test-reporter before-build
64+
# with ActiveRecord
65+
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_AR
66+
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake --trace db:migrate
67+
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake
68+
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.active_record.json coverage/.resultset.json
69+
# with Mongoid
70+
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_MONGOID
71+
- BUNDLE_GEMFILE=$GEMFILE_MONGOID DEVISE_TOKEN_AUTH_ORM=mongoid bundle exec rake
72+
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.mongoid.json coverage/.resultset.json
73+
# merge test results
74+
- if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then
7075
./cc-test-reporter sum-coverage coverage/codeclimate.active_record.json coverage/codeclimate.mongoid.json;
7176
./cc-test-reporter upload-coverage;
72-
fi
77+
fi
7378
exclude:
7479
- rvm: 2.6.4
7580
gemfile: gemfiles/rails_4_2.gemfile
81+
- rvm: 2.7.0
82+
gemfile: gemfiles/rails_4_2.gemfile
83+
- rvm: 2.3.8
84+
gemfile: gemfiles/rails_6_0.gemfile
85+
- rvm: 2.4.7
86+
gemfile: gemfiles/rails_6_0.gemfile
7687
fast_finish: true
7788

7889
before_install:

Appraisals

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ end
3232
{ name: '5-1', ruby: '2.4.5', rails: '5.1', mongoid: '7.0' },
3333
{ name: '5-2', ruby: '2.5.5', rails: '5.2', mongoid: '6.4' },
3434
{ name: '5-2', ruby: '2.5.5', rails: '5.2', mongoid: '7.0' },
35-
{ name: '5-2', ruby: '2.6.2', rails: '5.2', mongoid: '7.0' }
35+
{ name: '5-2', ruby: '2.6.2', rails: '5.2', mongoid: '7.0' },
36+
{ name: '6-0', ruby: '2.7.0', rails: '6.0', mongoid: '7.0' }
3637
].each do |set|
3738
appraise "rails-#{set[:name]}-mongoid-#{set[:mongoid][0]}" do
3839
gem 'rails', "~> #{set[:rails]}"

gemfiles/rails_6_0.gemfile

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 6.0"
6+
gem "sqlite3", "~> 1.4.1"
7+
gem "mysql2"
8+
gem "pg"
9+
10+
group :development, :test do
11+
gem "attr_encrypted"
12+
gem "figaro", git: "https://github.com/laserlemon/figaro"
13+
gem "omniauth-facebook", git: "https://github.com/mkdynamic/omniauth-facebook"
14+
gem "omniauth-github", git: "https://github.com/intridea/omniauth-github"
15+
gem "omniauth-google-oauth2", git: "https://github.com/zquestz/omniauth-google-oauth2"
16+
gem 'omniauth-apple'
17+
gem "rack-cors", require: "rack/cors"
18+
gem "thor"
19+
gem "database_cleaner"
20+
gem "factory_bot_rails"
21+
gem "faker"
22+
gem "fuzz_ball"
23+
gem "guard"
24+
gem "guard-minitest"
25+
gem "minitest"
26+
gem "minitest-focus"
27+
gem "minitest-rails"
28+
gem "minitest-reporters"
29+
gem "mocha", ">= 1.5"
30+
gem "pry"
31+
gem "pry-byebug"
32+
gem "pry-remote"
33+
gem "rubocop", require: false
34+
end
35+
36+
group :test do
37+
gem "rails-controller-testing"
38+
gem "simplecov", require: false
39+
end
40+
41+
group :development do
42+
gem "github_changelog_generator"
43+
end
44+
45+
gemspec path: "../"

gemfiles/rails_6_0_mongoid_7.gemfile

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 6.0"
6+
gem "mongoid", "~> 7.0"
7+
gem "mongoid-locker", "~> 1.0"
8+
9+
group :development, :test do
10+
gem "attr_encrypted"
11+
gem "figaro", git: "https://github.com/laserlemon/figaro"
12+
gem "omniauth-facebook", git: "https://github.com/mkdynamic/omniauth-facebook"
13+
gem "omniauth-github", git: "https://github.com/intridea/omniauth-github"
14+
gem "omniauth-google-oauth2", git: "https://github.com/zquestz/omniauth-google-oauth2"
15+
gem "omniauth-apple"
16+
gem "rack-cors", require: "rack/cors"
17+
gem "thor"
18+
gem "database_cleaner"
19+
gem "factory_bot_rails"
20+
gem "faker"
21+
gem "fuzz_ball"
22+
gem "guard"
23+
gem "guard-minitest"
24+
gem "minitest"
25+
gem "minitest-focus"
26+
gem "minitest-rails"
27+
gem "minitest-reporters"
28+
gem "mocha", ">= 1.5"
29+
gem "pry"
30+
gem "pry-byebug"
31+
gem "pry-remote"
32+
gem "rubocop", require: false
33+
end
34+
35+
group :test do
36+
gem "rails-controller-testing"
37+
gem "simplecov", require: false
38+
end
39+
40+
group :development do
41+
gem "github_changelog_generator"
42+
end
43+
44+
gemspec path: "../"

lib/generators/devise_token_auth/install_generator.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def database_version
7575
ActiveRecord::Base.connection.select_value('SELECT VERSION()')
7676
end
7777

78-
def rails5?
79-
Rails.version.start_with? '5'
78+
def rails_5_or_newer?
79+
Rails::VERSION::MAJOR >= 5
8080
end
8181

8282
def primary_key_type
83-
primary_key_string if rails5?
83+
primary_key_string if rails_5_or_newer?
8484
end
8585

8686
def primary_key_string

0 commit comments

Comments
 (0)