appraisal 2.0.0 → 2.3.0

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.
@@ -0,0 +1,51 @@
1
+ require "spec_helper"
2
+
3
+ describe "Bundler without flag" do
4
+ it "passes --without flag to Bundler on install" do
5
+ build_gems %w(pancake orange_juice waffle coffee sausage soda)
6
+
7
+ build_gemfile <<-Gemfile
8
+ source "https://rubygems.org"
9
+
10
+ gem "pancake"
11
+ gem "rake", "~> 10.5", :platform => :ruby_18
12
+
13
+ group :drinks do
14
+ gem "orange_juice"
15
+ end
16
+
17
+ gem "appraisal", :path => #{PROJECT_ROOT.inspect}
18
+ Gemfile
19
+
20
+ build_appraisal_file <<-Appraisals
21
+ appraise "breakfast" do
22
+ gem "waffle"
23
+
24
+ group :drinks do
25
+ gem "coffee"
26
+ end
27
+ end
28
+
29
+ appraise "lunch" do
30
+ gem "sausage"
31
+
32
+ group :drinks do
33
+ gem "soda"
34
+ end
35
+ end
36
+ Appraisals
37
+
38
+ run "bundle install --local"
39
+ output = run "appraisal install --without drinks"
40
+
41
+ expect(output).to include("Bundle complete")
42
+ expect(output).to include("Gems in the group drinks were not installed.")
43
+ expect(output).not_to include("orange_juice")
44
+ expect(output).not_to include("coffee")
45
+ expect(output).not_to include("soda")
46
+
47
+ output = run "appraisal install"
48
+
49
+ expect(output).to include("The Gemfile's dependencies are satisfied")
50
+ end
51
+ end
@@ -36,8 +36,8 @@ describe 'CLI', 'appraisal install' do
36
36
 
37
37
  run 'appraisal install'
38
38
 
39
- expect(content_of 'gemfiles/1.0.0.gemfile.lock').not_to include
40
- current_directory
39
+ expect(content_of("gemfiles/1.0.0.gemfile.lock")).
40
+ not_to include(current_directory)
41
41
  end
42
42
 
43
43
  context 'with job size', :parallel => true do
@@ -52,19 +52,61 @@ describe 'CLI', 'appraisal install' do
52
52
  it 'accepts --jobs option to set job size' do
53
53
  output = run 'appraisal install --jobs=2'
54
54
 
55
- expect(output).to include
56
- 'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=2'
55
+ expect(output).to include(
56
+ "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=2"
57
+ )
57
58
  end
58
59
 
59
60
  it 'ignores --jobs option if the job size is less than or equal to 1' do
60
61
  output = run 'appraisal install --jobs=0'
61
62
 
63
+ expect(output).to include(
64
+ "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}'"
65
+ )
62
66
  expect(output).not_to include(
63
- 'bundle install --gemfile=gemfiles/1.0.0.gemfile')
67
+ "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=0"
68
+ )
64
69
  expect(output).not_to include(
65
- 'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=0')
66
- expect(output).not_to include(
67
- 'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=1')
70
+ "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=1"
71
+ )
72
+ end
73
+ end
74
+
75
+ context "with full-index", :parallel do
76
+ before do
77
+ build_appraisal_file <<-APPRAISAL
78
+ appraise '1.0.0' do
79
+ gem 'dummy', '1.0.0'
80
+ end
81
+ APPRAISAL
82
+ end
83
+
84
+ it "accepts --full-index option to pull the full RubyGems index" do
85
+ output = run("appraisal install --full-index")
86
+
87
+ expect(output).to include(
88
+ "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' " \
89
+ "--retry 1 --full-index true"
90
+ )
91
+ end
92
+ end
93
+
94
+ context "with path", :parallel do
95
+ before do
96
+ build_appraisal_file <<-APPRAISAL
97
+ appraise '1.0.0' do
98
+ gem 'dummy', '1.0.0'
99
+ end
100
+ APPRAISAL
101
+ end
102
+
103
+ it "accepts --path option to specify the location to install gems into" do
104
+ output = run("appraisal install --path vendor/appraisal")
105
+
106
+ expect(output).to include(
107
+ "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' " \
108
+ "--path #{file('vendor/appraisal')} --retry 1",
109
+ )
68
110
  end
69
111
  end
70
112
  end
@@ -25,8 +25,9 @@ describe 'CLI', 'appraisal update' do
25
25
 
26
26
  context 'with no arguments' do
27
27
  it 'updates all the gems' do
28
- run 'appraisal update'
28
+ output = run 'appraisal update'
29
29
 
