bundler 1.3.5 → 1.3.6

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 (61) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +7 -3
  3. data/CHANGELOG.md +21 -0
  4. data/ISSUES.md +2 -2
  5. data/LICENSE.md +1 -1
  6. data/Rakefile +4 -3
  7. data/bin/bundle +6 -1
  8. data/bundler.gemspec +1 -1
  9. data/lib/bundler.rb +2 -4
  10. data/lib/bundler/cli.rb +13 -17
  11. data/lib/bundler/definition.rb +1 -1
  12. data/lib/bundler/deployment.rb +1 -1
  13. data/lib/bundler/dsl.rb +6 -5
  14. data/lib/bundler/fetcher.rb +6 -1
  15. data/lib/bundler/friendly_errors.rb +6 -0
  16. data/lib/bundler/gem_helper.rb +1 -2
  17. data/lib/bundler/installer.rb +1 -1
  18. data/lib/bundler/rubygems_ext.rb +1 -1
  19. data/lib/bundler/rubygems_integration.rb +23 -11
  20. data/lib/bundler/source/git.rb +3 -2
  21. data/lib/bundler/source/rubygems.rb +11 -1
  22. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  23. data/lib/bundler/ui.rb +4 -0
  24. data/lib/bundler/version.rb +1 -1
  25. data/man/bundle-exec.ronn +24 -6
  26. data/man/bundle-install.ronn +1 -1
  27. data/man/bundle.ronn +1 -1
  28. data/man/gemfile.5.ronn +1 -2
  29. data/spec/bundler/cli_rspec.rb +7 -2
  30. data/spec/bundler/dsl_spec.rb +4 -4
  31. data/spec/bundler/gem_helper_spec.rb +5 -6
  32. data/spec/install/gems/dependency_api_spec.rb +34 -0
  33. data/spec/install/gems/post_install_spec.rb +3 -3
  34. data/spec/install/gems/simple_case_spec.rb +16 -0
  35. data/spec/install/gems/win32_spec.rb +1 -1
  36. data/spec/install/git_spec.rb +1 -1
  37. data/spec/install/security_policy_spec.rb +10 -11
  38. data/spec/integration/inject.rb +1 -1
  39. data/spec/lock/git_spec.rb +0 -1
  40. data/spec/lock/lockfile_spec.rb +29 -5
  41. data/spec/other/binstubs_spec.rb +16 -3
  42. data/spec/other/bundle_ruby_spec.rb +1 -1
  43. data/spec/other/check_spec.rb +1 -1
  44. data/spec/other/clean_spec.rb +2 -2
  45. data/spec/other/exec_spec.rb +0 -1
  46. data/spec/other/init_spec.rb +0 -1
  47. data/spec/other/outdated_spec.rb +0 -2
  48. data/spec/other/platform_spec.rb +2 -2
  49. data/spec/quality_spec.rb +27 -2
  50. data/spec/realworld/dependency_api_spec.rb +0 -1
  51. data/spec/resolver/basic_spec.rb +1 -1
  52. data/spec/runtime/setup_spec.rb +4 -3
  53. data/spec/runtime/with_clean_env_spec.rb +0 -1
  54. data/spec/spec_helper.rb +1 -0
  55. data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
  56. data/spec/support/builders.rb +4 -2
  57. data/spec/support/permissions.rb +11 -0
  58. data/spec/update/gems_spec.rb +3 -3
  59. data/spec/update/git_spec.rb +2 -2
  60. data/spec/update/source_spec.rb +0 -1
  61. metadata +11 -13
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
@@ -20,6 +20,10 @@ module Bundler
20
20
  def confirm(message, newline = nil)
21
21
  end
22
22
 
23
+ def quiet?
24
+ false
25
+ end
26
+
23
27
  def debug?
24
28
  false
25
29
  end
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.3.5" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.3.6" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -58,17 +58,35 @@ It also modifies Rubygems:
58
58
 
59
59
  ### Shelling out
60
60
 
