bundler 2.2.24 → 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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +246 -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/cache.rb +1 -1
  8. data/lib/bundler/cli/config.rb +10 -1
  9. data/lib/bundler/cli/doctor.rb +13 -4
  10. data/lib/bundler/cli/exec.rb +1 -6
  11. data/lib/bundler/cli/gem.rb +101 -11
  12. data/lib/bundler/cli/info.rb +26 -5
  13. data/lib/bundler/cli/install.rb +12 -45
  14. data/lib/bundler/cli/issue.rb +4 -3
  15. data/lib/bundler/cli/list.rb +7 -1
  16. data/lib/bundler/cli/open.rb +1 -2
  17. data/lib/bundler/cli/platform.rb +1 -1
  18. data/lib/bundler/cli/remove.rb +1 -2
  19. data/lib/bundler/cli/update.rb +9 -5
  20. data/lib/bundler/cli.rb +24 -20
  21. data/lib/bundler/compact_index_client/cache.rb +0 -9
  22. data/lib/bundler/compact_index_client/updater.rb +0 -5
  23. data/lib/bundler/compact_index_client.rb +2 -8
  24. data/lib/bundler/definition.rb +97 -161
  25. data/lib/bundler/dependency.rb +5 -7
  26. data/lib/bundler/digest.rb +71 -0
  27. data/lib/bundler/dsl.rb +32 -31
  28. data/lib/bundler/endpoint_specification.rb +21 -11
  29. data/lib/bundler/env.rb +1 -1
  30. data/lib/bundler/environment_preserver.rb +4 -1
  31. data/lib/bundler/errors.rb +19 -3
  32. data/lib/bundler/fetcher/compact_index.rb +9 -14
  33. data/lib/bundler/fetcher/index.rb +0 -26
  34. data/lib/bundler/fetcher.rb +13 -20
  35. data/lib/bundler/friendly_errors.rb +5 -30
  36. data/lib/bundler/gem_helper.rb +7 -18
  37. data/lib/bundler/injector.rb +10 -1
  38. data/lib/bundler/installer/gem_installer.rb +4 -22
  39. data/lib/bundler/installer/standalone.rb +13 -8
  40. data/lib/bundler/installer.rb +1 -5
  41. data/lib/bundler/lazy_specification.rb +19 -3
  42. data/lib/bundler/lockfile_generator.rb +1 -1
  43. data/lib/bundler/lockfile_parser.rb +11 -12
  44. data/lib/bundler/man/bundle-add.1 +10 -2
  45. data/lib/bundler/man/bundle-add.1.ronn +7 -1
  46. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  47. data/lib/bundler/man/bundle-cache.1 +1 -1
  48. data/lib/bundler/man/bundle-check.1 +1 -1
  49. data/lib/bundler/man/bundle-clean.1 +1 -1
  50. data/lib/bundler/man/bundle-config.1 +5 -5
  51. data/lib/bundler/man/bundle-config.1.ronn +5 -5
  52. data/lib/bundler/man/bundle-doctor.1 +1 -1
  53. data/lib/bundler/man/bundle-exec.1 +1 -1
  54. data/lib/bundler/man/bundle-gem.1 +14 -1
  55. data/lib/bundler/man/bundle-gem.1.ronn +16 -0
  56. data/lib/bundler/man/bundle-info.1 +1 -1
  57. data/lib/bundler/man/bundle-init.1 +1 -1
  58. data/lib/bundler/man/bundle-inject.1 +1 -1
  59. data/lib/bundler/man/bundle-install.1 +2 -2
  60. data/lib/bundler/man/bundle-install.1.ronn +2 -2
  61. data/lib/bundler/man/bundle-list.1 +1 -1
  62. data/lib/bundler/man/bundle-lock.1 +1 -1
  63. data/lib/bundler/man/bundle-open.1 +1 -1
  64. data/lib/bundler/man/bundle-outdated.1 +1 -1
  65. data/lib/bundler/man/bundle-platform.1 +1 -1
  66. data/lib/bundler/man/bundle-pristine.1 +1 -1
  67. data/lib/bundler/man/bundle-remove.1 +1 -1
  68. data/lib/bundler/man/bundle-show.1 +1 -1
  69. data/lib/bundler/man/bundle-update.1 +2 -2
  70. data/lib/bundler/man/bundle-update.1.ronn +2 -1
  71. data/lib/bundler/man/bundle-viz.1 +1 -1
  72. data/lib/bundler/man/bundle.1 +1 -1
  73. data/lib/bundler/man/gemfile.5 +28 -2
  74. data/lib/bundler/man/gemfile.5.ronn +9 -1
  75. data/lib/bundler/plugin/api/source.rb +1 -0
  76. data/lib/bundler/plugin/installer.rb +3 -1
  77. data/lib/bundler/plugin.rb +23 -6
  78. data/lib/bundler/process_lock.rb +1 -1
  79. data/lib/bundler/remote_specification.rb +7 -0
  80. data/lib/bundler/resolver/spec_group.rb +1 -1
  81. data/lib/bundler/resolver.rb +38 -47
  82. data/lib/bundler/ruby_version.rb +1 -1
  83. data/lib/bundler/rubygems_ext.rb +19 -10
  84. data/lib/bundler/rubygems_gem_installer.rb +25 -5
  85. data/lib/bundler/rubygems_integration.rb +40 -70
  86. data/lib/bundler/runtime.rb +17 -8
  87. data/lib/bundler/self_manager.rb +168 -0
  88. data/lib/bundler/settings.rb +15 -2
  89. data/lib/bundler/setup.rb +2 -2
  90. data/lib/bundler/shared_helpers.rb +4 -19
  91. data/lib/bundler/source/git/git_proxy.rb +8 -6
  92. data/lib/bundler/source/git.rb +22 -4
  93. data/lib/bundler/source/metadata.rb +1 -1
  94. data/lib/bundler/source/rubygems.rb +70 -81
  95. data/lib/bundler/source/rubygems_aggregate.rb +4 -0
  96. data/lib/bundler/source.rb +4 -0
  97. data/lib/bundler/source_list.rb +22 -31
  98. data/lib/bundler/spec_set.rb +14 -36
  99. data/lib/bundler/templates/Executable.bundler +7 -7
  100. data/lib/bundler/templates/Gemfile +0 -2
  101. data/lib/bundler/templates/gems.rb +0 -3
  102. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  103. data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
  104. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -2
  105. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -15
  106. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  107. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  108. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  109. data/lib/bundler/ui/shell.rb +1 -1
  110. data/lib/bundler/vendor/.document +1 -0
  111. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  112. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  113. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  114. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  115. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  116. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  117. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  118. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  119. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  120. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  121. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  122. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  123. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  124. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  125. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  126. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  127. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  128. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  129. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  130. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  131. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  132. data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
  133. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  134. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  135. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  136. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  137. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  138. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  139. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  140. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  141. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  142. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  143. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  144. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  145. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  146. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  147. data/lib/bundler/vendored_tsort.rb +4 -0
  148. data/lib/bundler/version.rb +1 -1
  149. data/lib/bundler/worker.rb +19 -4
  150. data/lib/bundler.rb +23 -26
  151. metadata +25 -10
  152. data/lib/bundler/gemdeps.rb +0 -29
  153. data/lib/bundler/psyched_yaml.rb +0 -22
  154. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -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)
