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.
# File lib/bundler.rb, line 174 174: def app_cache 175: root.join("vendor/cache") 176: end
# File lib/bundler.rb, line 168 168: def app_config_path 169: ENV['BUNDLE_APP_CONFIG'] ? 170: Pathname.new(ENV['BUNDLE_APP_CONFIG']).expand_path(root) : 171: root.join('.bundle') 172: end
# File lib/bundler.rb, line 92 92: def bin_path 93: @bin_path ||= begin 94: path = settings[:bin] || "bin" 95: path = Pathname.new(path).expand_path(root) 96: FileUtils.mkdir_p(path) 97: Pathname.new(path).expand_path 98: end 99: end
# File lib/bundler.rb, line 88 88: def bundle_path 89: @bundle_path ||= Pathname.new(settings.path).expand_path(root) 90: end
# File lib/bundler.rb, line 160 160: def cache 161: bundle_path.join("cache/bundler") 162: end
# File lib/bundler.rb, line 77 77: def configure 78: @configured ||= begin 79: configure_gem_home_and_path 80: true 81: end 82: end
# File lib/bundler.rb, line 194 194: def default_gemfile 195: SharedHelpers.default_gemfile 196: end
# File lib/bundler.rb, line 198 198: def default_lockfile 199: SharedHelpers.default_lockfile 200: end
# File lib/bundler.rb, line 131 131: def definition(unlock = nil) 132: @definition = nil if unlock 133: @definition ||= begin 134: configure 135: upgrade_lockfile 136: Definition.build(default_gemfile, default_lockfile, unlock) 137: end 138: end
# File lib/bundler.rb, line 127 127: def environment 128: Bundler::Environment.new(root, definition) 129: end
# File lib/bundler.rb, line 148 148: def home 149: bundle_path.join("bundler") 150: end
# File lib/bundler.rb, line 152 152: def install_path 153: home.join("gems") 154: end
# File lib/bundler.rb, line 123 123: def load 124: @load ||= Runtime.new(root, definition) 125: end
# File lib/bundler.rb, line 229 229: def load_gemspec(file) 230: path = Pathname.new(file) 231: # Eval the gemspec from its parent directory 232: Dir.chdir(path.dirname.to_s) do 233: contents = File.read(path.basename.to_s) 234: begin 235: Gem::Specification.from_yaml(contents) 236: # Raises ArgumentError if the file is not valid YAML 237: rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception 238: begin 239: eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s) 240: rescue LoadError => e 241: original_line = e.backtrace.find { |line| line.include?(path.to_s) } 242: msg = "There was a LoadError while evaluating #{path.basename}:\n #{e.message}" 243: msg << " from\n #{original_line}" if original_line 244: msg << "\n" 245: 246: if RUBY_VERSION >= "1.9.0" 247: msg << "\nDoes it try to require a relative path? That doesn't work in Ruby 1.9." 248: end 249: 250: raise GemspecError, msg 251: end 252: end 253: end 254: end
# File lib/bundler.rb, line 213 213: def mkdir_p(path) 214: if requires_sudo? 215: sudo "mkdir -p '#{path}'" unless File.exist?(path) 216: else 217: FileUtils.mkdir_p(path) 218: end 219: end
# File lib/bundler.rb, line 225 225: def read_file(file) 226: File.open(file, "rb") { |f| f.read } 227: end
# File lib/bundler.rb, line 119 119: def require(*groups) 120: setup(*groups).require(*groups) 121: end
# File lib/bundler.rb, line 202 202: def requires_sudo? 203: return @requires_sudo if defined?(@checked_for_sudo) && @checked_for_sudo 204: 205: path = bundle_path 206: path = path.parent until path.exist? 207: sudo_present = !(`which sudo` rescue '').empty? 208: 209: @checked_for_sudo = true 210: @requires_sudo = settings.allow_sudo? && !File.writable?(path) && sudo_present 211: end
# File lib/bundler.rb, line 164 164: def root 165: default_gemfile.dirname.expand_path 166: end
# File lib/bundler.rb, line 140 140: def ruby_scope 141: "#{Bundler.rubygems.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}" 142: end
# File lib/bundler.rb, line 182 182: def settings 183: @settings ||= Settings.new(app_config_path) 184: end
# File lib/bundler.rb, line 101 101: def setup(*groups) 102: # Just return if all groups are already loaded 103: return @setup if defined?(@setup) 104: 105: if groups.empty? 106: # Load all groups, but only once 107: @setup = load.setup 108: else 109: @completed_groups ||= [] 110: # Figure out which groups haven't been loaded yet 111: unloaded = groups - @completed_groups 112: # Record groups that are now loaded 113: @completed_groups = groups 114: # Load any groups that are not yet loaded 115: unloaded.any? ? load.setup(*unloaded) : load 116: end 117: end
# File lib/bundler.rb, line 156 156: def specs_path 157: bundle_path.join("specifications") 158: end
# File lib/bundler.rb, line 221 221: def sudo(str) 222: `sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}` 223: end
# File lib/bundler.rb, line 178 178: def tmp 179: user_bundle_path.join("tmp", Process.pid.to_s) 180: end
# File lib/bundler.rb, line 258 258: def configure_gem_home_and_path 259: if settings[:disable_shared_gems] 260: ENV['GEM_PATH'] = '' 261: ENV['GEM_HOME'] = File.expand_path(bundle_path, root) 262: elsif Bundler.rubygems.gem_dir != bundle_path.to_s 263: possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path] 264: paths = possibles.flatten.compact.uniq.reject { |p| p.empty? } 265: ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR) 266: ENV["GEM_HOME"] = bundle_path.to_s 267: end 268: 269: # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602) 270: FileUtils.mkdir_p bundle_path.to_s rescue nil 271: 272: Bundler.rubygems.clear_paths 273: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.