61
- When shelling out (using the `system` or backticks methods,
62
- for example), Bundler's environment changes will propagate to
63
- the subshell environment. If you desire to shell out without
64
- Bundler's environment changes, simply employ the `with_clean_env`
65
- method. It will restore all environment variables to what they
66
- were before Bundler was activated. For example:
61
+ Any Ruby code that opens a subshell (like `system`, backticks, or `%x{}`) will
62
+ automatically use the current Bundler environment. If you need to shell out to
63
+ a Ruby command that is not part of your current bundle, use the
64
+ `with_clean_env` method with a block. Any subshells created inside the block
65
+ will be given the environment present before Bundler was activated. For
66
+ example, Homebrew commands run Ruby, but don't work inside a bundle:
67
67
 
68
68
  Bundler.with_clean_env do
69
69
  `brew install wget`
70
70
  end
71
71
 
72
+ Using `with_clean_env` is also necessary if you are shelling out to a different
73
+ bundle. Any Bundler commands run in a subshell will inherit the current
74
+ Gemfile, so commands that need to run in the context of a different bundle also
75
+ need to use `with_clean_env`.
76
+
77
+ Bundler.with_clean_env do
78
+ Dir.chdir "/other/bundler/project" do
79
+ `bundle exec ./script`
80
+ end
81
+ end
82
+
83
+ Bundler provides convenience helpers that wrap `system` and `exec`, and they
84
+ can be used like this:
85
+
86
+ Bundler.clean_system('brew install wget')
87
+ Bundler.clean_exec('brew install wget')
88
+
89
+
72
90
  ## RUBYGEMS PLUGINS
73
91
 
74
92
  At present, the Rubygems plugin system requires all files
@@ -321,7 +321,7 @@ evaluates the gems currently being used to satisfy its requirements:
321
321
  also used to satisfy a dependency in `activemerchant`,
322
322
  which is not being updated
323
323
  * `rack ~> 1.1.0`:
324
- not currently being used to satify another dependency
324
+ not currently being used to satisfy another dependency
325
325
 
326
326
  Because you did not explicitly ask to update `activemerchant`,
327
327
  you would not expect it to suddenly stop working after updating
@@ -44,7 +44,7 @@ We divide `bundle` subcommands into primary commands and utilities.
44
44
  Specify and read configuration options for bundler
45
45
 
46
46
  * `bundle help(1)`:
47
- Displays this help page
47
+ Displays detailed help for each subcommand
48
48
 
49
49
  ## UTILITIES
50
50
 
@@ -196,8 +196,7 @@ as they would for a normal gem.
196
196
  A git repository `SHOULD` have at least one file, at the root of the
197
197
  directory containing the gem, with the extension `.gemspec`. This file
198
198
  `MUST` contain a valid gem specification, as expected by the `gem build`
199
- command. It `MUST NOT` have any dependencies, other than on the files in
200
- the git repository itself and any built-in functionality of Ruby or Rubygems.
199
+ command.
201
200
 
202
201
  If a git repository does not have a `.gemspec`, bundler will attempt to
203
202
  create one, but it will not contain any dependencies, executables, or
@@ -1,9 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
 
4
- describe 'bundle executable' do
5
- it 'returns non-zero exit status when passed unrecognized options' do
4
+ describe "bundle executable" do
5
+ it "returns non-zero exit status when passed unrecognized options" do
6
6
  bundle '--invalid_argument', :exitstatus => true
7
7
  expect(exitstatus).to_not be_zero
8
8
  end
9
+
10
+ it "returns non-zero exit status when passed unrecognized task" do
11
+ bundle 'unrecognized-tast', :exitstatus => true
12
+ expect(exitstatus).to_not be_zero
13
+ end
9
14
  end
@@ -6,7 +6,7 @@ describe Bundler::Dsl do
6
6
  Bundler::Source::Rubygems.stub(:new){ @rubygems }
7
7
  end
8
8
 
9
- describe '#_normalize_options' do
9
+ describe "#_normalize_options" do
10
10
  it "converts :github to :git" do
11
11
  subject.gem("sparks", :github => "indirect/sparks")
12
12
  github_uri = "git://github.com/indirect/sparks.git"
@@ -32,8 +32,8 @@ describe Bundler::Dsl do
32
32
  end
33
33
  end
34
34
 