@@ -122,7 +138,7 @@ module Bundler
122
138
 
123
139
  class VirtualProtocolError < BundlerError
124
140
  def message
125
- "There was an error relating to virtualization and file access." \
141
+ "There was an error relating to virtualization and file access. " \
126
142
  "It is likely that you need to grant access to or mount some file system correctly."
127
143
  end
128
144
 
@@ -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
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shellwords"
4
-
5
3
  module Bundler
6
4
  class GemInstaller
7
5
  attr_reader :spec, :standalone, :worker, :force, :installer
@@ -15,7 +13,7 @@ module Bundler
15
13
  end
16
14
 
17
15
  def install_from_spec
18
- post_install_message = spec_settings ? install_with_settings : install
16
+ post_install_message = install
19
17
  Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
20
18
  generate_executable_stubs
21
19
  return true, post_install_message
@@ -31,34 +29,23 @@ module Bundler
31
29
 
32
30
  def specific_failure_message(e)
33
31
  message = "#{e.class}: #{e.message}\n"
34
- message += " " + e.backtrace.join("\n ") + "\n\n" if Bundler.ui.debug?
32
+ message += " " + e.backtrace.join("\n ") + "\n\n"
35
33
  message = message.lines.first + Bundler.ui.add_color(message.lines.drop(1).join, :clear)
36
34
  message + Bundler.ui.add_color(failure_message, :red)
37
35
  end
38
36
 
39
37
  def failure_message
40
- return install_error_message if spec.source.options["git"]
41
- "#{install_error_message}\n#{gem_install_message}"
38
+ install_error_message
42
39
  end
43
40
 
44
41
  def install_error_message
45
42
  "An error occurred while installing #{spec.name} (#{spec.version}), and Bundler cannot continue."
46
43
  end
47
44
 
48
- def gem_install_message
49
- source = spec.source
50
- return unless source.respond_to?(:remotes)
51
-
52
- if source.remotes.size == 1
53
- "Make sure that `gem install #{spec.name} -v '#{spec.version}' --source '#{source.remotes.first}'` succeeds before bundling."
54
- else
55
- "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling."
56
- end
57
- end
58
-
59
45
  def spec_settings
60
46
  # Fetch the build settings, if there are any
