# File lib/bundler/runtime.rb, line 87 87: def cache 88: FileUtils.mkdir_p(cache_path) unless File.exists?(cache_path) 89: 90: Bundler.ui.info "Updating .gem files in vendor/cache" 91: specs.each do |spec| 92: next if spec.name == 'bundler' 93: spec.source.cache(spec) if spec.source.respond_to?(:cache) 94: end 95: prune_cache unless Bundler.settings[:no_prune] 96: end
# File lib/bundler/runtime.rb, line 77 77: def dependencies_for(*groups) 78: if groups.empty? 79: dependencies 80: else 81: dependencies.select { |d| (groups & d.groups).any? } 82: end 83: end
# File lib/bundler/runtime.rb, line 98 98: def prune_cache 99: FileUtils.mkdir_p(cache_path) unless File.exists?(cache_path) 100: 101: resolve = @definition.resolve 102: cached = Dir["#{cache_path}/*.gem"] 103: 104: cached = cached.delete_if do |path| 105: spec = Bundler.rubygems.spec_from_gem path 106: 107: resolve.any? do |s| 108: s.name == spec.name && s.version == spec.version && !s.source.is_a?(Bundler::Source::Git) 109: end 110: end 111: 112: if cached.any? 113: Bundler.ui.info "Removing outdated .gem files from vendor/cache" 114: 115: cached.each do |path| 116: Bundler.ui.info " * #{File.basename(path)}" 117: File.delete(path) 118: end 119: end 120: end
# File lib/bundler/runtime.rb, line 51 51: def require(*groups) 52: groups.map! { |g| g.to_sym } 53: groups = [:default] if groups.empty? 54: 55: @definition.dependencies.each do |dep| 56: # Skip the dependency if it is not in any of the requested 57: # groups 58: next unless ((dep.groups & groups).any? && dep.current_platform?) 59: 60: required_file = nil 61: 62: begin 63: # Loop through all the specified autorequires for the 64: # dependency. If there are none, use the dependency's name 65: # as the autorequire. 66: Array(dep.autorequire || dep.name).each do |file| 67: required_file = file 68: Kernel.require file 69: end 70: rescue LoadError => e 71: REGEXPS.find { |r| r =~ e.message } 72: raise if dep.autorequire || $1 != required_file 73: end 74: end 75: end
# File lib/bundler/runtime.rb, line 7 7: def setup(*groups) 8: # Has to happen first 9: clean_load_path 10: 11: specs = groups.any? ? @definition.specs_for(groups) : requested_specs 12: 13: setup_environment 14: Bundler.rubygems.replace_entrypoints(specs) 15: 16: # Activate the specs 17: specs.each do |spec| 18: unless spec.loaded_from 19: raise GemNotFound, "#{spec.full_name} is missing. Run `bundle` to get it." 20: end 21: 22: if activated_spec = Bundler.rubygems.loaded_specs(spec.name) and activated_spec.version != spec.version 23: e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " "but your Gemfile requires #{spec.name} #{spec.version}. Consider using bundle exec." 24: e.name = spec.name 25: if e.respond_to?(:requirement=) 26: e.requirement = Gem::Requirement.new(spec.version.to_s) 27: else 28: e.version_requirement = Gem::Requirement.new(spec.version.to_s) 29: end 30: raise e 31: end 32: 33: Bundler.rubygems.mark_loaded(spec) 34: load_paths = spec.load_paths.reject {|path| $LOAD_PATH.include?(path)} 35: $LOAD_PATH.unshift(*load_paths) 36: end 37: 38: lock 39: 40: self 41: end
# File lib/bundler/runtime.rb, line 124 124: def cache_path 125: root.join("vendor/cache") 126: end
# File lib/bundler/runtime.rb, line 128 128: def setup_environment 129: begin 130: ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) 131: rescue Gem::GemNotFoundException 132: ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../bin/bundle", __FILE__) 133: end 134: 135: # Set PATH 136: paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR) 137: paths.unshift "#{Bundler.bundle_path}/bin" 138: ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR) 139: 140: # Set BUNDLE_GEMFILE 141: ENV["BUNDLE_GEMFILE"] = default_gemfile.to_s 142: 143: # Set RUBYOPT 144: rubyopt = [ENV["RUBYOPT"]].compact 145: if rubyopt.empty? || rubyopt.first !~ /-rbundler\/setup/ 146: rubyopt.unshift "-rbundler/setup" 147: rubyopt.unshift "-I#{File.expand_path('../..', __FILE__)}" 148: ENV["RUBYOPT"] = rubyopt.join(' ') 149: end 150: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.