appraisal 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source "http://rubygems.org"
2
- gem "cucumber"
3
- gem "aruba"
4
- gem "rake"
5
- gem "rspec"
2
+
3
+ gemspec
@@ -1,38 +1,47 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ appraisal (0.3.1)
5
+ aruba (~> 0.3.6)
6
+ bundler
7
+ rake
8
+
1
9
  GEM
2
10
  remote: http://rubygems.org/
3
11
  specs:
4
- aruba (0.2.4)
5
- background_process
6
- cucumber (~> 0.9.3)
7
- background_process (1.2)
8
- builder (2.1.2)
9
- cucumber (0.9.4)
10
- builder (~> 2.1.2)
11
- diff-lcs (~> 1.1.2)
12
- gherkin (~> 2.2.9)
13
- json (~> 1.4.6)
14
- term-ansicolor (~> 1.0.5)
12
+ aruba (0.3.6)
13
+ childprocess (>= 0.1.7)
14
+ cucumber (>= 0.10.0)
15
+ rspec (>= 2.5.0)
16
+ builder (3.0.0)
17
+ childprocess (0.1.9)
18
+ ffi (~> 1.0.6)
19
+ cucumber (0.10.3)
20
+ builder (>= 2.1.2)
21
+ diff-lcs (>= 1.1.2)
22
+ gherkin (>= 2.3.8)
23
+ json (>= 1.4.6)
24
+ term-ansicolor (>= 1.0.5)
15
25
  diff-lcs (1.1.2)
16
- gherkin (2.2.9)
17
- json (~> 1.4.6)
18
- term-ansicolor (~> 1.0.5)
19
- json (1.4.6)
20
- rake (0.8.7)
21
- rspec (2.1.0)
22
- rspec-core (~> 2.1.0)
23
- rspec-expectations (~> 2.1.0)
24
- rspec-mocks (~> 2.1.0)
25
- rspec-core (2.1.0)
26
- rspec-expectations (2.1.0)
26
+ ffi (1.0.9)
27
+ gherkin (2.3.9)
28
+ json (>= 1.4.6)
29
+ json (1.5.1)
30
+ rake (0.9.0)
31
+ rspec (2.6.0)
32
+ rspec-core (~> 2.6.0)
33
+ rspec-expectations (~> 2.6.0)
34
+ rspec-mocks (~> 2.6.0)
35
+ rspec-core (2.6.3)
36
+ rspec-expectations (2.6.0)
27
37
  diff-lcs (~> 1.1.2)
28
- rspec-mocks (2.1.0)
38
+ rspec-mocks (2.6.0)
29
39
  term-ansicolor (1.0.5)
30
40
 
31
41
  PLATFORMS
32
42
  ruby
33
43
 
34
44
  DEPENDENCIES
35
- aruba
36
- cucumber
37
- rake
38
- rspec
45
+ appraisal!
46
+ cucumber (~> 0.10)
47
+ rspec (~> 2.6)
@@ -36,40 +36,40 @@ Feature: run a rake task through several appraisals
36
36
  end
37
37
  task :default => :version