30
+ expect(output).to include("gemfiles/dummy.gemfile bundle update")
30
31
  expect(content_of 'gemfiles/dummy.gemfile.lock').to include 'dummy (1.0.1)'
31
32
  expect(content_of 'gemfiles/dummy.gemfile.lock').to include 'dummy2 (1.0.1)'
32
33
  end
@@ -67,6 +67,7 @@ describe 'Gemspec' do
67
67
  s.name = 'gemspec_project'
68
68
  s.version = '0.1'
69
69
  s.summary = 'Awesome Gem!'
70
+ s.authors = "Appraisal"
70
71
 
71
72
  s.add_development_dependency('dummy', '1.1.0')
72
73
  end
@@ -21,7 +21,7 @@ describe "Travis CI integration" do
21
21
 
22
22
  expect(output).to include <<-stdout.strip_heredoc
23
23
  # Put this in your .travis.yml
24
- gemfiles:
24
+ gemfile:
25
25
  - gemfiles/1.0.0.gemfile
26
26
  - gemfiles/1.1.0.gemfile
27
27
  stdout
@@ -44,7 +44,7 @@ describe "Travis CI integration" do
44
44
  context "with incorrect gemfiles directive" do
45
45
  before do
46
46
  write_file ".travis.yml", <<-travis_yml
47
- gemfiles:
47
+ gemfile:
48
48
  - gemfiles/1.0.0.gemfile
49
49
  - gemfiles/1.0.1.gemfile
50
50
  travis_yml
@@ -60,7 +60,7 @@ describe "Travis CI integration" do
60
60
  context "with correct gemfiles directive" do
61
61
  before do
62
62
  write_file ".travis.yml", <<-travis_yml
63
- gemfiles:
63
+ gemfile:
64
64
  - gemfiles/1.0.0.gemfile
65
65
  - gemfiles/1.1.0.gemfile
66
66
  travis_yml
@@ -1,13 +1,14 @@
1
1
  require 'spec_helper'
2
- require 'appraisal/file'
2
+ require 'appraisal/appraisal_file'
3
3
 
4
4
  # Requiring this to make the test pass on Rubinius 2.2.5
5
5
  # https://github.com/rubinius/rubinius/issues/2934
6
6
  require 'rspec/matchers/built_in/raise_error'
7
7
 
8
- describe Appraisal::File do
8
+ describe Appraisal::AppraisalFile do
9
9
  it "complains when no Appraisals file is found" do
10
- allow(::File).to receive(:exist?).with("Appraisals").and_return(false)
10
+ allow(File).to receive(:exist?).with(/Gemfile/).and_return(true)
11
+ allow(File).to receive(:exist?).with("Appraisals").and_return(false)
11
12
  expect { described_class.new }.to raise_error(Appraisal::AppraisalsNotFound)
12
13
  end
13
14
  end
@@ -34,6 +34,8 @@ describe Appraisal::Appraisal do
34
34
  before do
35
35
  @appraisal = Appraisal::Appraisal.new('fake', 'fake')
36
36
  allow(@appraisal).to receive(:gemfile_path).and_return("/home/test/test directory")
37
+ allow(@appraisal).to receive(:project_root).
38
+ and_return(Pathname.new("/home/test"))
37
39
  allow(Appraisal::Command).to receive(:new).and_return(double(:run => true))
38
40
  end
39
41
 
@@ -41,7 +43,7 @@ describe Appraisal::Appraisal do
41
43
  stub_const('Bundler::VERSION', '1.3.0')
42
44
 
43
45
  warning = capture(:stderr) do
44
- @appraisal.install(42)
46
+ @appraisal.install("jobs" => 42)
45
47
  end
46
48
 
47
49
  expect(Appraisal::Command).to have_received(:new).
@@ -52,12 +54,26 @@ describe Appraisal::Appraisal do
52
54
  it 'runs parallel install command on Bundler >= 1.4.0' do
53
55
  stub_const('Bundler::VERSION', '1.4.0')
54
56
 
55
- @appraisal.install(42)
57
+ @appraisal.install("jobs" => 42)
56
58
 
57
59
  expect(Appraisal::Command).to have_received(:new).
58
60
  with("#{bundle_check_command} || #{bundle_parallel_install_command}")
59
61
  end
60
62
 
