Module Bundler
In: lib/bundler.rb
lib/bundler/source.rb
lib/bundler/match_platform.rb
lib/bundler/endpoint_specification.rb
lib/bundler/psyched_yaml.rb
lib/bundler/ruby_version.rb
lib/bundler/injector.rb
lib/bundler/deprecate.rb
lib/bundler/fetcher.rb
lib/bundler/retry.rb
lib/bundler/dep_proxy.rb
lib/bundler/settings.rb
lib/bundler/index.rb
lib/bundler/dsl.rb
lib/bundler/gem_installer.rb
lib/bundler/runtime.rb
lib/bundler/shared_helpers.rb
lib/bundler/rubygems_integration.rb
lib/bundler/resolver.rb
lib/bundler/constants.rb
lib/bundler/source/path/installer.rb
lib/bundler/source/git/git_proxy.rb
lib/bundler/source/rubygems.rb
lib/bundler/source/git.rb
lib/bundler/source/path.rb
lib/bundler/env.rb
lib/bundler/friendly_errors.rb
lib/bundler/ui.rb
lib/bundler/gem_helper.rb
lib/bundler/ruby_dsl.rb
lib/bundler/remote_specification.rb
lib/bundler/definition.rb
lib/bundler/gem_helpers.rb
lib/bundler/parallel_workers.rb
lib/bundler/current_ruby.rb
lib/bundler/dependency.rb
lib/bundler/cli.rb
lib/bundler/similarity_detector.rb
lib/bundler/version.rb
lib/bundler/parallel_workers/unix_worker.rb
lib/bundler/parallel_workers/thread_worker.rb
lib/bundler/parallel_workers/worker.rb
lib/bundler/graph.rb
lib/bundler/deployment.rb
lib/bundler/lazy_specification.rb
lib/bundler/installer.rb
lib/bundler/lockfile_parser.rb
lib/bundler/spec_set.rb
lib/bundler/gem_path_manipulation.rb
lib/bundler/safe_catch.rb
lib/bundler/environment.rb

SafeCatch provides a mechanism to safely deepen the stack, performing stack-unrolling similar to catch/throw, but using Fiber or Thread to avoid deepening the stack too quickly.

The API is the same as that of catch/throw: SafeCatch#safe_catch takes a "tag" to be rescued when some code deeper in the process raises it. If the catch block completes successfully, that value is returned. If the tag is "thrown" by safe_throw, the tag‘s value is returned. Other exceptions propagate out as normal.

The implementation, however, uses fibers or threads along with raise/rescue to handle "deepening" the stack and unrolling it. On implementations where Fiber is available, it will be used. If Fiber is not available, Thread will be used. If neither of these classes are available, Proc will be used, effectively deepening the stack for each recursion as in normal catch/throw.

In order to avoid causing a new issue of creating too many fibers or threads, especially on implementations where fibers are actually backed by native threads, the "safe" recursion mechanism is only used every 20 recursions. Based on experiments with JRuby (which seems to suffer the most from excessively deep stacks), this appears to be a sufficient granularity to prevent stack overflow without spinning up excessive numbers of fibers or threads. This value can be adjusted with the BUNDLER_SAFE_RECURSE_EVERY env var; setting it to zero effectively disables safe recursion.

Methods

Classes and Modules

Module Bundler::GemHelpers
Module Bundler::MatchPlatform
Module Bundler::ParallelWorkers
Module Bundler::RubyDsl
Module Bundler::SafeCatch
Module Bundler::SharedHelpers
Module Bundler::Source
Class Bundler::BundlerError
Class Bundler::CLI
Class Bundler::CurrentRuby
Class Bundler::CyclicDependencyError
Class Bundler::Definition
Class Bundler::DepProxy
Class Bundler::Dependency
Class Bundler::Deployment
Class Bundler::Deprecate
Class Bundler::DeprecatedError
Class Bundler::Dsl
Class Bundler::EndpointSpecification
Class Bundler::Env
Class Bundler::Environment
Class Bundler::Fetcher
Class Bundler::GemHelper
Class Bundler::GemInstaller
Class Bundler::GemNotFound
Class Bundler::GemfileError
Class Bundler::GemfileNotFound
Class Bundler::GemspecError
Class Bundler::GitError
Class Bundler::Graph
Class Bundler::HTTPError
Class Bundler::Index
Class Bundler::Injector
Class Bundler::InstallError
Class Bundler::InstallHookError
Class Bundler::Installer
Class Bundler::InvalidOption
Class Bundler::LazySpecification
Class Bundler::LockfileError
Class Bundler::LockfileParser
Class Bundler::MarshalError
Class Bundler::PathError
Class Bundler::ProductionError
Class Bundler::RemoteSpecification
Class Bundler::Resolver
Class Bundler::Retry
Class Bundler::RubyVersion
Class Bundler::RubyVersionMismatch
Class Bundler::RubygemsIntegration
Class Bundler::Runtime
Class Bundler::SecurityError
Class Bundler::Settings
Class Bundler::SimilarityDetector
Class Bundler::SpecSet
Class Bundler::SystemRubyVersion
Class Bundler::UI
Class Bundler::VersionConflict

Constants

ORIGINAL_ENV = ENV.to_hash
YamlSyntaxError = ::Psych::SyntaxError
YamlSyntaxError = ::ArgumentError
Deprecate = ::Deprecate
Deprecate = Gem::Deprecate
WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
NULL = WINDOWS ? "NUL" : "/dev/null"
VERSION = "1.5.2" unless defined?(::Bundler::VERSION)   We‘re doing this because we might write tests that deal with other versions of bundler and we are unsure how to handle this better.

Attributes

bundle_path  [W] 
rubygems  [R] 
ui  [W] 

Public Class methods

Returns absolute location of where binstubs are installed to.

Returns absolute path of where gems are installed on the filesystem.

Returns current version of Ruby

@return [CurrentRuby] Current version of Ruby

Returns an instance of Bundler::Definition for given Gemfile and lockfile

@param unlock [Hash, Boolean, nil] Gems that have been requested

  to be updated or true if all gems should be updated

@return [Bundler::Definition]

[Validate]