Skip to content

Commit a6c3e37

Browse files
authored
Merge pull request activeadmin#4624 from deivid-rodriguez/fix_build
Add Appraisal
2 parents ab72c33 + ccf3f6b commit a6c3e37

20 files changed

+417
-195
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pkg
3737
spec/rails
3838
*.sqlite3-journal
3939
Gemfile.lock
40-
Gemfile-*.lock
40+
gemfiles/rails_[3-5][0-9].gemfile.lock
4141
capybara*
4242
viewcumber
4343
test-rails*

.travis.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ before_install:
1212
- source script/install_phantomjs.sh
1313
- gem update --system # use the very latest Rubygems
1414
- rvm @global do gem uninstall bundler -a -x
15-
- rvm @global do gem install bundler -v 1.14.2 # latest version known to work
15+
- rvm @global do gem install bundler -v 1.14.3 # latest version known to work
1616

1717
before_script:
1818
- bundle exec rake setup
@@ -27,14 +27,14 @@ rvm:
2727
- 2.3.3
2828
- 2.4.0
2929

30-
env:
31-
matrix:
32-
- RAILS=3.2.22
33-
- RAILS=4.0.13
34-
- RAILS=4.1.16
35-
- RAILS=4.2.7.1
36-
- RAILS=5.0.1
30+
gemfile:
31+
- gemfiles/rails_32.gemfile
32+
- gemfiles/rails_40.gemfile
33+
- gemfiles/rails_41.gemfile
34+
- gemfiles/rails_42.gemfile
35+
- gemfiles/rails_50.gemfile
3736

37+
env:
3838
global:
3939
- JRUBY_OPTS="-J-Xmx1024m --debug"
4040

@@ -43,7 +43,7 @@ matrix:
4343

4444
exclude:
4545
- rvm: 1.9.3
46-
env: RAILS=5.0.1
46+
gemfile: gemfiles/rails_50.gemfile
4747

4848
- rvm: 2.4.0
4949
env: RAILS=3.2.22
@@ -56,7 +56,7 @@ matrix:
5656

5757
allow_failures:
5858
- rvm: jruby-9.1.7.0
59-
env: RAILS=5.0.1
59+
gemfile: gemfiles/rails_50.gemfile
6060

6161
- rvm: 2.4.0
6262
env: RAILS=4.2.7.1

Appraisals

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
appraise 'rails_32' do
2+
gemspec
3+
4+
gem 'rails', '3.2.22'
5+
gem 'jquery-ui-rails', '~> 4.0'
6+
gem 'devise', '~> 3.5'
7+
8+
gem 'inherited_resources'
9+
10+
gem 'test-unit', '~> 3.0'
11+
12+
gem 'draper', '~> 2.1'
13+
14+
platforms :ruby_19 do # Remove this block when we drop support for Ruby 1.9
15+
gem 'kaminari', '~> 0.15'
16+
gem 'mime-types', '< 3'
17+
gem 'nokogiri', '< 1.7'
18+
gem 'public_suffix', '< 1.5'
19+
end
20+
end
21+
22+
appraise 'rails_40' do
23+
gemspec
24+
25+
gem 'rails', '4.0.13'
26+
gem 'jquery-ui-rails', '~> 5.0'
27+
gem 'devise', '~> 3.5'
28+
29+
gem 'inherited_resources'
30+
31+
gem 'draper', '~> 2.1'
32+
33+
platforms :ruby_19 do # Remove this block when we drop support for Ruby 1.9
34+
gem 'kaminari', '~> 0.15'
35+
gem 'mime-types', '< 3'
36+
gem 'nokogiri', '< 1.7'
37+
gem 'public_suffix', '< 1.5'
38+
end
39+
end
40+
41+
appraise 'rails_41' do
42+
gemspec
43+
44+
gem 'rails', '4.1.16'
45+
gem 'jquery-ui-rails', '~> 5.0'
46+
gem 'devise', '~> 3.5'
47+
48+
gem 'inherited_resources'
49+
50+
gem 'draper', '~> 2.1'
51+
52+
platforms :ruby_19 do # Remove this block when we drop support for Ruby 1.9
53+
gem 'kaminari', '~> 0.15'
54+
gem 'mime-types', '< 3'
55+
gem 'nokogiri', '< 1.7'
56+
gem 'public_suffix', '< 1.5'
57+
end
58+
end
59+
60+
appraise 'rails_42' do
61+
gemspec
62+
63+
gem 'rails', '4.2.7.1'
64+
gem 'jquery-ui-rails', '~> 5.0'
65+
gem 'devise', '~> 3.5'
66+
67+
gem 'inherited_resources'
68+
69+
gem 'draper', '~> 2.1'
70+
71+
platforms :ruby_19 do # Remove this block when we drop support for Ruby 1.9
72+
gem 'kaminari', '~> 0.15'
73+
gem 'mime-types', '< 3'
74+
gem 'nokogiri', '< 1.7'
75+
gem 'public_suffix', '< 1.5'
76+
end
77+
end
78+
79+
appraise 'rails_50' do
80+
gemspec
81+
82+
gem 'rails', '5.0.1'
83+
gem 'jquery-ui-rails', '~> 5.0'
84+
gem 'devise', '> 4.x'
85+
86+
# Note: when updating this list, be sure to also update the README
87+
gem 'inherited_resources', git: 'https://github.com/activeadmin/inherited_resources'
88+
89+
gem 'draper', '> 3.x'
90+
end

