bundler 2.1.0 → 2.2.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +832 -738
  3. data/README.md +6 -8
  4. data/bundler.gemspec +3 -3
  5. data/exe/bundle +3 -0
  6. data/lib/bundler.rb +15 -4
  7. data/lib/bundler/build_metadata.rb +2 -2
  8. data/lib/bundler/cli.rb +32 -11
  9. data/lib/bundler/cli/console.rb +1 -1
  10. data/lib/bundler/cli/exec.rb +3 -12
  11. data/lib/bundler/cli/gem.rb +83 -10
  12. data/lib/bundler/cli/info.rb +13 -3
  13. data/lib/bundler/cli/init.rb +1 -1
  14. data/lib/bundler/cli/install.rb +8 -16
  15. data/lib/bundler/cli/issue.rb +2 -2
  16. data/lib/bundler/cli/list.rb +11 -9
  17. data/lib/bundler/cli/outdated.rb +88 -65
  18. data/lib/bundler/cli/plugin.rb +10 -0
  19. data/lib/bundler/cli/pristine.rb +5 -0
  20. data/lib/bundler/definition.rb +32 -32
  21. data/lib/bundler/dependency.rb +0 -9
  22. data/lib/bundler/dsl.rb +1 -5
  23. data/lib/bundler/environment_preserver.rb +26 -2
  24. data/lib/bundler/errors.rb +1 -0
  25. data/lib/bundler/feature_flag.rb +0 -2
  26. data/lib/bundler/fetcher.rb +1 -0
  27. data/lib/bundler/friendly_errors.rb +4 -10
  28. data/lib/bundler/gem_helper.rb +18 -12
  29. data/lib/bundler/gem_version_promoter.rb +1 -1
  30. data/lib/bundler/injector.rb +14 -3
  31. data/lib/bundler/inline.rb +2 -2
  32. data/lib/bundler/installer.rb +29 -28
  33. data/lib/bundler/installer/gem_installer.rb +2 -2
  34. data/lib/bundler/installer/parallel_installer.rb +9 -9
  35. data/lib/bundler/lazy_specification.rb +16 -3
  36. data/lib/bundler/plugin.rb +26 -0
  37. data/lib/bundler/plugin/index.rb +9 -0
  38. data/lib/bundler/psyched_yaml.rb +0 -15
  39. data/lib/bundler/remote_specification.rb +4 -1
  40. data/lib/bundler/resolver.rb +31 -8
  41. data/lib/bundler/resolver/spec_group.rb +26 -5
  42. data/lib/bundler/rubygems_ext.rb +7 -8
  43. data/lib/bundler/rubygems_gem_installer.rb +1 -7
  44. data/lib/bundler/rubygems_integration.rb +13 -48
  45. data/lib/bundler/runtime.rb +2 -12
  46. data/lib/bundler/settings.rb +0 -3
  47. data/lib/bundler/setup.rb +5 -0
  48. data/lib/bundler/shared_helpers.rb +1 -1
  49. data/lib/bundler/source/git.rb +4 -4
  50. data/lib/bundler/source/git/git_proxy.rb +53 -58
  51. data/lib/bundler/source/path.rb +5 -1
  52. data/lib/bundler/source/path/installer.rb +7 -9
  53. data/lib/bundler/source/rubygems.rb +11 -14
  54. data/lib/bundler/stub_specification.rb +16 -4
  55. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  56. data/lib/bundler/templates/newgem/Gemfile.tt +9 -1
  57. data/lib/bundler/templates/newgem/Rakefile.tt +19 -5
  58. data/lib/bundler/templates/newgem/bin/console.tt +2 -0
  59. data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
  60. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
  61. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
  62. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  63. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -0
  64. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -4
  66. data/lib/bundler/templates/newgem/rubocop.yml.tt +10 -0
  67. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  68. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  69. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
  70. data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  71. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  72. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  73. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +72 -208
  74. data/lib/bundler/vendor/thor/lib/thor.rb +0 -7
  75. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  76. data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  77. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  78. data/lib/bundler/version.rb +1 -1
  79. data/man/bundle-add.1 +1 -1
  80. data/man/bundle-add.1.txt +15 -15
  81. data/man/bundle-binstubs.1 +1 -1
  82. data/man/bundle-binstubs.1.txt +10 -10
  83. data/man/bundle-cache.1 +1 -1
  84. data/man/bundle-cache.1.txt +15 -15
  85. data/man/bundle-check.1 +1 -1
  86. data/man/bundle-check.1.txt +8 -8
  87. data/man/bundle-clean.1 +1 -1
  88. data/man/bundle-clean.1.txt +6 -6
  89. data/man/bundle-config.1 +3 -9
  90. data/man/bundle-config.1.txt +271 -272
  91. data/man/bundle-config.ronn +5 -9
  92. data/man/bundle-doctor.1 +1 -1
  93. data/man/bundle-doctor.1.txt +9 -9
  94. data/man/bundle-exec.1 +1 -1
  95. data/man/bundle-exec.1.txt +84 -81
  96. data/man/bundle-gem.1 +25 -3
  97. data/man/bundle-gem.1.txt +65 -39
  98. data/man/bundle-gem.ronn +30 -7
  99. data/man/bundle-info.1 +1 -1
  100. data/man/bundle-info.1.txt +2 -2
  101. data/man/bundle-init.1 +1 -1
  102. data/man/bundle-init.1.txt +9 -9
  103. data/man/bundle-inject.1 +1 -1
  104. data/man/bundle-inject.1.txt +4 -4
  105. data/man/bundle-install.1 +1 -1
  106. data/man/bundle-install.1.txt +169 -169
  107. data/man/bundle-list.1 +7 -7
  108. data/man/bundle-list.1.txt +12 -11
  109. data/man/bundle-list.ronn +6 -6
  110. data/man/bundle-lock.1 +1 -1
  111. data/man/bundle-lock.1.txt +28 -28
  112. data/man/bundle-open.1 +1 -1
  113. data/man/bundle-open.1.txt +3 -3
  114. data/man/bundle-outdated.1 +1 -1
  115. data/man/bundle-outdated.1.txt +34 -34
  116. data/man/bundle-platform.1 +1 -1
  117. data/man/bundle-platform.1.txt +16 -16
  118. data/man/bundle-pristine.1 +1 -1
  119. data/man/bundle-pristine.1.txt +8 -8
  120. data/man/bundle-remove.1 +1 -1
  121. data/man/bundle-remove.1.txt +9 -9
  122. data/man/bundle-show.1 +1 -1
  123. data/man/bundle-show.1.txt +8 -8
  124. data/man/bundle-update.1 +1 -1
  125. data/man/bundle-update.1.txt +149 -148
  126. data/man/bundle-viz.1 +1 -1
  127. data/man/bundle-viz.1.txt +11 -11
  128. data/man/bundle.1 +1 -1
  129. data/man/bundle.1.txt +31 -31
  130. data/man/gemfile.5 +1 -1
  131. data/man/gemfile.5.txt +218 -216
  132. metadata +14 -8
