bundler 2.2.26 → 2.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +206 -1
  3. data/README.md +1 -1
  4. data/exe/bundle +7 -8
  5. data/lib/bundler/.document +1 -0
  6. data/lib/bundler/build_metadata.rb +2 -2
  7. data/lib/bundler/cli/check.rb +1 -1
  8. data/lib/bundler/cli/config.rb +10 -1
  9. data/lib/bundler/cli/doctor.rb +12 -3
  10. data/lib/bundler/cli/gem.rb +98 -9
  11. data/lib/bundler/cli/info.rb +26 -5
  12. data/lib/bundler/cli/install.rb +8 -28
  13. data/lib/bundler/cli/issue.rb +4 -3
  14. data/lib/bundler/cli/platform.rb +1 -1
  15. data/lib/bundler/cli/remove.rb +1 -2
  16. data/lib/bundler/cli/update.rb +8 -4
  17. data/lib/bundler/cli.rb +13 -11
  18. data/lib/bundler/compact_index_client/cache.rb +0 -9
  19. data/lib/bundler/compact_index_client/updater.rb +0 -5
  20. data/lib/bundler/compact_index_client.rb +2 -8
  21. data/lib/bundler/definition.rb +79 -133
  22. data/lib/bundler/dependency.rb +5 -7
  23. data/lib/bundler/digest.rb +71 -0
  24. data/lib/bundler/dsl.rb +18 -30
  25. data/lib/bundler/endpoint_specification.rb +21 -11
  26. data/lib/bundler/env.rb +1 -1
  27. data/lib/bundler/environment_preserver.rb +4 -1
  28. data/lib/bundler/errors.rb +18 -2
  29. data/lib/bundler/fetcher/compact_index.rb +9 -14
  30. data/lib/bundler/fetcher/index.rb +0 -26
  31. data/lib/bundler/fetcher.rb +13 -20
  32. data/lib/bundler/friendly_errors.rb +5 -30
  33. data/lib/bundler/gem_helper.rb +7 -18
  34. data/lib/bundler/injector.rb +10 -1
  35. data/lib/bundler/installer/gem_installer.rb +1 -6
  36. data/lib/bundler/installer.rb +1 -5
  37. data/lib/bundler/lazy_specification.rb +19 -3
  38. data/lib/bundler/lockfile_generator.rb +1 -1
  39. data/lib/bundler/lockfile_parser.rb +10 -12
  40. data/lib/bundler/man/bundle-add.1 +10 -2
  41. data/lib/bundler/man/bundle-add.1.ronn +7 -1
  42. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  43. data/lib/bundler/man/bundle-cache.1 +1 -1
  44. data/lib/bundler/man/bundle-check.1 +1 -1
  45. data/lib/bundler/man/bundle-clean.1 +1 -1
  46. data/lib/bundler/man/bundle-config.1 +5 -5
  47. data/lib/bundler/man/bundle-config.1.ronn +5 -5
  48. data/lib/bundler/man/bundle-doctor.1 +1 -1
  49. data/lib/bundler/man/bundle-exec.1 +1 -1
  50. data/lib/bundler/man/bundle-gem.1 +14 -1
  51. data/lib/bundler/man/bundle-gem.1.ronn +16 -0
  52. data/lib/bundler/man/bundle-info.1 +1 -1
  53. data/lib/bundler/man/bundle-init.1 +1 -1
  54. data/lib/bundler/man/bundle-inject.1 +1 -1
  55. data/lib/bundler/man/bundle-install.1 +2 -2
  56. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  57. data/lib/bundler/man/bundle-list.1 +1 -1
  58. data/lib/bundler/man/bundle-lock.1 +1 -1
  59. data/lib/bundler/man/bundle-open.1 +1 -1
  60. data/lib/bundler/man/bundle-outdated.1 +1 -1
  61. data/lib/bundler/man/bundle-platform.1 +1 -1
  62. data/lib/bundler/man/bundle-pristine.1 +1 -1
  63. data/lib/bundler/man/bundle-remove.1 +1 -1
  64. data/lib/bundler/man/bundle-show.1 +1 -1
  65. data/lib/bundler/man/bundle-update.1 +2 -2
  66. data/lib/bundler/man/bundle-update.1.ronn +2 -1
  67. data/lib/bundler/man/bundle-viz.1 +1 -1
  68. data/lib/bundler/man/bundle.1 +1 -1
  69. data/lib/bundler/man/gemfile.5 +28 -2
  70. data/lib/bundler/man/gemfile.5.ronn +9 -1
  71. data/lib/bundler/plugin/api/source.rb +1 -0
  72. data/lib/bundler/plugin/installer.rb +3 -1
  73. data/lib/bundler/plugin.rb +23 -6
  74. data/lib/bundler/process_lock.rb +1 -1
  75. data/lib/bundler/remote_specification.rb +7 -0
  76. data/lib/bundler/resolver/spec_group.rb +1 -1
  77. data/lib/bundler/resolver.rb +38 -40
  78. data/lib/bundler/ruby_version.rb +1 -1
  79. data/lib/bundler/rubygems_ext.rb +19 -10
  80. data/lib/bundler/rubygems_gem_installer.rb +21 -5
  81. data/lib/bundler/rubygems_integration.rb +40 -70
  82. data/lib/bundler/runtime.rb +2 -2
  83. data/lib/bundler/self_manager.rb +168 -0
  84. data/lib/bundler/settings.rb +11 -2
  85. data/lib/bundler/shared_helpers.rb +4 -12
  86. data/lib/bundler/source/git/git_proxy.rb +7 -4
  87. data/lib/bundler/source/git.rb +22 -4
  88. data/lib/bundler/source/metadata.rb +1 -1
  89. data/lib/bundler/source/rubygems.rb +60 -85
  90. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  91. data/lib/bundler/source.rb +3 -1
  92. data/lib/bundler/source_list.rb +11 -29
  93. data/lib/bundler/spec_set.rb +2 -2
  94. data/lib/bundler/templates/Executable.bundler +1 -1
  95. data/lib/bundler/templates/Gemfile +0 -2
  96. data/lib/bundler/templates/gems.rb +0 -3
  97. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  98. data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
  99. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +4 -3
  100. data/lib/bundler/templates/newgem/newgem.gemspec.tt +15 -15
  101. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  102. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  103. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  104. data/lib/bundler/ui/shell.rb +1 -1
  105. data/lib/bundler/vendor/.document +1 -0
  106. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  107. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  108. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  109. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  110. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  111. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  112. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  113. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  114. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  115. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  116. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  117. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  118. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  119. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  120. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  121. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  122. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  123. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  124. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  125. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  126. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  127. data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
  128. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  129. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  130. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  131. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  132. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  133. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  134. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  135. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  136. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  137. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  138. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  139. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  140. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  141. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  142. data/lib/bundler/vendored_tsort.rb +4 -0
  143. data/lib/bundler/version.rb +1 -1
  144. data/lib/bundler/worker.rb +2 -2
  145. data/lib/bundler.rb +23 -22
  146. metadata +25 -10
  147. data/lib/bundler/gemdeps.rb +0 -29
  148. data/lib/bundler/psyched_yaml.rb +0 -22
  149. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -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
