bundler 1.5.3 → 1.6.0.pre.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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +14 -11
  3. data/CHANGELOG.md +10 -3
  4. data/CONTRIBUTING.md +21 -12
  5. data/DEVELOPMENT.md +2 -2
  6. data/README.md +3 -2
  7. data/Rakefile +19 -9
  8. data/bundler.gemspec +1 -1
  9. data/lib/bundler.rb +9 -5
  10. data/lib/bundler/cli.rb +51 -10
  11. data/lib/bundler/dsl.rb +10 -6
  12. data/lib/bundler/friendly_errors.rb +1 -1
  13. data/lib/bundler/installer.rb +28 -17
  14. data/lib/bundler/parallel_workers/worker.rb +1 -1
  15. data/lib/bundler/resolver.rb +191 -207
  16. data/lib/bundler/rubygems_ext.rb +2 -4
  17. data/lib/bundler/rubygems_integration.rb +5 -0
  18. data/lib/bundler/runtime.rb +15 -12
  19. data/lib/bundler/settings.rb +4 -2
  20. data/lib/bundler/source.rb +11 -1
  21. data/lib/bundler/source/git.rb +11 -7
  22. data/lib/bundler/source/git/git_proxy.rb +4 -7
  23. data/lib/bundler/source/path.rb +21 -12
  24. data/lib/bundler/source/path/installer.rb +1 -1
  25. data/lib/bundler/source/rubygems.rb +18 -8
  26. data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
  27. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  28. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -2
  29. data/lib/bundler/ui.rb +4 -141
  30. data/lib/bundler/ui/rg_proxy.rb +21 -0
  31. data/lib/bundler/ui/shell.rb +98 -0
  32. data/lib/bundler/ui/silent.rb +44 -0
  33. data/lib/bundler/vendor/net/http/faster.rb +0 -1
  34. data/lib/bundler/vendor/net/http/persistent.rb +0 -1
  35. data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +0 -1
  36. data/lib/bundler/version.rb +1 -1
  37. data/spec/bundler/definition_spec.rb +2 -2
  38. data/spec/bundler/dsl_spec.rb +3 -3
  39. data/spec/bundler/gem_helper_spec.rb +5 -7
  40. data/spec/bundler/settings_spec.rb +15 -0
  41. data/spec/bundler/source_spec.rb +1 -1
  42. data/spec/commands/config_spec.rb +18 -0
  43. data/spec/commands/console_spec.rb +22 -0
  44. data/spec/commands/exec_spec.rb +1 -0
  45. data/spec/commands/newgem_spec.rb +2 -2
  46. data/spec/commands/open_spec.rb +13 -0
  47. data/spec/{install/gems/packed_spec.rb → commands/package_spec.rb} +30 -0
  48. data/spec/commands/show_spec.rb +87 -71
  49. data/spec/install/binstubs_spec.rb +1 -1
  50. data/spec/install/bundler_spec.rb +1 -1
  51. data/spec/install/gemfile/git_spec.rb +1 -1
  52. data/spec/install/gemfile/path_spec.rb +12 -0
  53. data/spec/install/gemfile_spec.rb +1 -1
  54. data/spec/install/gems/groups_spec.rb +1 -1
  55. data/spec/install/gems/platform_spec.rb +0 -1
  56. data/spec/install/gems/post_install_spec.rb +74 -0
  57. data/spec/install/gems/resolving_spec.rb +22 -26
  58. data/spec/install/gems/simple_case_spec.rb +17 -1
  59. data/spec/install/gemspecs_spec.rb +1 -1
  60. data/spec/install/path_spec.rb +1 -1
  61. data/spec/install/prereleases_spec.rb +1 -1
  62. data/spec/other/ext_spec.rb +1 -1
  63. data/spec/other/ssl_cert_spec.rb +10 -0
  64. data/spec/realworld/edgecases_spec.rb +1 -1
  65. data/spec/resolver/basic_spec.rb +29 -0
  66. data/spec/support/builders.rb +42 -43
  67. data/spec/support/indexes.rb +129 -1
  68. data/spec/support/permissions.rb +1 -0
  69. data/spec/update/gems_spec.rb +37 -0
  70. data/spec/update/git_spec.rb +24 -1
  71. data/spec/update/source_spec.rb +14 -1
  72. metadata +14 -9
  73. data/lib/bundler/safe_catch.rb +0 -101
  74. data/spec/bundler/safe_catch_spec.rb +0 -37