@@ -46,6 +46,14 @@ module Bundler
46
46
  identifier == other.identifier
47
47
  end
48
48
 
49
+ def eql?(other)
50
+ identifier.eql?(other.identifier)
51
+ end
52
+
53
+ def hash
54
+ identifier.hash
55
+ end
56
+
49
57
  def satisfies?(dependency)
50
58
  @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
51
59
  end
@@ -68,12 +76,17 @@ module Bundler
68
76
  end
69
77
 
70
78
  def __materialize__
71
- search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version)
72
79
  @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
73
80
  source.gemspec.tap {|s| s.source = source }
74
81
  else
75
- search = source.specs.search(search_object).last
76
- if search && Gem::Platform.new(search.platform) != Gem::Platform.new(platform) && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
82
+ search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version)
83
+ platform_object = Gem::Platform.new(platform)
84
+ candidates = source.specs.search(search_object)
85
+ same_platform_candidates = candidates.select do |spec|
86
+ MatchPlatform.platforms_match?(spec.platform, platform_object)
87
+ end
88
+ search = same_platform_candidates.last || candidates.last
89
+ if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
77
90
  Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \
78
91
  "because it has different dependencies from the #{platform} version. " \
79
92
  "To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
@@ -47,6 +47,32 @@ module Bundler
47
47
  Bundler.ui.error "Failed to install plugin #{name}: #{e.message}\n #{e.backtrace.join("\n ")}"
48
48
  end
49
49
 