38
38
  """
39
- When I successfully run "bundle exec rake appraisal:install --trace"
39
+ When I successfully run `bundle exec rake appraisal:install --trace`
40
40
 
41
41
  @disable-bundler
42
42
  Scenario: run a specific task with one appraisal
43
- When I successfully run "bundle exec rake appraisal:1.3.0 version --trace"
43
+ When I successfully run `bundle exec rake appraisal:1.3.0 version --trace`
44
44
  Then the output should contain "Loaded 1.3.0"
45
45
 
46
46
  @disable-bundler
47
47
  Scenario: run a specific task with all appraisals
48
- When I successfully run "bundle exec rake appraisal version --trace"
48
+ When I successfully run `bundle exec rake appraisal version --trace`
49
49
  Then the output should contain "Loaded 1.3.0"
50
50
  And the output should contain "Loaded 1.3.2"
51
51
  And the output should not contain "Invoke version"
52
52
 
53
53
  @disable-bundler
54
54
  Scenario: run the default task with one appraisal
55
- When I successfully run "bundle exec rake appraisal:1.3.0 --trace"
55
+ When I successfully run `bundle exec rake appraisal:1.3.0 --trace`
56
56
  Then the output should contain "Loaded 1.3.0"
57
57
 
58
58
  @disable-bundler
59
59
  Scenario: run the default task with all appraisals
60
- When I successfully run "bundle exec rake appraisal --trace"
60
+ When I successfully run `bundle exec rake appraisal --trace`
61
61
  Then the output should contain "Loaded 1.3.0"
62
62
  And the output should contain "Loaded 1.3.2"
63
63
 
64
64
  @disable-bundler
65
65
  Scenario: run a failing task with one appraisal
66
- When I run "bundle exec rake appraisal:1.3.0 fail --trace"
66
+ When I run `bundle exec rake appraisal:1.3.0 fail --trace`
67
67
  Then the output should contain "Fail 1.3.0"
68
68
  And the exit status should be 1
69
69
 
70
70
  @disable-bundler
71
71
  Scenario: run a failing task with all appraisals
72
- When I run "bundle exec rake appraisal fail --trace"
72
+ When I run `bundle exec rake appraisal fail --trace`
73
73
  Then the output should contain "Fail 1.3.2"
74
74
  But the output should not contain "Fail 1.3.0"
75
75
  And the exit status should be 1
@@ -0,0 +1,70 @@
1
+ Feature: appraisals using an existing gemspec
2
+
3
+ Background:
4
+ Given a directory named "gemspecced"
5
+ When I cd to "gemspecced"
6
+ And I write to "gemspecced.gemspec" with:
7
+ """
8
+ Gem::Specification.new do |s|
9
+ s.name = %q{gemspecced}
10
+ s.version = '0.1'
11
+ s.summary = %q{featureful!}
12
+
13
+ s.add_runtime_dependency('mocha')
14
+ s.add_development_dependency('factory_girl', '1.3.2')
15
+ end
16
+ """
17
+ And a directory named "specdir"
18
+ And I write to "specdir/gemspecced.gemspec" with:
19
+ """
20
+ Gem::Specification.new do |s|
21
+ s.name = %q{gemspecced}
22
+ s.version = '0.1'
23
+ s.summary = %q{featureful!}
24
+
25
+ s.add_runtime_dependency('mocha')
26
+ s.add_development_dependency('factory_girl', '1.3.0')
27
+ end
28
+ """
29
+ And I write to "Appraisals" with:
30
+ """
31
+ appraise "stock" do
32
+ gem "shoulda", "2.11.3"
33
+ end
34
+ """
35
+ When I write to "Rakefile" with:
36
+ """
37
+ require 'rubygems'
38
+ require 'bundler/setup'
39
+ require 'appraisal'
40
+ task :version do
41
+ require 'factory_girl'
42
+ puts "Loaded #{Factory::VERSION}"
43
+ end
44
+ """
45
+
46
+ @disable-bundler
47
+ Scenario: run a gem in the gemspec
48
+ And I write to "Gemfile" with:
49
+ """
50
+ source "http://rubygems.org"
51
+ gemspec
52
+ """
53
+ When I add "appraisal" from this project as a dependency
54
+ When I successfully run `bundle exec rake appraisal:install --trace`
55
+ When I run `bundle exec rake appraisal version --trace`
56
+ Then the output should contain "Loaded 1.3.2"
57
+
58
+
59
+ @disable-bundler
60
+ Scenario: run a gem in the gemspec via path
61
+ And I write to "Gemfile" with:
62
+ """
63
+ source "http://rubygems.org"
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
+
@@ -0,0 +1,4 @@
1
+ Before do
2
+ # Extend the timeout before Aruba will kill the process to 5 minute.
3
+ @aruba_timeout_seconds = 18000
4
+ end
@@ -1,4 +1,4 @@
1
- require 'aruba'
1
+ require 'aruba/cucumber'
2
2
 
3
3
  PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
4
4
 
@@ -43,7 +43,11 @@ module Appraisal
43
43
  end
44
44
 
45
45
  def announce
46
- puts ">> BUNDLE_GEMFILE=#{@gemfile} #{@command}"
46
+ if @gemfile
47
+ puts ">> BUNDLE_GEMFILE=#{@gemfile} #{@command}"
48
+ else
49
+ puts ">> #{@command}"
50
+ end
47
51
  end
48
52
 
49
53
  def unset_bundler_env_vars
@@ -20,7 +20,7 @@ module Appraisal
20
20
  private
21
21
 
22
22
  def inspect_requirements
23
- requirements.map { |requirement| requirement.inspect }.join(", ")
23
+ requirements.map { |requirement| requirement.inspect.gsub(/^\{|\}$/, '') }.join(", ")
24
24
  end
