bundler 1.3.0.pre.7 → 1.3.0.pre.8

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 (69) hide show
  1. data/.rspec +1 -1
  2. data/.travis.yml +5 -0
  3. data/CHANGELOG.md +47 -0
  4. data/CONTRIBUTE.md +1 -2
  5. data/CONTRIBUTING.md +1 -1
  6. data/{LICENSE → LICENSE.md} +1 -1
  7. data/Rakefile +16 -13
  8. data/bundler.gemspec +20 -24
  9. data/lib/bundler.rb +6 -6
  10. data/lib/bundler/cli.rb +48 -11
  11. data/lib/bundler/deployment.rb +2 -1
  12. data/lib/bundler/deprecate.rb +1 -1
  13. data/lib/bundler/dsl.rb +4 -1
  14. data/lib/bundler/env.rb +1 -1
  15. data/lib/bundler/fetcher.rb +85 -57
  16. data/lib/bundler/friendly_errors.rb +0 -12
  17. data/lib/bundler/index.rb +2 -2
  18. data/lib/bundler/injector.rb +1 -1
  19. data/lib/bundler/installer.rb +7 -3
  20. data/lib/bundler/resolver.rb +17 -0
  21. data/lib/bundler/rubygems_ext.rb +4 -3
  22. data/lib/bundler/rubygems_integration.rb +38 -19
  23. data/lib/bundler/runtime.rb +9 -3
  24. data/lib/bundler/source/git.rb +20 -12
  25. data/lib/bundler/source/git/git_proxy.rb +1 -0
  26. data/lib/bundler/source/path/installer.rb +1 -1
  27. data/lib/bundler/source/rubygems.rb +25 -31
  28. data/lib/bundler/templates/newgem/.travis.yml.tt +3 -0
  29. data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
  30. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -16
  31. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
  32. data/lib/bundler/ui.rb +3 -2
  33. data/lib/bundler/vendor/net/http/persistent.rb +743 -91
  34. data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +129 -0
  35. data/lib/bundler/vendored_persistent.rb +11 -0
  36. data/lib/bundler/version.rb +1 -1
  37. data/lib/bundler/vlad.rb +1 -1
  38. data/man/bundle-config.ronn +3 -2
  39. data/man/bundle-install.ronn +19 -4
  40. data/man/bundle-package.ronn +1 -1
  41. data/man/bundle-platform.ronn +1 -1
  42. data/man/bundle-update.ronn +5 -5
  43. data/man/gemfile.5.ronn +1 -1
  44. data/spec/bundler/bundler_spec.rb +26 -0
  45. data/spec/cache/git_spec.rb +1 -1
  46. data/spec/install/gems/dependency_api_spec.rb +12 -23
  47. data/spec/install/gems/flex_spec.rb +1 -0
  48. data/spec/install/gems/groups_spec.rb +0 -19
  49. data/spec/install/gems/simple_case_spec.rb +4 -1
  50. data/spec/install/gems/sudo_spec.rb +11 -15
  51. data/spec/install/git_spec.rb +17 -0
  52. data/spec/install/security_policy_spec.rb +78 -0
  53. data/spec/other/licenses_spec.rb +18 -0
  54. data/spec/other/newgem_spec.rb +36 -0
  55. data/spec/other/outdated_spec.rb +10 -2
  56. data/spec/other/show_spec.rb +6 -1
  57. data/spec/realworld/dependency_api_spec.rb +2 -2
  58. data/spec/realworld/edgecases_spec.rb +3 -3
  59. data/spec/resolver/basic_spec.rb +7 -1
  60. data/spec/resolver/platform_spec.rb +1 -1
  61. data/spec/runtime/executable_spec.rb +2 -2
  62. data/spec/runtime/setup_spec.rb +14 -1
  63. data/spec/support/artifice/endpoint.rb +2 -0
  64. data/spec/support/builders.rb +74 -1
  65. data/spec/support/fakeweb/windows.rb +1 -1
  66. data/spec/support/indexes.rb +22 -0
  67. data/spec/support/path.rb +4 -0
  68. data/spec/support/rubygems_ext.rb +1 -0
  69. metadata +63 -83
@@ -194,6 +194,7 @@ describe "bundle flex_install" do
194
194
  it "suggests bundle update when the Gemfile requires different versions than the lock" do
195
195
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
196
196
  Fetching source index from file:#{gem_repo2}/
