rubygems-update 3.1.0.pre3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +43 -0
  6. data/History.txt +97 -2
  7. data/Manifest.txt +21 -3
  8. data/README.md +4 -4
  9. data/Rakefile +11 -10
  10. data/bin/update_rubygems +1 -1
  11. data/bundler/CHANGELOG.md +56 -3
  12. data/bundler/lib/bundler.rb +0 -1
  13. data/bundler/lib/bundler/build_metadata.rb +2 -0
  14. data/bundler/lib/bundler/cli.rb +1 -1
  15. data/bundler/lib/bundler/cli/config.rb +1 -1
  16. data/bundler/lib/bundler/cli/install.rb +3 -2
  17. data/bundler/lib/bundler/cli/update.rb +1 -1
  18. data/bundler/lib/bundler/feature_flag.rb +1 -1
  19. data/bundler/lib/bundler/fetcher.rb +2 -2
  20. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  21. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  22. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  23. data/bundler/lib/bundler/gem_helper.rb +13 -12
  24. data/bundler/lib/bundler/inline.rb +36 -31
  25. data/bundler/lib/bundler/lazy_specification.rb +0 -1
  26. data/bundler/lib/bundler/mirror.rb +3 -3
  27. data/bundler/lib/bundler/plugin/api/source.rb +2 -4
  28. data/bundler/lib/bundler/remote_specification.rb +0 -2
  29. data/bundler/lib/bundler/rubygems_integration.rb +15 -13
  30. data/bundler/lib/bundler/settings.rb +7 -4
  31. data/bundler/lib/bundler/setup.rb +5 -0
  32. data/bundler/lib/bundler/source/git.rb +5 -5
  33. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -2
  34. data/bundler/lib/bundler/source/rubygems.rb +3 -3
  35. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  36. data/bundler/lib/bundler/uri_credentials_filter.rb +7 -3
  37. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
  38. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -48
  39. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +7 -0
  40. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
  41. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
  42. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  43. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
  45. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
  46. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  47. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
  48. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
  49. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  50. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  51. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  52. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  53. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  54. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  63. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  64. data/bundler/lib/bundler/version.rb +1 -1
  65. data/bundler/man/bundle-add.1 +1 -1
  66. data/bundler/man/bundle-add.1.txt +1 -1
  67. data/bundler/man/bundle-binstubs.1 +1 -1
  68. data/bundler/man/bundle-binstubs.1.txt +1 -1
  69. data/bundler/man/bundle-cache.1 +1 -1
  70. data/bundler/man/bundle-cache.1.txt +1 -1
  71. data/bundler/man/bundle-check.1 +1 -1
  72. data/bundler/man/bundle-check.1.txt +1 -1
  73. data/bundler/man/bundle-clean.1 +1 -1
  74. data/bundler/man/bundle-clean.1.txt +1 -1
  75. data/bundler/man/bundle-config.1 +1 -1
  76. data/bundler/man/bundle-config.1.txt +1 -1
  77. data/bundler/man/bundle-doctor.1 +1 -1
  78. data/bundler/man/bundle-doctor.1.txt +1 -1
  79. data/bundler/man/bundle-exec.1 +1 -1
  80. data/bundler/man/bundle-exec.1.txt +1 -1
  81. data/bundler/man/bundle-gem.1 +1 -1
  82. data/bundler/man/bundle-gem.1.txt +1 -1
  83. data/bundler/man/bundle-info.1 +1 -1
  84. data/bundler/man/bundle-info.1.txt +1 -1
  85. data/bundler/man/bundle-init.1 +1 -1
  86. data/bundler/man/bundle-init.1.txt +1 -1
  87. data/bundler/man/bundle-inject.1 +1 -1
  88. data/bundler/man/bundle-inject.1.txt +1 -1
  89. data/bundler/man/bundle-install.1 +1 -1
  90. data/bundler/man/bundle-install.1.txt +1 -1
  91. data/bundler/man/bundle-list.1 +1 -1
  92. data/bundler/man/bundle-list.1.txt +1 -1
  93. data/bundler/man/bundle-lock.1 +1 -1
  94. data/bundler/man/bundle-lock.1.txt +1 -1
  95. data/bundler/man/bundle-open.1 +1 -1
  96. data/bundler/man/bundle-open.1.txt +1 -1
  97. data/bundler/man/bundle-outdated.1 +1 -1
  98. data/bundler/man/bundle-outdated.1.txt +1 -1
  99. data/bundler/man/bundle-platform.1 +1 -1
  100. data/bundler/man/bundle-platform.1.txt +1 -1
  101. data/bundler/man/bundle-pristine.1 +1 -1
  102. data/bundler/man/bundle-pristine.1.txt +1 -1
  103. data/bundler/man/bundle-remove.1 +1 -1
  104. data/bundler/man/bundle-remove.1.txt +1 -1
  105. data/bundler/man/bundle-show.1 +1 -1
  106. data/bundler/man/bundle-show.1.txt +1 -1
  107. data/bundler/man/bundle-update.1 +1 -1
  108. data/bundler/man/bundle-update.1.txt +1 -1
  109. data/bundler/man/bundle-viz.1 +1 -1
  110. data/bundler/man/bundle-viz.1.txt +1 -1
  111. data/bundler/man/bundle.1 +1 -1
  112. data/bundler/man/bundle.1.txt +1 -1
  113. data/bundler/man/gemfile.5 +1 -1
  114. data/bundler/man/gemfile.5.txt +1 -1
  115. data/lib/rubygems.rb +64 -47
  116. data/lib/rubygems/basic_specification.rb +1 -1
  117. data/lib/rubygems/command.rb +29 -7
  118. data/lib/rubygems/commands/generate_index_command.rb +3 -0
  119. data/lib/rubygems/commands/help_command.rb +1 -1
  120. data/lib/rubygems/commands/setup_command.rb +30 -15
  121. data/lib/rubygems/commands/sources_command.rb +17 -3
  122. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  123. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  124. data/lib/rubygems/core_ext/kernel_warn.rb +8 -4
  125. data/lib/rubygems/ext/builder.rb +4 -2
  126. data/lib/rubygems/remote_fetcher.rb +20 -31
  127. data/lib/rubygems/request.rb +2 -0
  128. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  129. data/lib/rubygems/resolver/api_set.rb +1 -1
  130. data/lib/rubygems/resolver/api_specification.rb +1 -1
  131. data/lib/rubygems/server.rb +1 -1
  132. data/lib/rubygems/source.rb +7 -1
  133. data/lib/rubygems/source_list.rb +2 -0
  134. data/lib/rubygems/specification.rb +12 -8
  135. data/lib/rubygems/specification_policy.rb +53 -30
  136. data/lib/rubygems/test_case.rb +60 -0
  137. data/lib/rubygems/uri_formatter.rb +0 -1
  138. data/lib/rubygems/uri_parser.rb +36 -0
  139. data/lib/rubygems/uri_parsing.rb +23 -0
  140. data/lib/rubygems/util.rb +7 -1
  141. data/lib/rubygems/version.rb +1 -1
  142. data/rubygems-update.gemspec +1 -8
  143. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +14 -0
  144. data/test/rubygems/test_gem.rb +90 -46
  145. data/test/rubygems/test_gem_command.rb +38 -9
  146. data/test/rubygems/test_gem_commands_build_command.rb +18 -1
  147. data/test/rubygems/test_gem_commands_generate_index_command.rb +37 -1
  148. data/test/rubygems/test_gem_commands_help_command.rb +1 -6
  149. data/test/rubygems/test_gem_commands_server_command.rb +6 -2
  150. data/test/rubygems/test_gem_commands_setup_command.rb +56 -10
  151. data/test/rubygems/test_gem_commands_sources_command.rb +113 -1
  152. data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -0
  153. data/test/rubygems/test_gem_gem_runner.rb +3 -1
  154. data/test/rubygems/test_gem_indexer.rb +1 -1
  155. data/test/rubygems/test_gem_installer.rb +10 -23
  156. data/test/rubygems/test_gem_package.rb +3 -8
  157. data/test/rubygems/test_gem_package_tar_writer.rb +5 -0
  158. data/test/rubygems/test_gem_request_set.rb +52 -0
  159. data/test/rubygems/test_gem_source.rb +14 -0
  160. data/test/rubygems/test_gem_specification.rb +74 -54
  161. data/test/rubygems/test_gem_stub_specification.rb +0 -1
  162. data/test/rubygems/test_project_sanity.rb +0 -43
  163. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  164. data/test/rubygems/test_require.rb +41 -42
  165. data/util/bisect +0 -21
  166. data/util/ci.sh +1 -1
  167. data/util/update_changelog.rb +7 -10
  168. metadata +27 -93
  169. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  170. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  171. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
