bundler 1.12.0.pre.1 → 1.12.0.pre.2

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +6 -7
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +27 -0
  5. data/DEVELOPMENT.md +18 -0
  6. data/Rakefile +4 -4
  7. data/bin/rake +3 -3
  8. data/bin/rspec +3 -3
  9. data/bin/rubocop +4 -4
  10. data/bin/with_rubygems +39 -0
  11. data/lib/bundler.rb +48 -31
  12. data/lib/bundler/cli.rb +8 -1
  13. data/lib/bundler/cli/exec.rb +47 -11
  14. data/lib/bundler/cli/install.rb +10 -5
  15. data/lib/bundler/cli/outdated.rb +43 -10
  16. data/lib/bundler/definition.rb +4 -15
  17. data/lib/bundler/environment_preserver.rb +35 -0
  18. data/lib/bundler/errors.rb +9 -0
  19. data/lib/bundler/fetcher.rb +1 -1
  20. data/lib/bundler/resolver.rb +15 -4
  21. data/lib/bundler/rubygems_ext.rb +1 -1
  22. data/lib/bundler/rubygems_integration.rb +18 -3
  23. data/lib/bundler/runtime.rb +11 -1
  24. data/lib/bundler/settings.rb +1 -1
  25. data/lib/bundler/shared_helpers.rb +2 -0
  26. data/lib/bundler/source/git.rb +4 -0
  27. data/lib/bundler/source/path.rb +11 -4
  28. data/lib/bundler/source/rubygems/remote.rb +4 -0
  29. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +1 -0
  30. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +1 -0
  31. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -0
  32. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  33. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  34. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +1 -0
  35. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +2 -0
  36. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  37. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +1 -0
  38. data/lib/bundler/version.rb +1 -1
  39. metadata +5 -4
  40. data/lib/bundler/path_preserver.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b760f9de4dfb482173fc42326c0835065a447b4
4
- data.tar.gz: 76008afb974bf6f329a58cc41c82c2b5debb695c
3
+ metadata.gz: df71627144b74925ef94e86632b2a1e695aca20c
4
+ data.tar.gz: f0caee062084df614e8ae210e40d38cc644f6987
5
5
  SHA512:
6
- metadata.gz: f86fc362c9d5734ec0356c53c19c80b896c804cc4c9598359544634d9f144778d4649ee64cfb790a76b21192d079808174088b32af1e84a826e4b2efc1c07b48
7
- data.tar.gz: 33716914172bab80e7f76cfeee7a049800055bda2606a41042a43001925c56d1f4d2d1e6fd000a6cbda3875af23a574910ad0da6183a4a5098e04db86b7c1e5f
6
+ metadata.gz: 2df75889fd75224791131114686b8c30d51c72819ad410b86ab66a7fe04a08bd25bade89483cc40dc7465154f12e9e7dc64e6bd96fb665dc74ffc2994662703d
7
+ data.tar.gz: b12d427f335b9a56618fd52a415780070e4ca019dcbe190a57632ae2adb51035bb8d832dd408c4d91d6fe3999190ae231221d8514cc3d43e8866d384fec7ee6e
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-02-05 10:43:08 -0600 using RuboCop version 0.37.0.
3
+ # on 2016-02-09 10:53:24 -0600 using RuboCop version 0.37.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -25,7 +25,7 @@ Lint/IneffectiveAccessModifier:
25
25
  Exclude:
26
26
  - 'lib/bundler/settings.rb'
27
27
 
28
- # Offense count: 4
28
+ # Offense count: 3
29
29
  Lint/NestedMethodDefinition:
30
30
  Exclude:
31
31
  - 'lib/bundler/inline.rb'
@@ -52,7 +52,7 @@ Lint/UselessAssignment:
52
52
  - 'lib/bundler/index.rb'
53
53
  - 'lib/bundler/installer.rb'
54
54
 
55
- # Offense count: 1291
55
+ # Offense count: 1295
56
56
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
57
57
  # URISchemes: http, https
58
58
  Metrics/LineLength:
@@ -63,7 +63,7 @@ Metrics/LineLength:
63
63
  Metrics/ParameterLists:
64
64
  Max: 6
65
65
 
66
- # Offense count: 53
66
+ # Offense count: 52
67
67
  Metrics/PerceivedComplexity:
68
68
  Max: 54
69
69
 
@@ -148,11 +148,10 @@ Style/GlobalVars:
148
148
  - 'spec/spec_helper.rb'
149
149
  - 'spec/support/helpers.rb'
150
150
 
151
- # Offense count: 2
151
+ # Offense count: 1
152
152
  Style/IfInsideElse:
153
153
  Exclude:
154
154
  - 'lib/bundler/cli/install.rb'
155
- - 'lib/bundler/definition.rb'
156
155
 
157
156
  # Offense count: 4
158
157
  # Cop supports --auto-correct.
@@ -196,7 +195,7 @@ Style/PredicateName:
196
195
  - 'lib/bundler/source/git/git_proxy.rb'
197
196
  - 'lib/bundler/source/path.rb'
198
197
 
199
- # Offense count: 22
198
+ # Offense count: 23
200
199
  # Configuration parameters: EnforcedStyle, SupportedStyles.