@@ -1,102 +1,118 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "bundle show" do
4
- before :each do
5
- install_gemfile <<-G
6
- source "file://#{gem_repo1}"
7
- gem "rails"
8
- G
9
- end
4
+ context "with a standard Gemfile" do
5
+ before :each do
6
+ install_gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+ gem "rails"
9
+ G
10
+ end
10
11
 
11
- it "creates a Gemfile.lock if one did not exist" do
12
- FileUtils.rm("Gemfile.lock")
12
+ it "creates a Gemfile.lock if one did not exist" do
13
+ FileUtils.rm("Gemfile.lock")
13
14
 
14
- bundle "show"
15
+ bundle "show"
15
16
 
16
- expect(bundled_app("Gemfile.lock")).to exist
17
- end
17
+ expect(bundled_app("Gemfile.lock")).to exist
18
+ end
18
19
 
19
- it "creates a Gemfile.lock when invoked with a gem name" do
20
- FileUtils.rm("Gemfile.lock")
20
+ it "creates a Gemfile.lock when invoked with a gem name" do
21
+ FileUtils.rm("Gemfile.lock")
21
22
 
22
- bundle "show rails"
23
+ bundle "show rails"
23
24
 
24
- expect(bundled_app("Gemfile.lock")).to exist
25
- end
25
+ expect(bundled_app("Gemfile.lock")).to exist
26
+ end
26
27
 
27
- it "prints path if gem exists in bundle" do
28
- bundle "show rails"
29
- expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s)
30
- end
28
+ it "prints path if gem exists in bundle" do
29
+ bundle "show rails"
30
+ expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s)
31
+ end
31
32
 
32
- it "warns if path no longer exists on disk" do
33
- FileUtils.rm_rf("#{system_gem_path}/gems/rails-2.3.2")
33
+ it "warns if path no longer exists on disk" do
34
+ FileUtils.rm_rf("#{system_gem_path}/gems/rails-2.3.2")
34
35
 
35
- bundle "show rails"
36
+ bundle "show rails"
36
37
 
37
- expect(out).to match(/has been deleted/i)
38
- expect(out).to include(default_bundle_path('gems', 'rails-2.3.2').to_s)
39
- end
38
+ expect(out).to match(/has been deleted/i)
39
+ expect(out).to include(default_bundle_path('gems', 'rails-2.3.2').to_s)
40
+ end
40
41
 
41
- it "prints the path to the running bundler" do
42
- bundle "show bundler"
43
- expect(out).to eq(File.expand_path('../../../', __FILE__))
44
- end
42
+ it "prints the path to the running bundler" do
43
+ bundle "show bundler"
44
+ expect(out).to eq(File.expand_path('../../../', __FILE__))
45
+ end
45
46
 
46
- it "complains if gem not in bundle" do
47
- bundle "show missing"
48
- expect(out).to match(/could not find gem 'missing'/i)
49
- end
47
+ it "complains if gem not in bundle" do
48
+ bundle "show missing"
49
+ expect(out).to match(/could not find gem 'missing'/i)
50
+ end
50
51
 
51
- it "prints path of all gems in bundle sorted by name" do
52
- bundle "show --paths"
52
+ it "prints path of all gems in bundle sorted by name" do
53
+ bundle "show --paths"
53
54
 
54
- expect(out).to include(default_bundle_path('gems', 'rake-10.0.2').to_s)
55
- expect(out).to include(default_bundle_path('gems', 'rails-2.3.2').to_s)
55
+ expect(out).to include(default_bundle_path('gems', 'rake-10.0.2').to_s)
56
+ expect(out).to include(default_bundle_path('gems', 'rails-2.3.2').to_s)
56
57
 