@@ -50,7 +50,6 @@ module Bundler
50
50
  autoload :FeatureFlag, File.expand_path("bundler/feature_flag", __dir__)
51
51
  autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
52
52
  autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
53
- autoload :GemRemoteFetcher, File.expand_path("bundler/gem_remote_fetcher", __dir__)
54
53
  autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
55
54
  autoload :Graph, File.expand_path("bundler/graph", __dir__)
56
55
  autoload :Index, File.expand_path("bundler/index", __dir__)
@@ -4,6 +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 = "2020-06-03".freeze
8
+ @git_commit_sha = "32a4159325".freeze
7
9
  @release = false
8
10
  # end ivars
9
11
 
@@ -783,7 +783,7 @@ module Bundler
783
783
  return unless SharedHelpers.md5_available?
784
784
 
785
785
  latest = Fetcher::CompactIndex.
786
- new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil).
786
+ new(nil, Source::Rubygems::Remote.new(Bundler::URI("https://rubygems.org")), nil).
787
787
  send(:compact_index_client).
788
788
  instance_variable_get(:@cache).
789
789
  dependencies("bundler").
@@ -25,7 +25,7 @@ module Bundler
25
25
  ["config", "get", ARGV[1]]
26
26
  end
27
27
 
28
- SharedHelpers.major_deprecation 2,
28
+ SharedHelpers.major_deprecation 3,
29
29
  "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