50
+ # Uninstalls plugins by the given names
51
+ #
52
+ # @param [Array<String>] names the names of plugins to be uninstalled
53
+ def uninstall(names, options)
54
+ if names.empty? && !options[:all]
55
+ Bundler.ui.error "No plugins to uninstall. Specify at least 1 plugin to uninstall.\n"\
56
+ "Use --all option to uninstall all the installed plugins."
57
+ return
58
+ end
59
+
60
+ names = index.installed_plugins if options[:all]
61
+ if names.any?
62
+ names.each do |name|
63
+ if index.installed?(name)
64
+ Bundler.rm_rf(index.plugin_path(name))
65
+ index.unregister_plugin(name)
66
+ Bundler.ui.info "Uninstalled plugin #{name}"
67
+ else
68
+ Bundler.ui.error "Plugin #{name} is not installed \n"
69
+ end
70
+ end
71
+ else
72
+ Bundler.ui.info "No plugins installed"
73
+ end
74
+ end
75
+
50
76
  # List installed plugins and commands
51
77
  #
52
78
  def list
@@ -71,6 +71,15 @@ module Bundler
71
71
  raise
72
72
  end
73
73
 
74
+ def unregister_plugin(name)
75
+ @commands.delete_if {|_, v| v == name }
76
+ @sources.delete_if {|_, v| v == name }
77
+ @hooks.each {|_, plugin_names| plugin_names.delete(name) }
78
+ @plugin_paths.delete(name)
79
+ @load_paths.delete(name)
80
+ save_index
81
+ end
82
+
74
83
  # Path of default index file
75
84
  def index_file
76
85
  Plugin.root.join("index")
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Psych could be a gem, so try to ask for it
4
- begin
5
- gem "psych"
6
- rescue LoadError
7
- end if defined?(gem)
8
-
9
3
  # Psych could be in the stdlib
10
4
  # but it's too late if Syck is already loaded
11
5
  begin
@@ -26,12 +20,3 @@ module Bundler
26
20
  YamlLibrarySyntaxError = ::ArgumentError
27
21
  end
28
22
  end
29
-
30
- require_relative "deprecate"
31
- begin
32
- Bundler::Deprecate.skip_during do
33
- require "rubygems/safe_yaml"
34
- end
35
- rescue LoadError
36
- # it's OK if the file isn't there
37
- end
@@ -50,6 +50,8 @@ module Bundler
50
50
  # once the remote gem is downloaded, the backend specification will
51
51
  # be swapped out.
52
52
  def __swap__(spec)
53
+ raise APIResponseInvalidDependenciesError unless spec.dependencies.all? {|d| d.is_a?(Gem::Dependency) }
54
+
53
55
  SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies)
54
56
  @_remote_specification = spec
55
57
  end
@@ -76,7 +78,8 @@ module Bundler
76
78
  deps = method_missing(:dependencies)
77
79
 
78
80
  # allow us to handle when the specs dependencies are an array of array of string
79
- # see https://github.com/bundler/bundler/issues/5797
81
+ # in order to delay the crash to `#__swap__` where it results in a friendlier error
82
+ # see https://github.com/rubygems/bundler/issues/5797
80
83
  deps = deps.map {|d| d.is_a?(Gem::Dependency) ? d : Gem::Dependency.new(*d) }
81
84
 
82
85
  deps
@@ -75,12 +75,17 @@ module Bundler
75
75
  return unless debug?
76
76
  debug_info = yield
77
77
  debug_info = debug_info.inspect unless debug_info.is_a?(String)
78
- warn debug_info.split("\n").map {|s| " " * depth + s }
78
+ warn debug_info.split("\n").map {|s| "BUNDLER: " + " " * depth + s }
79
79
  end
80
80
 
81
81
  def debug?
82
82
  return @debug_mode if defined?(@debug_mode)
83
- @debug_mode = ENV["DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER_TREE"] || false
83
+ @debug_mode =
84
+ ENV["BUNDLER_DEBUG_RESOLVER"] ||
85
+ ENV["BUNDLER_DEBUG_RESOLVER_TREE"] ||
86
+ ENV["DEBUG_RESOLVER"] ||
87
+ ENV["DEBUG_RESOLVER_TREE"] ||
88
+ false
84
89
  end
85
90
 
86
91
  def before_resolution