25
25
  end
26
26
  end
@@ -1,4 +1,5 @@
1
1
  require 'appraisal/dependency'
2
+ require 'appraisal/gemspec'
2
3
 
3
4
  module Appraisal
4
5
  # Load bundler Gemfiles and merge dependencies
@@ -26,8 +27,7 @@ module Appraisal
26
27
  end
27
28
 
28
29
  def to_s
29
- %{source "#{@source}"\n} <<
30
- dependencies.values.map { |dependency| dependency.to_s }.join("\n")
30
+ [source_entry, dependencies_entry, gemspec_entry].join("\n\n")
31
31
  end
32
32
 
33
33
  def dup
@@ -36,7 +36,26 @@ module Appraisal
36
36
  dependencies.values.each do |dependency|
37
37
  gemfile.gem(dependency.name, *dependency.requirements)
38
38
  end
39
+ gemfile.gemspec(@gemspec.options) if @gemspec
39
40
  end
40
41
  end
42
+
43
+ def gemspec(options = {})
44
+ @gemspec = Gemspec.new(options)
45
+ end
46
+
47
+ protected
48
+
49
+ def source_entry
50
+ %(source "#{@source}")
51
+ end
52
+
53
+ def dependencies_entry
54
+ dependencies.values.map { |dependency| dependency.to_s }.join("\n")
55
+ end
56
+
57
+ def gemspec_entry
58
+ @gemspec.to_s
59
+ end
41
60
  end
42
61
  end
@@ -0,0 +1,23 @@
1
+ require 'pathname'
2
+
3
+ module Appraisal
4
+ class Gemspec
5
+ attr_reader :options
6
+
7
+ def initialize(options = {})
8
+ @options = options
9
+
10
+ # figure out the right path for the gemspec
11
+ @options[:path] ||= '.'
12
+ @options[:path] = ::File.expand_path(@options[:path])
13
+ end
14
+
15
+ def exists?
16
+ Dir[::File.join(@options[:path], "*.gemspec")].size > 0
17
+ end
18
+
19
+ def to_s
20
+ "gemspec #{@options.inspect.gsub(/^\{|\}$/, '')}" if exists?
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: appraisal
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Joe Ferris
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-23 00:00:00 -04:00
13
+ date: 2011-05-24 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -18,20 +18,20 @@ dependencies:
18
18
  requirement: &id001 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
- - - ">="
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: "0.10"
24
24
  type: :development
25
25
  prerelease: false
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: aruba
28
+ name: rspec
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
- - - ">="
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: "0"
34
+ version: "2.6"
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: *id002
@@ -57,6 +57,17 @@ dependencies:
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: aruba
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 0.3.6
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: *id005
60
71
  description: Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals."
61
72
  email: jferris@thoughtbot.com
62
73
  executables: []
@@ -75,10 +86,13 @@ files:
75
86
  - lib/appraisal/dependency.rb
76
87
  - lib/appraisal/file.rb
77
88
  - lib/appraisal/gemfile.rb
89
+ - lib/appraisal/gemspec.rb
78
90
  - lib/appraisal/task.rb
79
91
  - lib/appraisal.rb
80
92
  - features/appraisals.feature
93
+ - features/gemspec.feature
81
94
  - features/step_definitions/dependency_steps.rb
95
+ - features/support/aruba.rb
82
96
  - features/support/env.rb
83
97
  has_rdoc: true
84
98
  homepage: http://github.com/thoughtbot/appraisal
@@ -94,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - ">="
96
110
  - !ruby/object:Gem::Version
97
- hash: -3413517185819594219
111
+ hash: 1018536850827095615
98
112
  segments:
99
113
  - 0
100
114
  version: "0"
@@ -103,6 +117,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
117
  requirements:
104
118
  - - ">="
105
119
  - !ruby/object:Gem::Version
120
+ hash: 1018536850827095615
121
+ segments:
122
+ - 0
106
123
  version: "0"
107
124
  requirements: []
108
125
 
@@ -113,5 +130,7 @@ specification_version: 3
113
130
  summary: Find out what your Ruby gems are worth
114
131
  test_files:
115
132
  - features/appraisals.feature
133
+ - features/gemspec.feature
116
134
  - features/step_definitions/dependency_steps.rb
135
+ - features/support/aruba.rb
117
136
  - features/support/env.rb