bundler 1.2.5 → 1.3.0.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- data/.gitignore +10 -7
- data/.travis.yml +12 -3
- data/CHANGELOG.md +26 -19
- data/CONTRIBUTE.md +97 -0
- data/README.md +4 -2
- data/Rakefile +17 -59
- data/bundler.gemspec +2 -1
- data/lib/bundler.rb +23 -20
- data/lib/bundler/cli.rb +68 -22
- data/lib/bundler/definition.rb +3 -2
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +14 -16
- data/lib/bundler/environment.rb +0 -5
- data/lib/bundler/fetcher.rb +23 -78
- data/lib/bundler/friendly_errors.rb +4 -5
- data/lib/bundler/gem_helper.rb +14 -16
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +1 -7
- data/lib/bundler/lazy_specification.rb +6 -3
- data/lib/bundler/lockfile_parser.rb +25 -13
- data/lib/bundler/resolver.rb +0 -1
- data/lib/bundler/rubygems_integration.rb +83 -17
- data/lib/bundler/settings.rb +4 -2
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +3 -886
- data/lib/bundler/source/git.rb +267 -0
- data/lib/bundler/source/git/git_proxy.rb +142 -0
- data/lib/bundler/source/path.rb +209 -0
- data/lib/bundler/source/path/installer.rb +33 -0
- data/lib/bundler/source/rubygems.rb +261 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +9 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +20 -5
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/thor.rb +74 -5
- data/lib/bundler/vendor/thor/actions.rb +5 -5
- data/lib/bundler/vendor/thor/actions/directory.rb +1 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +7 -1
- data/lib/bundler/vendor/thor/base.rb +44 -11
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +5 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +14 -7
- data/lib/bundler/vendor/thor/parser/arguments.rb +7 -1
- data/lib/bundler/vendor/thor/parser/option.rb +8 -8
- data/lib/bundler/vendor/thor/parser/options.rb +62 -24
- data/lib/bundler/vendor/thor/runner.rb +1 -1
- data/lib/bundler/vendor/thor/shell/basic.rb +2 -2
- data/lib/bundler/vendor/thor/task.rb +2 -2
- data/lib/bundler/vendor/thor/version.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +3 -15
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-exec.ronn +1 -1
- data/man/bundle-update.ronn +1 -1
- data/man/bundle.ronn +4 -1
- data/spec/bundler/bundler_spec.rb +2 -28
- data/spec/bundler/cli_rspec.rb +9 -0
- data/spec/bundler/definition_spec.rb +1 -1
- data/spec/bundler/dsl_spec.rb +15 -8
- data/spec/bundler/gem_helper_spec.rb +38 -21
- data/spec/bundler/psyched_yaml_spec.rb +1 -0
- data/spec/bundler/source_spec.rb +3 -3
- data/spec/cache/gems_spec.rb +24 -24
- data/spec/cache/git_spec.rb +21 -23
- data/spec/cache/path_spec.rb +11 -11
- data/spec/cache/platform_spec.rb +6 -6
- data/spec/install/deploy_spec.rb +38 -38
- data/spec/install/gems/c_ext_spec.rb +2 -2
- data/spec/install/gems/dependency_api_spec.rb +23 -116
- data/spec/install/gems/env_spec.rb +1 -1
- data/spec/install/gems/flex_spec.rb +7 -8
- data/spec/install/gems/groups_spec.rb +10 -10
- data/spec/install/gems/packed_spec.rb +4 -4
- data/spec/install/gems/platform_spec.rb +3 -3
- data/spec/install/gems/post_install_spec.rb +9 -9
- data/spec/install/gems/resolving_spec.rb +2 -2
- data/spec/install/gems/simple_case_spec.rb +50 -53
- data/spec/install/gems/standalone_spec.rb +19 -19
- data/spec/install/gems/sudo_spec.rb +31 -16
- data/spec/install/gems/win32_spec.rb +1 -1
- data/spec/install/gemspec_spec.rb +6 -6
- data/spec/install/git_spec.rb +34 -34
- data/spec/install/invalid_spec.rb +3 -3
- data/spec/install/path_spec.rb +71 -8
- data/spec/install/upgrade_spec.rb +2 -2
- data/spec/integration/inject.rb +78 -0
- data/spec/lock/git_spec.rb +2 -2
- data/spec/lock/lockfile_spec.rb +14 -14
- data/spec/other/check_spec.rb +29 -29
- data/spec/other/clean_spec.rb +47 -48
- data/spec/other/config_spec.rb +20 -20
- data/spec/other/console_spec.rb +5 -5
- data/spec/other/exec_spec.rb +48 -28
- data/spec/other/ext_spec.rb +3 -3
- data/spec/other/help_spec.rb +6 -6
- data/spec/other/init_spec.rb +8 -8
- data/spec/other/newgem_spec.rb +95 -15
- data/spec/other/open_spec.rb +10 -5
- data/spec/other/outdated_spec.rb +8 -8
- data/spec/other/platform_spec.rb +45 -45
- data/spec/other/show_spec.rb +10 -10
- data/spec/quality_spec.rb +2 -2
- data/spec/realworld/dependency_api_spec.rb +61 -0
- data/spec/realworld/edgecases_spec.rb +8 -8
- data/spec/runtime/executable_spec.rb +13 -13
- data/spec/runtime/load_spec.rb +12 -12
- data/spec/runtime/platform_spec.rb +1 -1
- data/spec/runtime/require_spec.rb +24 -24
- data/spec/runtime/setup_spec.rb +113 -56
- data/spec/runtime/with_clean_env_spec.rb +11 -13
- data/spec/spec_helper.rb +6 -0
- data/spec/support/artifice/endpoint.rb +28 -13
- data/spec/support/artifice/endpoint_extra.rb +4 -0
- data/spec/support/builders.rb +1 -1
- data/spec/support/helpers.rb +2 -7
- data/spec/support/indexes.rb +3 -3
- data/spec/support/matchers.rb +6 -6
- data/spec/update/gems_spec.rb +19 -8
- data/spec/update/git_spec.rb +10 -10
- data/spec/update/source_spec.rb +1 -1
- metadata +86 -55
- data/.rspec +0 -2
@@ -11,7 +11,7 @@ describe "bundle install with deprecated features" do
|
|
11
11
|
G
|
12
12
|
|
13
13
|
bundle :install
|
14
|
-
out.
|
14
|
+
expect(out).to match(/You passed :lib as an option for gem 'rack', but it is invalid/)
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
@@ -30,6 +30,6 @@ describe "bundle install to a dead symlink" do
|
|
30
30
|
G
|
31
31
|
|
32
32
|
bundle "install --path bundle"
|
33
|
-
out.
|
33
|
+
expect(out).to match(/invalid symlink/)
|
34
34
|
end
|
35
|
-
end
|
35
|
+
end
|
data/spec/install/path_spec.rb
CHANGED
@@ -67,7 +67,7 @@ describe "bundle install with explicit source paths" do
|
|
67
67
|
G
|
68
68
|
|
69
69
|
bundle "install --frozen", :exitstatus => true
|
70
|
-
exitstatus.
|
70
|
+
expect(exitstatus).to eq(0)
|
71
71
|
end
|
72
72
|
|
73
73
|
it "installs dependencies from the path even if a newer gem is available elsewhere" do
|
@@ -87,7 +87,7 @@ describe "bundle install with explicit source paths" do
|
|
87
87
|
G
|
88
88
|
|
89
89
|
run "require 'rack'"
|
90
|
-
out.
|
90
|
+
expect(out).to eq('WIN OVERRIDE')
|
91
91
|
end
|
92
92
|
|
93
93
|
it "works" do
|
@@ -191,8 +191,8 @@ describe "bundle install with explicit source paths" do
|
|
191
191
|
gemspec :path => "#{lib_path("foo")}"
|
192
192
|
G
|
193
193
|
|
194
|
-
exitstatus.
|
195
|
-
out.
|
194
|
+
expect(exitstatus).to eq(15)
|
195
|
+
expect(out).to match(/There are multiple gemspecs/)
|
196
196
|
end
|
197
197
|
|
198
198
|
it "allows :name to be specified to resolve ambiguity" do
|
@@ -220,7 +220,7 @@ describe "bundle install with explicit source paths" do
|
|
220
220
|
G
|
221
221
|
|
222
222
|
bundle "exec foobar"
|
223
|
-
out.
|
223
|
+
expect(out).to eq("1.0")
|
224
224
|
end
|
225
225
|
|
226
226
|
it "handles directories in bin/" do
|
@@ -231,7 +231,7 @@ describe "bundle install with explicit source paths" do
|
|
231
231
|
install_gemfile <<-G
|
232
232
|
gem 'foo', '1.0', :path => "#{lib_path('foo-1.0')}"
|
233
233
|
G
|
234
|
-
err.
|
234
|
+
expect(err).to eq("")
|
235
235
|
end
|
236
236
|
|
237
237
|
it "removes the .gem file after installing" do
|
@@ -241,7 +241,7 @@ describe "bundle install with explicit source paths" do
|
|
241
241
|
gem 'foo', :path => "#{lib_path('foo-1.0')}"
|
242
242
|
G
|
243
243
|
|
244
|
-
lib_path('foo-1.0').join('foo-1.0.gem').
|
244
|
+
expect(lib_path('foo-1.0').join('foo-1.0.gem')).not_to exist
|
245
245
|
end
|
246
246
|
|
247
247
|
describe "block syntax" do
|
@@ -297,7 +297,7 @@ describe "bundle install with explicit source paths" do
|
|
297
297
|
G
|
298
298
|
|
299
299
|
bundle "exec foo"
|
300
|
-
out.
|
300
|
+
expect(out).to eq("1.0")
|
301
301
|
end
|
302
302
|
|
303
303
|
describe "when the gem version in the path is updated" do
|
@@ -402,4 +402,67 @@ describe "bundle install with explicit source paths" do
|
|
402
402
|
should_be_installed "bar 1.0"
|
403
403
|
end
|
404
404
|
end
|
405
|
+
|
406
|
+
describe "gem install hooks" do
|
407
|
+
it "runs pre-install hooks" do
|
408
|
+
build_git "foo"
|
409
|
+
gemfile <<-G
|
410
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
411
|
+
G
|
412
|
+
|
413
|
+
File.open(lib_path("install_hooks.rb"), "w") do |h|
|
414
|
+
h.write <<-H
|
415
|
+
require 'rubygems'
|
416
|
+
Gem.pre_install_hooks << lambda do |inst|
|
417
|
+
STDERR.puts "Ran pre-install hook: \#{inst.spec.full_name}"
|
418
|
+
end
|
419
|
+
H
|
420
|
+
end
|
421
|
+
|
422
|
+
bundle :install, :expect_err => true,
|
423
|
+
:requires => [lib_path('install_hooks.rb')]
|
424
|
+
expect(err).to eq("Ran pre-install hook: foo-1.0")
|
425
|
+
end
|
426
|
+
|
427
|
+
it "runs post-install hooks" do
|
428
|
+
build_git "foo"
|
429
|
+
gemfile <<-G
|
430
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
431
|
+
G
|
432
|
+
|
433
|
+
File.open(lib_path("install_hooks.rb"), "w") do |h|
|
434
|
+
h.write <<-H
|
435
|
+
require 'rubygems'
|
436
|
+
Gem.post_install_hooks << lambda do |inst|
|
437
|
+
STDERR.puts "Ran post-install hook: \#{inst.spec.full_name}"
|
438
|
+
end
|
439
|
+
H
|
440
|
+
end
|
441
|
+
|
442
|
+
bundle :install, :expect_err => true,
|
443
|
+
:requires => [lib_path('install_hooks.rb')]
|
444
|
+
expect(err).to eq("Ran post-install hook: foo-1.0")
|
445
|
+
end
|
446
|
+
|
447
|
+
it "complains if the install hook fails" do
|
448
|
+
build_git "foo"
|
449
|
+
gemfile <<-G
|
450
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
451
|
+
G
|
452
|
+
|
453
|
+
File.open(lib_path("install_hooks.rb"), "w") do |h|
|
454
|
+
h.write <<-H
|
455
|
+
require 'rubygems'
|
456
|
+
Gem.pre_install_hooks << lambda do |inst|
|
457
|
+
false
|
458
|
+
end
|
459
|
+
H
|
460
|
+
end
|
461
|
+
|
462
|
+
bundle :install, :expect_err => true,
|
463
|
+
:requires => [lib_path('install_hooks.rb')]
|
464
|
+
expect(out).to include("failed for foo-1.0")
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
405
468
|
end
|
@@ -13,14 +13,14 @@ describe "bundle install for the first time with v1.0" do
|
|
13
13
|
it "removes lockfiles in 0.9 YAML format" do
|
14
14
|
File.open("Gemfile.lock", "w"){|f| YAML.dump({}, f) }
|
15
15
|
bundle :install
|
16
|
-
File.read("Gemfile.lock").
|
16
|
+
expect(File.read("Gemfile.lock")).not_to match(/^---/)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "removes env.rb if it exists" do
|
20
20
|
bundled_app.join(".bundle").mkdir
|
21
21
|
bundled_app.join(".bundle/environment.rb").open("w"){|f| f.write("raise 'nooo'") }
|
22
22
|
bundle :install
|
23
|
-
bundled_app.join(".bundle/environment.rb").
|
23
|
+
expect(bundled_app.join(".bundle/environment.rb")).not_to exist
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "bundle inject" do
|
4
|
+
before :each do
|
5
|
+
gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rack"
|
8
|
+
G
|
9
|
+
end
|
10
|
+
|
11
|
+
context "without a lockfile" do
|
12
|
+
it "locks with the injected gems" do
|
13
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
14
|
+
bundle "inject 'rack-obama' '> 0'"
|
15
|
+
expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "with a lockfile" do
|
20
|
+
before do
|
21
|
+
bundle "install"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "adds the injected gems to the gemfile" do
|
25
|
+
expect(bundled_app("Gemfile").read).not_to match(/rack-obama/)
|
26
|
+
bundle "inject 'rack-obama' '> 0'"
|
27
|
+
expect(bundled_app("Gemfile").read).to match(/rack-obama/)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "locks with the injected gems" do
|
31
|
+
expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
|
32
|
+
bundle "inject 'rack-obama' '> 0'"
|
33
|
+
expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "with injected gems already in the Gemfile" do
|
38
|
+
it "doesn't add existing gems" do
|
39
|
+
bundle "inject 'rack' '> 0'"
|
40
|
+
expect(out).to match(/cannot specify the same gem twice/i)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when frozen" do
|
45
|
+
before do
|
46
|
+
bundle "install"
|
47
|
+
bundle "config --local frozen 1"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "injects anyway" do
|
51
|
+
bundle "inject 'rack-obama' '> 0'"
|
52
|
+
expect(bundled_app("Gemfile").read).to match(/rack-obama/)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "locks with the injected gems" do
|
56
|
+
expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
|
57
|
+
bundle "inject 'rack-obama' '> 0'"
|
58
|
+
expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "restores frozen afterwards" do
|
62
|
+
bundle "inject 'rack-obama' '> 0'"
|
63
|
+
config = YAML.load(bundled_app(".bundle/config").read)
|
64
|
+
expect(config["BUNDLE_FROZEN"]).to eq("1")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "doesn't allow Gemfile changes" do
|
68
|
+
gemfile <<-G
|
69
|
+
source "file://#{gem_repo1}"
|
70
|
+
gem "rack-obama"
|
71
|
+
G
|
72
|
+
bundle "inject 'rack' '> 0'"
|
73
|
+
expect(out).to match(/trying to install in deployment mode after changing/)
|
74
|
+
|
75
|
+
expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/spec/lock/git_spec.rb
CHANGED
@@ -22,14 +22,14 @@ describe "bundle lock with git gems" do
|
|
22
22
|
puts "WIN" unless defined?(FOO_PREV_REF)
|
23
23
|
RUBY
|
24
24
|
|
25
|
-
out.
|
25
|
+
expect(out).to eq("WIN")
|
26
26
|
end
|
27
27
|
|
28
28
|
it "provides correct #full_gem_path" do
|
29
29
|
run <<-RUBY
|
30
30
|
puts Bundler.rubygems.find_name('foo').first.full_gem_path
|
31
31
|
RUBY
|
32
|
-
out.
|
32
|
+
expect(out).to eq(bundle("show foo"))
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
data/spec/lock/lockfile_spec.rb
CHANGED
@@ -633,8 +633,8 @@ describe "the lockfile format" do
|
|
633
633
|
gem "rack", "1.1"
|
634
634
|
G
|
635
635
|
|
636
|
-
bundled_app("Gemfile.lock").
|
637
|
-
out.
|
636
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
637
|
+
expect(out).to include "rack (= 1.0) and rack (= 1.1)"
|
638
638
|
end
|
639
639
|
|
640
640
|
|
@@ -645,8 +645,8 @@ describe "the lockfile format" do
|
|
645
645
|
gem "rack", :git => "git://hubz.com"
|
646
646
|
G
|
647
647
|
|
648
|
-
bundled_app("Gemfile.lock").
|
649
|
-
out.
|
648
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
649
|
+
expect(out).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"
|
650
650
|
end
|
651
651
|
|
652
652
|
it "works correctly with multiple version dependencies" do
|
@@ -720,7 +720,7 @@ describe "the lockfile format" do
|
|
720
720
|
should_be_installed "omg 1.0"
|
721
721
|
|
722
722
|
# Confirm that duplicate specs do not appear
|
723
|
-
File.read(bundled_app('Gemfile.lock')).
|
723
|
+
expect(File.read(bundled_app('Gemfile.lock'))).to eq(strip_whitespace(<<-L))
|
724
724
|
GIT
|
725
725
|
remote: #{lib_path('omg')}
|
726
726
|
revision: #{revision}
|
@@ -755,7 +755,7 @@ describe "the lockfile format" do
|
|
755
755
|
end
|
756
756
|
|
757
757
|
it "generates Gemfile.lock with \\n line endings" do
|
758
|
-
File.read(bundled_app("Gemfile.lock")).
|
758
|
+
expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
|
759
759
|
should_be_installed "rack 1.0"
|
760
760
|
end
|
761
761
|
|
@@ -764,8 +764,8 @@ describe "the lockfile format" do
|
|
764
764
|
it "preserves Gemfile.lock \\n line endings" do
|
765
765
|
update_repo2
|
766
766
|
|
767
|
-
|
768
|
-
File.read(bundled_app("Gemfile.lock")).
|
767
|
+
expect { bundle "update" }.to change { File.mtime(bundled_app('Gemfile.lock')) }
|
768
|
+
expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
|
769
769
|
should_be_installed "rack 1.2"
|
770
770
|
end
|
771
771
|
|
@@ -775,8 +775,8 @@ describe "the lockfile format" do
|
|
775
775
|
File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
|
776
776
|
set_lockfile_mtime_to_known_value
|
777
777
|
|
778
|
-
|
779
|
-
File.read(bundled_app("Gemfile.lock")).
|
778
|
+
expect { bundle "update" }.to change { File.mtime(bundled_app('Gemfile.lock')) }
|
779
|
+
expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n")
|
780
780
|
should_be_installed "rack 1.2"
|
781
781
|
end
|
782
782
|
end
|
@@ -784,12 +784,12 @@ describe "the lockfile format" do
|
|
784
784
|
context "when nothing changes" do
|
785
785
|
|
786
786
|
it "preserves Gemfile.lock \\n line endings" do
|
787
|
-
|
787
|
+
expect { ruby <<-RUBY
|
788
788
|
require 'rubygems'
|
789
789
|
require 'bundler'
|
790
790
|
Bundler.setup
|
791
791
|
RUBY
|
792
|
-
}.
|
792
|
+
}.not_to change { File.mtime(bundled_app('Gemfile.lock')) }
|
793
793
|
end
|
794
794
|
|
795
795
|
it "preserves Gemfile.lock \\n\\r line endings" do
|
@@ -797,12 +797,12 @@ describe "the lockfile format" do
|
|
797
797
|
File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
|
798
798
|
set_lockfile_mtime_to_known_value
|
799
799
|
|
800
|
-
|
800
|
+
expect { ruby <<-RUBY
|
801
801
|
require 'rubygems'
|
802
802
|
require 'bundler'
|
803
803
|
Bundler.setup
|
804
804
|
RUBY
|
805
|
-
}.
|
805
|
+
}.not_to change { File.mtime(bundled_app('Gemfile.lock')) }
|
806
806
|
end
|
807
807
|
end
|
808
808
|
end
|
data/spec/other/check_spec.rb
CHANGED
@@ -8,8 +8,8 @@ describe "bundle check" do
|
|
8
8
|
G
|
9
9
|
|
10
10
|
bundle :check, :exitstatus => true
|
11
|
-
@exitstatus.
|
12
|
-
out.
|
11
|
+
expect(@exitstatus).to eq(0)
|
12
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
13
13
|
end
|
14
14
|
|
15
15
|
it "works with the --gemfile flag when not in the directory" do
|
@@ -20,7 +20,7 @@ describe "bundle check" do
|
|
20
20
|
|
21
21
|
Dir.chdir tmp
|
22
22
|
bundle "check --gemfile bundled_app/Gemfile"
|
23
|
-
out.
|
23
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
24
24
|
end
|
25
25
|
|
26
26
|
it "creates a Gemfile.lock by default if one did not exist" do
|
@@ -33,7 +33,7 @@ describe "bundle check" do
|
|
33
33
|
|
34
34
|
bundle "check"
|
35
35
|
|
36
|
-
bundled_app("Gemfile.lock").
|
36
|
+
expect(bundled_app("Gemfile.lock")).to exist
|
37
37
|
end
|
38
38
|
|
39
39
|
it "does not create a Gemfile.lock if --dry-run was passed" do
|
@@ -46,7 +46,7 @@ describe "bundle check" do
|
|
46
46
|
|
47
47
|
bundle "check --dry-run"
|
48
48
|
|
49
|
-
bundled_app("Gemfile.lock").
|
49
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
50
50
|
end
|
51
51
|
|
52
52
|
it "prints a generic error if the missing gems are unresolvable" do
|
@@ -58,7 +58,7 @@ describe "bundle check" do
|
|
58
58
|
G
|
59
59
|
|
60
60
|
bundle :check
|
61
|
-
out.
|
61
|
+
expect(out).to include("Your Gemfile's dependencies could not be satisfied")
|
62
62
|
end
|
63
63
|
|
64
64
|
it "prints a generic error if a Gemfile.lock does not exist and a toplevel dependency does not exist" do
|
@@ -68,8 +68,8 @@ describe "bundle check" do
|
|
68
68
|
G
|
69
69
|
|
70
70
|
bundle :check, :exitstatus => true
|
71
|
-
@exitstatus.
|
72
|
-
out.
|
71
|
+
expect(@exitstatus).to be > 0
|
72
|
+
expect(out).to include("could not be satisfied")
|
73
73
|
end
|
74
74
|
|
75
75
|
it "prints a generic message if you changed your lockfile" do
|
@@ -89,7 +89,7 @@ describe "bundle check" do
|
|
89
89
|
G
|
90
90
|
|
91
91
|
bundle :check
|
92
|
-
out.
|
92
|
+
expect(out).to include("Your Gemfile's dependencies could not be satisfied")
|
93
93
|
end
|
94
94
|
|
95
95
|
it "remembers --without option from install" do
|
@@ -102,8 +102,8 @@ describe "bundle check" do
|
|
102
102
|
|
103
103
|
bundle "install --without foo"
|
104
104
|
bundle "check", :exitstatus => true
|
105
|
-
@exitstatus.
|
106
|
-
out.
|
105
|
+
expect(@exitstatus).to eq(0)
|
106
|
+
expect(out).to include("The Gemfile's dependencies are satisfied")
|
107
107
|
end
|
108
108
|
|
109
109
|
it "ensures that gems are actually installed and not just cached" do
|
@@ -120,8 +120,8 @@ describe "bundle check" do
|
|
120
120
|
G
|
121
121
|
|
122
122
|
bundle "check", :exitstatus => true
|
123
|
-
out.
|
124
|
-
@exitstatus.
|
123
|
+
expect(out).to include("* rack (1.0.0)")
|
124
|
+
expect(@exitstatus).to eq(1)
|
125
125
|
end
|
126
126
|
|
127
127
|
it "ignores missing gems restricted to other platforms" do
|
@@ -152,7 +152,7 @@ describe "bundle check" do
|
|
152
152
|
G
|
153
153
|
|
154
154
|
bundle :check
|
155
|
-
out.
|
155
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
156
156
|
end
|
157
157
|
|
158
158
|
it "works with env conditionals" do
|
@@ -183,19 +183,19 @@ describe "bundle check" do
|
|
183
183
|
G
|
184
184
|
|
185
185
|
bundle :check
|
186
|
-
out.
|
186
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
187
187
|
end
|
188
188
|
|
189
189
|
it "outputs an error when the default Gemfile is not found" do
|
190
190
|
bundle :check, :exitstatus => true
|
191
|
-
@exitstatus.
|
192
|
-
out.
|
191
|
+
expect(@exitstatus).to eq(10)
|
192
|
+
expect(out).to include("Could not locate Gemfile")
|
193
193
|
end
|
194
194
|
|
195
195
|
it "does not output fatal error message" do
|
196
196
|
bundle :check, :exitstatus => true
|
197
|
-
@exitstatus.
|
198
|
-
out.
|
197
|
+
expect(@exitstatus).to eq(10)
|
198
|
+
expect(out).not_to include("Unfortunately, a fatal error has occurred. ")
|
199
199
|
end
|
200
200
|
|
201
201
|
it "should not crash when called multiple times on a new machine" do
|
@@ -209,8 +209,8 @@ describe "bundle check" do
|
|
209
209
|
last_out = out
|
210
210
|
3.times do |i|
|
211
211
|
bundle :check
|
212
|
-
out.
|
213
|
-
err.
|
212
|
+
expect(out).to eq(last_out)
|
213
|
+
expect(err).to be_empty
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
@@ -225,7 +225,7 @@ describe "bundle check" do
|
|
225
225
|
FileUtils.rm(bundled_app("Gemfile.lock"))
|
226
226
|
|
227
227
|
bundle :check, :exitstatus => true
|
228
|
-
exitstatus.
|
228
|
+
expect(exitstatus).not_to eq(0)
|
229
229
|
end
|
230
230
|
|
231
231
|
context "--path" do
|
@@ -241,14 +241,14 @@ describe "bundle check" do
|
|
241
241
|
|
242
242
|
it "returns success" do
|
243
243
|
bundle "check --path vendor/bundle", :exitstatus => true
|
244
|
-
@exitstatus.
|
245
|
-
out.
|
244
|
+
expect(@exitstatus).to eq(0)
|
245
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
246
246
|
end
|
247
247
|
|
248
248
|
it "should write to .bundle/config" do
|
249
249
|
bundle "check --path vendor/bundle", :exitstatus => true
|
250
250
|
bundle "check", :exitstatus => true
|
251
|
-
@exitstatus.
|
251
|
+
expect(@exitstatus).to eq(0)
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
@@ -264,15 +264,15 @@ describe "bundle check" do
|
|
264
264
|
it "returns success when the Gemfile is satisfied" do
|
265
265
|
bundle :install
|
266
266
|
bundle :check, :exitstatus => true
|
267
|
-
@exitstatus.
|
268
|
-
out.
|
267
|
+
expect(@exitstatus).to eq(0)
|
268
|
+
expect(out).to eq("The Gemfile's dependencies are satisfied")
|
269
269
|
end
|
270
270
|
|
271
271
|
it "shows what is missing with the current Gemfile if it is not satisfied" do
|
272
272
|
simulate_new_machine
|
273
273
|
bundle :check
|
274
|
-
out.
|
275
|
-
out.
|
274
|
+
expect(out).to match(/The following gems are missing/)
|
275
|
+
expect(out).to include("* rack (1.0")
|
276
276
|
end
|
277
277
|
end
|
278
278
|
end
|