35
- describe '#method_missing' do
36
- it 'raises an error for unknown DSL methods' do
35
+ describe "#method_missing" do
36
+ it "raises an error for unknown DSL methods" do
37
37
  Bundler.should_receive(:read_file).with("Gemfile").and_return("unknown")
38
38
  error_msg = "Undefined local variable or method `unknown'" \
39
39
  " for Gemfile\\s+from Gemfile:1"
@@ -51,7 +51,7 @@ describe Bundler::Dsl do
51
51
  end
52
52
 
53
53
  describe "syntax errors" do
54
- it "raise a Bundler::GemfileError" do
54
+ it "will raise a Bundler::GemfileError" do
55
55
  gemfile "gem 'foo', :path => /unquoted/string/syntax/error"
56
56
  expect { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }.
57
57
  to raise_error(Bundler::GemfileError)
@@ -62,7 +62,7 @@ describe "Bundler::GemHelper tasks" do
62
62
  expect(Bundler.ui).to be_a(Bundler::UI::Shell)
63
63
  end
64
64
 
65
- describe 'install_tasks' do
65
+ describe "install_tasks" do
66
66
  before(:each) do
67
67
  @saved, Rake.application = Rake.application, Rake::Application.new
68
68
  end
@@ -92,7 +92,7 @@ describe "Bundler::GemHelper tasks" do
92
92
  end
93
93
  end
94
94
 
95
- describe 'build' do
95
+ describe "build" do
96
96
  it "builds" do
97
97
  mock_build_message
98
98
  @helper.build_gem
@@ -106,7 +106,7 @@ describe "Bundler::GemHelper tasks" do
106
106
  end
107
107
  end
108
108
 
109
- describe 'install' do
109
+ describe "install" do
110
110
  it "installs" do
111
111
  mock_build_message
112
112
  mock_confirm_message "test (0.0.1) installed."
@@ -127,7 +127,7 @@ describe "Bundler::GemHelper tasks" do
127
127
  end
128
128
  end
129
129
 
130
- describe 'release' do
130
+ describe "release" do
131
131
  it "shouldn't push if there are unstaged files" do
132
132
  expect { @helper.release_gem }.to raise_error(/files that need to be committed/)
133
133
  end
@@ -137,7 +137,7 @@ describe "Bundler::GemHelper tasks" do
137
137
  expect { @helper.release_gem }.to raise_error(/files that need to be committed/)
138
138
  end
139
139
 
140
- it 'raises an appropriate error if there is no git remote' do
140
+ it "raises an appropriate error if there is no git remote" do
141
141
  Bundler.ui.stub(:confirm => nil, :error => nil) # silence messages
142
142
 
143
143
  Dir.chdir(gem_repo1) {
@@ -193,7 +193,6 @@ describe "Bundler::GemHelper tasks" do
193
193
  }
194
194
  @helper.release_gem
195
195
  end
196
-
197
196
  end
198
197
  end
199
198
  end
@@ -162,6 +162,40 @@ describe "gemcutter's dependency API" do
162
162
  should_be_installed "rack 1.0.0"
163
163
  end
164
164
 
165
+ it "handles host redirects" do
166
+ gemfile <<-G
167
+ source "#{source_uri}"
168
+ gem "rack"
169
+ G
170
+
171
+ bundle :install, :artifice => "endpoint_host_redirect"
172
+ should_be_installed "rack 1.0.0"
173
+ end
174
+
175
+ it "handles host redirects without Net::HTTP::Persistent" do
176
+ gemfile <<-G
177
+ source "#{source_uri}"
178
+ gem "rack"
179
+ G
180
+
181
+ FileUtils.mkdir_p lib_path
182
+ File.open(lib_path("disable_net_http_persistent.rb"), "w") do |h|
183
+ h.write <<-H
184
+ module Kernel
185
+ alias require_without_disabled_net_http require
186
+ def require(*args)
187
+ raise LoadError, 'simulated' if args.first == 'openssl' && !caller.grep(/vendored_persistent/).empty?
188
+ require_without_disabled_net_http(*args)
189
+ end
190
+ end
191
+ H
192
+ end
193
+
194
+ bundle :install, :artifice => "endpoint_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")]
195
+ expect(out).to_not match(/Too many redirects/)
196
+ should_be_installed "rack 1.0.0"
197
+ end
198
+
165
199
  it "timeouts when Bundler::Fetcher redirects too much" do