data/lib/bundler/dsl.rb CHANGED
@@ -18,6 +18,8 @@ module Bundler
18
18
  VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
19
19
  platform platforms type source install_if gemfile].freeze
20
20
 
21
+ GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}.freeze
22
+
21
23
  attr_reader :gemspecs
22
24
  attr_accessor :dependencies
23
25
 
@@ -275,26 +277,24 @@ module Bundler
275
277
 
276
278
  def add_git_sources
277
279
  git_source(:github) do |repo_name|
278
- warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
279
- "https://github.com/#{repo_name}.git"
280
- RUBY
281
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
282
- "https://github.com/#{repo_name}.git"
280
+ if repo_name =~ GITHUB_PULL_REQUEST_URL
281
+ {
282
+ "git" => "https://github.com/#{$1}.git",
283
+ "branch" => "refs/pull/#{$2}/head",
284
+ "ref" => nil,
285
+ "tag" => nil,
286
+ }
287
+ else
288
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
289
+ "https://github.com/#{repo_name}.git"
290
+ end
283
291
  end
284
292
 
285
293
  git_source(:gist) do |repo_name|
286
- warn_deprecated_git_source(:gist, '"https://gist.github.com/#{repo_name}.git"')
287
-
288
294
  "https://gist.github.com/#{repo_name}.git"