CONTRIBUTING.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,26 @@ git checkout -b 325-add-japanese-translations
2929
Install the development dependencies:
3030

3131
```sh
32-
bundle install
32+
script/appraisal install
3333
```
3434

3535
Now you should be able to run the entire suite using:
3636

3737
```sh
38-
rake test
38+
script/appraisal rails_50 rake test
3939
```
4040

41-
Which will generate a rails application in `spec/rails` to run the tests against.
41+
NOTE: You can also use `rails_42` or the other Rails versions defined in the
42+
`Appraisals` file, but initial focus on the latest supported Rails version is
43+
preferred.
44+
45+
The previous command will generate a rails application in `spec/rails` to run
46+
the tests against.
4247

4348
If your tests are passing locally but they're failing on Travis, reset your test environment:
4449

4550
```sh
46-
rm -rf spec/rails && bundle update
51+
rm -rf spec/rails && script/appraisal update
4752
```
4853

4954
### 4. Implement your fix or feature
@@ -59,20 +64,12 @@ a look at your changes in a browser.
5964
To boot up a test Rails app:
6065

6166
```sh
62-
script/local server
67+
script/appraisal rails_50 script/local server
6368
```
6469

6570
This will automatically create a Rails app if none already exists, and store it in the
6671
`.test-rails-apps` folder. The currently active app is symlinked to `test-rails-app`.
6772

68-
If you have any Bundler issues, call the `use_rails` script then prepend
69-
the version of rails you would like to use in an environment variable:
70-
71-
```sh
72-
script/use_rails 4.0.0
73-
RAILS=4.0.0 script/local server
74-
```
75-
7673
You should now be able to open <http://localhost:3000/admin> in your browser. You can log in using:
7774

7875
User: admin@example.com
@@ -84,13 +81,13 @@ If you need to perform any other commands on the test application, use the
8481
To boot the rails console:
8582

8683
```sh
87-
script/local console
84+
script/appraisal rails_50 script/local console
8885
```
8986

9087
Or to migrate the database:
9188

9289
```sh
93-
script/local rake db:migrate
90+
script/appraisal rails_50 script/local rake db:migrate
9491
```
9592

9693
### 6. Run tests against major supported rails versions
@@ -99,7 +96,7 @@ Once you've implemented your code, got the tests passing, previewed it in a
9996
browser, you're ready to test it against multiple versions of Rails.
10097

10198
```sh
102-
rake test:major_supported_rails
99+
script/appraisal rake test
103100
```
104101

105102
This runs our test suite against a couple of major versions of Rails.

Gemfile

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,9 @@
11
source 'https://rubygems.org'
22