30
30
 
31
31
  Base.new(options, name, value, self).run
@@ -38,7 +38,8 @@ module Bundler
38
38
  if Bundler.feature_flag.deployment_means_frozen?
39
39
  Bundler.settings.set_command_option :deployment, true
40
40
  else
41
- Bundler.settings.set_command_option :frozen, true
41
+ Bundler.settings.set_command_option :deployment, true if options[:deployment]
42
+ Bundler.settings.set_command_option :frozen, true if options[:frozen]
42
43
  end
43
44
  end
44
45
 
@@ -169,7 +170,7 @@ module Bundler
169
170
  def normalize_settings
170
171
  Bundler.settings.set_command_option :path, nil if options[:system]
171
172
  Bundler.settings.temporary(:path_relative_to_cwd => false) do
172
- Bundler.settings.set_command_option :path, "vendor/bundle" if options[:deployment]
173
+ Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
173
174
  end
174
175
  Bundler.settings.set_command_option_if_given :path, options[:path]
175
176
  Bundler.settings.temporary(:path_relative_to_cwd => false) do
@@ -22,7 +22,7 @@ module Bundler
22
22
  if Bundler.feature_flag.update_requires_all_flag?
23
23
  raise InvalidOption, "To update everything, pass the `--all` flag."
24
24
  end
25
- SharedHelpers.major_deprecation 2, "Pass --all to `bundle update` to update everything"
25
+ SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything"
26
26
  elsif !full_update && options[:all]