289
295
  end
290
296
 
291
297
  git_source(:bitbucket) do |repo_name|
292
- warn_deprecated_git_source(:bitbucket, <<-'RUBY'.strip)
293
- user_name, repo_name = repo_name.split("/")
294
- repo_name ||= user_name
295
- "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
296
- RUBY
297
-
298
298
  user_name, repo_name = repo_name.split("/")
299
299
  repo_name ||= user_name
300
300
  "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
@@ -365,7 +365,11 @@ repo_name ||= user_name
365
365
 
366
366
  git_name = (git_names & opts.keys).last
367
367
  if @git_sources[git_name]
368
- opts["git"] = @git_sources[git_name].call(opts[git_name])
368
+ git_opts = @git_sources[git_name].call(opts[git_name])
369
+ git_opts = { "git" => git_opts } if git_opts.is_a?(String)
370
+ opts.merge!(git_opts) do |key, _gemfile_value, _git_source_value|
371
+ raise GemfileError, %(The :#{key} option can't be used with `#{git_name}: #{opts[git_name].inspect}`)
372
+ end
369
373
  end
370
374
 
371
375
  %w[git path].each do |type|
@@ -475,22 +479,6 @@ repo_name ||= user_name
475
479
  end
476
480
  end
477
481
 
478
- def warn_deprecated_git_source(name, replacement, additional_message = nil)
479
- additional_message &&= " #{additional_message}"
480
- replacement = if replacement.count("\n").zero?
481
- "{|repo_name| #{replacement} }"
482
- else
483
- "do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
484
- end
485
-
486
- Bundler::SharedHelpers.major_deprecation 3, <<-EOS
487
- The :#{name} git source is deprecated, and will be removed in the future.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
488
-
489
- git_source(:#{name}) #{replacement}
490
-
491
- EOS
492
- end
493
-
494
482
  class DSLError < GemfileError
495
483
  # @return [String] the description that should be presented to the user.
496
484
  #
@@ -3,17 +3,17 @@
3
3
  module Bundler
4
4
  # used for Creating Specifications from the Gemcutter Endpoint
5
5
  class EndpointSpecification < Gem::Specification
6
- ILLFORMED_MESSAGE = 'Ill-formed requirement ["#<YAML::Syck::DefaultKey'.freeze
7
6
  include MatchPlatform
8
7
 
9
- attr_reader :name, :version, :platform, :required_rubygems_version, :required_ruby_version, :checksum
8
+ attr_reader :name, :version, :platform, :checksum
10
9
  attr_accessor :source, :remote, :dependencies
11
10
 
12
- def initialize(name, version, platform, dependencies, metadata = nil)
11
+ def initialize(name, version, platform, spec_fetcher, dependencies, metadata = nil)
13
12
  super()
14
13
  @name = name
15
14
  @version = Gem::Version.create version
16
15
  @platform = platform
16
+ @spec_fetcher = spec_fetcher
17
17
  @dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }
18
18
 
19
19
  @loaded_from = nil
@@ -22,6 +22,14 @@ module Bundler
22
22
  parse_metadata(metadata)
23
23
  end
24
24
 
25
+ def required_ruby_version
26
+ @required_ruby_version ||= _remote_specification.required_ruby_version
27
+ end
28
+
29
+ def required_rubygems_version
30
+ @required_rubygems_version ||= _remote_specification.required_rubygems_version
31
+ end
32
+
25
33
  def fetch_platform
26
34
  @platform
27
35
  end
@@ -106,12 +114,21 @@ module Bundler
106
114
 
107
115
  private
108
116
 
117
+ def _remote_specification
118
+ @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform])
119
+ end
120
+
109
121
  def local_specification_path
