lib/bundler/rubygems_integration.rb in bundler-2.1.4 vs lib/bundler/rubygems_integration.rb in bundler-2.2.0.rc.1
- old
+ new
@@ -100,15 +100,10 @@
spec.load_paths.map do |lp|
Dir["#{lp}/#{glob}#{suffix_pattern}"]
end.flatten(1)
end
- def spec_extension_dir(spec)
- return unless spec.respond_to?(:extension_dir)
- spec.extension_dir
- end
-
def stub_set_spec(stub, spec)
stub.instance_variable_set(:@spec, spec)
end
def path(obj)
@@ -139,18 +134,14 @@
def read_binary(path)
Gem.read_binary(path)
end
def inflate(obj)
- require "rubygems/util"
-
Gem::Util.inflate(obj)
end
def correct_for_windows_path(path)
- require "rubygems/util"
-
if Gem::Util.respond_to?(:correct_for_windows_path)
Gem::Util.correct_for_windows_path(path)
elsif path[0].chr == "/" && path[1].chr =~ /[a-z]/i && path[2].chr == ":"
path[1..-1]
else
@@ -221,15 +212,10 @@
def bin_path(gem, bin, ver)
Gem.bin_path(gem, bin, ver)
end
- def preserve_paths
- # this is a no-op outside of RubyGems 1.8
- yield
- end
-
def loaded_gem_paths
loaded_gem_paths = Gem.loaded_specs.map {|_, s| s.full_require_paths }
loaded_gem_paths.flatten
end
@@ -263,12 +249,10 @@
def spec_from_gem(path, policy = nil)
require "rubygems/security"
require_relative "psyched_yaml"
gem_from_path(path, security_policies[policy]).spec
- rescue Gem::Package::FormatError
- raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
if e.is_a?(Gem::Security::Exception) ||
e.message =~ /unknown trust policy|unsigned gem/i ||
e.message =~ /couldn't verify (meta)?data signature/i
raise SecurityError,
@@ -344,11 +328,11 @@
e.version_requirement = dep.requirement
end
raise e
end
- # backwards compatibility shim, see https://github.com/bundler/bundler/issues/5102
+ # backwards compatibility shim, see https://github.com/rubygems/bundler/issues/5102
kernel_class.send(:public, :gem) if Bundler.feature_flag.setup_makes_kernel_gem_public?
end
end
# Used to make bin stubs that are not created by bundler work
@@ -441,39 +425,10 @@
replace_bin_path(specs_by_name)
Gem.clear_paths
end
- # This backports base_dir which replaces installation path
- # RubyGems 1.8+
- def backport_base_dir
- redefine_method(Gem::Specification, :base_dir) do
- return Gem.dir unless loaded_from
- File.dirname File.dirname loaded_from
- end
- end
-
- def backport_cache_file
- redefine_method(Gem::Specification, :cache_dir) do
- @cache_dir ||= File.join base_dir, "cache"
- end
-
- redefine_method(Gem::Specification, :cache_file) do
- @cache_file ||= File.join cache_dir, "#{full_name}.gem"
- end
- end
-
- def backport_spec_file
- redefine_method(Gem::Specification, :spec_dir) do
- @spec_dir ||= File.join base_dir, "specifications"
- end
-
- redefine_method(Gem::Specification, :spec_file) do
- @spec_file ||= File.join spec_dir, "#{full_name}.gemspec"
- end
- end
-
def undo_replacements
@replaced_methods.each do |(sym, klass), method|
redefine_method(klass, sym, method)
end
if Binding.public_method_defined?(:source_location)
@@ -600,13 +555,13 @@
end
end
def backport_ext_builder_monitor
# So we can avoid requiring "rubygems/ext" in its entirety
- Gem.module_eval <<-RB, __FILE__, __LINE__ + 1
+ Gem.module_eval <<-RUBY, __FILE__, __LINE__ + 1
module Ext
end
- RB
+ RUBY
require "rubygems/ext/builder"
Gem::Ext::Builder.class_eval do
unless const_defined?(:CHDIR_MONITOR)