63
+ it 'runs install command with retries on Bundler' do
64
+ @appraisal.install("retry" => 3)
65
+
66
+ expect(Appraisal::Command).to have_received(:new).
67
+ with("#{bundle_check_command} || #{bundle_install_command_with_retries}")
68
+ end
69
+
70
+ it "runs install command with path on Bundler" do
71
+ @appraisal.install("path" => "vendor/appraisal")
72
+
73
+ expect(Appraisal::Command).to have_received(:new).
74
+ with("#{bundle_check_command} || #{bundle_install_command_with_path}")
75
+ end
76
+
61
77
  def bundle_check_command
62
78
  "bundle check --gemfile='/home/test/test directory'"
63
79
  end
@@ -69,5 +85,14 @@ describe Appraisal::Appraisal do
69
85
  def bundle_parallel_install_command
70
86
  "bundle install --gemfile='/home/test/test directory' --jobs=42"
71
87
  end
88
+
89
+ def bundle_install_command_with_retries
90
+ "bundle install --gemfile='/home/test/test directory' --retry 3"
91
+ end
92
+
93
+ def bundle_install_command_with_path
94
+ "bundle install --gemfile='/home/test/test directory' " \
95
+ "--path /home/test/vendor/appraisal"
96
+ end
72
97
  end
73
98
  end
@@ -251,26 +251,28 @@ describe Appraisal::Gemfile do
251
251
  end
252
252
 
253
253
  context "relative path handling" do
254
+ before { stub_const('RUBY_VERSION', '2.3.0') }
255
+
254
256
  context "in :path option" do
255
257
  it "handles dot path" do
256
258
  gemfile = Appraisal::Gemfile.new
257
259
  gemfile.gem "bacon", :path => "."
258
260
 
259
- expect(gemfile.to_s).to eq %(gem "bacon", :path => "../")
261
+ expect(gemfile.to_s).to eq %(gem "bacon", path: "../")
260
262
  end
261
263
 
262
264
  it "handles relative path" do
263
265
  gemfile = Appraisal::Gemfile.new
264
266
  gemfile.gem "bacon", :path => "../bacon"
265
267
 
266
- expect(gemfile.to_s).to eq %(gem "bacon", :path => "../../bacon")
268
+ expect(gemfile.to_s).to eq %(gem "bacon", path: "../../bacon")
267
269
  end
268
270
 
269
271
  it "handles absolute path" do
270
272
  gemfile = Appraisal::Gemfile.new
271
273
  gemfile.gem "bacon", :path => "/tmp"
272
274
 
273
- expect(gemfile.to_s).to eq %(gem "bacon", :path => "/tmp")
275
+ expect(gemfile.to_s).to eq %(gem "bacon", path: "/tmp")
274
276
  end
275
277
  end
276
278
 
@@ -279,21 +281,21 @@ describe Appraisal::Gemfile do
279
281
  gemfile = Appraisal::Gemfile.new
280
282
  gemfile.gem "bacon", :git => "."
281
283
 
282
- expect(gemfile.to_s).to eq %(gem "bacon", :git => "../")
284
+ expect(gemfile.to_s).to eq %(gem "bacon", git: "../")
283
285
  end
284
286
 
285
287
  it "handles relative git path" do
286
288
  gemfile = Appraisal::Gemfile.new
287
289
  gemfile.gem "bacon", :git => "../bacon"
288
290
 
289
- expect(gemfile.to_s).to eq %(gem "bacon", :git => "../../bacon")
291
+ expect(gemfile.to_s).to eq %(gem "bacon", git: "../../bacon")
290
292
  end
291
293
 
292
294
  it "handles absolute git path" do
293
295
  gemfile = Appraisal::Gemfile.new
294
296
  gemfile.gem "bacon", :git => "/tmp"
295
297
 
296
- expect(gemfile.to_s).to eq %(gem "bacon", :git => "/tmp")
298
+ expect(gemfile.to_s).to eq %(gem "bacon", git: "/tmp")
297
299
  end
298
300
 
299
301
  it "handles git uri" do
@@ -301,7 +303,7 @@ describe Appraisal::Gemfile do
301
303
  gemfile.gem "bacon", :git => "git@github.com:bacon/bacon.git"
302
304
 
303
305
  expect(gemfile.to_s).
304
- to eq %(gem "bacon", :git => "git@github.com:bacon/bacon.git")
306
+ to eq %(gem "bacon", git: "git@github.com:bacon/bacon.git")
305
307
  end
306
308
  end
307
309
 
@@ -412,8 +414,20 @@ describe Appraisal::Gemfile do
412
414
  gemfile = Appraisal::Gemfile.new
413
415
  gemfile.gemspec :path => "."
414
416
 
415
- expect(gemfile.to_s).to eq %(gemspec :path => "../")
417
+ expect(gemfile.to_s).to eq %(gemspec path: "../")
416
418
  end