110
122
  "#{base_dir}/specifications/#{full_name}.gemspec"
111
123
  end
112
124
 
113
125
  def parse_metadata(data)
114
- return unless data
126
+ unless data
127
+ @required_ruby_version = nil
128
+ @required_rubygems_version = nil
129
+ return
130
+ end
131
+
115
132
  data.each do |k, v|
116
133
  next unless v
117
134
  case k.to_s
@@ -129,13 +146,6 @@ module Bundler
129
146
 
130
147
  def build_dependency(name, requirements)
131
148
  Gem::Dependency.new(name, requirements)
132
- rescue ArgumentError => e
133
- raise unless e.message.include?(ILLFORMED_MESSAGE)
134
- puts # we shouldn't print the error message on the "fetching info" status line
135
- raise GemspecError,
136
- "Unfortunately, the gem #{name} (#{version}) has an invalid " \
137
- "gemspec.\nPlease ask the gem author to yank the bad version to fix " \
138
- "this issue. For more information, see http://bit.ly/syck-defaultkey."
139
149
  end
140
150
  end
141
151
  end
data/lib/bundler/env.rb CHANGED
@@ -71,7 +71,7 @@ module Bundler
71
71
  def self.ruby_version
72
72
  str = String.new(RUBY_VERSION)
73
73
  str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
74
- str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
74
+ str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{Gem::Platform.local}]"
75
75
  end
76
76
 
77
77
  def self.git_version
@@ -38,7 +38,10 @@ module Bundler
38
38
 
39
39
  # Replaces `ENV` with the bundler environment variables backed up
40
40
  def replace_with_backup
41
- ENV.replace(backup) unless Gem.win_platform?
41
+ unless Gem.win_platform?
42
+ ENV.replace(backup)
43
+ return
44
+ end
42
45
 
43
46
  # Fallback logic for Windows below to workaround
44
47
  # https://bugs.ruby-lang.org/issues/16798. Can be dropped once all
@@ -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)
@@ -57,22 +57,17 @@ module Bundler
57
57
  gem_info
58
58
  end
59
59
 
60
- def fetch_spec(spec)
61
- spec -= [nil, "ruby", ""]
62
- contents = compact_index_client.spec(*spec)
63
- return nil if contents.nil?
64
- contents.unshift(spec.first)
65
- contents[3].map! {|d| Gem::Dependency.new(*d) }
66
- EndpointSpecification.new(*contents)
67
- end
68
- compact_index_request :fetch_spec
69
-
70
60
  def available?
71
- return nil unless SharedHelpers.md5_available?
72
- user_home = Bundler.user_home
73
- return nil unless user_home.directory? && user_home.writable?
61
+ unless SharedHelpers.md5_available?
62
+ Bundler.ui.debug("FIPS mode is enabled, bundler can't use the CompactIndex API")
63
+ return nil
64
+ end
65
+ if fetch_uri.scheme == "file"
66
+ Bundler.ui.debug("Using a local server, bundler won't use the CompactIndex API")
67
+ return false
68
+ end
74
69
  # Read info file checksums out of /versions, so we can know if gems are up to date
75
- fetch_uri.scheme != "file" && compact_index_client.update_and_parse_checksums!
70
+ compact_index_client.update_and_parse_checksums!
76
71
  rescue CompactIndexClient::Updater::MisMatchedChecksumError => e
77
72
  Bundler.ui.debug(e.message)
78
73
  nil
@@ -21,32 +21,6 @@ module Bundler
21
21
  raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>"
22
22
  end
23
23
  end