27
27
  raise InvalidOption, "Cannot specify --all along with specific options."
28
28
  end
@@ -46,7 +46,7 @@ module Bundler
46
46
  settings_flag(:specific_platform) { bundler_3_mode? }
47
47
  settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
48
48
  settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
49
- settings_flag(:update_requires_all_flag) { bundler_3_mode? }
49
+ settings_flag(:update_requires_all_flag) { bundler_4_mode? }
50
50
  settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
51
51
 
52
52
  settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
@@ -97,7 +97,7 @@ module Bundler
97
97
  spec -= [nil, "ruby", ""]
98
98
  spec_file_name = "#{spec.join "-"}.gemspec"
99
99
 
100
- uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
100
+ uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
101
101
  if uri.scheme == "file"
102
102
  path = Bundler.rubygems.correct_for_windows_path(uri.path)
103
103
  Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
@@ -244,7 +244,7 @@ module Bundler
244
244
 
245
245
  con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
246
246
  if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
247
- con.proxy = URI.parse(gem_proxy) if gem_proxy != :no_proxy
247
+ con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
248
248
  end
249
249
 
250
250
  if remote_uri.scheme == "https"
@@ -21,7 +21,7 @@ module Bundler
21
21
  when Net::HTTPSuccess, Net::HTTPNotModified
22
22
  response
23
23
  when Net::HTTPRedirection
24
- new_uri = URI.parse(response["location"])
24
+ new_uri = Bundler::URI.parse(response["location"])
25
25
  if new_uri.host == uri.host
26
26
  new_uri.user = uri.user
27
27
  new_uri.password = uri.password
@@ -28,7 +28,7 @@ module Bundler
28
28
  spec -= [nil, "ruby", ""]
29
29
  spec_file_name = "#{spec.join "-"}.gemspec"
30
30
 
31
- uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
31
+ uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
32
32
  if uri.scheme == "file"
33
33
  path = Bundler.rubygems.correct_for_windows_path(uri.path)
34
34
  Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "cgi"
4
3
  require_relative "vendored_thor"
5
4
 
6
5
  module Bundler
@@ -114,6 +113,7 @@ module Bundler
114
113
  def issues_url(exception)
115
114
  message = exception.message.lines.first.tr(":", " ").chomp
116
115
  message = message.split("-").first if exception.is_a?(Errno)
116
+ require "cgi"
117
117
  "https://github.com/bundler/bundler/search?q=" \
118
118
  "#{CGI.escape(message)}&type=Issues"
119
119
  end
@@ -73,8 +73,7 @@ module Bundler
73
73
 
74
74
  def build_gem
75
75
  file_name = nil
76
- gem = ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
77
- sh("#{gem} build -V #{spec_path}".shellsplit) do
76
+ sh("#{gem_command} build -V #{spec_path.shellescape}".shellsplit) do
78
77
  file_name = File.basename(built_gem_path)
79
78
  SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
80
79
  FileUtils.mv(built_gem_path, "pkg")
@@ -85,11 +84,10 @@ module Bundler
85
84
 
86
85
  def install_gem(built_gem_path = nil, local = false)
87
86
  built_gem_path ||= build_gem
88
- gem = ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
89
- cmd = "#{gem} install #{built_gem_path}"
87
+ cmd = "#{gem_command} install #{built_gem_path}"
90
88
  cmd += " --local" if local
91
- out, status = sh_with_status(cmd.shellsplit)
92
- unless status.success? && out[/Successfully installed/]
89
+ _, status = sh_with_status(cmd.shellsplit)
90
+ unless status.success?
93
91
  raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
94
92
  end
95
93
  Bundler.ui.confirm "#{name} (#{version}) installed."
@@ -98,13 +96,13 @@ module Bundler
98
96
  protected
99
97
 
100
98
  def rubygem_push(path)