197
+ Resolving dependencies...
197
198
  Bundler could not find compatible versions for gem "rack":
198
199
  In snapshot (Gemfile.lock):
199
200
  rack (0.9.1)
@@ -182,16 +182,6 @@ describe "bundle install with gem sources" do
182
182
  should_be_installed "rack 1.0.0", "activesupport 2.3.5"
183
183
  end
184
184
 
185
- it "works when locked as well" do
186
- bundle "install --without emo"
187
- bundle "lock"
188
-
189
- simulate_new_machine
190
-
191
- bundle "install --without lolercoaster"
192
- should_be_installed "rack 1.0.0", "activesupport 2.3.5"
193
- end
194
-
195
185
  describe "with a gem defined multiple times in different groups" do
196
186
  before :each do
197
187
  gemfile <<-G
@@ -253,15 +243,6 @@ describe "bundle install with gem sources" do
253
243
  should_be_installed "rack 1.0.0", "activesupport 2.3.5"
254
244
  end
255
245
 
256
- it "works when locked as well" do
257
- bundle "install --without emo"
258
- bundle "lock"
259
-
260
- simulate_new_machine
261
-
262
- bundle "install --without lolercoaster"
263
- should_be_installed "rack 1.0.0", "activesupport 2.3.5"
264
- end
265
246
  end
266
247
  end
267
248
  end
@@ -310,7 +310,7 @@ describe "bundle install with gem sources" do
310
310
  G
311
311
 
312
312
  bundle :install
313
- expect(out).to include("Could not reach http://localhost:9384/")
313
+ expect(out).to include("Could not fetch specs from http://localhost:9384/")
314
314
  expect(out).not_to include("file://")
315
315
  end
316
316
 
@@ -658,6 +658,7 @@ describe "bundle install with gem sources" do
658
658
 
659
659
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
660
660
  Fetching source index from file:#{gem_repo2}/
661
+ Resolving dependencies...
661
662
  Bundler could not find compatible versions for gem "bundler":
662
663
  In Gemfile:
663
664
  bundler (= 0.9.2) ruby
@@ -715,6 +716,7 @@ describe "bundle install with gem sources" do
715
716
 
716
717
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
717
718
  Fetching source index from file:#{gem_repo2}/
719
+ Resolving dependencies...
718
720
  Bundler could not find compatible versions for gem "activesupport":
719
721
  In Gemfile:
720
722
  activemerchant (>= 0) ruby depends on
@@ -735,6 +737,7 @@ describe "bundle install with gem sources" do
735
737
 
736
738
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
737
739
  Fetching source index from file:#{gem_repo2}/
740
+ Resolving dependencies...
738
741
  Bundler could not find compatible versions for gem "activesupport":
739
742
  In Gemfile:
740
743
  rails_fail (>= 0) ruby depends on
@@ -61,24 +61,20 @@ describe "when using sudo", :sudo => true do
61
61
  end
62
62
  end
63
63
 
64
- describe "and BUNDLE_PATH is not writable" do
64
+ describe "and GEM_HOME is not writable" do
65
65
  it "installs" do
66
- begin
67
- gem_home = tmp('sudo_gem_home')
68
-
69
- sudo "mkdir -p #{gem_home}"
70
- sudo "chmod ugo-w #{gem_home}"
71
- ENV['GEM_HOME'] = gem_home.to_s
72
- ENV['GEM_PATH'] = nil
66
+ gem_home = tmp('sudo_gem_home')
67
+ sudo "mkdir -p #{gem_home}"
68
+ sudo "chmod ugo-w #{gem_home}"
73
69
 
74
- install_gemfile <<-G
75
- source "file://#{gem_repo1}"
76
- gem "rack", '1.0'
77
- G
70
+ gemfile <<-G
71
+ source "file://#{gem_repo1}"
72
+ gem "rack", '1.0'
73
+ G
78
74
 
79
- expect(gem_home.join('bin/rackup')).to exist
80
- should_be_installed "rack 1.0"
81
- end
75
+ bundle :install, :env => {'GEM_HOME' => gem_home.to_s, 'GEM_PATH' => nil}
76
+ expect(gem_home.join('bin/rackup')).to exist
77
+ should_be_installed "rack 1.0", :env => {'GEM_HOME' => gem_home.to_s, 'GEM_PATH' => nil}
82
78
  end
83
79
  end
84
80
 
