Class: Bundler::RubygemsIntegration::MoreFuture

Inherits:
Future show all
Defined in:
lib/bundler/rubygems_integration.rb

Overview

RubyGems 2.1.0

Constant Summary

Constants inherited from Bundler::RubygemsIntegration

EXT_LOCK

Instance Method Summary collapse

Methods inherited from Future

#build, #download_gem, #fetch_all_remote_specs, #fetch_specs, #gem_from_path, #gem_remote_fetcher, #install_with_build_args, #path_separator, #repository_subdirectories, #stub_rubygems

Methods inherited from Bundler::RubygemsIntegration

#backport_base_dir, #backport_cache_file, #backport_segment_generation, #backport_spec_file, #backport_yaml_initialize, #bin_path, #build, #build_args, #build_args=, #build_gem, #clear_paths, #config_map, #configuration, #download_gem, #ext_lock, #fetch_all_remote_specs, #fetch_prerelease_specs, #fetch_specs, #gem_bindir, #gem_cache, #gem_dir, #gem_from_path, #gem_path, #inflate, #install_with_build_args, #load_path_insert_index, #load_plugin_files, #load_plugins, #loaded_gem_paths, #loaded_specs, #mark_loaded, #marshal_spec_dir, #method_visibility, #path, #path_separator, #platforms, #post_reset_hooks, #preserve_paths, #provides?, provides?, #read_binary, #redefine_method, #replace_bin_path, #replace_entrypoints, #replace_gem, #replace_refresh, #repository_subdirectories, #reset, #reverse_rubygems_kernel_mixin, #ruby_engine, #security_policies, #security_policy_keys, #set_installed_by_version, #sources, #sources=, #spec_cache_dirs, #spec_default_gem?, #spec_extension_dir, #spec_from_gem, #spec_matches_for_glob, #spec_missing_extensions?, #stub_set_spec, #stub_source_index, #suffix_pattern, #ui=, #undo_replacements, #user_home, #validate, version, #version, #with_build_args

Constructor Details

#initializeMoreFuture

Returns a new instance of MoreFuture.



810
811
812
813
# File 'lib/bundler/rubygems_integration.rb', line 810

def initialize
  super
  backport_ext_builder_monitor
end

Instance Method Details

#all_specsObject



815
816
817
818
819
820
# File 'lib/bundler/rubygems_integration.rb', line 815

def all_specs
  require "bundler/remote_specification"
  Gem::Specification.stubs.map do |stub|
    StubSpecification.from_stub(stub)
  end
end

#backport_ext_builder_monitorObject



822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'lib/bundler/rubygems_integration.rb', line 822

def backport_ext_builder_monitor
  # So we can avoid requiring "rubygems/ext" in its entirety
  Gem.module_eval <<-RB, __FILE__, __LINE__ + 1
    module Ext
    end
  RB

  require "rubygems/ext/builder"

  Gem::Ext::Builder.class_eval do
    unless const_defined?(:CHDIR_MONITOR)
      const_set(:CHDIR_MONITOR, EXT_LOCK)
    end

    remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
    const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
  end
end

#binstubs_call_gem?Boolean

RubyGems-generated binstubs call Kernel#gem

Returns:

  • (Boolean)


864
865
866
# File 'lib/bundler/rubygems_integration.rb', line 864

def binstubs_call_gem?
  false
end

#find_name(name) ⇒ Object



842
843
844
# File 'lib/bundler/rubygems_integration.rb', line 842

def find_name(name)
  Gem::Specification.stubs_for(name).map(&:to_spec)
end

#stubs_provide_full_functionality?Boolean

only 2.5.2+ has all of the stub methods we want to use, and since this is a performance optimization only, we’ll restrict ourselves to the most recent RG versions instead of all versions that have stubs

Returns:

  • (Boolean)


872
873
874
# File 'lib/bundler/rubygems_integration.rb', line 872

def stubs_provide_full_functionality?
  true
end

#use_gemdeps(gemfile) ⇒ Object



853
854
855
856
857
858
859
860
# File 'lib/bundler/rubygems_integration.rb', line 853

def use_gemdeps(gemfile)
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
  require "bundler/gemdeps"
  runtime = Bundler.setup
  Bundler.ui = nil
  activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
  [Gemdeps.new(runtime), activated_spec_names]
end