166
200
  gemfile <<-G
167
201
  source "#{source_uri}"
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'bundle install with gem sources' do
4
- describe 'when gems include post install messages' do
3
+ describe "bundle install with gem sources" do
4
+ describe "when gems include post install messages" do
5
5
  it "should display the post-install messages after installing" do
6
6
  gemfile <<-G
7
7
  source "file://#{gem_repo1}"
@@ -20,7 +20,7 @@ describe 'bundle install with gem sources' do
20
20
  end
21
21
  end
22
22
 
23
- describe 'when gems do not include post install messages' do
23
+ describe "when gems do not include post install messages" do
24
24
  it "should not display any post-install messages" do
25
25
  gemfile <<-G
26
26
  source "file://#{gem_repo1}"
@@ -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
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "bundle install with win32-generated lockfile" do
4
- it 'should read lockfile' do
4
+ it "should read lockfile" do
5
5
  File.open(bundled_app('Gemfile.lock'), 'wb') do |f|
6
6
  f << "GEM\r\n"
7
7
  f << " remote: file:#{gem_repo1}/\r\n"
@@ -34,7 +34,7 @@ describe "bundle install with git sources" do
34
34
  git = update_git "foo" do |s|
35
35
  s.executables = ["foobar"] # we added this the first time, so keep it now
