Module: Bundler::SharedHelpers

Extended by:
SharedHelpers
Included in:
Runtime, SharedHelpers
Defined in:
lib/bundler/shared_helpers.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) gem_loaded

Returns the value of attribute gem_loaded



20
21
22
# File 'lib/bundler/shared_helpers.rb', line 20

def gem_loaded
  @gem_loaded
end

Instance Method Details

- (Object) chdir(dir, &blk)



39
40
41
42
43
# File 'lib/bundler/shared_helpers.rb', line 39

def chdir(dir, &blk)
  @chdir_monitor.synchronize do
    Dir.chdir dir, &blk
  end
end

- (Object) default_gemfile

Raises:



22
23
24
25
26
# File 'lib/bundler/shared_helpers.rb', line 22

def default_gemfile
  gemfile = find_gemfile
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
  Pathname.new(gemfile)
end

- (Object) default_lockfile



28
29
30
# File 'lib/bundler/shared_helpers.rb', line 28

def default_lockfile
  Pathname.new("#{default_gemfile}.lock")
end

- (Boolean) in_bundle?



32
33
34
# File 'lib/bundler/shared_helpers.rb', line 32

def in_bundle?
  find_gemfile
end

- (Object) pwd



45
46
47
48
49
# File 'lib/bundler/shared_helpers.rb', line 45

def pwd
  @chdir_monitor.synchronize do
    Dir.pwd
  end
end

- (Object) with_clean_git_env(&block)



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/bundler/shared_helpers.rb', line 60

def with_clean_git_env(&block)
  keys    = %w[GIT_DIR GIT_WORK_TREE]
  old_env = keys.inject({}) do |h, k|
    h.update(k => ENV[k])
  end

  keys.each {|key| ENV.delete(key) }

  block.call
ensure
  keys.each {|key| ENV[key] = old_env[key] }
end