Class Index [+]

Quicksearch

Bundler

Constants

ORIGINAL_ENV
WINDOWS
FREEBSD
NULL
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

ui[W]
bundle_path[W]

Public Class Methods

app_cache() click to toggle source
     # File lib/bundler.rb, line 166
166:     def app_cache
167:       root.join("vendor/cache")
168:     end
app_config_path() click to toggle source
     # 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
bin_path() click to toggle source
    # 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
bundle_path() click to toggle source
    # 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
cache() click to toggle source
     # File lib/bundler.rb, line 152
152:     def cache
153:       bundle_path.join("cache/bundler")
154:     end
configure() click to toggle source
    # File lib/bundler.rb, line 70
70:     def configure
71:       @configured ||= begin
72:         configure_gem_home_and_path
73:         true
74:       end
75:     end
default_gemfile() click to toggle source
     # File lib/bundler.rb, line 186
186:     def default_gemfile
187:       SharedHelpers.default_gemfile
188:     end
default_lockfile() click to toggle source
     # File lib/bundler.rb, line 190
190:     def default_lockfile
191:       SharedHelpers.default_lockfile
192:     end
definition(unlock = nil) click to toggle source
     # 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
environment() click to toggle source
     # File lib/bundler.rb, line 119
119:     def environment
120:       Bundler::Environment.new(root, definition)
121:     end
home() click to toggle source
     # File lib/bundler.rb, line 140
140:     def home
141:       bundle_path.join("bundler")
142:     end
install_path() click to toggle source
     # File lib/bundler.rb, line 144
144:     def install_path
145:       home.join("gems")
146:     end
load() click to toggle source
     # File lib/bundler.rb, line 115
115:     def load
116:       @load ||= Runtime.new(root, definition)
117:     end
load_gemspec(file) click to toggle source
     # File lib/bundler.rb, line 221
221:     def load_gemspec(file)
222:       path = Pathname.new(file)
223:       # Eval the gemspec from its parent directory
224:       Dir.chdir(path.dirname) do
225:         begin
226:           Gem::Specification.from_yaml(path.basename)
227:           # Raises ArgumentError if the file is not valid YAML
228:         rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception
229:           begin
230:             eval(File.read(path.basename), TOPLEVEL_BINDING, path.expand_path.to_s)
231:           rescue LoadError => e
232:             original_line = e.backtrace.find { |line| line.include?(path.to_s) }
233:             msg  = "There was a LoadError while evaluating #{path.basename}:\n  #{e.message}"
234:             msg << " from\n  #{original_line}" if original_line
235:             msg << "\n"
236: 
237:             if RUBY_VERSION >= "1.9.0"
238:               msg << "\nDoes it try to require a relative path? That doesn't work in Ruby 1.9."
239:             end
240: 
241:             raise GemspecError, msg
242:           end
243:         end
244:       end
245:     end
mkdir_p(path) click to toggle source
     # File lib/bundler.rb, line 205
205:     def mkdir_p(path)
206:       if requires_sudo?
207:         sudo "mkdir -p '#{path}'" unless File.exist?(path)
208:       else
209:         FileUtils.mkdir_p(path)
210:       end
211:     end
read_file(file) click to toggle source
     # File lib/bundler.rb, line 217
217:     def read_file(file)
218:       File.open(file, "rb") { |f| f.read }
219:     end
require(*groups) click to toggle source
     # File lib/bundler.rb, line 111
111:     def require(*groups)
112:       setup(*groups).require(*groups)
113:     end
requires_sudo?() click to toggle source
     # File lib/bundler.rb, line 194
194:     def requires_sudo?
195:       return @requires_sudo if @checked_for_sudo
196: 
197:       path = bundle_path
198:       path = path.parent until path.exist?
199:       sudo_present = !(`which sudo` rescue '').empty?
200: 
201:       @checked_for_sudo = true
202:       @requires_sudo = settings.allow_sudo? && !File.writable?(path) && sudo_present
203:     end
root() click to toggle source
     # File lib/bundler.rb, line 156
156:     def root
157:       default_gemfile.dirname.expand_path
158:     end
ruby_scope() click to toggle source
     # File lib/bundler.rb, line 132
132:     def ruby_scope
133:       "#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
134:     end
settings() click to toggle source
     # File lib/bundler.rb, line 174
174:     def settings
175:       @settings ||= Settings.new(app_config_path)
176:     end
setup(*groups) click to toggle source
     # 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
specs_path() click to toggle source
     # File lib/bundler.rb, line 148
148:     def specs_path
149:       bundle_path.join("specifications")
150:     end
sudo(str) click to toggle source
     # File lib/bundler.rb, line 213
213:     def sudo(str)
214:       `sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}`
215:     end
tmp() click to toggle source
     # File lib/bundler.rb, line 170
170:     def tmp
171:       user_bundle_path.join("tmp", Process.pid.to_s)
172:     end
ui() click to toggle source
    # File lib/bundler.rb, line 77
77:     def ui
78:       @ui ||= UI.new
79:     end
user_bundle_path() click to toggle source
     # File lib/bundler.rb, line 136
136:     def user_bundle_path
137:       Pathname.new(Gem.user_home).join(".bundler")
138:     end
with_clean_env() click to toggle source
     # File lib/bundler.rb, line 178
178:     def with_clean_env
179:       bundled_env = ENV.to_hash
180:       ENV.replace(ORIGINAL_ENV)
181:       yield
182:     ensure
183:       ENV.replace(bundled_env.to_hash)
184:     end

Private Class Methods

configure_gem_home_and_path() click to toggle source
     # File lib/bundler.rb, line 249
249:     def configure_gem_home_and_path
250:       if settings[:disable_shared_gems]
251:         ENV['GEM_PATH'] = ''
252:         ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
253:       elsif Gem.dir != bundle_path.to_s
254:         paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
255:         ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
256:         ENV["GEM_HOME"] = bundle_path.to_s
257:       end
258: 
259:       FileUtils.mkdir_p bundle_path.to_s
260:       Gem.clear_paths
261:     end
upgrade_lockfile() click to toggle source
     # File lib/bundler.rb, line 263
263:     def upgrade_lockfile
264:       lockfile = default_lockfile
265:       if lockfile.exist? && lockfile.read(3) == "---"
266:         Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
267:         lockfile.rmtree
268:       end
269:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.