417
419
  end
418
420
  end
421
+
422
+ context "git_source support" do
423
+ before { stub_const('RUBY_VERSION', '2.3.0') }
424
+
425
+ it "stores git_source declaration and apply it as git option" do
426
+ gemfile = Appraisal::Gemfile.new
427
+ gemfile.git_source(:custom_source) { |repo| "path/#{repo}" }
428
+ gemfile.gem "bacon", :custom_source => "bacon_pancake"
429
+
430
+ expect(gemfile.to_s).to eq %(gem "bacon", git: "../path/bacon_pancake")
431
+ end
432
+ end
419
433
  end
@@ -3,22 +3,24 @@ require 'appraisal/utils'
3
3
 
4
4
  describe Appraisal::Utils do
5
5
  describe '.format_string' do
6
- it 'prints out a nice looking hash without a brackets' do
6
+ it "prints out a nice looking hash without brackets with new syntax" do
7
7
  hash = { :foo => 'bar' }
8
- expect(Appraisal::Utils.format_string(hash)).to eq(':foo => "bar"')
8
+ expect(Appraisal::Utils.format_string(hash)).to eq('foo: "bar"')
9
9
 
10
10
  hash = { 'baz' => { :ball => 'boo' }}
11
11
  expect(Appraisal::Utils.format_string(hash)).
12
- to eq('"baz" => { :ball => "boo" }')
12
+ to eq('"baz" => { ball: "boo" }')
13
13
  end
14
14
  end
15
15
 
16
16
  describe '.format_arguments' do
17
+ before { stub_const('RUBY_VERSION', '2.3.0') }
18
+
17
19
  it 'prints out arguments without enclosing square brackets' do
18
20
  arguments = [:foo, { :bar => { :baz => 'ball' }}]
19
21
 
20
22
  expect(Appraisal::Utils.format_arguments(arguments)).to eq(
21
- ':foo, :bar => { :baz => "ball" }'
23
+ ':foo, bar: { baz: "ball" }'
22
24
  )
23
25
  end
24
26
 
@@ -58,4 +60,16 @@ describe Appraisal::Utils do
58
60
  ).to eq("https://github.com/bacon/bacon.git")
59
61
  end
60
62
  end
63
+
64
+ describe ".bundler_version" do
65
+ it "returns the bundler version" do
66
+ bundler = double("Bundler", :name => "bundler", :version => "a.b.c")
67
+ allow(Gem::Specification).to receive(:detect).and_return(bundler)
68
+
69
+ version = Appraisal::Utils.bundler_version
70
+
71
+ expect(version).to eq "a.b.c"
72
+ expect(Gem::Specification).to have_received(:detect)
73
+ end
74
+ end
61
75
  end
@@ -80,12 +80,15 @@ module AcceptanceTestHelpers
80
80
  s.name = 'stage'
81
81
  s.version = '0.1'
82
82
  s.summary = 'Awesome Gem!'
83
+ s.authors = "Appraisal"
83
84
  end
84
85
  gemspec
85
86
  end
86
87
 
87
88
  def content_of(path)
88
- file(path).read
89
+ file(path).read.tap do |content|
90
+ content.gsub!(/(\S+): /, ":\\1 => ")
91
+ end
89
92
  end
90
93
 
91
94
  def file(path)
@@ -125,8 +128,9 @@ module AcceptanceTestHelpers
125
128
  Reinstall Bundler to #{TMP_GEM_ROOT} as `BUNDLE_DISABLE_SHARED_GEMS`
126
129
  is enabled.
127
130
  WARNING
131
+ version = Utils.bundler_version
128
132
 
129
- run "gem install bundler --install-dir '#{TMP_GEM_ROOT}'"
133
+ run "gem install bundler --version #{version} --install-dir '#{TMP_GEM_ROOT}'"
130
134
  end
131
135
  end
132
136
 
@@ -135,11 +139,6 @@ module AcceptanceTestHelpers
135
139
  source 'https://rubygems.org'
136
140
 
137
141
  gem 'appraisal', :path => '#{PROJECT_ROOT}'
138
-
139
- if RUBY_VERSION < "1.9"
140
- gem "i18n", "~> 0.6.0"
141
- gem "activesupport", "~> 3.2.21"
142
- end
143
142
  Gemfile
144
143
 
145
144
  run "bundle install --binstubs --local"
@@ -53,4 +53,8 @@ module DependencyHelpers
53
53
  FileUtils.rm_r(path)
54
54
  end
55
55
  end