36
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")')
37
+ foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files -z`.split("\x0")')
38
38
  s.write "foo.gemspec", foospec
39
39
  end
40
40
 
@@ -14,37 +14,37 @@ describe "policies with unsigned gems" do
14
14
  G
15
15
  end
16
16
 
17
- it "works after you try to deploy without a lock" do
17
+ it "will work after you try to deploy without a lock" do
18
18
  bundle "install --deployment"
19
19
  bundle :install, :exitstatus => true
20
20
  expect(exitstatus).to eq(0)
21
21
  should_be_installed "rack 1.0", "signed_gem 1.0"
22
22
  end
23
23
 
24
- it "fails when given invalid security policy" do
24
+ it "will fail when given invalid security policy" do
25
25
  bundle "install --trust-policy=InvalidPolicyName"
26
26
  expect(out).to include("Rubygems doesn't know about trust policy")
27
27
  end
28
28
 
29
- it "fails with High Security setting due to presence of unsigned gem" do
29
+ it "will fail with High Security setting due to presence of unsigned gem" do
30
30
  bundle "install --trust-policy=HighSecurity"
31
31
  expect(out).to include("security policy didn't allow")
32
32
  end
33
33
 
34
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
35
+ it "will fail with Medium Security setting due to presence of unsigned gem", :unless => ENV['RGV'] == "v2.0.0.rc.1" do
36
36
  bundle "install --trust-policy=MediumSecurity"
37
37
  expect(out).to include("security policy didn't allow")
38
38
  end
39
39
 
40
- it "succeeds with no policy" do
40
+ it "will succeed with no policy" do
41
41
  bundle "install", :exitstatus => true
42
42
  expect(exitstatus).to eq(0)
43
43
  end
44
44
 
45
45
  end
46
46
 
47
- describe "policies with signed gems, no CA" do
47
+ describe "policies with signed gems and no CA" do
48
48
  before do
49
49
  build_security_repo
50
50
  gemfile <<-G
@@ -53,26 +53,25 @@ describe "policies with signed gems, no CA" do
53
53
  G
54
54
  end
55
55
 
56
- it "fails with High Security setting, gem is self-signed" do
56
+ it "will fail with High Security setting, gem is self-signed" do
57
57
  bundle "install --trust-policy=HighSecurity"
58
58
  expect(out).to include("security policy didn't allow")
59
59
  end
60
60
 
61
- it "fails with Medium Security setting, gem is self-signed" do
61
+ it "will fail with Medium Security setting, gem is self-signed" do
62
62
  bundle "install --trust-policy=MediumSecurity"
63
63
  expect(out).to include("security policy didn't allow")
64
64
  end
65
65
 
66
- it "succeeds with Low Security setting, low security accepts self signed gem" do
66
+ it "will succeed with Low Security setting, low security accepts self signed gem" do
67
67
  bundle "install --trust-policy=LowSecurity", :exitstatus => true
68
68
  expect(exitstatus).to eq(0)
69
69
  should_be_installed "signed_gem 1.0"
70
70
  end
71
71
 
72
- it "succeeds with no policy" do
72
+ it "will succeed with no policy" do
73
73
  bundle "install", :exitstatus => true
74
74
  expect(exitstatus).to eq(0)
75
75
  should_be_installed "signed_gem 1.0"
76
76
  end
77
-
78
77
  end
@@ -21,7 +21,7 @@ describe "bundle inject" do
21
21
  bundle "install"
22
22
  end
23
23
 
24
- it "adds the injected gems to the gemfile" do
24
+ it "adds the injected gems to the Gemfile" do
25
25
  expect(bundled_app("Gemfile").read).not_to match(/rack-obama/)
26
26
  bundle "inject 'rack-obama' '> 0'"
27
27
  expect(bundled_app("Gemfile").read).to match(/rack-obama/)
@@ -31,5 +31,4 @@ describe "bundle lock with git gems" do
31
31
  RUBY
32
32
  expect(out).to eq(bundle("show foo"))
33
33
  end
34
-
35
34
  end
@@ -292,7 +292,7 @@ describe "the lockfile format" do
292
292
  G
293
293
  end
294
294
 
295
- it "order dependencies of dependencies in alphabetical order" do
295
+ it "orders dependencies' dependencies in alphabetical order" do
296
296
  install_gemfile <<-G
297
297
  source "file://#{gem_repo1}"
298
298
 
@@ -328,7 +328,7 @@ describe "the lockfile format" do
328
328
  G
329
329
  end
330
330
 
331
- it "orders dependencies according to version" do
331
+ it "orders dependencies by version" do
332
332
  install_gemfile <<-G
333
333
  source "file://#{gem_repo1}"
334
334
  gem 'double_deps'
@@ -472,6 +472,30 @@ describe "the lockfile format" do
472
472
  G
473
473
  end
474
474
 
475
+ it "stores relative paths when the path is provided for gemspec" do
476
+ build_lib("foo", :path => tmp.join("foo"))
477
+
478
+ install_gemfile <<-G
479
+ gemspec :path => "../foo"
480
+ G
481
+
482
+ lockfile_should_be <<-G
483
+ PATH
484
+ remote: ../foo
485
+ specs:
486
+ foo (1.0)
487
+
488
+ GEM
489
+ specs:
490
+
491
+ PLATFORMS
492
+ #{generic(Gem::Platform.local)}
493
+
494
+ DEPENDENCIES
495
+ foo!
496
+ G
497
+ end
498
+
475
499
  it "keeps existing platforms in the lockfile" do
476
500
  lockfile <<-G
477
501
  GEM
@@ -638,7 +662,7 @@ describe "the lockfile format" do
638
662
  end
639
663
 
640
664
 
641
- it "raises if two different versions are used" do
665
+ it "raises if two different sources are used" do
642
666
  install_gemfile <<-G
643
667
  source "file://#{gem_repo1}"
644
668
  gem "rack"
@@ -676,7 +700,7 @@ describe "the lockfile format" do
676
700
  # * multiple copies of the same GIT section appeared in the lockfile
677
701
  # * when this happened, those sections got multiple copies of gems
678
702
  # in those sections.
679
- it "fix corrupted lockfiles" do
703
+ it "fixes corrupted lockfiles" do
680
704
  build_git "omg", :path => lib_path('omg')
681
705
  revision = revision_for(lib_path('omg'))
682
706
 
@@ -740,7 +764,7 @@ describe "the lockfile format" do
740
764
  L
741
765
  end
742
766
 
743
- describe "line endings" do
767
+ describe "a line ending" do
744
768
  def set_lockfile_mtime_to_known_value
745
769
  time = Time.local(2000, 1, 1, 0, 0, 0)
746
770
  File.utime(time, time, bundled_app('Gemfile.lock'))