rubygems-update 3.1.0.pre3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/Gemfile +8 -0
  4. data/Gemfile.lock +43 -0
  5. data/History.txt +32 -0
  6. data/Manifest.txt +20 -3
  7. data/Rakefile +2 -6
  8. data/bundler/CHANGELOG.md +3 -3
  9. data/bundler/lib/bundler.rb +0 -1
  10. data/bundler/lib/bundler/build_metadata.rb +2 -0
  11. data/bundler/lib/bundler/cli.rb +4 -3
  12. data/bundler/lib/bundler/cli/config.rb +1 -1
  13. data/bundler/lib/bundler/cli/exec.rb +12 -3
  14. data/bundler/lib/bundler/cli/gem.rb +10 -1
  15. data/bundler/lib/bundler/cli/info.rb +7 -0
  16. data/bundler/lib/bundler/cli/list.rb +11 -9
  17. data/bundler/lib/bundler/cli/outdated.rb +86 -63
  18. data/bundler/lib/bundler/cli/pristine.rb +5 -0
  19. data/bundler/lib/bundler/cli/update.rb +1 -1
  20. data/bundler/lib/bundler/feature_flag.rb +1 -1
  21. data/bundler/lib/bundler/fetcher.rb +2 -2
  22. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  23. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  24. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  25. data/bundler/lib/bundler/gem_helper.rb +12 -10
  26. data/bundler/lib/bundler/inline.rb +36 -31
  27. data/bundler/lib/bundler/lazy_specification.rb +0 -1
  28. data/bundler/lib/bundler/mirror.rb +3 -3
  29. data/bundler/lib/bundler/plugin/api/source.rb +2 -4
  30. data/bundler/lib/bundler/remote_specification.rb +0 -2
  31. data/bundler/lib/bundler/rubygems_integration.rb +5 -42
  32. data/bundler/lib/bundler/settings.rb +7 -4
  33. data/bundler/lib/bundler/source/git.rb +9 -9
  34. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -2
  35. data/bundler/lib/bundler/source/rubygems.rb +3 -3
  36. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  37. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +3 -0
  38. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -3
  39. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
  40. data/bundler/lib/bundler/uri_credentials_filter.rb +7 -3
  41. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
  42. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -26
  43. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +7 -0
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
  45. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
  46. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  47. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  48. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
  49. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
  50. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  51. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
  52. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
  53. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  54. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  63. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  64. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  65. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  66. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  67. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  68. data/bundler/man/bundle-add.1 +1 -1
  69. data/bundler/man/bundle-add.1.txt +1 -1
  70. data/bundler/man/bundle-binstubs.1 +1 -1
  71. data/bundler/man/bundle-binstubs.1.txt +1 -1
  72. data/bundler/man/bundle-cache.1 +1 -1
  73. data/bundler/man/bundle-cache.1.txt +1 -1
  74. data/bundler/man/bundle-check.1 +1 -1
  75. data/bundler/man/bundle-check.1.txt +1 -1
  76. data/bundler/man/bundle-clean.1 +1 -1
  77. data/bundler/man/bundle-clean.1.txt +1 -1
  78. data/bundler/man/bundle-config.1 +1 -1
  79. data/bundler/man/bundle-config.1.txt +1 -1
  80. data/bundler/man/bundle-doctor.1 +1 -1
  81. data/bundler/man/bundle-doctor.1.txt +1 -1
  82. data/bundler/man/bundle-exec.1 +1 -1
  83. data/bundler/man/bundle-exec.1.txt +1 -1
  84. data/bundler/man/bundle-gem.1 +1 -1
  85. data/bundler/man/bundle-gem.1.txt +1 -1
  86. data/bundler/man/bundle-info.1 +1 -1
  87. data/bundler/man/bundle-info.1.txt +1 -1
  88. data/bundler/man/bundle-init.1 +1 -1
  89. data/bundler/man/bundle-init.1.txt +1 -1
  90. data/bundler/man/bundle-inject.1 +1 -1
  91. data/bundler/man/bundle-inject.1.txt +1 -1
  92. data/bundler/man/bundle-install.1 +1 -1
  93. data/bundler/man/bundle-install.1.txt +1 -1
  94. data/bundler/man/bundle-list.1 +7 -7
  95. data/bundler/man/bundle-list.1.txt +9 -8
  96. data/bundler/man/bundle-list.ronn +6 -6
  97. data/bundler/man/bundle-lock.1 +1 -1
  98. data/bundler/man/bundle-lock.1.txt +1 -1
  99. data/bundler/man/bundle-open.1 +1 -1
  100. data/bundler/man/bundle-open.1.txt +1 -1
  101. data/bundler/man/bundle-outdated.1 +1 -1
  102. data/bundler/man/bundle-outdated.1.txt +1 -1
  103. data/bundler/man/bundle-platform.1 +1 -1
  104. data/bundler/man/bundle-platform.1.txt +1 -1
  105. data/bundler/man/bundle-pristine.1 +1 -1
  106. data/bundler/man/bundle-pristine.1.txt +1 -1
  107. data/bundler/man/bundle-remove.1 +1 -1
  108. data/bundler/man/bundle-remove.1.txt +1 -1
  109. data/bundler/man/bundle-show.1 +1 -1
  110. data/bundler/man/bundle-show.1.txt +1 -1
  111. data/bundler/man/bundle-update.1 +1 -1
  112. data/bundler/man/bundle-update.1.txt +1 -1
  113. data/bundler/man/bundle-viz.1 +1 -1
  114. data/bundler/man/bundle-viz.1.txt +1 -1
  115. data/bundler/man/bundle.1 +1 -1
  116. data/bundler/man/bundle.1.txt +1 -1
  117. data/bundler/man/gemfile.5 +1 -1
  118. data/bundler/man/gemfile.5.txt +1 -1
  119. data/lib/rubygems.rb +5 -15
  120. data/lib/rubygems/command.rb +28 -6
  121. data/lib/rubygems/commands/generate_index_command.rb +3 -0
  122. data/lib/rubygems/commands/setup_command.rb +1 -1
  123. data/lib/rubygems/commands/sources_command.rb +14 -0
  124. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  125. data/lib/rubygems/core_ext/kernel_warn.rb +8 -4
  126. data/lib/rubygems/ext/builder.rb +1 -1
  127. data/lib/rubygems/remote_fetcher.rb +20 -31
  128. data/lib/rubygems/request.rb +2 -0
  129. data/lib/rubygems/source.rb +7 -1
  130. data/lib/rubygems/specification_policy.rb +44 -29
  131. data/lib/rubygems/uri_formatter.rb +0 -1
  132. data/lib/rubygems/uri_parser.rb +36 -0
  133. data/lib/rubygems/uri_parsing.rb +23 -0
  134. data/rubygems-update.gemspec +1 -8
  135. data/test/rubygems/test_gem.rb +3 -3
  136. data/test/rubygems/test_gem_command.rb +38 -9
  137. data/test/rubygems/test_gem_commands_generate_index_command.rb +37 -1
  138. data/test/rubygems/test_gem_commands_help_command.rb +1 -6
  139. data/test/rubygems/test_gem_commands_server_command.rb +6 -2
  140. data/test/rubygems/test_gem_commands_sources_command.rb +74 -0
  141. data/test/rubygems/test_gem_gem_runner.rb +3 -1
  142. data/test/rubygems/test_gem_indexer.rb +1 -1
  143. data/test/rubygems/test_gem_source.rb +14 -0
  144. data/test/rubygems/test_gem_specification.rb +48 -48
  145. data/test/rubygems/test_project_sanity.rb +0 -43
  146. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  147. data/test/rubygems/test_require.rb +41 -42
  148. data/util/bisect +0 -21
  149. data/util/ci.sh +1 -1
  150. metadata +23 -90
  151. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  152. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  153. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
