appraisal 0.3.8 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/README.md +9 -0
- data/Rakefile +6 -1
- data/features/appraisals.feature +22 -19
- data/features/gemspec.feature +62 -62
- data/features/step_definitions/dependency_steps.rb +27 -0
- data/features/support/env.rb +7 -0
- data/lib/appraisal/gemfile.rb +13 -7
- metadata +26 -28
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
appraisal (0.
|
4
|
+
appraisal (0.4.0)
|
5
5
|
bundler
|
6
6
|
rake
|
7
7
|
|
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
json (>= 1.4.6)
|
32
32
|
json (1.5.3)
|
33
33
|
rack (1.3.2)
|
34
|
-
rake (0.9.2)
|
34
|
+
rake (0.9.2.2)
|
35
35
|
rdiscount (1.6.8)
|
36
36
|
rspec (2.6.0)
|
37
37
|
rspec-core (~> 2.6.0)
|
data/README.md
CHANGED
@@ -85,6 +85,15 @@ control to ensure that the same versions are always used. When running rake
|
|
85
85
|
tasks for an appraisal, the rake task is run with the appropriate Gemfile for
|
86
86
|
that appraisal, ensuring the correct dependencies are used.
|
87
87
|
|
88
|
+
Version Control
|
89
|
+
--------------
|
90
|
+
|
91
|
+
When using Appraisal, we recommend that you check your Gemfile.lock into
|
92
|
+
version control, as well as the gemfiles directory generated by Appraisal. This
|
93
|
+
will ensure that your tests are always green when you check out a fresh copy.
|
94
|
+
It also allows you to create reproducible regression tests for version-specific
|
95
|
+
bugs.
|
96
|
+
|
88
97
|
Credits
|
89
98
|
-------
|
90
99
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
3
|
require 'rake/gempackagetask'
|
4
|
+
require 'rspec/core/rake_task'
|
4
5
|
require 'cucumber/rake/task'
|
5
6
|
|
6
7
|
eval("$specification = #{IO.read('appraisal.gemspec')}")
|
@@ -9,11 +10,15 @@ Rake::GemPackageTask.new($specification) do |package|
|
|
9
10
|
package.need_tar = true
|
10
11
|
end
|
11
12
|
|
13
|
+
RSpec::Core::RakeTask.new do |t|
|
14
|
+
t.pattern = 'spec/**/*_spec.rb'
|
15
|
+
end
|
16
|
+
|
12
17
|
Cucumber::Rake::Task.new(:cucumber) do |t|
|
13
18
|
t.fork = true
|
14
19
|
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
|
15
20
|
end
|
16
21
|
|
17
22
|
desc "Default: run the cucumber scenarios"
|
18
|
-
task :default => :cucumber
|
23
|
+
task :default => [:spec, :cucumber]
|
19
24
|
|
data/features/appraisals.feature
CHANGED
@@ -1,23 +1,33 @@
|
|
1
|
+
@disable-bundler
|
1
2
|
Feature: run a rake task through several appraisals
|
2
3
|
|
3
4
|
Background:
|
4
5
|
Given a directory named "projecto"
|
6
|
+
And the following installed dummy gems:
|
7
|
+
| name | version |
|
8
|
+
| dummy_girl | 1.3.0 |
|
9
|
+
| dummy_girl | 1.3.2 |
|
10
|
+
| dummy_rake | 0.8.7 |
|
11
|
+
| dummy_rake | 0.9.0 |
|
12
|
+
| dummy_sass | 3.1.0 |
|
5
13
|
When I cd to "projecto"
|
6
14
|
And I write to "Gemfile" with:
|
7
15
|
"""
|
8
|
-
|
9
|
-
gem "
|
10
|
-
|
16
|
+
gem "dummy_rake", "0.8.7"
|
17
|
+
gem "dummy_girl"
|
18
|
+
group :assets do
|
19
|
+
gem 'dummy_sass', " ~> 3.1.0"
|
20
|
+
end
|
11
21
|
"""
|
12
22
|
When I add "appraisal" from this project as a dependency
|
13
23
|
And I write to "Appraisals" with:
|
14
24
|
"""
|
15
25
|
appraise "1.3.2" do
|
16
|
-
gem "
|
26
|
+
gem "dummy_girl", "1.3.2"
|
17
27
|
end
|
18
28
|
appraise "1.3.0" do
|
19
|
-
gem "
|
20
|
-
gem "
|
29
|
+
gem "dummy_girl", "1.3.0"
|
30
|
+
gem "dummy_rake", "0.9.0"
|
21
31
|
end
|
22
32
|
"""
|
23
33
|
When I write to "Rakefile" with:
|
@@ -26,59 +36,52 @@ Feature: run a rake task through several appraisals
|
|
26
36
|
require 'bundler/setup'
|
27
37
|
require 'appraisal'
|
28
38
|
task :version do
|
29
|
-
require '
|
30
|
-
puts "Loaded #{
|
39
|
+
require 'dummy_girl'
|
40
|
+
puts "Loaded #{$dummy_girl_version}"
|
31
41
|
end
|
32
42
|
task :fail do
|
33
|
-
require '
|
34
|
-
puts "Fail #{
|
43
|
+
require 'dummy_girl'
|
44
|
+
puts "Fail #{$dummy_girl_version}"
|
35
45
|
raise
|
36
46
|
end
|
37
47
|
task :default => :version
|
38
48
|
"""
|
39
|
-
When I successfully run `bundle
|
49
|
+
When I successfully run `bundle install --local`
|
50
|
+
And I successfully run `bundle exec rake appraisal:install --trace`
|
40
51
|
|
41
|
-
@disable-bundler
|
42
52
|
Scenario: run a specific task with one appraisal
|
43
53
|
When I successfully run `bundle exec rake appraisal:1.3.0 version --trace`
|
44
54
|
Then the output should contain "Loaded 1.3.0"
|
45
55
|
|
46
|
-
@disable-bundler
|
47
56
|
Scenario: run a specific task with all appraisals
|
48
57
|
When I successfully run `bundle exec rake appraisal version --trace`
|
49
58
|
Then the output should contain "Loaded 1.3.0"
|
50
59
|
And the output should contain "Loaded 1.3.2"
|
51
60
|
And the output should not contain "Invoke version"
|
52
61
|
|
53
|
-
@disable-bundler
|
54
62
|
Scenario: run the default task with one appraisal
|
55
63
|
When I successfully run `bundle exec rake appraisal:1.3.0 --trace`
|
56
64
|
Then the output should contain "Loaded 1.3.0"
|
57
65
|
|
58
|
-
@disable-bundler
|
59
66
|
Scenario: run the default task with all appraisals
|
60
67
|
When I successfully run `bundle exec rake appraisal --trace`
|
61
68
|
Then the output should contain "Loaded 1.3.0"
|
62
69
|
And the output should contain "Loaded 1.3.2"
|
63
70
|
|
64
|
-
@disable-bundler
|
65
71
|
Scenario: run a failing task with one appraisal
|
66
72
|
When I run `bundle exec rake appraisal:1.3.0 fail --trace`
|
67
73
|
Then the output should contain "Fail 1.3.0"
|
68
74
|
And the exit status should be 1
|
69
75
|
|
70
|
-
@disable-bundler
|
71
76
|
Scenario: run a failing task with all appraisals
|
72
77
|
When I run `bundle exec rake appraisal fail --trace`
|
73
78
|
Then the output should contain "Fail 1.3.2"
|
74
79
|
But the output should not contain "Fail 1.3.0"
|
75
80
|
And the exit status should be 1
|
76
81
|
|
77
|
-
@disable-bundler
|
78
82
|
Scenario: run a cleanup task
|
79
83
|
When I run `bundle exec rake appraisal:cleanup --trace`
|
80
84
|
Then a file named "gemfiles/1.3.0.gemfile" should not exist
|
81
85
|
And a file named "gemfiles/1.3.0.gemfile.lock" should not exist
|
82
86
|
And a file named "gemfiles/1.3.2.gemfile" should not exist
|
83
87
|
And a file named "gemfiles/1.3.2.gemfile.lock" should not exist
|
84
|
-
|
data/features/gemspec.feature
CHANGED
@@ -1,70 +1,70 @@
|
|
1
|
+
@disable-bundler
|
1
2
|
Feature: appraisals using an existing gemspec
|
2
3
|
|
3
|
-
Background:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
Background:
|
5
|
+
Given a directory named "gemspecced"
|
6
|
+
And the following installed dummy gems:
|
7
|
+
| name | version |
|
8
|
+
| dummy_girl | 1.3.0 |
|
9
|
+
| dummy_girl | 1.3.2 |
|
10
|
+
When I cd to "gemspecced"
|
11
|
+
And I write to "gemspecced.gemspec" with:
|
12
|
+
"""
|
13
|
+
Gem::Specification.new do |s|
|
14
|
+
s.name = %q{gemspecced}
|
15
|
+
s.version = '0.1'
|
16
|
+
s.summary = %q{featureful!}
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
s.summary = %q{featureful!}
|
18
|
+
s.add_development_dependency('dummy_girl', '1.3.2')
|
19
|
+
end
|
20
|
+
"""
|
21
|
+
And a directory named "specdir"
|
22
|
+
And I write to "specdir/gemspecced.gemspec" with:
|
23
|
+
"""
|
24
|
+
Gem::Specification.new do |s|
|
25
|
+
s.name = %q{gemspecced}
|
26
|
+
s.version = '0.1'
|
27
|
+
s.summary = %q{featureful!}
|
24
28
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
"""
|
29
|
+
s.add_development_dependency('dummy_girl', '1.3.0')
|
30
|
+
end
|
31
|
+
"""
|
32
|
+
And I write to "Appraisals" with:
|
33
|
+
"""
|
34
|
+
appraise "stock" do
|
35
|
+
gem "shoulda", "2.11.3"
|
36
|
+
end
|
37
|
+
"""
|
38
|
+
When I write to "Rakefile" with:
|
39
|
+
"""
|
40
|
+
require 'rubygems'
|
41
|
+
require 'bundler/setup'
|
42
|
+
require 'appraisal'
|
43
|
+
task :version do
|
44
|
+
require 'dummy_girl'
|
45
|
+
puts "Loaded #{$dummy_girl_version}"
|
46
|
+
end
|
47
|
+
"""
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
Then the output should contain "Loaded 1.3.2"
|
49
|
+
Scenario: run a gem in the gemspec
|
50
|
+
And I write to "Gemfile" with:
|
51
|
+
"""
|
52
|
+
gemspec
|
53
|
+
"""
|
54
|
+
When I add "appraisal" from this project as a dependency
|
55
|
+
And I successfully run `bundle install --local`
|
56
|
+
And I successfully run `bundle exec rake appraisal:install --trace`
|
57
|
+
And I run `bundle exec rake appraisal version --trace`
|
58
|
+
Then the output should contain "Loaded 1.3.2"
|
57
59
|
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
When I run `bundle exec rake appraisal version --trace`
|
69
|
-
Then the output should contain "Loaded 1.3.0"
|
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
70
|
|
@@ -2,3 +2,30 @@ When /^I add "([^"]*)" from this project as a dependency$/ do |gem_name|
|
|
2
2
|
append_to_file('Gemfile', %{\ngem "#{gem_name}", :path => "#{PROJECT_ROOT}"})
|
3
3
|
end
|
4
4
|
|
5
|
+
Given /^the following installed dummy gems:$/ do |table|
|
6
|
+
table.hashes.each do |hash|
|
7
|
+
name = hash["name"]
|
8
|
+
version = hash["version"]
|
9
|
+
create_dir(name)
|
10
|
+
cd(name)
|
11
|
+
create_dir("lib")
|
12
|
+
gem_path = "#{name}.gemspec"
|
13
|
+
version_path = "lib/#{name}.rb"
|
14
|
+
spec = <<-SPEC
|
15
|
+
Gem::Specification.new do |s|
|
16
|
+
s.name = '#{name}'
|
17
|
+
s.version = '#{version}'
|
18
|
+
s.authors = 'Mr. Smith'
|
19
|
+
s.summary = 'summary'
|
20
|
+
s.files = '#{version_path}'
|
21
|
+
end
|
22
|
+
SPEC
|
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
|
30
|
+
end
|
31
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
require 'aruba/cucumber'
|
2
2
|
|
3
3
|
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
|
4
|
+
TMP_GEM_ROOT = File.join(PROJECT_ROOT, "tmp", "gems")
|
4
5
|
|
6
|
+
Before do
|
7
|
+
FileUtils.rm_rf(TMP_GEM_ROOT)
|
8
|
+
FileUtils.mkdir_p(TMP_GEM_ROOT)
|
9
|
+
end
|
10
|
+
|
11
|
+
ENV["GEM_PATH"] = [TMP_GEM_ROOT, ENV["GEM_PATH"]].join(":")
|
data/lib/appraisal/gemfile.rb
CHANGED
@@ -7,7 +7,8 @@ module Appraisal
|
|
7
7
|
attr_reader :dependencies
|
8
8
|
|
9
9
|
def initialize
|
10
|
-
@
|
10
|
+
@sources = []
|
11
|
+
@dependencies = []
|
11
12
|
end
|
12
13
|
|
13
14
|
def load(path)
|
@@ -19,11 +20,16 @@ module Appraisal
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def gem(name, *requirements)
|
22
|
-
@dependencies
|
23
|
+
@dependencies.reject! { |dependency| dependency.name == name }
|
24
|
+
@dependencies << Dependency.new(name, requirements)
|
25
|
+
end
|
26
|
+
|
27
|
+
def group(name)
|
28
|
+
# ignore the group
|
23
29
|
end
|
24
30
|
|
25
31
|
def source(source)
|
26
|
-
@
|
32
|
+
@sources << source
|
27
33
|
end
|
28
34
|
|
29
35
|
def to_s
|
@@ -32,8 +38,8 @@ module Appraisal
|
|
32
38
|
|
33
39
|
def dup
|
34
40
|
gemfile = Gemfile.new
|
35
|
-
gemfile.source
|
36
|
-
dependencies.
|
41
|
+
@sources.each { |source| gemfile.source source }
|
42
|
+
dependencies.each do |dependency|
|
37
43
|
gemfile.gem(dependency.name, *dependency.requirements)
|
38
44
|
end
|
39
45
|
gemfile.gemspec(@gemspec.options) if @gemspec
|
@@ -47,11 +53,11 @@ module Appraisal
|
|
47
53
|
protected
|
48
54
|
|
49
55
|
def source_entry
|
50
|
-
|
56
|
+
@sources.map { |source| "source #{source.inspect}" }.join("\n")
|
51
57
|
end
|
52
58
|
|
53
59
|
def dependencies_entry
|
54
|
-
dependencies.
|
60
|
+
dependencies.map { |dependency| dependency.to_s }.join("\n")
|
55
61
|
end
|
56
62
|
|
57
63
|
def gemspec_entry
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appraisal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joe Ferris
|
@@ -15,12 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-11-11 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
22
|
none: false
|
25
23
|
requirements:
|
26
24
|
- - ~>
|
@@ -30,12 +28,12 @@ dependencies:
|
|
30
28
|
- 1
|
31
29
|
- 0
|
32
30
|
version: "1.0"
|
33
|
-
|
34
|
-
|
31
|
+
requirement: *id001
|
32
|
+
type: :development
|
35
33
|
prerelease: false
|
34
|
+
name: cucumber
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
|
-
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
37
|
none: false
|
40
38
|
requirements:
|
41
39
|
- - ~>
|
@@ -45,12 +43,12 @@ dependencies:
|
|
45
43
|
- 2
|
46
44
|
- 6
|
47
45
|
version: "2.6"
|
48
|
-
|
49
|
-
|
46
|
+
requirement: *id002
|
47
|
+
type: :development
|
50
48
|
prerelease: false
|
49
|
+
name: rspec
|
51
50
|
- !ruby/object:Gem::Dependency
|
52
|
-
|
53
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
52
|
none: false
|
55
53
|
requirements:
|
56
54
|
- - ~>
|
@@ -61,12 +59,12 @@ dependencies:
|
|
61
59
|
- 4
|
62
60
|
- 2
|
63
61
|
version: 0.4.2
|
64
|
-
|
65
|
-
|
62
|
+
requirement: *id003
|
63
|
+
type: :development
|
66
64
|
prerelease: false
|
65
|
+
name: aruba
|
67
66
|
- !ruby/object:Gem::Dependency
|
68
|
-
|
69
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
68
|
none: false
|
71
69
|
requirements:
|
72
70
|
- - ">="
|
@@ -75,12 +73,12 @@ dependencies:
|
|
75
73
|
segments:
|
76
74
|
- 0
|
77
75
|
version: "0"
|
78
|
-
|
79
|
-
|
76
|
+
requirement: *id004
|
77
|
+
type: :runtime
|
80
78
|
prerelease: false
|
79
|
+
name: rake
|
81
80
|
- !ruby/object:Gem::Dependency
|
82
|
-
|
83
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
84
82
|
none: false
|
85
83
|
requirements:
|
86
84
|
- - ">="
|
@@ -89,9 +87,10 @@ dependencies:
|
|
89
87
|
segments:
|
90
88
|
- 0
|
91
89
|
version: "0"
|
92
|
-
|
93
|
-
|
90
|
+
requirement: *id005
|
91
|
+
type: :runtime
|
94
92
|
prerelease: false
|
93
|
+
name: bundler
|
95
94
|
description: Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals."
|
96
95
|
email: jferris@thoughtbot.com
|
97
96
|
executables: []
|
@@ -119,7 +118,6 @@ files:
|
|
119
118
|
- features/step_definitions/dependency_steps.rb
|
120
119
|
- features/support/aruba.rb
|
121
120
|
- features/support/env.rb
|
122
|
-
has_rdoc: true
|
123
121
|
homepage: http://github.com/thoughtbot/appraisal
|
124
122
|
licenses: []
|
125
123
|
|
@@ -149,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
147
|
requirements: []
|
150
148
|
|
151
149
|
rubyforge_project:
|
152
|
-
rubygems_version: 1.
|
150
|
+
rubygems_version: 1.8.11
|
153
151
|
signing_key:
|
154
152
|
specification_version: 3
|
155
153
|
summary: Find out what your Ruby gems are worth
|