123456789_123456789_123456789_123456789_123456789_

Class: Bundler::RubygemsIntegration::Future

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Bundler::RubygemsIntegration
Defined in: lib/bundler/rubygems_integration.rb

Overview

RubyGems 2.0

Constant Summary

::Bundler::RubygemsIntegration - Inherited

EXT_LOCK

Class Method Summary

Instance Attribute Summary

Instance Method Summary

::Bundler::RubygemsIntegration - Inherited

#backport_base_dir

This backports base_dir which replaces installation path RubyGems 1.8+.

#backport_cache_file,
#backport_segment_generation

This backports the correct segment generation code from RubyGems 1.4+ by monkeypatching it into the method in RubyGems 1.3.6 and 1.3.7.

#backport_spec_file,
#backport_yaml_initialize

This backport fixes the marshaling of @segments.

#bin_path, #build, #build_gem, #clear_paths, #config_map, #configuration, #download_gem, #ext_lock,
#fetch_all_remote_specs

TODO: This is for older versions of RubyGems…

#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?, #read_binary, #redefine_method,
#replace_bin_path

Used to make bin stubs that are not created by bundler work under bundler.

#replace_entrypoints

Replace or hook into RubyGems to provide a bundlerized view of the world.

#replace_gem,
#replace_refresh

Because Bundler has a static view of what specs are available, we don’t #refresh, so stub it out.

#repository_subdirectories, #reset, #reverse_rubygems_kernel_mixin, #ruby_engine, #security_policies, #security_policy_keys, #set_installed_by_version, #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, #undo_replacements, #user_home, #validate, #version, #with_build_args

Constructor Details

This class inherits a constructor from Bundler::RubygemsIntegration

Instance Method Details

#all_specs

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 739

def all_specs
  Gem::Specification.to_a
end

#build(spec, skip_validation = false)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 790

def build(spec, skip_validation = false)
  require "rubygems/package"
  Gem::Package.build(spec, skip_validation)
end

#download_gem(spec, uri, path)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 767

def download_gem(spec, uri, path)
  uri = Bundler.settings.mirror_for(uri)
  fetcher = gem_remote_fetcher
  fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri
  Bundler::Retry.new("download gem from #{uri}").attempts do
    fetcher.download(spec, uri, path)
  end
end

#fetch_all_remote_specs(remote)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 758

def fetch_all_remote_specs(remote)
  source = remote.uri.is_a?(URI) ? remote.uri : URI.parse(source.to_s)

  specs = fetch_specs(source, remote, "specs")
  pres = fetch_specs(source, remote, "prerelease_specs") || []

  specs.concat(pres)
end

#fetch_specs(source, remote, name)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 747

def fetch_specs(source, remote, name)
  path = source + "#{name}.#{Gem.marshal_version}.gz"
  fetcher = gem_remote_fetcher
  fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
  string = fetcher.fetch_path(path)
  Bundler.load_marshal(string)
rescue Gem::RemoteFetcher::FetchError => e
  # it's okay for prerelease to fail
  raise e unless name == "prerelease_specs"
end

#find_name(name)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 743

def find_name(name)
  Gem::Specification.find_all_by_name name
end

#gem_from_path(path, policy = nil)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 783

def gem_from_path(path, policy = nil)
  require "rubygems/package"
  p = Gem::Package.new(path)
  p.security_policy = policy if policy
  p
end

#gem_remote_fetcher

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 776

def gem_remote_fetcher
  require "resolv"
  proxy = configuration[:http_proxy]
  dns = Resolv::DNS.new
  Bundler::GemRemoteFetcher.new(proxy, dns)
end

#install_with_build_args(args)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 799

def install_with_build_args(args)
  yield
end

#path_separator

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 803

def path_separator
  Gem.path_separator
end

#repository_subdirectories

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 795

def repository_subdirectories
  Gem::REPOSITORY_SUBDIRECTORIES
end

#stub_rubygems(specs)

[ GitHub ]

  
# File 'lib/bundler/rubygems_integration.rb', line 727

def stub_rubygems(specs)
  Gem::Specification.all = specs

  Gem.post_reset do
    Gem::Specification.all = specs
  end

  redefine_method((class << Gem; self; end), :finish_resolve) do |*|
    []
  end
end