61
47
  if settings = Bundler.settings["build.#{spec.name}"]
48
+ require "shellwords"
62
49
  Shellwords.shellsplit(settings)
63
50
  end
64
51
  end
@@ -67,11 +54,6 @@ module Bundler
67
54
  spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings))
68
55
  end
69
56
 
70
- def install_with_settings
71
- # Build arguments are global, so this is mutexed
72
- Bundler.rubygems.install_with_build_args([spec_settings]) { install }
73
- end
74
-
75
57
  def out_of_space_message
76
58
  "#{install_error_message}\nYour disk is out of space. Free some space to be able to install your bundle."
77
59
  end
@@ -12,12 +12,13 @@ module Bundler
12
12
  end
13
13
  File.open File.join(bundler_path, "setup.rb"), "w" do |file|
14
14
  file.puts "require 'rbconfig'"
15
- file.puts "ruby_engine = RUBY_ENGINE"
16
- file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
17
- file.puts "path = File.expand_path('..', __FILE__)"
18
15
  file.puts reverse_rubygems_kernel_mixin
19
16
  paths.each do |path|
20
- file.puts %($:.unshift File.expand_path("\#{path}/#{path}"))
17
+ if Pathname.new(path).absolute?
18
+ file.puts %($:.unshift "#{path}")
19
+ else
20
+ file.puts %($:.unshift File.expand_path("\#{__dir__}/#{path}"))
21
+ end
21
22
  end
22
23
  end
23
24
  end
@@ -28,14 +29,14 @@ module Bundler
28
29
  @specs.map do |spec|
29
30
  next if spec.name == "bundler"
30
31
  Array(spec.require_paths).map do |path|
31
- gem_path(path, spec).sub(version_dir, '#{ruby_engine}/#{ruby_version}')
32
+ gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
32
33
  # This is a static string intentionally. It's interpolated at a later time.
33
34
  end
34
- end.flatten
35
+ end.flatten.compact
35
36
  end
36
37
 
37
38
  def version_dir
38
- "#{Bundler::RubyVersion.system.engine}/#{RbConfig::CONFIG["ruby_version"]}"
39
+ "#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}"
39
40
  end
40
41
 
41
42
  def bundler_path
@@ -44,7 +45,11 @@ module Bundler
44
45
 
45
46
  def gem_path(path, spec)
46
47
  full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
47
- Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
48
+ if spec.source.instance_of?(Source::Path)
49
+ full_path
50
+ else
51
+ Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
52
+ end
48
53
  rescue TypeError
49
54
  error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
50
55
  raise Gem::InvalidSpecificationException.new(error_message)
@@ -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)
@@ -38,8 +38,24 @@ module Bundler
38
38
  identifier.hash
39
39
  end
40
40
 
41
+ ##
42
+ # Does this locked specification satisfy +dependency+?
43
+ #
44
+ # NOTE: Rubygems default requirement is ">= 0", which doesn't match
45
+ # prereleases of 0 versions, like "0.0.0.dev" or "0.0.0.SNAPSHOT". However,
46
+ # bundler users expect those to work. We need to make sure that Gemfile
47
+ # dependencies without explicit requirements (which use ">= 0" under the
48
+ # hood by default) are still valid for locked specs using this kind of
49
+ # versions. The method implements an ad-hoc fix for that. A better solution
50
+ # might be to change default rubygems requirement of dependencies to be ">=
51
+ # 0.A" but that's a major refactoring likely to break things. Hopefully we
52
+ # can attempt it in the future.
53
+ #
54
+
41
55
  def satisfies?(dependency)
42
- @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
56
+ effective_requirement = dependency.requirement == Gem::Requirement.default ? Gem::Requirement.new(">= 0.A") : dependency.requirement
57
+
58
+ @name == dependency.name && effective_requirement.satisfied_by?(Gem::Version.new(@version))
43
59
  end
44
60
 
45
61
  def to_lock
@@ -74,11 +90,11 @@ module Bundler
74
90
  MatchPlatform.platforms_match?(spec.platform, platform_object)
75
91
  end
76
92
  installable_candidates = same_platform_candidates.select do |spec|
77
- !spec.is_a?(EndpointSpecification) ||
93
+ spec.is_a?(StubSpecification) ||
78
94
  (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
79
95
  spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
80
96
  end
81
- search = installable_candidates.last || same_platform_candidates.last
97
+ search = installable_candidates.last
82
98
  search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
83
99
  search
84
100
  end
@@ -71,7 +71,7 @@ module Bundler
71
71
  end
72
72
 
73
73
  def add_bundled_with
74
- add_section("BUNDLED WITH", definition.locked_bundler_version.to_s)
74
+ add_section("BUNDLED WITH", Bundler::VERSION)
75
75
  end
76
76
 
77
77
  def add_section(name, value)