101
- gem_command = %W[gem push #{path}]
102
- gem_command << "--key" << gem_key if gem_key
103
- gem_command << "--host" << allowed_push_host if allowed_push_host
99
+ cmd = %W[#{gem_command} push #{path}]
100
+ cmd << "--key" << gem_key if gem_key
101
+ cmd << "--host" << allowed_push_host if allowed_push_host
104
102
  unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
105
103
  raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
106
104
  end
107
- sh_with_input(gem_command)
105
+ sh_with_input(cmd)
108
106
  Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
109
107
  end
110
108
 
@@ -132,9 +130,8 @@ module Bundler
132
130
 
133
131
  def perform_git_push(options = "")
134
132
  cmd = "git push #{options}"
135
- out, status = sh_with_status(cmd)
133
+ out, status = sh_with_status(cmd.shellsplit)
136
134
  return if status.success?
137
- cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
138
135
  raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
139
136
  end
140
137
 
@@ -211,5 +208,9 @@ module Bundler
211
208
  def gem_push?
212
209
  !%w[n no nil false off 0].include?(ENV["gem_push"].to_s.downcase)
213
210
  end
211
+
212
+ def gem_command
213
+ ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
214
+ end
214
215
  end
215
216
  end
@@ -37,43 +37,48 @@ def gemfile(install = false, options = {}, &gemfile)
37
37
  ui.level = "silent" if opts.delete(:quiet)
38
38
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
39
39
 
40
- old_root = Bundler.method(:root)
41
- bundler_module = class << Bundler; self; end
42
- bundler_module.send(:remove_method, :root)
43
- def Bundler.root
44
- Bundler::SharedHelpers.pwd.expand_path
45
- end
46
- Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
47
-
48
- Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
49
- builder = Bundler::Dsl.new
50
- builder.instance_eval(&gemfile)
40
+ begin
41
+ old_root = Bundler.method(:root)
42
+ bundler_module = class << Bundler; self; end
43
+ bundler_module.send(:remove_method, :root)
44
+ def Bundler.root
45
+ Bundler::SharedHelpers.pwd.expand_path
46
+ end
47
+ old_gemfile = ENV["BUNDLE_GEMFILE"]
48
+ Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
51
49
 
52
- Bundler.settings.temporary(:frozen => false) do
53
- definition = builder.to_definition(nil, true)
54
- def definition.lock(*); end
55
- definition.validate_runtime!
50
+ Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
51
+ builder = Bundler::Dsl.new
52
+ builder.instance_eval(&gemfile)
56
53
 
57
- missing_specs = proc do
58
- definition.missing_specs?
59
- end
54
+ Bundler.settings.temporary(:frozen => false) do
55
+ definition = builder.to_definition(nil, true)
56
+ def definition.lock(*); end
57
+ definition.validate_runtime!
60
58
 
61
- Bundler.ui = install ? ui : Bundler::UI::Silent.new
62
- if install || missing_specs.call
63
- Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) do
64
- installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
65
- installer.post_install_messages.each do |name, message|
66
- Bundler.ui.info "Post-install message from #{name}:\n#{message}"
59
+ Bundler.ui = install ? ui : Bundler::UI::Silent.new
60
+ if install || definition.missing_specs?
61
+ Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) do
62
+ installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
63
+ installer.post_install_messages.each do |name, message|
64
+ Bundler.ui.info "Post-install message from #{name}:\n#{message}"
65
+ end
67
66
  end
68
67
  end
68
+
69
+ runtime = Bundler::Runtime.new(nil, definition)
70
+ runtime.setup.require
71
+ end
72
+ ensure
73
+ if bundler_module
74
+ bundler_module.send(:remove_method, :root)
75
+ bundler_module.send(:define_method, :root, old_root)
69
76
  end
70
77
 
71
- runtime = Bundler::Runtime.new(nil, definition)
72
- runtime.setup.require
73
- end
74
- ensure
75
- if bundler_module
76
- bundler_module.send(:remove_method, :root)
77
- bundler_module.send(:define_method, :root, old_root)
78
+ if old_gemfile
79
+ ENV["BUNDLE_GEMFILE"] = old_gemfile
80
+ else
81
+ ENV["BUNDLE_GEMFILE"] = ""
82
+ end
78
83
  end
