bundler 1.4.0.rc.1 → 1.5.0.rc.1

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.

Files changed (58) hide show
  1. data/.travis.yml +18 -15
  2. data/CHANGELOG.md +23 -2
  3. data/Rakefile +3 -1
  4. data/bundler.gemspec +1 -1
  5. data/lib/bundler.rb +3 -2
  6. data/lib/bundler/capistrano.rb +1 -0
  7. data/lib/bundler/cli.rb +19 -5
  8. data/lib/bundler/definition.rb +6 -2
  9. data/lib/bundler/dsl.rb +7 -3
  10. data/lib/bundler/endpoint_specification.rb +1 -1
  11. data/lib/bundler/fetcher.rb +22 -41
  12. data/lib/bundler/installer.rb +1 -11
  13. data/lib/bundler/lazy_specification.rb +1 -1
  14. data/lib/bundler/parallel_workers/unix_worker.rb +6 -0
  15. data/lib/bundler/remote_specification.rb +1 -1
  16. data/lib/bundler/retry.rb +4 -3
  17. data/lib/bundler/ruby_version.rb +1 -1
  18. data/lib/bundler/rubygems_ext.rb +7 -2
  19. data/lib/bundler/rubygems_integration.rb +31 -30
  20. data/lib/bundler/settings.rb +21 -0
  21. data/lib/bundler/source.rb +13 -2
  22. data/lib/bundler/source/git/git_proxy.rb +1 -1
  23. data/lib/bundler/source/rubygems.rb +43 -13
  24. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  25. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -2
  26. data/lib/bundler/version.rb +1 -1
  27. data/man/bundle-config.ronn +9 -0
  28. data/man/bundle-install.ronn +9 -5
  29. data/man/gemfile.5.ronn +6 -0
  30. data/spec/bundler/retry_spec.rb +26 -3
  31. data/spec/commands/config_spec.rb +14 -0
  32. data/spec/{integration/inject.rb → commands/inject_spec.rb} +0 -0
  33. data/spec/commands/newgem_spec.rb +2 -2
  34. data/spec/commands/outdated_spec.rb +17 -0
  35. data/spec/install/binstubs_spec.rb +24 -0
  36. data/spec/install/bundler_spec.rb +146 -0
  37. data/spec/install/{gemspec_spec.rb → gemfile/gemspec_spec.rb} +0 -0
  38. data/spec/install/{git_spec.rb → gemfile/git_spec.rb} +2 -2
  39. data/spec/install/gemfile/path_spec.rb +468 -0
  40. data/spec/install/gemfile_spec.rb +44 -0
  41. data/spec/install/gems/groups_spec.rb +236 -177
  42. data/spec/install/gems/mirror_spec.rb +39 -0
  43. data/spec/install/gems/platform_spec.rb +2 -14
  44. data/spec/install/gems/simple_case_spec.rb +1 -450
  45. data/spec/install/gemspecs_spec.rb +50 -0
  46. data/spec/install/path_spec.rb +91 -409
  47. data/spec/install/prereleases_spec.rb +43 -0
  48. data/spec/other/bundle_ruby_spec.rb +2 -2
  49. data/spec/other/ext_spec.rb +1 -1
  50. data/spec/other/platform_spec.rb +29 -2
  51. data/spec/realworld/parallel_install_spec.rb +2 -1
  52. data/spec/realworld/parallel_update_spec.rb +31 -0
  53. data/spec/runtime/platform_spec.rb +2 -2
  54. data/spec/spec_helper.rb +2 -2
  55. data/spec/support/{rubygems_hax/platform.rb → hax.rb} +0 -0
  56. metadata +110 -67
  57. checksums.yaml +0 -7
  58. data/spec/install/invalid_spec.rb +0 -50
@@ -0,0 +1,39 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with a mirror configured" do
4
+ describe "when the mirror does not match the gem source" do
5
+ before :each do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+
9
+ gem "rack"
10
+ G
11
+ bundle "config --local mirror.http://gems.example.org http://gem-mirror.example.org"
12
+ end
13
+
14
+ it "installs from the normal location" do
15
+ bundle :install
16
+ expect(out).to include("Fetching source index from file:#{gem_repo1}")
17
+ should_be_installed "rack 1.0"
18
+ end
19
+ end
20
+
21
+ describe "when the gem source matches a configured mirror" do
22
+ before :each do
23
+ gemfile <<-G
24
+ # This source is bogus and doesn't have the gem we're looking for
25
+ source "file://#{gem_repo2}"
26
+
27
+ gem "rack"
28
+ G
29
+ bundle "config --local mirror.file://#{gem_repo2} file://#{gem_repo1}"
30
+ end
31
+
32
+ it "installs the gem from the mirror" do
33
+ bundle :install
34
+ expect(out).to include("Fetching source index from file:#{gem_repo1}")
35
+ expect(out).not_to include("Fetching source index from file:#{gem_repo2}")
36
+ should_be_installed "rack 1.0"
37
+ end
38
+ end
39
+ end
@@ -96,22 +96,10 @@ describe "bundle install across platforms" do
96
96
 
