bundler 2.2.26 → 2.2.30

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -1
  3. data/README.md +1 -1
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli/check.rb +1 -1
  6. data/lib/bundler/cli/gem.rb +19 -2
  7. data/lib/bundler/cli/info.rb +11 -4
  8. data/lib/bundler/cli/issue.rb +4 -3
  9. data/lib/bundler/cli/remove.rb +1 -2
  10. data/lib/bundler/cli.rb +1 -0
  11. data/lib/bundler/compact_index_client.rb +2 -2
  12. data/lib/bundler/definition.rb +16 -6
  13. data/lib/bundler/digest.rb +71 -0
  14. data/lib/bundler/errors.rb +18 -2
  15. data/lib/bundler/fetcher.rb +2 -1
  16. data/lib/bundler/friendly_errors.rb +5 -30
  17. data/lib/bundler/gem_helper.rb +6 -17
  18. data/lib/bundler/installer.rb +0 -1
  19. data/lib/bundler/plugin/installer.rb +2 -0
  20. data/lib/bundler/plugin.rb +23 -6
  21. data/lib/bundler/rubygems_ext.rb +4 -0
  22. data/lib/bundler/rubygems_gem_installer.rb +20 -4
  23. data/lib/bundler/rubygems_integration.rb +28 -9
  24. data/lib/bundler/runtime.rb +1 -1
  25. data/lib/bundler/settings.rb +9 -1
  26. data/lib/bundler/source/git.rb +22 -4
  27. data/lib/bundler/source/rubygems.rb +43 -72
  28. data/lib/bundler/source.rb +2 -0
  29. data/lib/bundler/source_list.rb +4 -0
  30. data/lib/bundler/spec_set.rb +1 -1
  31. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -1
  32. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  33. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  34. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  35. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  36. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  37. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  38. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  39. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  40. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  41. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  42. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  43. data/lib/bundler/version.rb +1 -1
  44. data/lib/bundler/worker.rb +2 -2
  45. data/lib/bundler.rb +13 -18
  46. metadata +14 -7
  47. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f6b49cdd4d65c0b945ba09e5a1f49de540a778e19e0157ed2a376a6daf9511c
4
- data.tar.gz: 52ade727aa83b8390bb5eeaceda718c1d194d00251ea535013c9da8e58b79094
3
+ metadata.gz: e20b3afe2b252225aaf6d7e99c4aeb2e476e4e6e928e42be1b6b03b3cba5f68a
4
+ data.tar.gz: e398755ca8b609ea5b6cadbc205e48fad15ddf369932964fa293c1532f42b8b1
5
5
  SHA512:
6
- metadata.gz: 2e9f6084d7c8059af49ed11ccc1b0748babe41d40d6a363b7dad9091762c979091ad5388cc913545eb2853867ebe9ee7088c3ffb331e667eb57d04345799ab87
7
- data.tar.gz: dab0d503f64a592ec7dcc8e91ff509f149cc65e20b83db73857ea3e750f10bec57301042db96639f3d77707db78fea0a1f29338a4a3c5721dad3b8db906fd71b
6
+ metadata.gz: 8fdddc111238b3365bfb45466d8c4239b3f5b7a005cb477d675d00be9585e7ae2e7feb8669e979a5695dea8be31f6c87670e7fe72fd7d18b6da4e27775cd650f
7
+ data.tar.gz: 51dec18f2ade00c902d9e45fcbee5dd7010d96d06edd6daf9856279fd9267651020bdc49f8d95bae853627e060f64444f25675fd633e975158dee3c724c6d908
data/CHANGELOG.md CHANGED
@@ -1,3 +1,52 @@
1
+ # 2.2.30 (October 26, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Add a custom SHA1 digest implementation to no longer depend on the digest gem before we know which version to activate [#4989](https://github.com/rubygems/rubygems/pull/4989)
6
+ - Ensure vendored gems have licenses [#4998](https://github.com/rubygems/rubygems/pull/4998)
7
+ - Update broken link in Bundler::Fetcher::CertificateFailureError [#4987](https://github.com/rubygems/rubygems/pull/4987)
8
+ - Give better errors for some permission issues [#4965](https://github.com/rubygems/rubygems/pull/4965)
9
+ - Print better errors when `bundler/gem_tasks` fail [#4872](https://github.com/rubygems/rubygems/pull/4872)
10
+ - Fix `bundle install` to reinstall deleted gems [#4974](https://github.com/rubygems/rubygems/pull/4974)
11
+ - Unify issue template and ISSUES.md document [#4980](https://github.com/rubygems/rubygems/pull/4980)
12
+ - Bump vendored connection_pool to 2.2.5 [#4738](https://github.com/rubygems/rubygems/pull/4738)
13
+
14
+ ## Bug fixes:
15
+
16
+ - Fix error message pointing to non existing file when using a global gem cache [#4999](https://github.com/rubygems/rubygems/pull/4999)
17
+ - Fix install crash when lockfile has missing dependencies for the current platform [#4941](https://github.com/rubygems/rubygems/pull/4941)
18
+ - Make `bundle info` show a proper warning every time it finds a deleted gem [#4971](https://github.com/rubygems/rubygems/pull/4971)
19
+
20
+ # 2.2.29 (October 8, 2021)
21
+
22
+ ## Enhancements:
23
+
24
+ - Require at least Ruby 2.6.0 for gems created with recent rubies [#4920](https://github.com/rubygems/rubygems/pull/4920)
25
+ - Include glob information in string representation of git sources to make generated lockfiles deterministic [#4947](https://github.com/rubygems/rubygems/pull/4947)
26
+ - Add missing `rubygem_push` prerequisite [#4930](https://github.com/rubygems/rubygems/pull/4930)
27
+
28
+ # 2.2.28 (September 23, 2021)
29
+
30
+ ## Enhancements:
31
+
32
+ - Use example.com in new gem template, since it will never have a potentially dangerous backing website [#4918](https://github.com/rubygems/rubygems/pull/4918)
33
+ - Deprecate `--install` flag to `bundle remove` and trigger install by default [#4891](https://github.com/rubygems/rubygems/pull/4891)
34
+
35
+ # 2.2.27 (September 3, 2021)
36
+
37
+ ## Enhancements:
38
+
39
+ - Optimize some requires [#4887](https://github.com/rubygems/rubygems/pull/4887)
40
+ - Correctly redact credentials when using x-oauth-basic [#4866](https://github.com/rubygems/rubygems/pull/4866)
41
+
42
+ ## Bug fixes:
43
+
44
+ - Add missing key `branches:` to template for GitHub Actions [#4883](https://github.com/rubygems/rubygems/pull/4883)
45
+ - Fix `bundle plugin install` detection of already installed plugins [#4869](https://github.com/rubygems/rubygems/pull/4869)
46
+ - Make plugin installation idempotent [#4864](https://github.com/rubygems/rubygems/pull/4864)
47
+ - Fix `bundle check` showing duplicated gems when multiple platforms are locked [#4854](https://github.com/rubygems/rubygems/pull/4854)
48
+ - Fix `bundle check` incorrectly considering cached gems [#4853](https://github.com/rubygems/rubygems/pull/4853)
49
+
1
50
  # 2.2.26 (August 17, 2021)
2
51
 
3
52
  ## Enhancements:
@@ -77,7 +126,7 @@
77
126
  - Fix `bundle doctor` crashing when finding a broken symlink [#4707](https://github.com/rubygems/rubygems/pull/4707)
78
127
  - Fix incorrect re-resolve edge case [#4700](https://github.com/rubygems/rubygems/pull/4700)
79
128
  - Fix some gems being unintentionally locked under multiple lockfile sections [#4701](https://github.com/rubygems/rubygems/pull/4701)
80
- - Fix `--conservative` flag unexpectedly updating indirect dependencies [#4692](https://github.com/rubygems/rubygems/pull/4692)
129
+ - Fix `--conservative` flag unexpectedly updating indirect dependencies. NOTE: As part of this bug fix, some undocumented, unintentional code causing `bundle update --source <gem>` to update conservatively was fixed. Use the documented `bundle update --conservative <gem>` instead [#4692](https://github.com/rubygems/rubygems/pull/4692)
81
130
 
82
131
  # 2.2.21 (June 23, 2021)
83
132
 
data/README.md CHANGED
@@ -32,7 +32,7 @@ See [bundler.io](https://bundler.io) for the full documentation.
32
32
 
33
33
  For help with common problems, see [TROUBLESHOOTING](doc/TROUBLESHOOTING.md).
34
34
 
35
- Still stuck? Try [filing an issue](doc/contributing/ISSUES.md).
35
+ Still stuck? Try [filing an issue](https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md).
36
36
 
37
37
  ### Other questions
38
38
 
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2021-08-17".freeze
8
- @git_commit_sha = "21fd333002".freeze
7
+ @built_at = "2021-10-26".freeze
8
+ @git_commit_sha = "e8df9bea62".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -15,7 +15,7 @@ module Bundler
15
15
  definition.validate_runtime!
16
16
 
17
17
  begin
18
- definition.resolve_with_cache!
18
+ definition.resolve_only_locally!
19
19
  not_installed = definition.missing_specs
20
20
  rescue GemNotFound, VersionConflict
21
21
  Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
@@ -68,7 +68,7 @@ module Bundler
68
68
  :bundler_version => bundler_dependency_version,
69
69
  :git => use_git,
70
70
  :github_username => github_username.empty? ? "[USERNAME]" : github_username,
71
- :required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
71
+ :required_ruby_version => required_ruby_version,
72
72
  }
73
73
  ensure_safe_gem_name(name, constant_array)
74
74
 
@@ -169,7 +169,7 @@ module Bundler
169
169
  "For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
170
170
  "and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
171
171
  config[:rubocop] = true
172
- config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
172
+ config[:rubocop_version] = rubocop_version
173
173
  Bundler.ui.info "RuboCop enabled in config"
174
174
  templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
175
175
  end
@@ -350,5 +350,22 @@ module Bundler
350
350
  def open_editor(editor, file)
351
351
  thor.run(%(#{editor} "#{file}"))
352
352
  end
353
+
354
+ def required_ruby_version
355
+ if Gem.ruby_version < Gem::Version.new("2.4.a") then "2.3.0"
356
+ elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "2.4.0"
357
+ elsif Gem.ruby_version < Gem::Version.new("2.6.a") then "2.5.0"
358
+ else
359
+ "2.6.0"
360
+ end
361
+ end
362
+
363
+ def rubocop_version
364
+ if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.81.0"
365
+ elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.12"
366
+ else
367
+ "1.21"
368
+ end
369
+ end
353
370
  end
354
371
  end
@@ -40,12 +40,13 @@ module Bundler
40
40
  end
41
41
 
42
42
  def print_gem_path(spec)
43
- if spec.name == "bundler"
43
+ name = spec.name
44
+ if name == "bundler"
44
45
  path = File.expand_path("../../../..", __FILE__)
45
46
  else
46
47
  path = spec.full_gem_path
47
- unless File.directory?(path)
48
- return Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at: #{path}"
48
+ if spec.deleted_gem?
49
+ return Bundler.ui.warn "The gem #{name} has been deleted. It was installed at: #{path}"
49
50
  end
50
51
  end
51
52
 
@@ -54,8 +55,9 @@ module Bundler
54
55
 
55
56
  def print_gem_info(spec)
56
57
  metadata = spec.metadata
58
+ name = spec.name
57
59
  gem_info = String.new
58
- gem_info << " * #{spec.name} (#{spec.version}#{spec.git_version})\n"
60
+ gem_info << " * #{name} (#{spec.version}#{spec.git_version})\n"
59
61
  gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
60
62
  gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
61
63
  gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri")
@@ -67,6 +69,11 @@ module Bundler
67
69
  gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
68
70
  gem_info << "\tPath: #{spec.full_gem_path}\n"
69
71
  gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
72
+
73
+ if spec.deleted_gem?
74
+ return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
75
+ end
76
+
70
77
  Bundler.ui.info gem_info
71
78
  end
72
79
  end
@@ -20,9 +20,10 @@ module Bundler
20
20
 
21
21
  Hopefully the troubleshooting steps above resolved your problem! If things
22
22
  still aren't working the way you expect them to, please let us know so
23
- that we can diagnose and help fix the problem you're having. Please
24
- view the Filing Issues guide for more information:
25
- https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md
23
+ that we can diagnose and help fix the problem you're having, by filling
24
+ in the new issue form located at
25
+ https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md,
26
+ and copy and pasting the information below.
26
27
 
27
28
  EOS
28
29
 
@@ -11,8 +11,7 @@ module Bundler
11
11
  raise InvalidOption, "Please specify gems to remove." if @gems.empty?
12
12
 
13
13
  Injector.remove(@gems, {})
14
-
15
- Installer.install(Bundler.root, Bundler.definition) if @options["install"]
14
+ Installer.install(Bundler.root, Bundler.definition)
16
15
  end
17
16
  end
18
17
  end
data/lib/bundler/cli.rb CHANGED
@@ -184,6 +184,7 @@ module Bundler
184
184
  method_option "install", :type => :boolean, :banner =>
185
185
  "Runs 'bundle install' after removing the gems from the Gemfile"
186
186
  def remove(*gems)
187
+ SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
187
188
  require_relative "cli/remove"
188
189
  Remove.new(gems, options).run
189
190
  end
@@ -5,7 +5,7 @@ require "set"
5
5
 
6
6
  module Bundler
7
7
  class CompactIndexClient
8
- DEBUG_MUTEX = Mutex.new
8
+ DEBUG_MUTEX = Thread::Mutex.new
9
9
  def self.debug
10
10
  return unless ENV["DEBUG_COMPACT_INDEX"]
11
11
  DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
@@ -25,7 +25,7 @@ module Bundler
25
25
  @endpoints = Set.new
26
26
  @info_checksums_by_name = {}
27
27
  @parsed_checksums = false
28
- @mutex = Mutex.new
28
+ @mutex = Thread::Mutex.new
29
29
  end
30
30
 
31
31
  def execution_mode=(block)
@@ -73,7 +73,6 @@ module Bundler
73
73
  @lockfile_contents = String.new
74
74
  @locked_bundler_version = nil
75
75
  @locked_ruby_version = nil
76
- @locked_specs_incomplete_for_platform = false
77
76
  @new_platform = nil
78
77
 
79
78
  if lockfile && File.exist?(lockfile)
@@ -139,6 +138,8 @@ module Bundler
139
138
  @dependency_changes = converge_dependencies
140
139
  @local_changes = converge_locals
141
140
 
141
+ @locked_specs_incomplete_for_platform = !@locked_specs.for(expand_dependencies(requested_dependencies & locked_dependencies), true, true)
142
+
142
143
  @requires = compute_requires
143
144
  end
144
145
 
@@ -161,6 +162,12 @@ module Bundler
161
162
  @multisource_allowed
162
163
  end
163
164
 
165
+ def resolve_only_locally!
166
+ @remote = false
167
+ sources.local_only!
168
+ resolve
169
+ end
170
+
164
171
  def resolve_with_cache!
165
172
  sources.cached!
166
173
  resolve
@@ -222,6 +229,10 @@ module Bundler
222
229
  end
223
230
  end
224
231
 
232
+ def locked_dependencies
233
+ @locked_deps.values
234
+ end
235
+
225
236
  def specs_for(groups)
226
237
  groups = requested_groups if groups.empty?
227
238
  deps = dependencies_for(groups)
@@ -361,8 +372,8 @@ module Bundler
361
372
  new_sources = gemfile_sources - @locked_sources
362
373
  deleted_sources = @locked_sources - gemfile_sources
363
374
 
364
- new_deps = @dependencies - @locked_deps.values
365
- deleted_deps = @locked_deps.values - @dependencies
375
+ new_deps = @dependencies - locked_dependencies
376
+ deleted_deps = locked_dependencies - @dependencies
366
377
 
367
378
  # Check if it is possible that the source is only changed thing
368
379
  if (new_deps.empty? && deleted_deps.empty?) && (!new_sources.empty? && !deleted_sources.empty?)
@@ -554,7 +565,7 @@ module Bundler
554
565
 
555
566
  def dependencies_for_source_changed?(source, locked_source = source)
556
567
  deps_for_source = @dependencies.select {|s| s.source == source }
557
- locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
568
+ locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
558
569
 
559
570
  deps_for_source.uniq.sort != locked_deps_for_source.sort
560
571
  end
@@ -638,7 +649,7 @@ module Bundler
638
649
 
639
650
  def converge_dependencies
640
651
  frozen = Bundler.frozen_bundle?
641
- (@dependencies + @locked_deps.values).each do |dep|
652
+ (@dependencies + locked_dependencies).each do |dep|
642
653
  locked_source = @locked_deps[dep.name]
643
654
  # This is to make sure that if bundler is installing in deployment mode and
644
655
  # after locked_source and sources don't match, we still use locked_source.
@@ -745,7 +756,6 @@ module Bundler
745
756
  end
746
757
 
747
758
  resolve = SpecSet.new(converged)
748
- @locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), true, true)
749
759
  resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
750
760
  diff = nil
751
761
 
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This code was extracted from https://github.com/Solistra/ruby-digest which is under public domain
4
+ module Bundler
5
+ module Digest
6
+ # The initial constant values for the 32-bit constant words A, B, C, D, and
7
+ # E, respectively.
8
+ SHA1_WORDS = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0].freeze
9
+
10
+ # The 8-bit field used for bitwise `AND` masking. Defaults to `0xFFFFFFFF`.
11
+ SHA1_MASK = 0xFFFFFFFF
12
+
13
+ class << self
14
+ def sha1(string)
15
+ unless string.is_a?(String)
16
+ raise TypeError, "can't convert #{string.class.inspect} into String"
17
+ end
18
+
19
+ buffer = string.b
20
+
21
+ words = SHA1_WORDS.dup
22
+ generate_split_buffer(buffer) do |chunk|
23
+ w = []
24
+ chunk.each_slice(4) do |a, b, c, d|
25
+ w << (((a << 8 | b) << 8 | c) << 8 | d)
26
+ end
27
+ a, b, c, d, e = *words
28
+ (16..79).each do |i|
29
+ w[i] = SHA1_MASK & rotate((w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]), 1)
30
+ end
31
+ 0.upto(79) do |i|
32
+ case i
33
+ when 0..19
34
+ f = ((b & c) | (~b & d))
35
+ k = 0x5A827999
36
+ when 20..39
37
+ f = (b ^ c ^ d)
38
+ k = 0x6ED9EBA1
39
+ when 40..59
40
+ f = ((b & c) | (b & d) | (c & d))
41
+ k = 0x8F1BBCDC
42
+ when 60..79
43
+ f = (b ^ c ^ d)
44
+ k = 0xCA62C1D6
45
+ end
46
+ t = SHA1_MASK & (SHA1_MASK & rotate(a, 5) + f + e + k + w[i])
47
+ a, b, c, d, e = t, a, SHA1_MASK & rotate(b, 30), c, d # rubocop:disable Style/ParallelAssignment
48
+ end
49
+ mutated = [a, b, c, d, e]
50
+ words.map!.with_index {|word, index| SHA1_MASK & (word + mutated[index]) }
51
+ end
52
+
53
+ words.pack("N*").unpack("H*").first
54
+ end
55
+
56
+ private
57
+
58
+ def generate_split_buffer(string, &block)
59
+ size = string.bytesize * 8
60
+ buffer = string.bytes << 128
61
+ buffer << 0 while buffer.size % 64 != 56
62
+ buffer.concat([size].pack("Q>").bytes)
63
+ buffer.each_slice(64, &block)
64
+ end
65
+
66
+ def rotate(value, spaces)
67
+ value << spaces | value >> (32 - spaces)
68
+ end
69
+ end
70
+ end
71
+ end
@@ -75,10 +75,26 @@ module Bundler
75
75
  end
76
76
  end
77
77
 
78
+ def permission_type
79
+ case @permission_type
80
+ when :create
81
+ "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
82
+ when :delete
83
+ permissions = "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
84
+ permissions += ", and the same thing for all subdirectories inside #{@path}" if File.directory?(@path)
85
+ permissions
86
+ else
87
+ "#{@permission_type} permissions for that path"
88
+ end
89
+ end
90
+
91
+ def parent_folder
92
+ File.dirname(@path)
93
+ end
94
+
78
95
  def message
79
96
  "There was an error while trying to #{action} `#{@path}`. " \
80
- "It is likely that you need to grant #{@permission_type} permissions " \
81
- "for that path."
97
+ "It is likely that you need to grant #{permission_type}."
82
98
  end
83
99
 
84
100
  status_code(23)
@@ -28,7 +28,8 @@ module Bundler
28
28
  " is a chance you are experiencing a man-in-the-middle attack, but" \
29
29
  " most likely your system doesn't have the CA certificates needed" \
30
30
  " for verification. For information about OpenSSL certificates, see" \
31
- " http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile" \
31
+ " https://railsapps.github.io/openssl-certificate-verify-failed.html." \
32
+ " To connect without using SSL, edit your Gemfile" \
32
33
  " sources and change 'https' to 'http'."
33
34
  end
34
35
  end
@@ -63,34 +63,6 @@ module Bundler
63
63
  def request_issue_report_for(e)
64
64
  Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, nil
65
65
  --- ERROR REPORT TEMPLATE -------------------------------------------------------
66
- # Error Report
67
-
68
- ## Questions
69
-
70
- Please fill out answers to these questions, it'll help us figure out
71
- why things are going wrong.
72
-
73
- - **What did you do?**
74
-
75
- I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
76
-
77
- - **What did you expect to happen?**
78
-
79
- I expected Bundler to...
80
-
81
- - **What happened instead?**
82
-
83
- Instead, what happened was...
84
-
85
- - **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**
86
-
87
- I tried...
88
-
89
- - **Have you read our issues document, https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md?**
90
-
91
- ...
92
-
93
- ## Backtrace
94
66
 
95
67
  ```
96
68
  #{e.class}: #{e.message}
@@ -109,8 +81,7 @@ module Bundler
109
81
  First, try this link to see if there are any existing issue reports for this error:
110
82
  #{issues_url(e)}
111
83
 
112
- If there aren't any reports for this error yet, please copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
113
- https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md
84
+ If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}, and copy and paste the report template above in there.
114
85
  EOS
115
86
  end
116
87
 
@@ -121,6 +92,10 @@ module Bundler
121
92
  "https://github.com/rubygems/rubygems/search?q=" \
122
93
  "#{CGI.escape(message)}&type=Issues"
123
94
  end
95
+
96
+ def new_issue_url
97
+ "https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md"
98
+ end
124
99
  end
125
100
 
126
101
  def self.with_friendly_errors
@@ -76,7 +76,7 @@ module Bundler
76
76
  tag_version { git_push(args[:remote]) } unless already_tagged?
77
77
  end
78
78
 
79
- task "release:rubygem_push" do
79
+ task "release:rubygem_push" => "build" do
80
80
  rubygem_push(built_gem_path) if gem_push?
81
81
  end
82
82
 
@@ -98,10 +98,7 @@ module Bundler
98
98
  built_gem_path ||= build_gem
99
99
  cmd = [*gem_command, "install", built_gem_path.to_s]
100
100
  cmd << "--local" if local
101
- _, status = sh_with_status(cmd)
102
- unless status.success?
103
- raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
104
- end
101
+ sh(cmd)
105
102
  Bundler.ui.confirm "#{name} (#{version}) installed."
106
103
  end
107
104
 
@@ -110,7 +107,7 @@ module Bundler
110
107
  SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
111
108
  file_name = "#{File.basename(built_gem_path)}.sha512"
112
109
  require "digest/sha2"
113
- checksum = Digest::SHA512.new.hexdigest(built_gem_path.to_s)
110
+ checksum = ::Digest::SHA512.new.hexdigest(built_gem_path.to_s)
114
111
  target = File.join(base, "checksums", file_name)
115
112
  File.write(target, checksum)
116
113
  Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
@@ -132,8 +129,8 @@ module Bundler
132
129
 
133
130
  def git_push(remote = nil)
134
131
  remote ||= default_remote
135
- perform_git_push "#{remote} refs/heads/#{current_branch}"
136
- perform_git_push "#{remote} refs/tags/#{version_tag}"
132
+ sh(%W[git push #{remote} refs/heads/#{current_branch}])
133
+ sh(%W[git push #{remote} refs/tags/#{version_tag}])
137
134
  Bundler.ui.confirm "Pushed git commits and release tag."
138
135
  end
139
136
 
@@ -161,13 +158,6 @@ module Bundler
161
158
  allowed_push_host || env_rubygems_host || "rubygems.org"
162
159
  end
163
160
 
164
- def perform_git_push(options = "")
165
- cmd = "git push #{options}"
166
- out, status = sh_with_status(cmd.shellsplit)
167
- return if status.success?
168
- raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
169
- end
170
-
171
161
  def already_tagged?
172
162
  return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
173
163
  Bundler.ui.confirm "Tag #{version_tag} has already been created."
@@ -218,8 +208,7 @@ module Bundler
218
208
  def sh(cmd, &block)
219
209
  out, status = sh_with_status(cmd, &block)
220
210
  unless status.success?
221
- cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
222
- raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
211
+ raise("Running `#{cmd.shelljoin}` failed with the following output:\n\n#{out}\n")
223
212
  end
224
213
  out
225
214
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rubygems/dependency_installer"
4
3
  require_relative "worker"
5
4
  require_relative "installer/parallel_installer"
6
5
  require_relative "installer/standalone"
@@ -81,6 +81,8 @@ module Bundler
81
81
 
82
82
  deps = names.map {|name| Dependency.new name, version }
83
83
 
84
+ Bundler.configure_gem_home_and_path(Plugin.root)
85
+
84
86
  definition = Definition.new(nil, deps, source_list, true)
85
87
  install_definition(definition)
86
88
  end
@@ -13,6 +13,7 @@ module Bundler
13
13
  class MalformattedPlugin < PluginError; end
14
14
  class UndefinedCommandError < PluginError; end
15
15
  class UnknownSourceError < PluginError; end
16
+ class PluginInstallError < PluginError; end
16
17
 
17
18
  PLUGIN_FILE_NAME = "plugins.rb".freeze
18
19
 
@@ -38,12 +39,11 @@ module Bundler
38
39
  specs = Installer.new.install(names, options)
39
40
 
40
41
  save_plugins names, specs
41
- rescue PluginError => e
42
+ rescue PluginError
42
43
  specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }
43
44
  specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }
44
45
 
45
- names_list = names.map {|name| "`#{name}`" }.join(", ")
46
- Bundler.ui.error "Failed to install the following plugins: #{names_list}. The underlying error was: #{e.message}.\n #{e.backtrace.join("\n ")}"
46
+ raise
47
47
  end
48
48
 
49
49
  # Uninstalls plugins by the given names
@@ -245,10 +245,11 @@ module Bundler
245
245
  # @param [Array<String>] names of inferred source plugins that can be ignored
246
246
  def save_plugins(plugins, specs, optional_plugins = [])
247
247
  plugins.each do |name|
248
+ next if index.installed?(name)
249
+
248
250
  spec = specs[name]
249
- validate_plugin! Pathname.new(spec.full_gem_path)
250
- installed = register_plugin(name, spec, optional_plugins.include?(name))
251
- Bundler.ui.info "Installed plugin #{name}" if installed
251
+
252
+ save_plugin(name, spec, optional_plugins.include?(name))
252
253
  end
253
254
  end
254
255
 
@@ -263,6 +264,22 @@ module Bundler
263
264
  raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
264
265
  end
265
266
 
267
+ # Validates and registers a plugin.
268
+ #
269
+ # @param [String] name the name of the plugin
270
+ # @param [Specification] spec of installed plugin
271
+ # @param [Boolean] optional_plugin, removed if there is conflict with any
272
+ # other plugin (used for default source plugins)
273
+ #
274
+ # @raise [PluginInstallError] if validation or registration raises any error
275
+ def save_plugin(name, spec, optional_plugin = false)
276
+ validate_plugin! Pathname.new(spec.full_gem_path)
277
+ installed = register_plugin(name, spec, optional_plugin)
278
+ Bundler.ui.info "Installed plugin #{name}" if installed
279
+ rescue PluginError => e
280
+ raise PluginInstallError, "Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})"
281
+ end
282
+
266
283
  # Runs the plugins.rb file in an isolated namespace, records the plugin
267
284
  # actions it registers for and then passes the data to index to be stored.
268
285
  #
@@ -85,6 +85,10 @@ module Gem
85
85
  dependencies - development_dependencies
86
86
  end
87
87
 
88
+ def deleted_gem?
89
+ !default_gem? && !File.directory?(full_gem_path)
90
+ end
91
+
88
92
  private
89
93
 
90
94
  def dependencies_to_gemfile(dependencies, group = nil)