@@ -29,6 +29,11 @@ module Bundler
29
29
 
30
30
  FileUtils.rm_rf spec.full_gem_path
31
31
  when Source::Git
32
+ if source.local?
33
+ Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is locally overriden.")
34
+ next
35
+ end
36
+
32
37
  source.remote!
33
38
  if extension_cache_path = source.extension_cache_path(spec)
34
39
  FileUtils.rm_rf extension_cache_path
@@ -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}".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
 
@@ -211,5 +209,9 @@ module Bundler
211
209
  def gem_push?
212
210
  !%w[n no nil false off 0].include?(ENV["gem_push"].to_s.downcase)
213
211
  end
212
+
213
+ def gem_command
214
+ ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
215
+ end
214
216
  end
215
217
  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.delete("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
@@ -247,12 +247,6 @@ module Bundler
247
247
  EXT_LOCK
248
248
  end
249
249
 
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
250
  def with_build_args(args)
257
251
  ext_lock.synchronize do
258
252
  old_args = build_args
@@ -447,35 +441,6 @@ module Bundler
447
441
  Gem.clear_paths
448
442
  end
449
443
 
450
- # This backports base_dir which replaces installation path
451
- # RubyGems 1.8+
452
- def backport_base_dir
453
- redefine_method(Gem::Specification, :base_dir) do
454
- return Gem.dir unless loaded_from
455
- File.dirname File.dirname loaded_from
456
- end
457
- end
458
-
459
- def backport_cache_file
460
- redefine_method(Gem::Specification, :cache_dir) do
461
- @cache_dir ||= File.join base_dir, "cache"
462
- end
463
-
464
- redefine_method(Gem::Specification, :cache_file) do
465
- @cache_file ||= File.join cache_dir, "#{full_name}.gem"
466
- end
467
- end
468
-
469
- def backport_spec_file
470
- redefine_method(Gem::Specification, :spec_dir) do
471
- @spec_dir ||= File.join base_dir, "specifications"
472
- end
473
-
474
- redefine_method(Gem::Specification, :spec_file) do
475
- @spec_file ||= File.join spec_dir, "#{full_name}.gemspec"
476
- end
477
- end
478
-
479
444
  def undo_replacements
480
445
  @replaced_methods.each do |(sym, klass), method|
481
446
  redefine_method(klass, sym, method)
@@ -531,8 +496,8 @@ module Bundler
531
496
  end
532
497
  end
533
498
 
534
- def fetch_specs(source, remote, name)
535
- path = source + "#{name}.#{Gem.marshal_version}.gz"
499
+ def fetch_specs(remote, name)
500
+ path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
536
501
  fetcher = gem_remote_fetcher
537
502
  fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
538
503
  string = fetcher.fetch_path(path)
@@ -543,10 +508,8 @@ module Bundler
543
508
  end
544
509
 
545
510
  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") || []
511
+ specs = fetch_specs(remote, "specs")
512
+ pres = fetch_specs(remote, "prerelease_specs") || []
550
513
 
551
514
  specs.concat(pres)
552
515
  end
@@ -564,7 +527,7 @@ module Bundler
564
527
  require "resolv"
565
528
  proxy = configuration[:http_proxy]
566
529
  dns = Resolv::DNS.new
567
- Bundler::GemRemoteFetcher.new(proxy, dns)
530
+ Gem::RemoteFetcher.new(proxy, dns)
568
531
  end
569
532
 
570
533
  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
@@ -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?
@@ -230,6 +230,10 @@ module Bundler
230
230
  @allow_remote || @allow_cached
231
231
  end
232
232
 
233
+ def local?
234
+ @local
235
+ end
236
+
233
237
  private
234
238
 
235
239
  def serialize_gemspecs_in(destination)
@@ -256,10 +260,6 @@ module Bundler
256
260
  cached_revision && super
257
261
  end
258
262
 
259
- def local?
260
- @local
261
- end
262
-
263
263
  def requires_checkout?
264
264
  allow_git_ops? && !local? && !cached_revision_checked_out?
265
265
  end
@@ -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