24
-
25
- def fetch_spec(spec)
26
- spec -= [nil, "ruby", ""]
27
- spec_file_name = "#{spec.join "-"}.gemspec"
28
-
29
- uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
30
- if uri.scheme == "file"
31
- path = Bundler.rubygems.correct_for_windows_path(uri.path)
32
- Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
33
- elsif cached_spec_path = gemspec_cached_path(spec_file_name)
34
- Bundler.load_gemspec(cached_spec_path)
35
- else
36
- Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
37
- end
38
- rescue MarshalError
39
- raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
40
- "Your network or your gem server is probably having issues right now."
41
- end
42
-
43
- private
44
-
45
- # cached gem specification path, if one exists
46
- def gemspec_cached_path(spec_file_name)
47
- paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
48
- paths.find {|path| File.file? path }
49
- end
50
24
  end
51
25
  end
52
26
  end
@@ -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
@@ -70,8 +71,8 @@ module Bundler
70
71
  :HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
71
72
  FAIL_ERRORS = begin
72
73
  fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
73
- fail_errors << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError)
74
- fail_errors.concat(NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact)
74
+ fail_errors << Gem::Requirement::BadRequirementError
75
+ fail_errors.concat(NET_ERRORS.map {|e| Net.const_get(e) })
75
76
  end.freeze
76
77
 
77
78
  class << self
@@ -121,7 +122,6 @@ module Bundler
121
122
 
122
123
  # return the specs in the bundler format as an index
123
124
  def specs(gem_names, source)
124
- old = Bundler.rubygems.sources
125
125
  index = Bundler::Index.new
126
126
 
127
127
  if Bundler::Fetcher.disable_endpoint
@@ -129,17 +129,15 @@ module Bundler
129
129
  specs = fetchers.last.specs(gem_names)
130
130
  else
131
131
  specs = []
132
- fetchers.shift until fetchers.first.available? || fetchers.empty?
133
- fetchers.dup.each do |f|
134
- break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
135
- fetchers.delete(f)
132
+ @fetchers = fetchers.drop_while do |f|
133
+ !f.available? || (f.api_fetcher? && !gem_names) || !specs = f.specs(gem_names)
136
134
  end
137
135
  @use_api = false if fetchers.none?(&:api_fetcher?)
138
136
  end
139
137
 
140
138
  specs.each do |name, version, platform, dependencies, metadata|
141
139
  spec = if dependencies
142
- EndpointSpecification.new(name, version, platform, dependencies, metadata)
140
+ EndpointSpecification.new(name, version, platform, self, dependencies, metadata)
143
141
  else
144
142
  RemoteSpecification.new(name, version, platform, self)
145
143
  end
@@ -152,8 +150,6 @@ module Bundler
152
150
  rescue CertificateFailureError
153
151
  Bundler.ui.info "" if gem_names && use_api # newline after dots
154
152
  raise
155
- ensure
156
- Bundler.rubygems.sources = old
157
153
  end
158
154
 
159
155
  def use_api
@@ -244,7 +240,7 @@ module Bundler
244
240
  raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
245
241
 
246
242
  con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
247
- if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
243
+ if gem_proxy = Gem.configuration[:http_proxy]
248
244
  con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
249
245
  end
250
246
 
@@ -255,8 +251,8 @@ module Bundler
255
251
  end
256
252
 
257
253
  ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
258
- (Bundler.rubygems.configuration.ssl_client_cert if
259
- Bundler.rubygems.configuration.respond_to?(:ssl_client_cert))
254
+ (Gem.configuration.ssl_client_cert if
255
+ Gem.configuration.respond_to?(:ssl_client_cert))
260
256
  if ssl_client_cert
261
257
  pem = File.read(ssl_client_cert)
262
258
  con.cert = OpenSSL::X509::Certificate.new(pem)
@@ -274,8 +270,7 @@ module Bundler
274
270
  # cached gem specification path, if one exists
275
271
  def gemspec_cached_path(spec_file_name)
276
272
  paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
277
- paths = paths.select {|path| File.file? path }
278
- paths.first
273
+ paths.find {|path| File.file? path }
279
274
  end
280
275
 