@@ -146,7 +151,26 @@ module Bundler
146
151
  @gem_version_promoter.sort_versions(dependency, spec_groups)
147
152
  end
148
153
  end
149
- search.select {|sg| sg.for?(platform) }.each {|sg| sg.activate_platform!(platform) }
154
+ selected_sgs = []
155
+ search.each do |sg|
156
+ next unless sg.for?(platform)
157
+ # Add a spec group for "non platform specific spec" as the fallback
158
+ # spec group.
159
+ sg_ruby = sg.copy_for(Gem::Platform::RUBY)
160
+ selected_sgs << sg_ruby if sg_ruby
161
+ sg_all_platforms = nil
162
+ all_platforms = @platforms + [platform]
163
+ sorted_all_platforms = self.class.sort_platforms(all_platforms)
164
+ sorted_all_platforms.reverse_each do |other_platform|
165
+ if sg_all_platforms.nil?
166
+ sg_all_platforms = sg.copy_for(other_platform)
167
+ else
168
+ sg_all_platforms.activate_platform!(other_platform)
169
+ end
170
+ end
171
+ selected_sgs << sg_all_platforms
172
+ end
173
+ selected_sgs
150
174
  end
151
175
 
152
176
  def index_for(dependency)
@@ -183,9 +207,7 @@ module Bundler
183
207
  end
184
208
 
185
209
  def requirement_satisfied_by?(requirement, activated, spec)
186
- return false unless requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
187
- spec.activate_platform!(requirement.__platform) if !@platforms || @platforms.include?(requirement.__platform)
188
- true
210
+ requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
189
211
  end
190
212
 
191
213
  def relevant_sources_for_vertex(vertex)
@@ -223,8 +245,9 @@ module Bundler
223
245
  end
224
246
 
225
247
  def self.platform_sort_key(platform)
226
- return ["", "", ""] if Gem::Platform::RUBY == platform
227
- platform.to_a.map {|part| part || "" }
248
+ # Prefer specific platform to not specific platform
249
+ return ["99-LAST", "", "", ""] if Gem::Platform::RUBY == platform
250
+ ["00", *platform.to_a.map {|part| part || "" }]
228
251
  end
229
252
 
230
253
  private
@@ -9,6 +9,7 @@ module Bundler
9
9
  attr_accessor :ignores_bundler_dependencies
10
10
 
11
11
  def initialize(all_specs)
12
+ @all_specs = all_specs
12
13
  raise ArgumentError, "cannot initialize with an empty value" unless exemplary_spec = all_specs.first
13
14
  @name = exemplary_spec.name
14
15
  @version = exemplary_spec.version
@@ -28,7 +29,7 @@ module Bundler
28
29
  lazy_spec = LazySpecification.new(name, version, s.platform, source)
29
30
  lazy_spec.dependencies.replace s.dependencies
30
31
  lazy_spec
31
- end.compact
32
+ end.compact.uniq
32
33
  end
33
34
 
34
35
  def activate_platform!(platform)
@@ -37,13 +38,25 @@ module Bundler
37
38
  @activated_platforms << platform
38
39
  end
39
40
 
41
+ def copy_for(platform)
42
+ copied_sg = self.class.new(@all_specs)
43
+ copied_sg.ignores_bundler_dependencies = @ignores_bundler_dependencies
44
+ return nil unless copied_sg.for?(platform)
45
+ copied_sg.activate_platform!(platform)
46
+ copied_sg
47
+ end
48
+
49
+ def spec_for(platform)
50
+ @specs[platform]
51
+ end
52
+
40
53
  def for?(platform)
41
- spec = @specs[platform]
42
- !spec.nil?
54
+ !spec_for(platform).nil?
43
55
  end
44
56
 
45
57
  def to_s
46
- @to_s ||= "#{name} (#{version})"
58
+ activated_platforms_string = sorted_activated_platforms.join(", ")
59
+ "#{name} (#{version}) (#{activated_platforms_string})"
47
60
  end
48
61
 
49
62
  def dependencies_for_activated_platforms
@@ -58,6 +71,7 @@ module Bundler
58
71
  return unless other.is_a?(SpecGroup)
59
72
  name == other.name &&
60
73
  version == other.version &&
74
+ sorted_activated_platforms == other.sorted_activated_platforms &&
61
75
  source == other.source
62
76
  end