201
200
  # SupportedStyles: compact, exploded
202
201
  Style/RaiseArgs:
@@ -39,7 +39,7 @@ env:
39
39
  # We need to know if changes to rubygems will break bundler on release
40
40
  - RGV=master
41
41
  # Test the latest rubygems release with all of our supported rubies
42
- - RGV=v2.5.2
42
+ - RGV=v2.6.0
43
43
  - RGV=v2.4.8
44
44
 
45
45
  matrix:
@@ -1,3 +1,30 @@
1
+ ## 1.12.0.pre.2 (2016-02-26)
2
+
3
+ Performance:
4
+
5
+ - speed up `bundle exec` by `load`ing the executable whenever possible, saving roughly .2 seconds per invocation (@segiddins)
6
+
7
+ Features:
8
+
9
+ - add a `--patch` flag for `bundle outdated` (@RochesterinNYC)
10
+ - add `Bundler.clean_env` and `Bundler.original_env` (#4232, @njam)
11
+ - add `--frozen` support to `bundle package` (#3356, @RochesterinNYC)
12
+
13
+ Bugfixes:
14
+
15
+ - place bundler loaded gems after `-I` and `RUBYLIB` (@Elffers)
16
+ - give a better error message when filesystem access raises an `EPROTO` error (#3581, #3932, #4163, @RochesterinNYC)
17
+ - give a better error message when both `--deployment` and `--system` are used together (@RochesterinNYC)
18
+ - fix `$PATH` being preserved for use in `Bundler.with_clean_env` (#4251, @segiddins, @njam)
19
+ - give a better error message when running `bundle outdated` in frozen mode (#4287, @RochesterinNYC)
20
+ - handle when `http_proxy` is set to `:no_proxy` in the rubygems configuration (#4294, @segiddins)
21
+ - give a better error message when authentication details aren't properly escaped (#4288, @RochesterinNYC)
22
+ - fix `bundle outdated --minor` to only report updates that match the current minor version (@RochesterinNYC)
23
+ - fix extra dependencies being resolved unnecessarily (#4276, @segiddins)
24
+ - give a better error message when missing specs due to platform mis-matches (#4259, @RochesterinNYC)
25
+ - skip rebuilding extensions for git gems if they are already built (#4082, @csfrancis, @indirect, @segiddins)
26
+ - fix `bundle install` not installing when the `no_install` setting is set (#3966, @chulkilee, @segiddins)
27
+
1
28
  ## 1.12.0.pre.1 (2016-02-09)
2
29
 
3
30
  Performance:
@@ -33,6 +33,24 @@ Bundler doesn't use a Gemfile to list development dependencies, because when we
33
33
 
34
34
  With that set up, you can test changes you've made to Bundler by running `dbundle`, without interfering with the regular `bundle` command.
35
35
 
36
+ # Submitting Pull Requests
37
+
38
+ Before you submit a pull request, please remember to do the following:
39
+
40
+ - Make sure the code formatting and styling adheres to the guidelines. We use Rubocop for this. Lack of formatting adherence will result in automatic Travis build failures.
41
+
42
+ $ bin/rubocop -a
43
+
44
+ - Please run the test suite:
45
+
46
+ $ bin/rspec
47
+
48
+ - If you are unable to run the entire test suite, please run the unit test suite and at least the integration specs related to the command or domain of Bundler that your code changes relate to.
49
+
50
+ - Ex. For a pull request that changes something with `bundle update`, you might run:
51
+
52
+ $ bin/rspec spec/bundler
53
+ $ bin/rspec spec/commands/update_spec.rb
36
54
 
37
55
  # Bug triage
38
56
 
data/Rakefile CHANGED
@@ -34,7 +34,7 @@ namespace :spec do
34
34
  deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d|
35
35
  [d.name, d.requirement.to_s]
36
36
  end]
37
- deps["rubocop"] ||= "= 0.37.0" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement
37
+ deps["rubocop"] ||= "= 0.37.1" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement
38
38
 
39
39
  # JRuby can't build ronn or rdiscount, so we skip that
40
40
  if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
@@ -65,7 +65,7 @@ namespace :spec do
65
65
  sh "sudo apt-get install graphviz -y 2>&1 | tail -n 2"
66
66
 
67
67
  # Install the gems with a consistent version of RubyGems
68
- sh "gem update --system 2.5.2"
68
+ sh "gem update --system 2.6.0"
69
69
 
70
70
  $LOAD_PATH.unshift("./spec")
71
71
  require "support/rubygems_ext"
@@ -88,7 +88,7 @@ begin
88
88
 
89
89
  if RUBY_VERSION >= "1.9.3"
90
90
  # can't go in the gemspec because of the ruby version requirement
91
- gem "rubocop", "= 0.37.0"
91
+ gem "rubocop", "= 0.37.1"
92
92
  require "rubocop/rake_task"
93
93
  RuboCop::RakeTask.new
94
94
  end
@@ -122,7 +122,7 @@ begin
122
122
  rubyopt = ENV["RUBYOPT"]
123
123
  # When editing this list, also edit .travis.yml!
124
124
  branches = %w(master)
125
- releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2)
125
+ releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.6.0)
126
126
  (branches + releases).each do |rg|
127
127
  desc "Run specs with Rubygems #{rg}"
128
128
  RSpec::Core::RakeTask.new(rg) do |t|
data/bin/rake CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"]
5
+
4
6
  require "rubygems"
5
7
 
6
8
  bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
@@ -12,8 +14,6 @@ bundler_spec.dependencies.each do |dep|
12
14
  end
13
15
  end
14
16
 
15
- Gem::Specification.unresolved_deps.each do |_name, dep|
16
- gem dep.name, *dep.requirement
17
- end
17
+ Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
18
18
 
19
19
  load Gem.bin_path("rake", "rake")
data/bin/rspec CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"]
5
+
4
6
  require "rubygems"
5
7
 
6
8
  bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
@@ -8,8 +10,6 @@ bundler_spec.dependencies.each do |dep|
8
10
  gem dep.name, dep.requirement.to_s
9
11
  end
10
12
 
11
- Gem::Specification.unresolved_deps.each do |_name, dep|
12
- gem dep.name, *dep.requirement
13
- end
13
+ Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
14
14
 
15
15
  load Gem.bin_path("rspec-core", "rspec")
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ load File.expand_path("../with_rubygems", __FILE__) if ENV["RGV"]
5
+
4
6
  require "rubygems"
5
7
 
6
8
  bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
@@ -8,10 +10,8 @@ bundler_spec.dependencies.each do |dep|
8
10
  gem dep.name, dep.requirement.to_s
9
11
  end
10
12
 
11
- gem "rubocop", "= 0.37.0"
13
+ gem "rubocop", "= 0.37.1"
12
14
 
13
- Gem::Specification.unresolved_deps.each do |_name, dep|
14
- gem dep.name, *dep.requirement
15
- end
15
+ Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
16
16
 
17
17
  load Gem.bin_path("rubocop", "rubocop")
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "pathname"
5
+
6
+ def run(*cmd)
7
+ return if system(*cmd)
8
+ raise "Running `#{cmd.join(" ")}` failed"
9
+ end
10
+
11
+ version = ENV.delete("RGV")
12
+ rubygems_path = Pathname.new(__FILE__).join("../../tmp/rubygems").expand_path
13
+ unless rubygems_path.directory?
14
+ rubygems_path.parent.mkpath unless rubygems_path.directory?
15
+ run("git", "clone", "https://github.com/rubygems/rubygems.git", rubygems_path.to_s)
16
+ end
17
+ Dir.chdir(rubygems_path) do
18
+ version = "v#{version}" if version =~ /\A\d/
19
+ run("git", "checkout", version, "--quiet")
20
+ end if version
21
+
22
+ rubygems_lib = rubygems_path + "lib"
23
+ ENV["RUBYOPT"] = %(-I#{rubygems_lib} #{ENV["RUBYOPT"]})
24
+
25
+ if $0 != __FILE__
26
+ ARGV.unshift($0)
27
+ elsif cmd = ARGV.first
28
+ possible_dirs = [
29
+ Pathname.new(__FILE__) + "..",
30
+ Pathname.new(__FILE__) + "../../exe",
31
+ rubygems_path + "bin",
32
+ ]
33
+ cmd = possible_dirs.map do |dir|
34
+ dir.join(cmd).expand_path
35
+ end.find(&:file?)
36
+ ARGV[0] = cmd.to_s if cmd
37
+ end
38
+
39
+ exec(*ARGV)
@@ -3,7 +3,7 @@ require "fileutils"
3
3
  require "pathname"
4
4
  require "rbconfig"
5
5
  require "thread"
6
- require "bundler/path_preserver"
6
+ require "bundler/environment_preserver"
7
7
  require "bundler/gem_remote_fetcher"
8
8
  require "bundler/rubygems_ext"
9
9
  require "bundler/rubygems_integration"
@@ -13,9 +13,9 @@ require "bundler/current_ruby"
13
13
  require "bundler/errors"
14
14
 
15
15
  module Bundler
16
- PathPreserver.preserve_path_in_environment("PATH", ENV)
17
- PathPreserver.preserve_path_in_environment("GEM_PATH", ENV)
18
- ORIGINAL_ENV = ENV.to_hash
16
+ environment_preserver = EnvironmentPreserver.new(ENV, %w(PATH GEM_PATH))
17
+ ORIGINAL_ENV = environment_preserver.restore
18
+ ENV.replace(environment_preserver.backup)
19
19
  SUDO_MUTEX = Mutex.new
20
20
 
21
21
  autoload :Definition, "bundler/definition"
@@ -200,31 +200,41 @@ module Bundler
200
200
  @settings = Settings.new(Pathname.new(".bundle").expand_path)
201
201
  end
202
202
 
203
- def with_original_env
204
- bundled_env = ENV.to_hash
205
- ENV.replace(ORIGINAL_ENV)
206
- yield
207
- ensure
208
- ENV.replace(bundled_env.to_hash)
203
+ # @return [Hash] Environment present before Bundler was activated
204
+ def original_env
205
+ ORIGINAL_ENV.clone
209
206
  end
210
207
 
211
- def with_clean_env
212
- with_original_env do
213
- ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"]
214
- ENV.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
208
+ # @deprecated Use `original_env` instead
209
+ # @return [Hash] Environment with all bundler-related variables removed
210
+ def clean_env
211
+ env = original_env
215
212
 
216
- if ENV.key?("RUBYOPT")
217
- ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", ""
218
- end
213
+ if env.key?("BUNDLE_ORIG_MANPATH")
214
+ env["MANPATH"] = env["BUNDLE_ORIG_MANPATH"]
215
+ end
219
216
 
220
- if ENV.key?("RUBYLIB")
221
- rubylib = ENV["RUBYLIB"].split(File::PATH_SEPARATOR)
222
- rubylib.delete(File.expand_path("..", __FILE__))
223
- ENV["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
224
- end
217
+ env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
225
218
 
226
- yield
219
+ if env.key?("RUBYOPT")
220
+ env["RUBYOPT"] = env["RUBYOPT"].sub "-rbundler/setup", ""
227
221
  end
222
+
223
+ if env.key?("RUBYLIB")
224
+ rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
225
+ rubylib.delete(File.expand_path("..", __FILE__))
226
+ env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
227
+ end
228
+
229
+ env
230
+ end
231
+
232
+ def with_original_env
233
+ with_env(original_env) { yield }
234
+ end
235
+
236
+ def with_clean_env
237
+ with_env(clean_env) { yield }
228
238
  end
229
239
 
230
240
  def clean_system(*args)
@@ -345,18 +355,16 @@ module Bundler
345
355
  # depend on "./" relative paths.
346
356
  SharedHelpers.chdir(path.dirname.to_s) do
347
357
  contents = path.read
348
- if contents[0..2] == "---" # YAML header
349
- spec = eval_yaml_gemspec(path, contents)
358
+ spec = if contents[0..2] == "---" # YAML header
359
+ eval_yaml_gemspec(path, contents)
350
360
  else
351
- spec = eval_gemspec(path, contents)
361
+ eval_gemspec(path, contents)
352
362
  end
353
- Bundler.rubygems.validate(spec) if spec && validate
363
+ return unless spec
364
+ spec.loaded_from = path.expand_path.to_s
365
+ Bundler.rubygems.validate(spec) if validate
354
366
  spec
355
367
  end
356
- rescue Gem::InvalidSpecificationException => e
357
- error_message = "The gemspec at #{file} is not valid. Please fix this gemspec.\n" \
358
- "The validation error was '#{e.message}'\n"
359
- raise Gem::InvalidSpecificationException.new(error_message)
360
368
  end
361
369
 
362
370
  def clear_gemspec_cache
@@ -430,5 +438,14 @@ module Bundler
430
438
  Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
431
439
  lockfile.rmtree
432
440
  end
441
+
442
+ # @param env [Hash]
443
+ def with_env(env)
444
+ backup = ENV.to_hash
445
+ ENV.replace(env)
446
+ yield
447
+ ensure
448
+ ENV.replace(backup)
449
+ end
433
450
  end
434
451
  end
@@ -170,7 +170,11 @@ module Bundler
170
170
  map "i" => "install"
171
171
  def install
172
172
  require "bundler/cli/install"
173
+ no_install = Bundler.settings[:no_install]
174
+ Bundler.settings[:no_install] = false
173
175
  Install.new(options.dup).run
176
+ ensure
177
+ Bundler.settings[:no_install] = no_install
174
178
  end
175
179
 
176
180
  desc "update [OPTIONS]", "update the current environment"
@@ -244,7 +248,8 @@ module Bundler
244
248
  method_option "strict", :type => :boolean, :banner =>
245
249
  "Only list newer versions allowed by your Gemfile requirements"
246
250
  method_option "major", :type => :boolean, :banner => "Only list major newer versions"
247
- method_option "minor", :type => :boolean, :banner => "Only list at least minor newer versions"
251
+ method_option "minor", :type => :boolean, :banner => "Only list minor newer versions"
252
+ method_option "patch", :type => :boolean, :banner => "Only list patch newer versions"
248
253
  method_option "parseable", :aliases => "--porcelain", :type => :boolean, :banner =>
249
254
  "Use minimal formatting for more parseable output"
250
255
  def outdated(*gems)
@@ -272,6 +277,8 @@ module Bundler
272
277
  method_option "path", :type => :string, :banner =>
273
278
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
274
279
  method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
280
+ method_option "frozen", :type => :boolean, :banner =>
281
+ "Do not allow the Gemfile.lock to be updated after this package operation's install"
275
282
  long_desc <<-D
276
283
  The package command will copy the .gem files for every gem in the bundle into the
277
284
  directory ./vendor/cache. If you then check that directory into your source
@@ -18,16 +18,30 @@ module Bundler
18
18
  end
19
19
 
20
20
  def run
21
- ui = Bundler.ui
22
- raise ArgumentError if cmd.nil?
23
-
21
+ validate_cmd!
24
22
  SharedHelpers.set_bundle_environment
25
- bin_path = Bundler.which(@cmd)
23
+ if bin_path = Bundler.which(cmd)
24
+ kernel_load(bin_path, *args) && return if ruby_shebang?(bin_path)
25
+ # First, try to exec directly to something in PATH
26
+ kernel_exec([bin_path, cmd], *args)
27
+ else
28
+ # Just exec using the given command
29
+ kernel_exec(cmd, *args)
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def validate_cmd!
36
+ return unless cmd.nil?
37
+ Bundler.ui.error "bundler: exec needs a command to run"
38
+ exit 128
39
+ end
40
+
41
+ def kernel_exec(*args)
42
+ ui = Bundler.ui
26
43
  Bundler.ui = nil
27
- # First, try to exec directly to something in PATH
28
- Kernel.exec([bin_path, @cmd], *args) if bin_path
29
- # Just exec using the given command
30
- Kernel.exec(@cmd, *args)
44
+ Kernel.exec(*args)
31
45
  rescue Errno::EACCES, Errno::ENOEXEC
32
46
  Bundler.ui = ui
33
47
  Bundler.ui.error "bundler: not executable: #{cmd}"
@@ -37,10 +51,32 @@ module Bundler
37
51
  Bundler.ui.error "bundler: command not found: #{cmd}"
38
52
  Bundler.ui.warn "Install missing gem executables with `bundle install`"
39
53
  exit 127
40
- rescue ArgumentError
54
+ end
55
+
56
+ def kernel_load(file, *args)
57
+ args.pop if args.last.is_a?(Hash)
58
+ ARGV.replace(args)
59
+ $0 = file
60
+ ui = Bundler.ui
61
+ Bundler.ui = nil
62
+ require "bundler/setup"
63
+ Kernel.load(file)
64
+ rescue SystemExit
65
+ raise
66
+ rescue Exception => e # rubocop:disable Lint/RescueException
41
67
  Bundler.ui = ui
42
- Bundler.ui.error "bundler: exec needs a command to run"
43
- exit 128
68
+ Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
69
+ backtrace = e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) }
70
+ abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
71
+ end
72
+
73
+ def ruby_shebang?(file)
74
+ possibilities = [
75
+ "#!/usr/bin/env ruby\n",
76
+ "#!#{Gem.ruby}\n",
77
+ ]
78
+ first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
79
+ possibilities.any? {|shebang| first_line.start_with?(shebang) }
44
80
  end
45
81
  end
46
82
  end
@@ -45,11 +45,7 @@ module Bundler
45
45
  # Just disable color in deployment mode
46
46
  Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
47
47
 
48
- if (options[:path] || options[:deployment]) && options[:system]
49
- Bundler.ui.error "You have specified both a path to install your gems to, \n" \
50
- "as well as --system. Please choose."
51
- exit 1
52
- end
48
+ check_for_options_conflicts
53
49
 
54
50
  if options["trust-policy"]
55
51
  unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
@@ -185,5 +181,14 @@ module Bundler
185
181
  Bundler.ui.confirm "Post-install message from #{name}:"
186
182
  Bundler.ui.info msg
187
183
  end
184
+
185
+ def check_for_options_conflicts
186
+ if (options[:path] || options[:deployment]) && options[:system]
187
+ error_message = String.new
188
+ error_message << "You have specified both a path to install your gems to as well as --system. Please choose.\n" if options[:path]
189
+ error_message << "You have specified both --deployment as well as --system. Please choose.\n" if options[:deployment]
190
+ raise InvalidOption.new(error_message)
191
+ end
192
+ end
188
193
  end
189
194
  end
@@ -10,6 +10,8 @@ module Bundler
10
10
  end
11
11
 
12
12
  def run
13
+ check_for_deployment_mode
14
+
13
15
  sources = Array(options[:source])
14
16
 
15
17
  gems.each do |gem_name|
@@ -54,18 +56,12 @@ module Bundler
54
56
  end
55
57
  active_spec = active_spec.last
56
58
 
57
- if options[:major]
58
- current_major = current_spec.version.segments.first
59
- active_major = active_spec.version.segments.first
60
- active_spec = nil unless active_major > current_major
61
- end
62
-
63
- if options[:minor]
64
- current_minor = current_spec.version.segments[0, 2].compact.join(".")
65
- active_minor = active_spec.version.segments[0, 2].compact.join(".")
66
- active_spec = nil unless active_minor > current_minor
59
+ if options[:major] || options[:minor] || options[:patch]
60
+ update_present = update_present_via_semver_portions(current_spec, active_spec, options)
61
+ active_spec = nil unless update_present
67
62
  end
68
63
  end
64
+
69
65
  next if active_spec.nil?
70
66
 
71
67
  gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
@@ -109,5 +105,42 @@ module Bundler
109
105
  exit 1
110
106
  end
111
107
  end
108
+
109
+ private
110
+
111
+ def check_for_deployment_mode
112
+ if Bundler.settings[:frozen]
113
+ error_message = "You are trying to check outdated gems in deployment mode. " \
114
+ "Run `bundle outdated` elsewhere.\n" \
115
+ "\nIf this is a development machine, remove the #{Bundler.default_gemfile} freeze" \
116
+ "\nby running `bundle install --no-deployment`."
117
+ raise ProductionError, error_message
118
+ end
119
+ end
120
+
121
+ def update_present_via_semver_portions(current_spec, active_spec, options)
122
+ current_major = current_spec.version.segments.first
123
+ active_major = active_spec.version.segments.first
124
+
125
+ update_present = false
126
+
127
+ update_present = active_major > current_major if options[:major]
128
+
129
+ if (options[:minor] || options[:patch]) && current_major == active_major
130
+ current_minor = current_spec.version.segments[1, 1].first
131
+ active_minor = active_spec.version.segments[1, 1].first
132
+
133
+ if options[:minor]
134
+ update_present = active_minor > current_minor
135
+ elsif options[:patch] && current_minor == active_minor
136
+ current_patch = current_spec.version.segments[2, 1].first
137
+ active_patch = active_spec.version.segments[2, 1].first
138
+
139
+ update_present = active_patch > current_patch
140
+ end
141
+ end
142
+
143
+ update_present
144
+ end
112
145
  end
113
146
  end
@@ -280,22 +280,11 @@ module Bundler
280
280
  end
281
281
 
282
282
  def locked_ruby_version
283
- if @unlock[:ruby]
284
- if ruby_version && !@locked_ruby_version
285
- return Bundler::RubyVersion.system
286
- elsif ruby_version && @locked_ruby_version
287
- return Bundler::RubyVersion.system
288
- elsif !ruby_version && @locked_ruby_version
289
- return nil
290
- end
283
+ return unless ruby_version
284
+ if @unlock[:ruby] || !@locked_ruby_version
285
+ Bundler::RubyVersion.system
291
286
  else
292
- if ruby_version && !@locked_ruby_version
293
- return Bundler::RubyVersion.system
294
- elsif ruby_version && @locked_ruby_version
295
- return @locked_ruby_version
296
- elsif !ruby_version && @locked_ruby_version
297
- return @locked_ruby_version
298
- end
287
+ @locked_ruby_version
299
288
  end
300
289
  end
301
290
 
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class EnvironmentPreserver
4
+ # @param env [ENV]
5
+ # @param keys [Array<String>]
6
+ def initialize(env, keys)
7
+ @original = env.to_hash
8
+ @keys = keys
9
+ @prefix = "BUNDLE_ORIG_"
10
+ end
11
+
12
+ # @return [Hash]
13
+ def backup
14
+ env = restore.clone
15
+ @keys.each do |key|
16
+ value = env[key]
17
+ env[@prefix + key] = value unless value.nil? || value.empty?
18
+ end
19
+ env
20
+ end
21
+
22
+ # @return [Hash]
23
+ def restore
24
+ env = @original.clone
25
+ @keys.each do |key|
26
+ value_original = env[@prefix + key]
27
+ unless value_original.nil? || value_original.empty?
28
+ env[key] = value_original
29
+ env.delete(@prefix + key)
30
+ end
31
+ end
32
+ env
33
+ end
34
+ end
35
+ end
@@ -98,4 +98,13 @@ module Bundler
98
98
 
99
99
  status_code(26)
100
100
  end
101
+
102
+ class VirtualProtocolError < BundlerError
103
+ def message
104
+ "There was an error relating to virtualization and file access." \
105
+ "It is likely that you need to grant access to or mount some file system correctly."
106
+ end
107
+
108
+ status_code(27)
109
+ end
101
110
  end
@@ -236,7 +236,7 @@ module Bundler
236
236
 
237
237
  con = Net::HTTP::Persistent.new "bundler", :ENV
238
238
  if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
239
- con.proxy = URI.parse(gem_proxy)
239
+ con.proxy = URI.parse(gem_proxy) if gem_proxy != :no_proxy
240
240
  end
241
241
 
242
242
  if remote_uri.scheme == "https"
@@ -341,10 +341,11 @@ module Bundler
341
341
  "try passing them all to `bundle update`"
342
342
  elsif requirement.source
343
343
  name = requirement.name
344
- versions = @source_requirements[name][name].map(&:version)
345
- message = String.new("Could not find gem '#{requirement}' in #{requirement.source}.\n")
346
- message << if versions.any?
347
- "Source contains '#{name}' at: #{versions.join(", ")}"
344
+ specs = @source_requirements[name][name]
345
+ versions_with_platforms = specs.map {|s| [s.version, s.platform] }
346
+ message = String.new("Could not find gem '#{requirement}' in #{requirement.source}.\n")
347
+ message << if versions_with_platforms.any?
348
+ "Source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}"
348
349
  else
349
350
  "Source does not contain any versions of '#{requirement}'"
350
351
  end
@@ -355,5 +356,15 @@ module Bundler
355
356
  raise GemNotFound, message
356
357
  end
357
358
  end
359
+
360
+ def formatted_versions_with_platforms(versions_with_platforms)
361
+ version_platform_strs = versions_with_platforms.map do |vwp|
362
+ version = vwp.first
363
+ platform = vwp.last
364
+ version_platform_str = String.new(version.to_s)
365
+ version_platform_str << " #{platform}" unless platform.nil?
366
+ end
367
+ version_platform_strs.join(", ")
368
+ end
358
369
  end
359
370
  end
@@ -53,7 +53,7 @@ module Gem
53
53
  if method_defined?(:extension_dir)
54
54
  alias_method :rg_extension_dir, :extension_dir
55
55
  def extension_dir
56
- @extension_dir ||= if source.respond_to?(:extension_dir_name)
56
+ @bundler_extension_dir ||= if source.respond_to?(:extension_dir_name)
57
57
  File.expand_path(File.join(extensions_dir, source.extension_dir_name))
58
58
  else
59
59
  rg_extension_dir
@@ -35,6 +35,10 @@ module Bundler
35
35
  Gem::Command.build_args = args
36
36
  end
37
37
 
38
+ def load_path_insert_index
39
+ Gem.load_path_insert_index
40
+ end
41
+
38
42
  def loaded_specs(name)
39
43
  Gem.loaded_specs[name]
40
44
  end
@@ -50,10 +54,23 @@ module Bundler
50
54
 
51
55
  def validate(spec)
52
56
  Bundler.ui.silence { spec.validate(false) }
57
+ rescue Gem::InvalidSpecificationException => e
58
+ error_message = "The gemspec at #{spec.loaded_from} is not valid. Please fix this gemspec.\n" \
59
+ "The validation error was '#{e.message}'\n"
60
+ raise Gem::InvalidSpecificationException.new(error_message)
53
61
  rescue Errno::ENOENT
54
62
  nil
55
63
  end
56
64
 
65
+ def set_installed_by_version(spec, installed_by_version = Gem::VERSION)
66
+ return unless spec.respond_to?(:installed_by_version=)
67
+ spec.installed_by_version = Gem::Version.create(installed_by_version)
68
+ end
69
+
70
+ def spec_missing_extensions?(spec)
71
+ !spec.respond_to?(:missing_extensions?) || spec.missing_extensions?
72
+ end
73
+
57
74
  def path(obj)
58
75
  obj.to_s
59
76
  end
@@ -499,9 +516,7 @@ module Bundler
499
516
  # Missing summary is downgraded to a warning in later versions,
500
517
  # so we set it to an empty string to prevent an exception here.
501
518
  spec.summary ||= ""
502
- Bundler.ui.silence { spec.validate(false) }
503
- rescue Errno::ENOENT
504
- nil
519
+ RubygemsIntegration.instance_method(:validate).bind(self).call(spec)
505
520
  end
506
521
  end
507
522
 
@@ -37,7 +37,17 @@ module Bundler
37
37
 
38
38
  Bundler.rubygems.mark_loaded(spec)
39
39
  load_paths = spec.load_paths.reject {|path| $LOAD_PATH.include?(path) }
40
- $LOAD_PATH.unshift(*load_paths)
40
+
41
+ # See Gem::Specification#add_self_to_load_path (since RubyGems 1.8)
42
+ insert_index = Bundler.rubygems.load_path_insert_index
43
+
44
+ if insert_index
45
+ # Gem directories must come after -I and ENV['RUBYLIB']
46
+ $LOAD_PATH.insert(insert_index, *load_paths)
47
+ else
48
+ # We are probably testing in core, -I and RUBYLIB don't apply
49
+ $LOAD_PATH.unshift(*load_paths)
50
+ end
41
51
  end
42
52
 
43
53
  setup_manpath
@@ -3,7 +3,7 @@ require "uri"
3
3
 
4
4
  module Bundler
5
5
  class Settings
6
- BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check disable_shared_gems ignore_messages gem.mit gem.coc silence_root_warning).freeze
6
+ BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check disable_shared_gems ignore_messages gem.mit gem.coc silence_root_warning no_install).freeze
7
7
  NUMBER_KEYS = %w(retry timeout redirect ssl_verify_mode).freeze
8
8
  DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 }.freeze
9
9
 
@@ -107,6 +107,8 @@ module Bundler
107
107
  raise PermissionError.new(path, action)
108
108
  rescue Errno::EAGAIN
109
109
  raise TemporaryResourceError.new(path, action)
110
+ rescue Errno::EPROTO
111
+ raise VirtualProtocolError.new
110
112
  end
111
113
 
112
114
  def const_get_safely(constant_name, namespace)
@@ -222,6 +222,10 @@ module Bundler
222
222
 
223
223
  private
224
224
 
225
+ def build_extensions(installer)
226
+ super if Bundler.rubygems.spec_missing_extensions?(installer.spec)
227
+ end
228
+
225
229
  def serialize_gemspecs_in(destination)
226
230
  expanded_path = destination.expand_path(Bundler.root)
227
231
  Dir["#{expanded_path}/#{@glob}"].each do |spec_path|
@@ -135,9 +135,12 @@ module Bundler
135
135
  if File.directory?(expanded_path)
136
136
  # We sort depth-first since `<<` will override the earlier-found specs
137
137
  Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file|
138
- next unless spec = Bundler.load_gemspec(file, :validate)
139
- spec.loaded_from = file.to_s
138
+ next unless spec = Bundler.load_gemspec(file)
140
139
  spec.source = self
140
+ Bundler.rubygems.set_installed_by_version(spec)
141
+ # Validation causes extension_dir to be calculated, which depends
142
+ # on #source, so we validate here instead of load_gemspec
143
+ Bundler.rubygems.validate(spec)
141
144
  index << spec
142
145
  end
143
146
 
@@ -194,8 +197,7 @@ module Bundler
194
197
  SharedHelpers.chdir(gem_dir) do
195
198
  installer = Path::Installer.new(spec, :env_shebang => false)
196
199
  run_hooks(:pre_install, installer)
197
- installer.build_extensions unless disable_extensions
198
- run_hooks(:post_build, installer)
200
+ build_extensions(installer) unless disable_extensions
199
201
  installer.generate_bin
200
202
  run_hooks(:post_install, installer)
201
203
  end
@@ -213,6 +215,11 @@ module Bundler
213
215
  Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}"
214
216
  end
215
217
 
218
+ def build_extensions(installer)
219
+ installer.build_extensions
220
+ run_hooks(:post_build, installer)
221
+ end
222
+
216
223
  def run_hooks(type, installer)
217
224
  hooks_meth = "#{type}_hooks"
218
225
  return unless Gem.respond_to?(hooks_meth)
@@ -39,6 +39,10 @@ module Bundler
39
39
  end
40
40
 
41
41
  uri
42
+ rescue URI::InvalidComponentError
43
+ error_message = "Please CGI escape your usernames and passwords before " \
44
+ "setting them for authentication."
45
+ raise HTTPError.new(error_message)
42
46
  end
43
47
 
44
48
  def remove_auth(uri)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'bundler/vendor/molinillo/lib/molinillo/gem_metadata'
2
3
  require 'bundler/vendor/molinillo/lib/molinillo/errors'
3
4
  require 'bundler/vendor/molinillo/lib/molinillo/resolver'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'set'
2
3
  require 'tsort'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Bundler::Molinillo
2
3
  # An error that occurred during the resolution process
3
4
  class ResolverError < StandardError; end
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
1
2
  module Bundler::Molinillo
2
3
  # The version of Bundler::Molinillo.
3
- VERSION = '0.4.2'.freeze
4
+ VERSION = '0.4.3'.freeze
4
5
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Bundler::Molinillo
2
3
  # Provides information about specifcations and dependencies to the resolver,
3
4
  # allowing the {Resolver} class to remain generic while still providing power
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Bundler::Molinillo
2
3
  # Conveys information about the resolution process to a user.
3
4
  module UI
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Bundler::Molinillo
2
3
  class Resolver
3
4
  # A specific resolution from a given {Resolver}
@@ -362,6 +363,7 @@ module Bundler::Molinillo
362
363
  if !dep_names.include?(succ.name) && !succ.root? && succ.predecessors.to_a == [vertex]
363
364
  debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" }
364
365
  activated.detach_vertex_named(succ.name)
366
+ requirements.delete_if { |r| name_for(r) == succ.name }
365
367
  end
366
368
  end
367
369
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph'
2
3
 
3
4
  module Bundler::Molinillo
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Bundler::Molinillo
2
3
  # A state that a {Resolution} can be in
3
4
  # @attr [String] name the name of the current requirement
@@ -7,5 +7,5 @@ module Bundler
7
7
  # We're doing this because we might write tests that deal
8
8
  # with other versions of bundler and we are unsure how to
9
9
  # handle this better.
10
- VERSION = "1.12.0.pre.1" unless defined?(::Bundler::VERSION)
10
+ VERSION = "1.12.0.pre.2" unless defined?(::Bundler::VERSION)
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0.pre.1
4
+ version: 1.12.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2016-02-09 00:00:00.000000000 Z
14
+ date: 2016-02-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: automatiek
@@ -124,6 +124,7 @@ files:
124
124
  - bin/rake
125
125
  - bin/rspec
126
126
  - bin/rubocop
127
+ - bin/with_rubygems
127
128
  - bundler.gemspec
128
129
  - exe/bundle
129
130
  - exe/bundle_ruby
@@ -162,6 +163,7 @@ files:
162
163
  - lib/bundler/endpoint_specification.rb
163
164
  - lib/bundler/env.rb
164
165
  - lib/bundler/environment.rb
166
+ - lib/bundler/environment_preserver.rb
165
167
  - lib/bundler/errors.rb
166
168
  - lib/bundler/fetcher.rb
167
169
  - lib/bundler/fetcher/base.rb
@@ -206,7 +208,6 @@ files:
206
208
  - lib/bundler/man/gemfile.5.txt
207
209
  - lib/bundler/match_platform.rb
208
210
  - lib/bundler/mirror.rb
209
- - lib/bundler/path_preserver.rb
210
211
  - lib/bundler/psyched_yaml.rb
211
212
  - lib/bundler/remote_specification.rb
212
213
  - lib/bundler/resolver.rb
@@ -352,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
353
  version: 1.3.6
353
354
  requirements: []
354
355
  rubyforge_project:
355
- rubygems_version: 2.5.2
356
+ rubygems_version: 2.6.0
356
357
  signing_key:
357
358
  specification_version: 4
358
359
  summary: The best way to manage your application's dependencies
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
- module Bundler
3
- module PathPreserver
4
- def self.preserve_path_in_environment(env_var, env)
5
- original_env_var = "_ORIGINAL_#{env_var}"
6
- original_path = env[original_env_var]
7
- path = env[env_var]
8
- env[original_env_var] = path if original_path.nil? || original_path.empty?
9
- env[env_var] = original_path if path.nil? || path.empty?
10
- end
11
- end
12
- end