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 166 166: def app_cache 167: root.join("vendor/cache") 168: end
# File lib/bundler.rb, line 160 160: def app_config_path 161: ENV['BUNDLE_APP_CONFIG'] ? 162: Pathname.new(ENV['BUNDLE_APP_CONFIG']).expand_path(root) : 163: root.join('.bundle') 164: end
# File lib/bundler.rb, line 86 86: def bin_path 87: @bin_path ||= begin 88: path = settings[:bin] || "bin" 89: path = Pathname.new(path).expand_path(root) 90: FileUtils.mkdir_p(path) 91: Pathname.new(path).expand_path 92: end 93: end
# File lib/bundler.rb, line 81 81: def bundle_path 82: # STDERR.puts settings.path 83: @bundle_path ||= Pathname.new(settings.path).expand_path(root) 84: end
# File lib/bundler.rb, line 152 152: def cache 153: bundle_path.join("cache/bundler") 154: end
# File lib/bundler.rb, line 70 70: def configure 71: @configured ||= begin 72: configure_gem_home_and_path 73: true 74: end 75: end
# File lib/bundler.rb, line 186 186: def default_gemfile 187: SharedHelpers.default_gemfile 188: end
# File lib/bundler.rb, line 190 190: def default_lockfile 191: SharedHelpers.default_lockfile 192: end
# File lib/bundler.rb, line 123 123: def definition(unlock = nil) 124: @definition = nil if unlock 125: @definition ||= begin 126: configure 127: upgrade_lockfile 128: Definition.build(default_gemfile, default_lockfile, unlock) 129: end 130: end
# File lib/bundler.rb, line 119 119: def environment 120: Bundler::Environment.new(root, definition) 121: end
# File lib/bundler.rb, line 140 140: def home 141: bundle_path.join("bundler") 142: end
# File lib/bundler.rb, line 144 144: def install_path 145: home.join("gems") 146: end
# File lib/bundler.rb, line 115 115: def load 116: @load ||= Runtime.new(root, definition) 117: end
# File lib/bundler.rb, line 218 218: def load_gemspec(file) 219: path = Pathname.new(file) 220: # Eval the gemspec from its parent directory 221: Dir.chdir(path.dirname) do 222: begin 223: Gem::Specification.from_yaml(path.basename) 224: # Raises ArgumentError if the file is not valid YAML 225: rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception 226: begin 227: eval(File.read(path.basename), TOPLEVEL_BINDING, path.expand_path.to_s) 228: rescue LoadError => e 229: original_line = e.backtrace.find { |line| line.include?(path.to_s) } 230: msg = "There was a LoadError while evaluating #{path.basename}:\n #{e.message}" 231: msg << " from\n #{original_line}" if original_line 232: msg << "\n" 233: 234: if RUBY_VERSION >= "1.9.0" 235: msg << "\nDoes it try to require a relative path? That doesn't work in Ruby 1.9." 236: end 237: 238: raise GemspecError, msg 239: end 240: end 241: end 242: end
# File lib/bundler.rb, line 202 202: def mkdir_p(path) 203: if requires_sudo? 204: sudo "mkdir -p '#{path}'" unless File.exist?(path) 205: else 206: FileUtils.mkdir_p(path) 207: end 208: end
# File lib/bundler.rb, line 214 214: def read_file(file) 215: File.open(file, "rb") { |file| file.read } 216: end
# File lib/bundler.rb, line 111 111: def require(*groups) 112: setup(*groups).require(*groups) 113: end
# File lib/bundler.rb, line 194 194: def requires_sudo? 195: path = bundle_path 196: path = path.parent until path.exist? 197: sudo_present = !`which sudo 2>#{NULL}`.empty? 198: 199: settings.allow_sudo? && !File.writable?(path) && sudo_present 200: end
# File lib/bundler.rb, line 156 156: def root 157: default_gemfile.dirname.expand_path 158: end
# File lib/bundler.rb, line 132 132: def ruby_scope 133: "#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}" 134: end
# File lib/bundler.rb, line 174 174: def settings 175: @settings ||= Settings.new(app_config_path) 176: end
# File lib/bundler.rb, line 95 95: def setup(*groups) 96: return @setup if defined?(@setup) && @setup 97: 98: if groups.empty? 99: # Load all groups, but only once 100: @setup = load.setup 101: else 102: # Figure out which groups haven't been loaded yet 103: unloaded = groups - (@completed_groups || []) 104: # Record groups that are now loaded 105: @completed_groups = groups | (@completed_groups || []) 106: # Load any groups that are not yet loaded 107: unloaded.any? ? load.setup(*unloaded) : load 108: end 109: end
# File lib/bundler.rb, line 148 148: def specs_path 149: bundle_path.join("specifications") 150: end
# File lib/bundler.rb, line 210 210: def sudo(str) 211: `sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}` 212: end
# File lib/bundler.rb, line 170 170: def tmp 171: user_bundle_path.join("tmp", Process.pid.to_s) 172: end
# File lib/bundler.rb, line 246 246: def configure_gem_home_and_path 247: if settings[:disable_shared_gems] 248: ENV['GEM_PATH'] = '' 249: ENV['GEM_HOME'] = File.expand_path(bundle_path, root) 250: elsif Gem.dir != bundle_path.to_s 251: paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? } 252: ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR) 253: ENV["GEM_HOME"] = bundle_path.to_s 254: end 255: 256: Gem.clear_paths 257: end
# File lib/bundler.rb, line 259 259: def upgrade_lockfile 260: lockfile = default_lockfile 261: if lockfile.exist? && lockfile.read(3) == "---" 262: Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..." 263: lockfile.rmtree 264: # lock = YAML.load_file(lockfile) 265: # 266: # source_uris = lock["sources"].map{|s| s["Rubygems"]["uri"] } 267: # sources = [Bundler::Source::Rubygems.new({"remotes" => source_uris})] 268: # 269: # deps = lock["dependencies"].map do |name, opts| 270: # version = opts.delete("version") 271: # Bundler::Dependency.new(name, version, opts) 272: # end 273: # 274: # definition = Bundler::Definition.new(nil, deps, sources, {}) 275: # 276: # File.open(lockfile, 'w') do |f| 277: # f.write definition.to_lock 278: # end 279: end 280: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.