57
- # Gem names are the last component of their path.
58
- gem_list = out.split.map { |p| p.split('/').last }
59
- expect(gem_list).to eq(gem_list.sort)
58
+ # Gem names are the last component of their path.
59
+ gem_list = out.split.map { |p| p.split('/').last }
60
+ expect(gem_list).to eq(gem_list.sort)
61
+ end
60
62
  end
61
- end
62
63
 
63
- describe "bundle show with a git repo" do
64
- before :each do
65
- @git = build_git "foo", "1.0"
66
- end
64
+ context "with a git repo in the Gemfile" do
65
+ before :each do
66
+ @git = build_git "foo", "1.0"
67
+ end
67
68
 
68
- it "prints out git info" do
69
- install_gemfile <<-G
70
- gem "foo", :git => "#{lib_path('foo-1.0')}"
71
- G
72
- should_be_installed "foo 1.0"
69
+ it "prints out git info" do
70
+ install_gemfile <<-G
71
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
72
+ G
73
+ should_be_installed "foo 1.0"
73
74
 
74
- bundle :show
75
- expect(out).to include("foo (1.0 #{@git.ref_for('master', 6)}")
76
- end
75
+ bundle :show
76
+ expect(out).to include("foo (1.0 #{@git.ref_for('master', 6)}")
77
+ end
78
+
79
+ it "prints out branch names other than master" do
80
+ update_git "foo", :branch => "omg" do |s|
81
+ s.write "lib/foo.rb", "FOO = '1.0.omg'"
82
+ end
83
+ @revision = revision_for(lib_path("foo-1.0"))[0...6]
84
+
85
+ install_gemfile <<-G
86
+ gem "foo", :git => "#{lib_path('foo-1.0')}", :branch => "omg"
87
+ G
88
+ should_be_installed "foo 1.0.omg"
77
89
 
78
- it "prints out branch names other than master" do
79
- update_git "foo", :branch => "omg" do |s|
80
- s.write "lib/foo.rb", "FOO = '1.0.omg'"
90
+ bundle :show
91
+ expect(out).to include("foo (1.0 #{@git.ref_for('omg', 6)}")
81
92
  end
82
- @revision = revision_for(lib_path("foo-1.0"))[0...6]
83
93
 
84
- install_gemfile <<-G
85
- gem "foo", :git => "#{lib_path('foo-1.0')}", :branch => "omg"
86
- G
87
- should_be_installed "foo 1.0.omg"
94
+ it "doesn't print the branch when tied to a ref" do
95
+ sha = revision_for(lib_path("foo-1.0"))
96
+ install_gemfile <<-G
97
+ gem "foo", :git => "#{lib_path('foo-1.0')}", :ref => "#{sha}"
98
+ G
88
99
 
89
- bundle :show
90
- expect(out).to include("foo (1.0 #{@git.ref_for('omg', 6)}")
100
+ bundle :show
101
+ expect(out).to include("foo (1.0 #{sha[0..6]})")
102
+ end
91
103
  end
92
104
 
93
- it "doesn't print the branch when tied to a ref" do
94
- sha = revision_for(lib_path("foo-1.0"))
95
- install_gemfile <<-G
96
- gem "foo", :git => "#{lib_path('foo-1.0')}", :ref => "#{sha}"
97
- G
105
+ context "in a fresh gem in a blank git repo" do
106
+ before :each do
107
+ build_git "foo", :path => lib_path("foo")
108
+ in_app_root_custom lib_path("foo")
109
+ File.open('Gemfile', 'w') {|f| f.puts "gemspec" }
110
+ sys_exec 'rm -rf .git && git init'
111
+ end
98
112
 
99
- bundle :show
100
- expect(out).to include("foo (1.0 #{sha[0..6]})")
113
+ it "does not output git errors" do
114
+ bundle :show
115
+ expect(err).to be_empty
116
+ end
101
117
  end
102
118
  end
@@ -21,4 +21,4 @@ describe "bundle install" do
21
21
  end
22
22
  end
23
23
 
24
- end
24
+ end
@@ -143,4 +143,4 @@ describe "bundle install" do
143
143
  end