63
77
 
@@ -65,11 +79,18 @@ module Bundler
65
79
  return unless other.is_a?(SpecGroup)
66
80
  name.eql?(other.name) &&
67
81
  version.eql?(other.version) &&
82
+ sorted_activated_platforms.eql?(other.sorted_activated_platforms) &&
68
83
  source.eql?(other.source)
69
84
  end
70
85
 
71
86
  def hash
72
- to_s.hash ^ source.hash
87
+ name.hash ^ version.hash ^ sorted_activated_platforms.hash ^ source.hash
88
+ end
89
+
90
+ protected
91
+
92
+ def sorted_activated_platforms
93
+ @activated_platforms.sort_by(&:to_s)
73
94
  end
74
95
 
75
96
  private
@@ -47,14 +47,13 @@ module Gem
47
47
  full_require_paths
48
48
  end
49
49
 
50
- if method_defined?(:extension_dir)
51
- alias_method :rg_extension_dir, :extension_dir
52
- def extension_dir
53
- @bundler_extension_dir ||= if source.respond_to?(:extension_dir_name)
54
- File.expand_path(File.join(extensions_dir, source.extension_dir_name))
55
- else
56
- rg_extension_dir
57
- end
50
+ alias_method :rg_extension_dir, :extension_dir
51
+ def extension_dir
52
+ @bundler_extension_dir ||= if source.respond_to?(:extension_dir_name)
53
+ unique_extension_dir = [source.extension_dir_name, File.basename(full_gem_path)].uniq.join("-")
54
+ File.expand_path(File.join(extensions_dir, unique_extension_dir))
55
+ else
56
+ rg_extension_dir
58
57
  end
59
58
  end
60
59
 
@@ -4,12 +4,6 @@ require "rubygems/installer"
4
4
 
5
5
  module Bundler
6
6
  class RubyGemsGemInstaller < Gem::Installer
7
- unless respond_to?(:at)
8
- def self.at(*args)
9
- new(*args)
10
- end
11
- end
12
-
13
7
  def check_executable_overwrite(filename)
14
8
  # Bundler needs to install gems regardless of binstub overwriting
15
9
  end
@@ -20,7 +14,7 @@ module Bundler
20
14
 
21
15
  def build_extensions
22
16
  extension_cache_path = options[:bundler_extension_cache_path]
23
- return super unless extension_cache_path && extension_dir = Bundler.rubygems.spec_extension_dir(spec)
17
+ return super unless extension_cache_path && extension_dir = spec.extension_dir
24
18
 
25
19
  extension_dir = Pathname.new(extension_dir)
26
20
  build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
@@ -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)
@@ -100,11 +102,6 @@ module Bundler
100
102
  end.flatten(1)
101
103
  end
102
104
 
103
- def spec_extension_dir(spec)
104
- return unless spec.respond_to?(:extension_dir)
105
- spec.extension_dir
106
- end
107
-
108
105
  def stub_set_spec(stub, spec)
109
106
  stub.instance_variable_set(:@spec, spec)
110
107
  end
@@ -139,14 +136,10 @@ module Bundler
139
136
  end
140
137
 
141
138
  def inflate(obj)
142
- require "rubygems/util"
143
-
144
139
  Gem::Util.inflate(obj)
145
140
  end
146
141
 
147
142
  def correct_for_windows_path(path)
148
- require "rubygems/util"
149
-
150
143
  if Gem::Util.respond_to?(:correct_for_windows_path)
151
144
  Gem::Util.correct_for_windows_path(path)
152
145
  elsif path[0].chr == "/" && path[1].chr =~ /[a-z]/i && path[2].chr == ":"
@@ -221,11 +214,6 @@ module Bundler
221
214
  Gem.bin_path(gem, bin, ver)
222
215
  end
223
216
 
224
- def preserve_paths
225
- # this is a no-op outside of RubyGems 1.8
226
- yield
227
- end
228
-
229
217
  def loaded_gem_paths
230
218
  loaded_gem_paths = Gem.loaded_specs.map {|_, s| s.full_require_paths }
231
219
  loaded_gem_paths.flatten
@@ -263,8 +251,6 @@ module Bundler
263
251
  require "rubygems/security"
264
252
  require_relative "psyched_yaml"
265
253
  gem_from_path(path, security_policies[policy]).spec