97
97
  bundle "install --path vendor/bundle"
98
98
 
99
- expect(vendored_gems("gems/rack-1.0.0")).to exist
100
- end
101
-
102
- it "works after switching Rubies" do
103
- gemfile <<-G
104
- source "file://#{gem_repo1}"
105
-
106
- gem "rack", "1.0.0"
107
- G
108
-
109
- bundle "install --path vendor/bundle"
110
-
111
99
  new_version = Gem::ConfigMap[:ruby_version] == "1.8" ? "1.9.1" : "1.8"
112
100
  FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, new_version))
113
101
 
114
- bundle "install --path ./vendor/bundle"
102
+ bundle "install --path vendor/bundle"
115
103
  expect(vendored_gems("gems/rack-1.0.0")).to exist
116
104
  end
117
105
  end
@@ -191,7 +179,7 @@ describe "bundle install with platform conditionals" do
191
179
 
192
180
  end
193
181
 
194
- describe "when a gem has an architecture in its platform" do
182
+ describe "when a gem has no architecture" do
195
183
  it "still installs correctly" do
196
184
  simulate_platform mswin
197
185
 
@@ -298,7 +298,7 @@ describe "bundle install with gem sources" do
298
298
  install_gemfile <<-G
299
299
  G
300
300
 
301
- expect(File.exists?(bundled_app("Gemfile.lock"))).to be_true
301
+ expect(File.exists?(bundled_app("Gemfile.lock"))).to be true
302
302
  end
303
303
 
304
304
  it "gracefully handles error when rubygems server is unavailable" do
@@ -362,136 +362,6 @@ describe "bundle install with gem sources" do
362
362
  end
363
363
  end
364
364
 