79
84
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "uri"
4
3
  require_relative "match_platform"
5
4
 
6
5
  module Bundler
@@ -47,7 +47,7 @@ module Bundler
47
47
 
48
48
  def fetch_valid_mirror_for(uri)
49
49
  downcased = uri.to_s.downcase
50
- mirror = @mirrors[downcased] || @mirrors[URI(downcased).host] || Mirror.new(uri)
50
+ mirror = @mirrors[downcased] || @mirrors[Bundler::URI(downcased).host] || Mirror.new(uri)
51
51
  mirror.validate!(@prober)
52
52
  mirror = Mirror.new(uri) unless mirror.valid?
53
53
  mirror
@@ -74,7 +74,7 @@ module Bundler
74
74
  @uri = if uri.nil?
75
75
  nil
76
76
  else
77
- URI(uri.to_s)
77
+ Bundler::URI(uri.to_s)
78
78
  end
79
79
  @valid = nil
80
80
  end
@@ -126,7 +126,7 @@ module Bundler
126
126
  if uri == "all"
127
127
  @all = true
128
128
  else
129
- @uri = URI(uri).absolute? ? Settings.normalize_uri(uri) : uri
129
+ @uri = Bundler::URI(uri).absolute? ? Settings.normalize_uri(uri) : uri
130
130
  end
131
131
  @value = value
132
132
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "uri"
4
-
5
3
  module Bundler
6
4
  module Plugin
7
5
  class API
@@ -108,7 +106,7 @@ module Bundler
108
106
  def install_path
109
107
  @install_path ||=
110
108
  begin
111
- base_name = File.basename(URI.parse(uri).normalize.path)
109
+ base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
112
110
 
113
111
  gem_install_dir.join("#{base_name}-#{uri_hash[0..11]}")
114
112
  end
@@ -170,7 +168,7 @@ module Bundler
170
168
  #
171
169
  # This is used by `app_cache_path`
172
170
  def app_cache_dirname
173
- base_name = File.basename(URI.parse(uri).normalize.path)
171
+ base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
174
172
  "#{base_name}-#{uri_hash}"
175
173
  end
176
174
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "uri"
4
-
5
3
  module Bundler
6
4
  # Represents a lazily loaded gem specification, where the full specification
7
5
  # is on the source server in rubygems' "quick" index. The proxy object is to
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "rubygems" unless defined?(Gem)
4
+
3
5
  module Bundler
4
6
  class RubygemsIntegration
5
7
  if defined?(Gem::Ext::Builder::CHDIR_MONITOR)
@@ -247,12 +249,6 @@ module Bundler
247
249
  EXT_LOCK
248
250
  end
249
251
 
250
- def fetch_prerelease_specs
251
- fetch_specs(false, true)
252
- rescue Gem::RemoteFetcher::FetchError
253
- {} # if we can't download them, there aren't any
254
- end
255
-
256
252
  def with_build_args(args)
257
253
  ext_lock.synchronize do
258
254
  old_args = build_args
@@ -531,8 +527,16 @@ module Bundler
531
527
  end
532
528
  end
533
529
 
534
- def fetch_specs(source, remote, name)
535
- path = source + "#{name}.#{Gem.marshal_version}.gz"
530
+ def plain_specs
531
+ Gem::Specification._all
532
+ end
533
+
534
+ def plain_specs=(specs)
535
+ Gem::Specification.all = specs
536
+ end
537
+
538
+ def fetch_specs(remote, name)
539
+ path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
536
540
  fetcher = gem_remote_fetcher
537
541
  fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
538
542
  string = fetcher.fetch_path(path)
@@ -543,10 +547,8 @@ module Bundler
543
547
  end
544
548
 