266
- rescue Gem::Package::FormatError
267
- raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
268
254
  rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
269
255
  if e.is_a?(Gem::Security::Exception) ||
270
256
  e.message =~ /unknown trust policy|unsigned gem/i ||
@@ -344,7 +330,7 @@ module Bundler
344
330
  raise e
345
331
  end
346
332
 
347
- # backwards compatibility shim, see https://github.com/bundler/bundler/issues/5102
333
+ # backwards compatibility shim, see https://github.com/rubygems/bundler/issues/5102
348
334
  kernel_class.send(:public, :gem) if Bundler.feature_flag.setup_makes_kernel_gem_public?
349
335
  end
350
336
  end
@@ -441,35 +427,6 @@ module Bundler
441
427
  Gem.clear_paths
442
428
  end
443
429
 
444
- # This backports base_dir which replaces installation path
445
- # RubyGems 1.8+
446
- def backport_base_dir
447
- redefine_method(Gem::Specification, :base_dir) do
448
- return Gem.dir unless loaded_from
449
- File.dirname File.dirname loaded_from
450
- end
451
- end
452
-
453
- def backport_cache_file
454
- redefine_method(Gem::Specification, :cache_dir) do
455
- @cache_dir ||= File.join base_dir, "cache"
456
- end
457
-
458
- redefine_method(Gem::Specification, :cache_file) do
459
- @cache_file ||= File.join cache_dir, "#{full_name}.gem"
460
- end
461
- end
462
-
463
- def backport_spec_file
464
- redefine_method(Gem::Specification, :spec_dir) do
465
- @spec_dir ||= File.join base_dir, "specifications"
466
- end
467
-
468
- redefine_method(Gem::Specification, :spec_file) do
469
- @spec_file ||= File.join spec_dir, "#{full_name}.gemspec"
470
- end
471
- end
472
-
473
430
  def undo_replacements
474
431
  @replaced_methods.each do |(sym, klass), method|
475
432
  redefine_method(klass, sym, method)
@@ -525,6 +482,14 @@ module Bundler
525
482
  end
526
483
  end
527
484
 
485
+ def plain_specs
486
+ Gem::Specification._all
487
+ end
488
+
489
+ def plain_specs=(specs)
490
+ Gem::Specification.all = specs
491
+ end
492
+
528
493
  def fetch_specs(remote, name)
529
494
  path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
530
495
  fetcher = gem_remote_fetcher
@@ -592,10 +557,10 @@ module Bundler
592
557
 
593
558
  def backport_ext_builder_monitor
594
559
  # So we can avoid requiring "rubygems/ext" in its entirety
595
- Gem.module_eval <<-RB, __FILE__, __LINE__ + 1
560
+ Gem.module_eval <<-RUBY, __FILE__, __LINE__ + 1
596
561
  module Ext
597
562
  end
598
- RB
563
+ RUBY
599
564
 
600
565
  require "rubygems/ext/builder"
601
566
 
@@ -43,14 +43,6 @@ module Bundler
43
43
  self
44
44
  end
45
45
 
46
- REQUIRE_ERRORS = [
47
- /^no such file to load -- (.+)$/i,
48
- /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
49
- /^Missing API definition file in (.+)$/i,
50
- /^cannot load such file -- (.+)$/i,
51
- /^dlopen\([^)]*\): Library not loaded: (.+)$/i,
52
- ].freeze
53
-
54
46
  def require(*groups)
55
47
  groups.map!(&:to_sym)
56
48
  groups = [:default] if groups.empty?
@@ -79,16 +71,14 @@ module Bundler
79
71
  end
80
72
  end
81
73
  rescue LoadError => e
82
- REQUIRE_ERRORS.find {|r| r =~ e.message }
83
- raise if dep.autorequire || $1 != required_file
74
+ raise if dep.autorequire || e.path != required_file
84
75
 
85
76
  if dep.autorequire.nil? && dep.name.include?("-")
86
77
  begin
87
78
  namespaced_file = dep.name.tr("-", "/")
88
79
  Kernel.require namespaced_file
89
80
  rescue LoadError => e
90
- REQUIRE_ERRORS.find {|r| r =~ e.message }
91
- raise if $1 != namespaced_file
81
+ raise if e.path != namespaced_file
92
82
  end
93
83
  end
94
84
  end