144
144
  end
145
145
 
146
- end
146
+ end
@@ -27,7 +27,7 @@ describe "bundle install with git sources" do
27
27
  end
28
28
 
29
29
  it "caches the git repo" do
30
- expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have(1).item
30
+ expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"].size).to eq(1)
31
31
  end
32
32
 
33
33
  it "caches the evaluated gemspec" do
@@ -46,6 +46,18 @@ describe "bundle install with explicit source paths" do
46
46
  should_be_installed("foo 1.0")
47
47
  end
48
48
 
49
+ it "expands paths raise error with not existing user's home dir" do
50
+ build_lib "foo"
51
+ username = 'some_unexisting_user'
52
+ relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new("/home/#{username}").expand_path)
53
+
54
+ install_gemfile <<-G
55
+ gem 'foo', :path => "~#{username}/#{relative_path}"
56
+ G
57
+ expect(out).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
58
+ expect(out).to match("user #{username} doesn't exist")
59
+ end
60
+
49
61
  it "expands paths relative to Bundler.root" do
50
62
  build_lib "foo", :path => bundled_app("foo-1.0")
51
63
 
@@ -41,4 +41,4 @@ describe "bundle install" do
41
41
  end
42
42
  end
43
43
 
44
- end
44
+ end
@@ -305,4 +305,4 @@ describe "bundle install with groups" do
305
305
  end
306
306
  end
307
307
 
308
- end
308
+ end
@@ -193,4 +193,3 @@ describe "when a gem has no architecture" do
193
193
  should_be_installed "rcov 1.0.0"
194
194
  end
195
195
  end
196
-
@@ -45,3 +45,77 @@ describe "bundle install with gem sources" do
45
45
  end
46
46
  end
47
47
  end
48
+
49
+ describe "bundle install with git sources" do
50
+ describe "when gems include post install messages" do
51
+ it "should display the post-install messages after installing" do
52
+ build_git "foo" do |s|
53
+ s.post_install_message = "Foo's post install message"
54
+ end
55
+ gemfile <<-G
56
+ source "file://#{gem_repo1}"
57
+ gem 'foo', :git => '#{lib_path("foo-1.0")}'
58
+ G
59
+
60
+ bundle :install
61
+ expect(out).to include("Post-install message from foo:")
62
+ expect(out).to include("Foo's post install message")
63
+ end
64
+
65
+ it "should display the post-install messages if repo is updated" do
66
+ build_git "foo" do |s|
67
+ s.post_install_message = "Foo's post install message"
68
+ end
69
+ gemfile <<-G
70
+ source "file://#{gem_repo1}"
71
+ gem 'foo', :git => '#{lib_path("foo-1.0")}'
72
+ G
73
+ bundle :install
74
+
75
+ build_git "foo", "1.1" do |s|
76
+ s.post_install_message = "Foo's 1.1 post install message"
77
+ end
78
+ gemfile <<-G
79
+ source "file://#{gem_repo1}"
80
+ gem 'foo', :git => '#{lib_path("foo-1.1")}'
81
+ G
82
+ bundle :install
83
+
84
+ expect(out).to include("Post-install message from foo:")
85
+ expect(out).to include("Foo's 1.1 post install message")
86
+ end
87
+
88
+ it "should not display the post-install messages if repo is not updated" do
89
+ build_git "foo" do |s|
90
+ s.post_install_message = "Foo's post install message"
91
+ end
92
+ gemfile <<-G
93
+ source "file://#{gem_repo1}"
94
+ gem 'foo', :git => '#{lib_path("foo-1.0")}'
95
+ G
96
+
97
+ bundle :install
98
+ expect(out).to include("Post-install message from foo:")
99
+ expect(out).to include("Foo's post install message")
100
+
101
+ bundle :install
102
+ expect(out).not_to include("Post-install message")
103
+ end
104
+ end
105
+
106
+ describe "when gems do not include post install messages" do
107
+ it "should not display any post-install messages" do
108
+ build_git "foo" do |s|
109
+ s.post_install_message = nil
110
+ end
111
+ gemfile <<-G
112
+ source "file://#{gem_repo1}"
113
+ gem 'foo', :git => '#{lib_path("foo-1.0")}'
114
+ G
115
+
116
+ bundle :install
117
+ expect(out).not_to include("Post-install message")
118
+ end
119
+ end
120
+
121
+ end
@@ -69,38 +69,34 @@ describe "bundle install with gem sources" do
69
69
  end