@@ -30,6 +30,23 @@ describe "bundle install with git sources" do
30
30
  expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have(1).item
31
31
  end
32
32
 
33
+ it "caches the evaluated gemspec" do
34
+ git = update_git "foo" do |s|
35
+ s.executables = ["foobar"] # we added this the first time, so keep it now
36
+ s.files = ["bin/foobar"] # updating git nukes the files list
37
+ foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files`.split("\n")')
38
+ s.write "foo.gemspec", foospec
39
+ end
40
+
41
+ bundle "update foo"
42
+
43
+ sha = git.ref_for("master", 11)
44
+ spec_file = default_bundle_path.join("bundler/gems/foo-1.0-#{sha}/foo.gemspec").to_s
45
+ ruby_code = Gem::Specification.load(spec_file).to_ruby
46
+ file_code = File.read(spec_file)
47
+ expect(file_code).to eq(ruby_code)
48
+ end
49
+
33
50
  it "does not update the git source implicitly" do
34
51
  update_git "foo"
35
52
 
@@ -0,0 +1,78 @@
1
+ require "spec_helper"
2
+ require "rubygems/security"
3
+
4
+ # unfortunately, testing signed gems with a provided CA is extremely difficult
5
+ # as 'gem cert' is currently the only way to add CAs to the system.
6
+
7
+ describe "policies with unsigned gems" do
8
+ before do
9
+ build_security_repo
10
+ gemfile <<-G
11
+ source "file://#{security_repo}"
12
+ gem "rack"
13
+ gem "signed_gem"
14
+ G
15
+ end
16
+
17
+ it "works after you try to deploy without a lock" do
18
+ bundle "install --deployment"
19
+ bundle :install, :exitstatus => true
20
+ expect(exitstatus).to eq(0)
21
+ should_be_installed "rack 1.0", "signed_gem 1.0"
22
+ end
23
+
24
+ it "fails when given invalid security policy" do
25
+ bundle "install --trust-policy=InvalidPolicyName"
26
+ expect(out).to include("Rubygems doesn't know about trust policy")
27
+ end
28
+
29
+ it "fails with High Security setting due to presence of unsigned gem" do
30
+ bundle "install --trust-policy=HighSecurity"
31
+ expect(out).to include("security policy didn't allow")
32
+ end
33
+
34
+ # This spec will fail on Rubygems 2 rc1 due to a bug in policy.rb. the bug is fixed in rc3.
35
+ it "fails with Medium Security setting due to presence of unsigned gem", :unless => ENV['RGV'] == "v2.0.0.rc.1" do
36
+ bundle "install --trust-policy=MediumSecurity"
37
+ expect(out).to include("security policy didn't allow")
38
+ end
39
+
40
+ it "succeeds with no policy" do
41
+ bundle "install", :exitstatus => true
42
+ expect(exitstatus).to eq(0)
43
+ end
44
+
45
+ end
46
+
47
+ describe "policies with signed gems, no CA" do
48
+ before do
49
+ build_security_repo
50
+ gemfile <<-G
51
+ source "file://#{security_repo}"
52
+ gem "signed_gem"
53
+ G
54
+ end
55
+
56
+ it "fails with High Security setting, gem is self-signed" do
57
+ bundle "install --trust-policy=HighSecurity"
58
+ expect(out).to include("security policy didn't allow")
59
+ end
60
+
61
+ it "fails with Medium Security setting, gem is self-signed" do
62
+ bundle "install --trust-policy=MediumSecurity"
63
+ expect(out).to include("security policy didn't allow")
64
+ end
65
+
66
+ it "succeeds with Low Security setting, low security accepts self signed gem" do
67
+ bundle "install --trust-policy=LowSecurity", :exitstatus => true
68
+ expect(exitstatus).to eq(0)
69
+ should_be_installed "signed_gem 1.0"
70
+ end
71
+
72
+ it "succeeds with no policy" do
73
+ bundle "install", :exitstatus => true
74
+ expect(exitstatus).to eq(0)
75
+ should_be_installed "signed_gem 1.0"
76
+ end
77
+
78
+ end
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle licenses" do
4
+ before :each do
5
+ install_gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem "rails"
8
+ gem "with_license"
9
+ G
10
+ end
11
+
12
+ it "prints license information for all gems in the bundle" do
13
+ bundle "licenses"
14
+
15
+ expect(out).to include("actionpack: Unknown")
16
+ expect(out).to include("with_license: MIT")
17
+ end
18
+ end
@@ -120,6 +120,22 @@ RAKEFILE
120
120
  end
121
121
  end
122
122
 
123
+ context "no --test parameter" do
124
+ before do
125
+ reset!
126
+ in_app_root
127
+ bundle "gem #{gem_name}"
128
+ end
129
+
130
+ it "doesn't create any spec/test file" do
131
+ expect(bundled_app("test_gem/.rspec")).to_not exist
132
+ expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to_not exist
133
+ expect(bundled_app("test_gem/spec/spec_helper.rb")).to_not exist
134
+ expect(bundled_app("test_gem/test/test_test_gem.rb")).to_not exist
135
+ expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
136
+ end
137
+ end
138
+
123
139
  context "--test parameter set to rspec" do
124
140
  before do
125
141
  reset!
@@ -178,6 +194,10 @@ RAKEFILE
178
194
  expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
179
195
  expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
180
196
  end
197
+
198
+ it "creates a .travis.yml file to test the library against the current Ruby version on Travis CI" do
199
+ expect(bundled_app("test_gem/.travis.yml").read).to match(%r(- #{RUBY_VERSION}))
200
+ end
181
201
  end
182
202
 
183
203
  context "--edit option" do
@@ -276,6 +296,22 @@ RAKEFILE
276
296
  end
277
297
  end
278
298
 
299
+ context "no --test parameter" do
300
+ before do
301
+ reset!
302
+ in_app_root
303
+ bundle "gem #{gem_name}"
304
+ end
305
+
306
+ it "doesn't create any spec/test file" do
307
+ expect(bundled_app("test-gem/.rspec")).to_not exist
308
+ expect(bundled_app("test-gem/spec/test/gem_spec.rb")).to_not exist
309
+ expect(bundled_app("test-gem/spec/spec_helper.rb")).to_not exist
310
+ expect(bundled_app("test-gem/test/test_test/gem.rb")).to_not exist
311
+ expect(bundled_app("test-gem/test/minitest_helper.rb")).to_not exist
312
+ end
313
+ end
314
+
279
315
  context "--test parameter set to rspec" do
280
316
  before do
281
317
  reset!
@@ -5,25 +5,33 @@ describe "bundle outdated" do
5
5
  before :each do
6
6
  build_repo2 do
7
7
  build_git "foo", :path => lib_path("foo")
8
+ build_git "zebra", :path => lib_path("zebra")
8
9
  end
9
10
 
10
11
  install_gemfile <<-G
11
12
  source "file://#{gem_repo2}"
12
- gem "activesupport", "2.3.5"
13
+ gem "zebra", :git => "#{lib_path('zebra')}"
13
14
  gem "foo", :git => "#{lib_path('foo')}"
15
+ gem "activesupport", "2.3.5"
14
16
  G
15
17
  end
16
18
 
17
19
  describe "with no arguments" do
18
- it "returns list of outdated gems" do
20
+ it "returns a sorted list of outdated gems" do
19
21
  update_repo2 do
20
22
  build_gem "activesupport", "3.0"
21
23
  update_git "foo", :path => lib_path("foo")
24
+ update_git "zebra", :path => lib_path("zebra")
22
25
  end
23
26
 
24
27
  bundle "outdated"
28
+
25
29
  expect(out).to include("activesupport (3.0 > 2.3.5)")
26
30
  expect(out).to include("foo (1.0")
31
+
32
+ # Gem names are one per-line, between "*" and their parenthesized version.
33
+ gem_list = out.split("\n").map { |g| g[ /\* (.*) \(/, 1] }.compact
34
+ expect(gem_list).to eq(gem_list.sort)
27
35
  end
28
36
 
29
37
  it "returns non zero exit status if outdated gems present" do
@@ -48,10 +48,15 @@ describe "bundle show" do
48
48
  expect(out).to match(/could not find gem 'missing'/i)
49
49
  end
50
50
 
51
- it "prints path of all gems in bundle" do
51
+ it "prints path of all gems in bundle sorted by name" do
52
52
  bundle "show --paths"
53
+
53
54
  expect(out).to include(default_bundle_path('gems', 'rake-10.0.2').to_s)
54
55
  expect(out).to include(default_bundle_path('gems', 'rails-2.3.2').to_s)
56
+
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)
55
60
  end
56
61
  end
57
62
 
@@ -53,9 +53,9 @@ describe "gemcutter's dependency API", :realworld => true do
53
53
  G
54
54
 
55
55
  bundle :install
56
- expect(out).to include("\nFetching full source index from #{@server_uri}")
56
+ expect(out).to include("Fetching source index from #{@server_uri}/")
57
57
  should_be_installed "rack 1.0.0"
58
58
  end
59
59
  end
60
60
 
61
- end
61
+ end
@@ -11,7 +11,7 @@ describe "real world edgecases", :realworld => true do
11
11
  end
12
12
 
13
13
  # https://github.com/carlhuda/bundler/issues/1202
14
- it "bundle cache works with rubygems 1.3.7 and pre gems" do
14
+ it "bundle cache works with rubygems 1.3.7 and pre gems", :ruby => "1.8" do
15
15
  install_gemfile <<-G
16
16
  source :rubygems
17
17
  gem "rack", "1.3.0.beta2"
@@ -23,7 +23,7 @@ describe "real world edgecases", :realworld => true do
23
23
 
24
24
  # https://github.com/carlhuda/bundler/issues/1486
25
25
  # this is a hash collision that only manifests on 1.8.7
26
- it "finds the correct child versions" do
26
+ it "finds the correct child versions", :ruby => "1.8" do
27
27
  install_gemfile <<-G
28
28
  source :rubygems
29
29
 
@@ -141,7 +141,7 @@ describe "real world edgecases", :realworld => true do
141
141
  multi_json (~> 1.0)
142
142
 
143
143
  GEM
144
- remote: http://rubygems.org/
144
+ remote: https://rubygems.org/
145
145
  specs:
146
146
  arel (3.0.2)
147
147
  builder (3.0.0)
@@ -17,4 +17,10 @@ describe "Resolving" do
17
17
 
18
18
  should_resolve_as %w(actionpack-2.3.5 activesupport-2.3.5 rack-1.0)
19
19
  end
20
- end
20
+
21
+ it "resolve a conflicting index" do
22
+ @index = a_conflict_index
23
+ dep "my_app"
24
+ should_resolve_as %w(activemodel-3.2.11 builder-3.0.4 grape-0.2.6 my_app-1.0.0)
25
+ end
26
+ end
@@ -79,4 +79,4 @@ describe "Resolving platform craziness" do
79
79
  should_conflict_on "baz"
80
80
  end
81
81
  end
82
- end
82
+ end
@@ -130,7 +130,7 @@ describe "Running bin/* commands" do
130
130
  expect(bundled_app("bin/rackup")).to exist
131
131
  end
132
132
 
133
- it "doesn't overwrite on --binstub" do
133
+ it "rewrites bins on --binstubs (to maintain backwards compatibility)" do
134
134
  gemfile <<-G
135
135
  source "file://#{gem_repo1}"
136
136
  gem "rack"
@@ -144,6 +144,6 @@ describe "Running bin/* commands" do
144
144
 
145
145
  bundle "install"
146
146
 
147
- expect(bundled_app("bin/rackup").read).to eq("OMG")
147
+ expect(bundled_app("bin/rackup").read).to_not eq("OMG")
148
148
  end
149
149
  end
@@ -46,6 +46,19 @@ describe "Bundler.setup" do
46
46
  expect(out).to eq("WIN")
47
47
  end
48
48
 
49
+ it "accepts string for group name" do
50
+ ruby <<-RUBY
51
+ require 'rubygems'
52
+ require 'bundler'
53
+ Bundler.setup(:default, 'test')
54
+
55
+ require 'rack'
56
+ puts RACK
57
+ RUBY
58
+ expect(err).to eq("")
59
+ expect(out).to eq("1.0.0")
60
+ end
61
+
49
62
  it "leaves all groups available if they were already" do
50
63
  ruby <<-RUBY
51
64
  require 'rubygems'
@@ -806,7 +819,7 @@ describe "Bundler.setup" do
806
819
  s.write "bar.gemspec", "require 'foobarbaz'"
807
820
  end
808
821
  bundle :install
809
- expect(out).to include("was a LoadError while evaluating bar.gemspec")
822
+ expect(out).to include("was a LoadError while loading bar.gemspec")
810
823
  expect(out).to include("foobarbaz")
811
824
  expect(out).to include("bar.gemspec:1")
812
825
  expect(out).to include("try to require a relative path") if RUBY_VERSION >= "1.9"