appraisal 0.5.2 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -4
- data/README.md +87 -36
- data/appraisal.gemspec +10 -7
- data/bin/appraisal +7 -0
- data/features/appraisals.feature +16 -2
- data/features/bundler_gemfile_compatibility.feature +70 -0
- data/features/gemspec.feature +0 -11
- data/features/missing_appraisals_file.feature +23 -0
- data/features/step_definitions/dependency_steps.rb +17 -24
- data/features/support/dependency_helpers.rb +29 -0
- data/lib/appraisal/appraisal.rb +52 -12
- data/lib/appraisal/cli.rb +87 -0
- data/lib/appraisal/command.rb +4 -2
- data/lib/appraisal/errors.rb +8 -0
- data/lib/appraisal/file.rb +8 -2
- data/lib/appraisal/gemfile.rb +40 -10
- data/lib/appraisal/gemspec.rb +1 -7
- data/lib/appraisal/git_source.rb +23 -0
- data/lib/appraisal/group.rb +17 -0
- data/lib/appraisal/task.rb +20 -18
- data/lib/appraisal/utils.rb +8 -0
- data/lib/appraisal/version.rb +1 -1
- data/spec/acceptance/cli_spec.rb +233 -0
- data/spec/appraisal/appraisal_spec.rb +61 -7
- data/spec/appraisal/file_spec.rb +9 -0
- data/spec/appraisal/gemfile_spec.rb +43 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/acceptance_test_helpers.rb +113 -0
- metadata +61 -11
- data/GOALS +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e8b6522115c4dc3c17e760c10c3be470782a10
|
4
|
+
data.tar.gz: 88f5f2cd1d763807d3365a1c216883066922a683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16adfbd7bf60a34ff6567d3c5b177af70fbc07a4d9d0a8d57e63241d404a47ab95b513f9def0ffa3ce35047d6ca04e5a7b87f0973ddeab0f87f4cbf203977b05
|
7
|
+
data.tar.gz: 802f454088dece1fbc37920e67c5eab145f38e7789de70b3a9b9580bde97f1090cd0459011455483739a965b047089a846b74d716e39ab416b6797a96e9e6e24
|
data/.travis.yml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
before_install: gem install bundler --pre
|
2
|
+
|
1
3
|
rvm:
|
2
|
-
- 1.8.7
|
3
4
|
- 1.9.3
|
4
5
|
- 2.0.0
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
- jruby-19mode
|
7
|
+
- rbx-19mode
|
8
|
+
- ruby-head
|
9
|
+
- jruby-head
|
10
|
+
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
- rvm: jruby-19mode
|
14
|
+
- rvm: ruby-head
|
15
|
+
- rvm: jruby-head
|
data/README.md
CHANGED
@@ -1,14 +1,20 @@
|
|
1
|
-
|
1
|
+
Appraisal
|
2
|
+
=========
|
3
|
+
|
4
|
+
[![Build Status][Build Status Image]][Build Status]
|
2
5
|
|
3
6
|
Find out what your Ruby gems are worth.
|
4
7
|
|
8
|
+
[Build Status Image]: https://secure.travis-ci.org/thoughtbot/appraisal.png?branch=master
|
9
|
+
[Build Status]: http://travis-ci.org/thoughtbot/appraisal
|
10
|
+
|
5
11
|
Synopsis
|
6
12
|
--------
|
7
13
|
|
8
14
|
Appraisal integrates with bundler and rake to test your library against
|
9
15
|
different versions of dependencies in repeatable scenarios called "appraisals."
|
10
16
|
Appraisal is designed to make it easy to check for regressions in your library
|
11
|
-
without interfering with day-to-day development using
|
17
|
+
without interfering with day-to-day development using Bundler.
|
12
18
|
|
13
19
|
Installation
|
14
20
|
------------
|
@@ -17,22 +23,27 @@ In your Gemfile:
|
|
17
23
|
|
18
24
|
gem "appraisal"
|
19
25
|
|
26
|
+
Note that gems must be bundled in the global namespace. Bundling gems to a local
|
27
|
+
location or vendoring plugins is not supported. If you do not want to pollute the
|
28
|
+
global namespace, one alternative is [RVM's Gemsets](http://rvm.io/gemsets).
|
29
|
+
|
20
30
|
Setup
|
21
31
|
-----
|
22
32
|
|
23
33
|
Setting up appraisal requires an Appraisals file (similar to a Gemfile) in your
|
24
|
-
project root, named "Appraisals" (note the case), and some slight changes to
|
34
|
+
project root, named "Appraisals" (note the case), and some slight changes to
|
35
|
+
your project's Rakefile.
|
25
36
|
|
26
37
|
An Appraisals file consists of several appraisal definitions. An appraisal
|
27
38
|
definition is simply a list of gem dependencies. For example, to test with a
|
28
39
|
few versions of Rails:
|
29
40
|
|
30
|
-
appraise "
|
31
|
-
gem "rails", "2.
|
41
|
+
appraise "rails-3" do
|
42
|
+
gem "rails", "3.2.14"
|
32
43
|
end
|
33
44
|
|
34
|
-
appraise "
|
35
|
-
gem "rails", "
|
45
|
+
appraise "rails-4" do
|
46
|
+
gem "rails", "4.0.0"
|
36
47
|
end
|
37
48
|
|
38
49
|
The dependencies in your Appraisals file are combined with dependencies in your
|
@@ -40,15 +51,11 @@ Gemfile, so you don't need to repeat anything that's the same for each
|
|
40
51
|
appraisal. If something is specified in both the Gemfile and an appraisal, the
|
41
52
|
version from the appraisal takes precedence.
|
42
53
|
|
43
|
-
Once you have an Appraisals file set up, just require appraisal in your Rakefile:
|
44
|
-
|
45
|
-
require 'appraisal'
|
46
|
-
|
47
54
|
It's also recommended that you setup bundler at the very top of your Rakefile,
|
48
55
|
so that you don't need to constantly run bundle exec:
|
49
56
|
|
50
|
-
require
|
51
|
-
require
|
57
|
+
require "rubygems"
|
58
|
+
require "bundler/setup"
|
52
59
|
|
53
60
|
Usage
|
54
61
|
-----
|
@@ -56,55 +63,99 @@ Usage
|
|
56
63
|
Once you've configured the appraisals you want to use, you need to install the
|
57
64
|
dependencies for each appraisal:
|
58
65
|
|
59
|
-
|
66
|
+
appraisal install
|
60
67
|
|
61
68
|
This will resolve, install, and lock the dependencies for that appraisal using
|
62
|
-
bundler. Once you have your dependencies
|
69
|
+
bundler. Once you have your dependencies set up, you can run any command in a
|
63
70
|
single appraisal:
|
64
71
|
|
65
|
-
rake
|
72
|
+
appraisal rails-3 rake test
|
66
73
|
|
67
|
-
This will run
|
68
|
-
|
74
|
+
This will run `rake test` using the dependencies configured for Rails 3. You can
|
75
|
+
also run each appraisal in turn:
|
69
76
|
|
70
|
-
rake
|
77
|
+
appraisal rake test
|
71
78
|
|
72
|
-
If you want to use only the dependencies from your Gemfile, just run
|
73
|
-
test
|
79
|
+
If you want to use only the dependencies from your Gemfile, just run `rake
|
80
|
+
test` as normal. This allows you to keep running with the latest versions of
|
74
81
|
your dependencies in quick test runs, but keep running the tests in older
|
75
82
|
versions to check for regressions.
|
76
83
|
|
84
|
+
In the case that you want to run all the appraisals by default when you run
|
85
|
+
`rake`, you can override your default Rake task by put this into your Rakefile:
|
86
|
+
|
87
|
+
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
|
88
|
+
task :default => :appraisal
|
89
|
+
end
|
90
|
+
|
91
|
+
(Appraisal sets `APPRAISAL_INITIALIZED` environment variable when it runs your
|
92
|
+
process. We put a check here to ensure that `appraisal rake` command should run
|
93
|
+
your real default task, which usually is your `test` task.)
|
94
|
+
|
95
|
+
Note that this may conflict with your CI setup if you decide to split the test
|
96
|
+
into multiple processes by Appraisal and you are using `rake` to run tests by
|
97
|
+
default. Please see **Travis CI Integration** for more detail.
|
98
|
+
|
77
99
|
Under the hood
|
78
100
|
--------------
|
79
101
|
|
80
|
-
Running
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
102
|
+
Running `appraisal install` generates a Gemfile for each appraisal by combining
|
103
|
+
your root Gemfile with the specific requirements for each appraisal. These are
|
104
|
+
stored in the `gemfiles` directory, and should be added to version control to
|
105
|
+
ensure that the same versions are always used.
|
106
|
+
|
107
|
+
When you prefix a command with `appraisal`, the command is run with the
|
108
|
+
appropriate Gemfile for that appraisal, ensuring the correct dependencies
|
109
|
+
are used.
|
86
110
|
|
87
111
|
Version Control
|
88
|
-
|
112
|
+
---------------
|
113
|
+
|
114
|
+
When using Appraisal, we recommend you check in the Gemfiles that Appraisal
|
115
|
+
generates within the gemfiles directory, but exclude the lockfiles there
|
116
|
+
(`*.gemfile.lock`.) The Gemfiles are useful when running your tests against a
|
117
|
+
continuous integration server such as [Travis CI][Travis CI].
|
118
|
+
|
119
|
+
[Travis CI]: https://travis-ci.org
|
120
|
+
|
121
|
+
Travis CI integration
|
122
|
+
---------------------
|
89
123
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
124
|
+
If you're using Appraisal and using Travis CI, we're recommending you to setup
|
125
|
+
Travis to run the test against multiple generated Gemfiles. This can be done
|
126
|
+
by using `gemfile` setting:
|
127
|
+
|
128
|
+
# In .travis.yml
|
129
|
+
gemfile:
|
130
|
+
- gemfiles/3.0.gemfile
|
131
|
+
- gemfiles/3.1.gemfile
|
132
|
+
- gemfiles/3.2.gemfile
|
133
|
+
|
134
|
+
Please note that if you've set your default rake task to run the test against
|
135
|
+
all versions of its dependency, you might have to set a `script` setting:
|
136
|
+
|
137
|
+
script: "bundle exec rake test"
|
138
|
+
|
139
|
+
That will make sure that each of the test sub-job are not getting run more than
|
140
|
+
one time.
|
95
141
|
|
96
142
|
Credits
|
97
143
|
-------
|
98
144
|
|
99
145
|
![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
|
100
146
|
|
101
|
-
Appraisal is maintained and funded by [thoughtbot, inc]
|
147
|
+
Appraisal is maintained and funded by [thoughtbot, inc][thoughtbot]
|
102
148
|
|
103
|
-
Thank you to all [the contributors]
|
149
|
+
Thank you to all [the contributors][contributors]
|
104
150
|
|
105
151
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
106
152
|
|
153
|
+
[thoughtbot]: http://thoughtbot.com/community
|
154
|
+
[contributors]: https://github.com/thoughtbot/appraisal/contributors
|
155
|
+
|
107
156
|
License
|
108
157
|
-------
|
109
158
|
|
110
|
-
Appraisal is Copyright © 2010-2013 Joe Ferris and thoughtbot, inc. It is free
|
159
|
+
Appraisal is Copyright © 2010-2013 Joe Ferris and thoughtbot, inc. It is free
|
160
|
+
software, and may be redistributed under the terms specified in the MIT-LICENSE
|
161
|
+
file.
|
data/appraisal.gemspec
CHANGED
@@ -3,14 +3,15 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
require "appraisal/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'appraisal'
|
7
7
|
s.version = Appraisal::VERSION.dup
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = [
|
10
|
-
s.email =
|
11
|
-
s.homepage =
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
9
|
+
s.authors = ['Joe Ferris', 'Prem Sichanugrist']
|
10
|
+
s.email = ['jferris@thoughtbot.com', 'prem@thoughtbot.com']
|
11
|
+
s.homepage = 'http://github.com/thoughtbot/appraisal'
|
12
|
+
s.summary = 'Find out what your Ruby gems are worth'
|
13
|
+
s.description = 'Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals."'
|
14
|
+
s.license = 'MIT'
|
14
15
|
|
15
16
|
s.files = `git ls-files`.split("\n")
|
16
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -19,8 +20,10 @@ Gem::Specification.new do |s|
|
|
19
20
|
|
20
21
|
s.add_runtime_dependency('rake')
|
21
22
|
s.add_runtime_dependency('bundler')
|
23
|
+
s.add_runtime_dependency('thor', '~> 0.18.1')
|
22
24
|
|
25
|
+
s.add_development_dependency('activesupport', '>= 3.2.13')
|
23
26
|
s.add_development_dependency('cucumber', '~> 1.0')
|
24
27
|
s.add_development_dependency('rspec', '~> 2.6')
|
25
|
-
s.add_development_dependency('aruba', '~> 0.
|
28
|
+
s.add_development_dependency('aruba', '~> 0.5.1')
|
26
29
|
end
|
data/bin/appraisal
ADDED
data/features/appraisals.feature
CHANGED
@@ -16,11 +16,13 @@ Feature: run a rake task through several appraisals
|
|
16
16
|
"""
|
17
17
|
gem "dummy_rake", "0.8.7"
|
18
18
|
gem "dummy_girl"
|
19
|
+
|
19
20
|
group :assets do
|
20
|
-
gem 'dummy_sass', "
|
21
|
+
gem 'dummy_sass', "~> 3.1.0"
|
21
22
|
end
|
23
|
+
|
22
24
|
group :test, :development do
|
23
|
-
gem 'dummy_spec', "
|
25
|
+
gem 'dummy_spec', "~> 3.1.0"
|
24
26
|
end
|
25
27
|
"""
|
26
28
|
When I add "appraisal" from this project as a dependency
|
@@ -29,6 +31,7 @@ Feature: run a rake task through several appraisals
|
|
29
31
|
appraise "1.3.2" do
|
30
32
|
gem "dummy_girl", "1.3.2"
|
31
33
|
end
|
34
|
+
|
32
35
|
appraise "1.3.0" do
|
33
36
|
gem "dummy_girl", "1.3.0"
|
34
37
|
gem "dummy_rake", "0.9.0"
|
@@ -39,15 +42,18 @@ Feature: run a rake task through several appraisals
|
|
39
42
|
require 'rubygems'
|
40
43
|
require 'bundler/setup'
|
41
44
|
require 'appraisal'
|
45
|
+
|
42
46
|
task :version do
|
43
47
|
require 'dummy_girl'
|
44
48
|
puts "Loaded #{$dummy_girl_version}"
|
45
49
|
end
|
50
|
+
|
46
51
|
task :fail do
|
47
52
|
require 'dummy_girl'
|
48
53
|
puts "Fail #{$dummy_girl_version}"
|
49
54
|
raise
|
50
55
|
end
|
56
|
+
|
51
57
|
task :default => :version
|
52
58
|
"""
|
53
59
|
When I successfully run `bundle install --local`
|
@@ -89,3 +95,11 @@ Feature: run a rake task through several appraisals
|
|
89
95
|
And a file named "gemfiles/1.3.0.gemfile.lock" should not exist
|
90
96
|
And a file named "gemfiles/1.3.2.gemfile" should not exist
|
91
97
|
And a file named "gemfiles/1.3.2.gemfile.lock" should not exist
|
98
|
+
|
99
|
+
Scenario: install gems within groups
|
100
|
+
Then the file "gemfiles/1.3.0.gemfile" should contain:
|
101
|
+
"""
|
102
|
+
group :assets do
|
103
|
+
gem "dummy_sass", "~> 3.1.0"
|
104
|
+
end
|
105
|
+
"""
|
@@ -0,0 +1,70 @@
|
|
1
|
+
@disable-bundler
|
2
|
+
Feature: Bundler Gemfile Compatibility
|
3
|
+
|
4
|
+
Scenario: Parsing Gemfile
|
5
|
+
Given the following installed dummy gems:
|
6
|
+
| name | version |
|
7
|
+
| bacon | 1.0.0 |
|
8
|
+
| bread | 1.0.0 |
|
9
|
+
| miso_soup | 1.0.0 |
|
10
|
+
| rice | 1.0.0 |
|
11
|
+
And a git repository exists for gem "egg" with version "0.1.0"
|
12
|
+
And I write to "Gemfile" with:
|
13
|
+
"""
|
14
|
+
source "https://rubygems.org"
|
15
|
+
ruby RUBY_VERSION
|
16
|
+
|
17
|
+
git "./egg" do
|
18
|
+
gem "egg"
|
19
|
+
end
|
20
|
+
|
21
|
+
group :breakfast do
|
22
|
+
gem "bacon"
|
23
|
+
end
|
24
|
+
"""
|
25
|
+
And I add "appraisal" from this project as a dependency
|
26
|
+
And I write to "Appraisals" with:
|
27
|
+
"""
|
28
|
+
appraise "japanese" do
|
29
|
+
gem "rice"
|
30
|
+
gem "miso_soup"
|
31
|
+
end
|
32
|
+
|
33
|
+
appraise "english" do
|
34
|
+
gem "bread"
|
35
|
+
end
|
36
|
+
"""
|
37
|
+
And I write to "Rakefile" with:
|
38
|
+
"""
|
39
|
+
require 'rubygems'
|
40
|
+
require 'bundler/setup'
|
41
|
+
require 'appraisal'
|
42
|
+
"""
|
43
|
+
When I successfully run `bundle install --local`
|
44
|
+
And I successfully run `bundle exec rake appraisal:gemfiles --trace`
|
45
|
+
Then the file "gemfiles/japanese.gemfile" should contain:
|
46
|
+
"""
|
47
|
+
source "https://rubygems.org"
|
48
|
+
"""
|
49
|
+
And the file "gemfiles/japanese.gemfile" should contain a correct ruby directive
|
50
|
+
And the file "gemfiles/japanese.gemfile" should contain:
|
51
|
+
"""
|
52
|
+
gem "rice"
|
53
|
+
gem "miso_soup"
|
54
|
+
"""
|
55
|
+
And the file "gemfiles/japanese.gemfile" should contain:
|
56
|
+
"""
|
57
|
+
git "./egg" do
|
58
|
+
gem "egg"
|
59
|
+
end
|
60
|
+
"""
|
61
|
+
And the file "gemfiles/japanese.gemfile" should contain:
|
62
|
+
"""
|
63
|
+
group :breakfast do
|
64
|
+
gem "bacon"
|
65
|
+
end
|
66
|
+
"""
|
67
|
+
And the file "gemfiles/english.gemfile" should contain:
|
68
|
+
"""
|
69
|
+
gem "bread"
|
70
|
+
"""
|
data/features/gemspec.feature
CHANGED
@@ -57,17 +57,6 @@ Feature: appraisals using an existing gemspec
|
|
57
57
|
And I run `bundle exec rake appraisal version --trace`
|
58
58
|
Then the output should contain "Loaded 1.3.2"
|
59
59
|
|
60
|
-
|
61
|
-
Scenario: run a gem in the gemspec via path
|
62
|
-
And I write to "Gemfile" with:
|
63
|
-
"""
|
64
|
-
gemspec :path => './specdir'
|
65
|
-
"""
|
66
|
-
When I add "appraisal" from this project as a dependency
|
67
|
-
When I successfully run `bundle exec rake appraisal:install --trace`
|
68
|
-
When I run `bundle exec rake appraisal version --trace`
|
69
|
-
Then the output should contain "Loaded 1.3.0"
|
70
|
-
|
71
60
|
Scenario: run a gem in the gemspec via path
|
72
61
|
And I write to "Gemfile" with:
|
73
62
|
"""
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@disable-bundler
|
2
|
+
Feature: raise an exception when there is no Appraisal file
|
3
|
+
|
4
|
+
Scenario: No Appraisal file
|
5
|
+
Given a directory named "projecto"
|
6
|
+
And the following installed dummy gems:
|
7
|
+
| name | version |
|
8
|
+
| dummy_girl | 1.3.0 |
|
9
|
+
And I cd to "projecto"
|
10
|
+
And I write to "Gemfile" with:
|
11
|
+
"""
|
12
|
+
gem "dummy_girl"
|
13
|
+
"""
|
14
|
+
And I add "appraisal" from this project as a dependency
|
15
|
+
And I write to "Rakefile" with:
|
16
|
+
"""
|
17
|
+
require 'rubygems'
|
18
|
+
require 'bundler/setup'
|
19
|
+
require 'appraisal'
|
20
|
+
"""
|
21
|
+
And I successfully run `bundle install --local`
|
22
|
+
When I run `bundle exec rake appraisal:install --trace`
|
23
|
+
Then the output should contain "Unable to locate 'Appraisals' file in the current directory."
|
@@ -3,29 +3,22 @@ When /^I add "([^"]*)" from this project as a dependency$/ do |gem_name|
|
|
3
3
|
end
|
4
4
|
|
5
5
|
Given /^the following installed dummy gems:$/ do |table|
|
6
|
-
table.hashes.each
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
write_file(gem_path, spec)
|
24
|
-
write_file(version_path, "$#{name}_version = '#{version}'")
|
25
|
-
in_current_dir { `gem build #{gem_path} 2>&1` }
|
26
|
-
set_env("GEM_HOME", TMP_GEM_ROOT)
|
27
|
-
in_current_dir { `gem install #{name}-#{version}.gem 2>&1` }
|
28
|
-
FileUtils.rm_rf(File.join(current_dir, name))
|
29
|
-
dirs.pop
|
6
|
+
table.hashes.each { |hash| build_gem(hash["name"], hash["version"]) }
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^a git repository exists for gem "(.*?)" with version "(.*?)"$/ do |gem_name, version|
|
10
|
+
build_gem(gem_name, version)
|
11
|
+
cd gem_name
|
12
|
+
run_simple 'git init .'
|
13
|
+
run_simple 'git config user.email "appraisal@thoughtbot.com"'
|
14
|
+
run_simple 'git config user.name "Appraisal"'
|
15
|
+
run_simple 'git add .'
|
16
|
+
run_simple 'git commit -a -m "initial commit"'
|
17
|
+
dirs.pop
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /^the file "(.*?)" should contain a correct ruby directive$/ do |filename|
|
21
|
+
in_current_dir do
|
22
|
+
File.read(filename).should match(/^ruby "#{RUBY_VERSION}"$/)
|
30
23
|
end
|
31
24
|
end
|