70
70
 
71
71
  context "with ENV['DEBUG_RESOLVER'] set" do
72
- before do
73
- ENV['DEBUG_RESOLVER'] = '1'
74
- end
75
72
  it "produces debug output" do
76
- expect(capture(:stdout) do
77
- install_gemfile <<-G
78
- source "file://#{gem_repo1}"
79
- gem "net_c"
80
- gem "net_e"
81
- G
82
- end).to include "==== Iterating ===="
83
- end
84
- after do
85
- ENV['DEBUG_RESOLVER'] = nil
73
+ gemfile <<-G
74
+ source "file://#{gem_repo1}"
75
+ gem "net_c"
76
+ gem "net_e"
77
+ G
78
+
79
+ resolve_output = capture(:stdout) do
80
+ bundle :install, :env => {"DEBUG_RESOLVER" => "1"}
81
+ end
82
+
83
+ expect(resolve_output).to include("==== Iterating ====")
86
84
  end
87
85
  end
88
86
 
89
87
  context "with ENV['DEBUG_RESOLVER_TREE'] set" do
90
- before do
91
- ENV['DEBUG_RESOLVER_TREE'] = '1'
92
- end
93
88
  it "produces debug output" do
94
- expect(capture(:stdout) do
95
- install_gemfile <<-G
96
- source "file://#{gem_repo1}"
97
- gem "net_c"
98
- gem "net_e"
99
- G
100
- end).to include " net_b (>= 0) ruby"
101
- end
102
- after do
103
- ENV['DEBUG_RESOLVER_TREE'] = nil
89
+ gemfile <<-G
90
+ source "file://#{gem_repo1}"
91
+ gem "net_c"
92
+ gem "net_e"
93
+ G
94
+
95
+ resolve_output = capture(:stdout) do
96
+ bundle :install, :env => {"DEBUG_RESOLVER_TREE" => "1"}
97
+ end
98
+
99
+ expect(resolve_output).to include(" net_b (>= 0) ruby")
104
100
  end
105
101
  end
106
102
 
@@ -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 eq(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
@@ -337,6 +337,22 @@ describe "bundle install with gem sources" do
337
337
  G
338
338
  expect(exitstatus).to eq(0)
339
339
  end
340
+
341
+ it "reinstalls the gem if the gem dir is missing but the specification file exists" do
342
+ gemfile(<<-G)
343
+ source "file://#{gem_repo1}"
344
+
345
+ gem 'foo'
346
+ G
347
+
348
+ bundle "install --path vendor/bundle"
349
+
350
+ FileUtils.rm_rf(vendored_gems('gems/foo-1.0'))
351
+
352
+ bundle "install"
353
+
354
+ expect(vendored_gems('gems/foo-1.0')).to exist
355
+ end
340
356
  end
341
357
 
342
358
  describe "when Bundler root contains regex chars" do
@@ -47,4 +47,4 @@ describe "bundle install" do
47
47
  should_be_installed "activesupport 2.3.2"
48
48
  end
49
49
 
50
- end
50
+ end
@@ -147,4 +147,4 @@ describe "bundle install" do
147
147
  end
148
148
  end
149
149
 
150
- end
150
+ end
@@ -40,4 +40,4 @@ describe "bundle install" do
40
40
  end
41
41
  end
42
42
 
43
- end
43
+ end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe "Gem::Specification#match_platform" do
4
4
  it "does not match platforms other than the gem platform" do
5
5
  darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10"
6
- expect(darwin.match_platform(pl('java'))).to eq(false)
6
+ expect(darwin.match_platform(pl('java'))).to be false
7
7
  end
8
8
  end
9
9