545
549
  def fetch_all_remote_specs(remote)
546
- source = remote.uri.is_a?(URI) ? remote.uri : URI.parse(source.to_s)
547
-
548
- specs = fetch_specs(source, remote, "specs")
549
- pres = fetch_specs(source, remote, "prerelease_specs") || []
550
+ specs = fetch_specs(remote, "specs")
551
+ pres = fetch_specs(remote, "prerelease_specs") || []
550
552
 
551
553
  specs.concat(pres)
552
554
  end
@@ -564,7 +566,7 @@ module Bundler
564
566
  require "resolv"
565
567
  proxy = configuration[:http_proxy]
566
568
  dns = Resolv::DNS.new
567
- Bundler::GemRemoteFetcher.new(proxy, dns)
569
+ Gem::RemoteFetcher.new(proxy, dns)
568
570
  end
569
571
 
570
572
  def gem_from_path(path, policy = nil)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "uri"
4
-
5
3
  module Bundler
6
4
  class Settings
7
5
  autoload :Mirror, File.expand_path("mirror", __dir__)
@@ -152,7 +150,11 @@ module Bundler
152
150
  end
153
151
 
154
152
  def mirror_for(uri)
155
- uri = URI(uri.to_s) unless uri.is_a?(URI)
153
+ if uri.is_a?(String)
154
+ require_relative "vendored_uri"
155
+ uri = Bundler::URI(uri)
156
+ end
157
+
156
158
  gem_mirrors.for(uri.to_s).uri
157
159
  end
158
160
 
@@ -421,7 +423,8 @@ module Bundler
421
423
  suffix = $3
422
424
  end
423
425
  uri = "#{uri}/" unless uri.end_with?("/")
424
- uri = URI(uri)
426
+ require_relative "vendored_uri"
427
+ uri = Bundler::URI(uri)
425
428
  unless uri.absolute?
426
429
  raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
427
430
  end
@@ -19,4 +19,9 @@ if Bundler::SharedHelpers.in_bundle?
19
19
  else
20
20
  Bundler.ui.silence { Bundler.setup }
21
21
  end
22
+
23
+ # We might be in the middle of shelling out to rubygems
24
+ # (RUBYOPT=-rbundler/setup), so we need to give rubygems the opportunity of
25
+ # not being silent.
26
+ Gem::DefaultUserInteraction.ui = nil
22
27
  end
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../vendored_fileutils"
4
- require "uri"
5
4
 
6
5
  module Bundler
7
6
  class Source
8
7
  class Git < Path
9
8
  autoload :GitProxy, File.expand_path("git/git_proxy", __dir__)
10
9
 
11
- attr_reader :uri, :ref, :branch, :options, :submodules
10
+ attr_reader :uri, :ref, :branch, :options, :glob, :submodules
12
11
 
13
12
  def initialize(options)
14
13
  @options = options
@@ -48,13 +47,14 @@ module Bundler
48
47
  end
49
48
 
50
49
  def hash
51
- [self.class, uri, ref, branch, name, version, submodules].hash
50
+ [self.class, uri, ref, branch, name, version, glob, submodules].hash
52
51
  end
53
52
 
54
53
  def eql?(other)
55
54
  other.is_a?(Git) && uri == other.uri && ref == other.ref &&
56
55
  branch == other.branch && name == other.name &&
57
- version == other.version && submodules == other.submodules
56
+ version == other.version && glob == other.glob &&
57
+ submodules == other.submodules
58
58
  end
59
59
 
60
60
  alias_method :==, :eql?
@@ -284,7 +284,7 @@ module Bundler
284
284
  if uri =~ %r{^\w+://(\w+@)?}
285
285
  # Downcase the domain component of the URI
286
286
  # and strip off a trailing slash, if one is present
287
- input = URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
287
+ input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
288
288
  else
289
289
  # If there is no URI scheme, assume it is an ssh/git URI
290
290
  input = uri