281
276
  HTTP_ERRORS = [
@@ -288,8 +283,8 @@ module Bundler
288
283
  def bundler_cert_store
289
284
  store = OpenSSL::X509::Store.new
290
285
  ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
291
- (Bundler.rubygems.configuration.ssl_ca_cert if
292
- Bundler.rubygems.configuration.respond_to?(:ssl_ca_cert))
286
+ (Gem.configuration.ssl_ca_cert if
287
+ Gem.configuration.respond_to?(:ssl_ca_cert))
293
288
  if ssl_ca_cert
294
289
  if File.directory? ssl_ca_cert
295
290
  store.add_path ssl_ca_cert
@@ -303,8 +298,6 @@ module Bundler
303
298
  store
304
299
  end
305
300
 
306
- private
307
-
308
301
  def remote_uri
309
302
  @remote.uri
310
303
  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,9 +107,9 @@ 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.file(built_gem_path).hexdigest
114
111
  target = File.join(base, "checksums", file_name)
115
- File.write(target, checksum)
112
+ File.write(target, checksum + "\n")
116
113
  Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
117
114
  end
118
115
 
@@ -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("git push #{remote} refs/heads/#{current_branch}".shellsplit)
133
+ sh("git push #{remote} refs/tags/#{version_tag}".shellsplit)
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
@@ -112,9 +112,12 @@ module Bundler
112
112
 
113
113
  source = ", :source => \"#{d.source}\"" unless d.source.nil?
114
114
  git = ", :git => \"#{d.git}\"" unless d.git.nil?
115
+ github = ", :github => \"#{d.github}\"" unless d.github.nil?
115
116
  branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
117
+ ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil?
118
+ require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
116
119
 
117
- %(gem #{name}#{requirement}#{group}#{source}#{git}#{branch})
120
+ %(gem #{name}#{requirement}#{group}#{source}#{git}#{github}#{branch}#{ref}#{require_path})
118
121
  end.join("\n")
119
122
  end
120
123
 
@@ -269,5 +272,11 @@ module Bundler
269
272
  def show_warning(message)
270
273
  Bundler.ui.info Bundler.ui.add_color(message, :yellow)
271
274
  end
275
+
276
+ def convert_autorequire(autorequire)
277
+ autorequire = autorequire.first
278
+ return autorequire if autorequire == "false"
279
+ autorequire.inspect
280
+ end
272
281
  end
273
282
  end
@@ -13,7 +13,7 @@ module Bundler
13
13
  end
14
14
 
15
15
  def install_from_spec
16
- post_install_message = spec_settings ? install_with_settings : install
16
+ post_install_message = install
17
17
  Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
18
18
  generate_executable_stubs
19
19
  return true, post_install_message
@@ -54,11 +54,6 @@ module Bundler
54
54
  spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings))
55
55
  end
56
56
 
57
- def install_with_settings
58
- # Build arguments are global, so this is mutexed
59
- Bundler.rubygems.install_with_build_args([spec_settings]) { install }
60
- end
61
-
62
57
  def out_of_space_message
63
58
  "#{install_error_message}\nYour disk is out of space. Free some space to be able to install your bundle."
64
59
  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"
@@ -219,9 +218,6 @@ module Bundler
219
218
  return jobs
220
219
  end
221
220
 
222
- # Parallelization has some issues on Windows, so it's not yet the default
223
- return 1 if Gem.win_platform?
224
-
225
221
  Bundler.settings.processor_count
226
222
  end
227
223
 
@@ -243,7 +239,7 @@ module Bundler
243
239
 
244
240
  def ensure_specs_are_compatible!
245
241
  system_ruby = Bundler::RubyVersion.system
246
- rubygems_version = Gem::Version.create(Gem::VERSION)
242
+ rubygems_version = Bundler.rubygems.version
247
243
  @definition.specs.each do |spec|
248
244
  if required_ruby_version = spec.required_ruby_version
249
245
  unless required_ruby_version.satisfied_by?(system_ruby.gem_version)