365
- describe "when prerelease gems are available" do
366
- it "finds prereleases" do
367
- install_gemfile <<-G
368
- source "file://#{gem_repo1}"
369
- gem "not_released"
370
- G
371
- should_be_installed "not_released 1.0.pre"
372
- end
373
-
374
- it "uses regular releases if available" do
375
- install_gemfile <<-G
376
- source "file://#{gem_repo1}"
377
- gem "has_prerelease"
378
- G
379
- should_be_installed "has_prerelease 1.0"
380
- end
381
-
382
- it "uses prereleases if requested" do
383
- install_gemfile <<-G
384
- source "file://#{gem_repo1}"
385
- gem "has_prerelease", "1.1.pre"
386
- G
387
- should_be_installed "has_prerelease 1.1.pre"
388
- end
389
- end
390
-
391
- describe "when prerelease gems are not available" do
392
- it "still works" do
393
- build_repo3
394
- install_gemfile <<-G
395
- source "file://#{gem_repo3}"
396
- gem "rack"
397
- G
398
-
399
- should_be_installed "rack 1.0"
400
- end
401
- end
402
-
403
- describe "when BUNDLE_PATH or the global path config is set" do
404
- before :each do
405
- build_lib "rack", "1.0.0", :to_system => true do |s|
406
- s.write "lib/rack.rb", "raise 'FAIL'"
407
- end
408
-
409
- gemfile <<-G
410
- source "file://#{gem_repo1}"
411
- gem "rack"
412
- G
413
- end
414
-
415
- def set_bundle_path(type, location)
416
- if type == :env
417
- ENV["BUNDLE_PATH"] = location
418
- elsif type == :global
419
- bundle "config path #{location}", "no-color" => nil
420
- end
421
- end
422
-
423
- [:env, :global].each do |type|
424
- it "installs gems to a path if one is specified" do
425
- set_bundle_path(type, bundled_app("vendor2").to_s)
426
- bundle "install --path vendor/bundle"
427
-
428
- expect(vendored_gems("gems/rack-1.0.0")).to be_directory
429
- expect(bundled_app("vendor2")).not_to be_directory
430
- should_be_installed "rack 1.0.0"
431
- end
432
-
433
- it "installs gems to BUNDLE_PATH with #{type}" do
434
- set_bundle_path(type, bundled_app("vendor").to_s)
435
-
436
- bundle :install
437
-
438
- expect(bundled_app('vendor/gems/rack-1.0.0')).to be_directory
439
- should_be_installed "rack 1.0.0"
440
- end
441
-
442
- it "installs gems to BUNDLE_PATH relative to root when relative" do
443
- set_bundle_path(type, "vendor")
444
-
445
- FileUtils.mkdir_p bundled_app('lol')
446
- Dir.chdir(bundled_app('lol')) do
447
- bundle :install
448
- end
449
-
450
- expect(bundled_app('vendor/gems/rack-1.0.0')).to be_directory
451
- should_be_installed "rack 1.0.0"
452
- end
453
- end
454
-
455
- it "installs gems to BUNDLE_PATH from .bundle/config" do
456
- config "BUNDLE_PATH" => bundled_app("vendor/bundle").to_s
457
-
458
- bundle :install
459
-
460
- expect(vendored_gems('gems/rack-1.0.0')).to be_directory
461
- should_be_installed "rack 1.0.0"
462
- end
463
-
464
- it "sets BUNDLE_PATH as the first argument to bundle install" do
465
- bundle "install --path ./vendor/bundle"
466
-
467
- expect(vendored_gems('gems/rack-1.0.0')).to be_directory
468
- should_be_installed "rack 1.0.0"
469
- end
470
-
471
- it "disables system gems when passing a path to install" do
472
- # This is so that vendored gems can be distributed to others
473
- build_gem "rack", "1.1.0", :to_system => true
474
- bundle "install --path ./vendor/bundle"
475
-
476
- expect(vendored_gems('gems/rack-1.0.0')).to be_directory
477
- should_be_installed "rack 1.0.0"
478
- end
479
- end
480
-
481
- describe "when passing in a Gemfile via --gemfile" do
482
- it "finds the gemfile" do
483
- gemfile bundled_app("NotGemfile"), <<-G
484
- source "file://#{gem_repo1}"
485
- gem 'rack'
486
- G
487
-
488
- bundle :install, :gemfile => bundled_app("NotGemfile")
489
-
490
- ENV['BUNDLE_GEMFILE'] = "NotGemfile"
491
- should_be_installed "rack 1.0.0"
492
- end
493
- end
494
-
495
365
  describe "when requesting a quiet install via --quiet" do
496
366
  it "should be quiet if there are no warnings" do
497
367
  gemfile <<-G
@@ -513,323 +383,4 @@ describe "bundle install with gem sources" do
513
383
  end
514
384
  end
515
385
 