3-
gemspec
4-
5-
require File.expand_path 'spec/support/detect_rails_version', File.dirname(__FILE__)
6-
7-
rails_version = detect_rails_version
8-
rails_major = rails_version[0]
9-
10-
gem 'rails', rails_version
11-
12-
gem 'jquery-ui-rails', rails_major == '3' ? '~> 4.0' : '~> 5.0'
13-
14-
gem 'test-unit', '~> 3.0' if rails_major == '3'
15-
16-
if rails_major == '5'
17-
# Note: when updating this list, be sure to also update the README
18-
gem 'sass-rails', git: 'https://github.com/rails/sass-rails'
19-
gem 'inherited_resources', git: 'https://github.com/activeadmin/inherited_resources'
20-
gem 'ransack', git: 'https://github.com/activerecord-hackery/ransack'
21-
end
22-
23-
platform :ruby_19 do # Remove this block when we drop support for Ruby 1.9
24-
gem 'kaminari', '~> 0.15'
25-
gem 'mime-types', '< 3'
26-
gem 'nokogiri', '< 1.7'
27-
gem 'public_suffix', '< 1.5'
28-
end
29-
3+
gem 'appraisal'
304

315
# Optional dependencies
326
gem 'cancan'
33-
gem 'devise', rails_major == '5' ? '> 4.x' : '~> 3.5'
34-
gem 'draper', rails_major == '5' ? '> 3.x' : '~> 2.1'
357
gem 'pundit'
368

379
# Until https://github.com/erikhuda/thor/issues/538 fixed

Rakefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
require 'bundler/setup'
21
require 'bundler/gem_tasks'
32

4-
def cmd(command)
5-
puts command
6-
fail unless system command
7-
end
8-
9-
require File.expand_path('../spec/support/detect_rails_version', __FILE__)
10-
113
# Import all our rake tasks
124
FileList['tasks/**/*.rake'].each { |task| import task }
135

features/support/env.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
require File.expand_path('../../../spec/spec_helper', __FILE__)
1010

11-
ENV['RAILS_ROOT'] = File.expand_path("../../../spec/rails/rails-#{ENV["RAILS"]}", __FILE__)
11+
require 'rails'
12+
ENV['RAILS_ROOT'] = File.expand_path("../../../spec/rails/rails-#{Rails.version}", __FILE__)
1213

1314
# Create the test app if it doesn't exists
1415
unless File.exists?(ENV['RAILS_ROOT'])
1516
system 'rake setup'
1617
end
1718

18-
require 'rails'
1919
require 'active_record'
2020
require 'active_admin'
2121
require 'devise'

gemfiles/rails_32.gemfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "appraisal"
6+
gem "cancan"
7+
gem "pundit"
8+
gem "thor", "<= 0.19.1"
9+
gem "rake"
10+
gem "parallel_tests", "< 2.10"
11+
gem "pry"
12+
gem "rails", "3.2.22"
13+
gem "jquery-ui-rails", "~> 4.0"
14+
gem "devise", "~> 3.5"
15+
gem "inherited_resources"
16+
gem "test-unit", "~> 3.0"
17+
gem "draper", "~> 2.1"
18+
19+
group :development do
20+
gem "better_errors", :platforms => [:ruby_20, :ruby_21, :ruby_22, :ruby_23]
21+
gem "binding_of_caller", :platforms => :mri
22+
gem "rack-mini-profiler"
23+
gem "flamegraph", :platforms => :mri
24+
gem "stackprof", :platforms => [:mri_21, :mri_22, :mri_23], :require => false
25+
gem "fast_stack", :platforms => [:mri_19, :mri_20], :require => false
26+
gem "yard"
27+
gem "redcarpet", :platforms => :mri
28+
gem "kramdown", :platforms => :jruby
29+
end
30+
31+
group :test do
32+
gem "capybara"
33+
gem "simplecov", :require => false
34+
gem "codecov", :require => false
35+
gem "cucumber-rails", :require => false
36+
gem "cucumber", "1.3.20"
37+
gem "database_cleaner"
38+
gem "jasmine"
39+
gem "jslint_on_rails"
40+
gem "launchy"
41+
gem "rails-i18n"
42+
gem "rspec-rails"
43+
gem "i18n-spec"
44+
gem "shoulda-matchers", "<= 2.8.0"
45+
gem "sqlite3", :platforms => :mri
46+
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
47+
gem "poltergeist"
48+
end
49+
50+
platforms :ruby_19 do
51+
gem "kaminari", "~> 0.15"
52+
gem "mime-types", "< 3"
53+
gem "nokogiri", "< 1.7"
54+
gem "public_suffix", "< 1.5"
55+
end
56+
57+
gemspec :path => "../"

0 commit comments

Comments
 (0)