56
+
57
+ def build_git_gems(gems)
58
+ gems.each { |gem| build_git_gem(gem) }
59
+ end
56
60
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appraisal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Ferris
8
8
  - Prem Sichanugrist
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-10 00:00:00.000000000 Z
12
+ date: 2020-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -60,7 +60,7 @@ dependencies:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: 3.2.21
63
- type: :runtime
63
+ type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
@@ -103,25 +103,27 @@ files:
103
103
  - bin/appraisal
104
104
  - lib/appraisal.rb
105
105
  - lib/appraisal/appraisal.rb
106
+ - lib/appraisal/appraisal_file.rb
106
107
  - lib/appraisal/bundler_dsl.rb
107
108
  - lib/appraisal/cli.rb
108
109
  - lib/appraisal/command.rb
109
110
  - lib/appraisal/dependency.rb
110
111
  - lib/appraisal/dependency_list.rb
111
112
  - lib/appraisal/errors.rb
112
- - lib/appraisal/file.rb
113
113
  - lib/appraisal/gemfile.rb
114
114
  - lib/appraisal/gemspec.rb
115
- - lib/appraisal/git_source.rb
115
+ - lib/appraisal/git.rb
116
116
  - lib/appraisal/group.rb
117
- - lib/appraisal/path_source.rb
117
+ - lib/appraisal/path.rb
118
118
  - lib/appraisal/platform.rb
119
+ - lib/appraisal/source.rb
119
120
  - lib/appraisal/task.rb
120
121
  - lib/appraisal/travis_ci_helper.rb
121
122
  - lib/appraisal/utils.rb
122
123
  - lib/appraisal/version.rb
123
124
  - spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb
124
125
  - spec/acceptance/bundle_with_custom_path_spec.rb
126
+ - spec/acceptance/bundle_without_spec.rb
125
127
  - spec/acceptance/cli/clean_spec.rb
126
128
  - spec/acceptance/cli/generate_spec.rb
127
129
  - spec/acceptance/cli/help_spec.rb
@@ -134,9 +136,9 @@ files:
134
136
  - spec/acceptance/gemfile_dsl_compatibility_spec.rb
135
137
  - spec/acceptance/gemspec_spec.rb
136
138
  - spec/acceptance/travis_ci_integration_spec.rb
139
+ - spec/appraisal/appraisal_file_spec.rb
137
140
  - spec/appraisal/appraisal_spec.rb
138
141
  - spec/appraisal/dependency_list_spec.rb
139
- - spec/appraisal/file_spec.rb
140
142
  - spec/appraisal/gemfile_spec.rb
141
143
  - spec/appraisal/utils_spec.rb
142
144
  - spec/spec_helper.rb
@@ -147,7 +149,7 @@ homepage: http://github.com/thoughtbot/appraisal
147
149
  licenses:
148
150
  - MIT
149
151
  metadata: {}
150
- post_install_message:
152
+ post_install_message:
151
153
  rdoc_options: []
152
154
  require_paths:
153
155
  - lib
@@ -155,21 +157,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
157
  requirements:
156
158
  - - ">="
157
159
  - !ruby/object:Gem::Version
158
- version: '0'
160
+ version: 2.3.0
159
161
  required_rubygems_version: !ruby/object:Gem::Requirement
160
162
  requirements:
161
163
  - - ">="
162
164
  - !ruby/object:Gem::Version
163
165
  version: '0'
164
166
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.4.6
167
- signing_key:
167
+ rubygems_version: 3.1.2
168
+ signing_key:
168
169
  specification_version: 4
169
170
  summary: Find out what your Ruby gems are worth
170
171
  test_files:
171
172
  - spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb
172
173
  - spec/acceptance/bundle_with_custom_path_spec.rb
174
+ - spec/acceptance/bundle_without_spec.rb
173
175
  - spec/acceptance/cli/clean_spec.rb
174
176
  - spec/acceptance/cli/generate_spec.rb
175
177
  - spec/acceptance/cli/help_spec.rb
@@ -182,9 +184,9 @@ test_files:
182
184
  - spec/acceptance/gemfile_dsl_compatibility_spec.rb
183
185
  - spec/acceptance/gemspec_spec.rb
184
186
  - spec/acceptance/travis_ci_integration_spec.rb
187
+ - spec/appraisal/appraisal_file_spec.rb
185
188
  - spec/appraisal/appraisal_spec.rb
186
189
  - spec/appraisal/dependency_list_spec.rb
187
- - spec/appraisal/file_spec.rb
188
190
  - spec/appraisal/gemfile_spec.rb
189
191
  - spec/appraisal/utils_spec.rb
190
192
  - spec/spec_helper.rb