516
- describe "when disabling system gems" do
517
- before :each do
518
- build_gem "rack", "1.0.0", :to_system => true do |s|
519
- s.write "lib/rack.rb", "puts 'FAIL'"
520
- end
521
-
522
- gemfile <<-G
523
- source "file://#{gem_repo1}"
524
- gem "rack"
525
- G
526
- end
527
-
528
- it "behaves like bundle install vendor/bundle with --deployment" do
529
- bundle "install"
530
- bundle "install --deployment"
531
- expect(out).to include("It was installed into ./vendor/bundle")
532
- should_be_installed "rack 1.0.0"
533
- expect(bundled_app("vendor/bundle")).to exist
534
- end
535
-
536
- it "does not use available system gems with bundle --path vendor/bundle" do
537
- bundle "install --path vendor/bundle"
538
- should_be_installed "rack 1.0.0"
539
- end
540
-
541
- it "handles paths with regex characters in them" do
542
- dir = bundled_app("bun++dle")
543
- dir.mkpath
544
-
545
- Dir.chdir(dir) do
546
- bundle "install --path vendor/bundle"
547
- expect(out).to include("installed into ./vendor/bundle")
548
- end
549
-
550
- dir.rmtree
551
- end
552
-
553
- it "prints a warning to let the user know what has happened with bundle --path vendor/bundle" do
554
- bundle "install --path vendor/bundle"
555
- expect(out).to include("It was installed into ./vendor")
556
- end
557
-
558
- it "disallows --path vendor/bundle --system" do
559
- bundle "install --path vendor/bundle --system"
560
- expect(out).to include("Please choose.")
561
- end
562
-
563
- it "remembers to disable system gems after the first time with bundle --path vendor/bundle" do
564
- bundle "install --path vendor/bundle"
565
- FileUtils.rm_rf bundled_app('vendor')
566
- bundle "install"
567
-
568
- expect(vendored_gems('gems/rack-1.0.0')).to be_directory
569
- should_be_installed "rack 1.0.0"
570
- end
571
- end
572
-
573
- describe "when loading only the default group" do
574
- it "should not load all groups" do
575
- install_gemfile <<-G
576
- source "file://#{gem_repo1}"
577
- gem "rack"
578
- gem "activesupport", :groups => :development
579
- G
580
-
581
- ruby <<-R
582
- require "bundler"
583
- Bundler.setup :default
584
- Bundler.require :default
585
- puts RACK
586
- begin
587
- require "activesupport"
588
- rescue LoadError
589
- puts "no activesupport"
590
- end
591
- R
592
-
593
- expect(out).to include("1.0")
594
- expect(out).to include("no activesupport")
595
- end
596
- end
597
-
598
- describe "when a gem has a YAML gemspec" do
599
- before :each do
600
- build_repo2 do
601
- build_gem "yaml_spec", :gemspec => :yaml
602
- end
603
- end
604
-
605
- it "still installs correctly" do
606
- gemfile <<-G
607
- source "file://#{gem_repo2}"
608
- gem "yaml_spec"
609
- G
610
- bundle :install
611
- expect(err).to be_empty
612
- end
613
-
614
- it "still installs correctly when using path" do
615
- build_lib 'yaml_spec', :gemspec => :yaml
616
-
617
- install_gemfile <<-G
618
- gem 'yaml_spec', :path => "#{lib_path('yaml_spec-1.0')}"
619
- G
620
- expect(err).to eq("")
621
- end
622
- end
623
-
624
- describe "bundler dependencies" do
625
- before(:each) do
626
- build_repo2 do
627
- build_gem "rails", "3.0" do |s|
628
- s.add_dependency "bundler", ">= 0.9.0.pre"
629
- end
630
- build_gem "bundler", "0.9.1"
631
- build_gem "bundler", Bundler::VERSION
632
- end
633
- end
634
-
635
- it "are forced to the current bundler version" do
636
- install_gemfile <<-G
637
- source "file://#{gem_repo2}"
638
- gem "rails", "3.0"
639
- G
640
-
641
- should_be_installed "bundler #{Bundler::VERSION}"
642
- end
643
-
644
- it "are not added if not already present" do
645
- install_gemfile <<-G
646
- source "file://#{gem_repo1}"
647
- gem "rack"
648
- G
649
- should_not_be_installed "bundler #{Bundler::VERSION}"
650
- end
651
-
652
- it "causes a conflict if explicitly requesting a different version" do
653
- install_gemfile <<-G
654
- source "file://#{gem_repo2}"
655
- gem "rails", "3.0"
656
- gem "bundler", "0.9.2"
657
- G
658
-
659
- nice_error = <<-E.strip.gsub(/^ {8}/, '')
660
- Fetching source index from file:#{gem_repo2}/
661
- Resolving dependencies...
662
- Bundler could not find compatible versions for gem "bundler":
663
- In Gemfile:
664
- bundler (= 0.9.2) ruby
665
-
666
- Current Bundler version:
667
- bundler (#{Bundler::VERSION})
668
- E
669
- expect(out).to include(nice_error)
670
- end
671
-
672
- it "works for gems with multiple versions in its dependencies" do
673
- install_gemfile <<-G
674
- source "file://#{gem_repo2}"
675
-
676
- gem "multiple_versioned_deps"
677
- G
678
-
679
-
680
- install_gemfile <<-G
681
- source "file://#{gem_repo2}"
682
-
683
- gem "multiple_versioned_deps"
684
- gem "rack"
685
- G
686
-
687
- should_be_installed "multiple_versioned_deps 1.0.0"
688
- end
689
-
690
- it "includes bundler in the bundle when it's a child dependency" do
691
- install_gemfile <<-G
692
- source "file://#{gem_repo2}"
693
- gem "rails", "3.0"
694
- G
695
-
696
- run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError; puts 'FAIL'; end"
697
- expect(out).to eq("WIN")
698
- end
699
-
700
- it "allows gem 'bundler' when Bundler is not in the Gemfile or its dependencies" do
701
- install_gemfile <<-G
702
- source "file://#{gem_repo2}"
703
- gem "rack"
704
- G
705
-
706
- run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError => e; puts e.backtrace; end"
707
- expect(out).to eq("WIN")
708
- end
709
-
710
- it "causes a conflict if child dependencies conflict" do
711
- install_gemfile <<-G
712
- source "file://#{gem_repo2}"
713
- gem "activemerchant"
714
- gem "rails_fail"
715
- G
716
-
717
- nice_error = <<-E.strip.gsub(/^ {8}/, '')
718
- Fetching source index from file:#{gem_repo2}/
719
- Resolving dependencies...
720
- Bundler could not find compatible versions for gem "activesupport":
721
- In Gemfile:
722
- activemerchant (>= 0) ruby depends on
723
- activesupport (>= 2.0.0) ruby
724
-
725
- rails_fail (>= 0) ruby depends on
726
- activesupport (1.2.3)
727
- E
728
- expect(out).to eq(nice_error)
729
- end
730
-
731
- it "causes a conflict if a child dependency conflicts with the Gemfile" do
732
- install_gemfile <<-G
733
- source "file://#{gem_repo2}"
734
- gem "rails_fail"
735
- gem "activesupport", "2.3.5"
736
- G
737
-
738
- nice_error = <<-E.strip.gsub(/^ {8}/, '')
739
- Fetching source index from file:#{gem_repo2}/
740
- Resolving dependencies...
741
- Bundler could not find compatible versions for gem "activesupport":
742
- In Gemfile:
743
- rails_fail (>= 0) ruby depends on
744
- activesupport (= 1.2.3) ruby
745
-
746
- activesupport (2.3.5)
747
- E
748
- expect(out).to eq(nice_error)
749
- end
750
-
751
- it "can install dependencies even if " do
752
- install_gemfile <<-G
753
- source "file://#{gem_repo2}"
754
- gem "rails", "3.0"
755
- G
756
-
757
- simulate_bundler_version "10.0.0"
758
- #simulate_new_machine
759
-
760
- bundle "check"
761
- expect(out).to eq("The Gemfile's dependencies are satisfied")
762
- end
763
- end
764
-
765
- describe "when locked and installed with --without" do
766
- before(:each) do
767
- build_repo2
768
- system_gems "rack-0.9.1" do
769
- install_gemfile <<-G, :without => :rack
770
- source "file://#{gem_repo2}"
771
- gem "rack"
772
-
773
- group :rack do
774
- gem "rack_middleware"
775
- end
776
- G
777
- end
778
- end
779
-
780
- it "uses the correct versions even if --without was used on the original" do
781
- should_be_installed "rack 0.9.1"
782
- should_not_be_installed "rack_middleware 1.0"
783
- simulate_new_machine
784
-
785
- bundle :install
786
-
787
- should_be_installed "rack 0.9.1"
788
- should_be_installed "rack_middleware 1.0"
789
- end
790
-
791
- it "does not hit the remote a second time" do
792
- FileUtils.rm_rf gem_repo2
793
- bundle "install --without rack"
794
- expect(err).to be_empty
795
- end
796
- end
797
-
798
- describe "when system_bindir is set" do
799
- # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
800
- # you want to avoid sudo installs for system gems with OS X's default ruby
801
- it "overrides Gem.bindir" do
802
- expect(Pathname.new("/usr/bin")).not_to be_writable unless Process::euid == 0
803
- gemfile <<-G
804
- require 'rubygems'
805
- def Gem.bindir; "/usr/bin"; end
806
- source "file://#{gem_repo1}"
807
- gem "rack"
808
- G
809
-
810
- config "BUNDLE_SYSTEM_BINDIR" => system_gem_path('altbin').to_s
811
- bundle :install
812
- should_be_installed "rack 1.0.0"
813
- expect(system_gem_path("altbin/rackup")).to exist
814
- end
815
- end
816
-
817
- it "should use gemspecs in the system cache when available" do
818
- gemfile <<-G
819
- source "http://localtestserver.gem"
820
- gem 'rack'
821
- G
822
-
823
- FileUtils.mkdir_p "#{tmp}/gems/system/specifications"
824
- File.open("#{tmp}/gems/system/specifications/rack-1.0.0.gemspec", 'w+') do |f|
825
- spec = Gem::Specification.new do |s|
826
- s.name = 'rack'
827
- s.version = '1.0.0'
828
- s.add_runtime_dependency 'activesupport', '2.3.2'
829
- end
830
- f.write spec.to_ruby
831
- end
832
- bundle :install, :artifice => 'endpoint_marshal_fail' # force gemspec load
833
- should_be_installed "activesupport 2.3.2"
834
- end
835
386
  end