Parent

Class/Module Index [+]

Quicksearch

Bundler::Source::Git::GitProxy

The GitProxy is responsible to iteract with git repositories. All actions required by the Git source is encapsualted in this object.

Attributes

path[RW]
ref[RW]
revision[W]
uri[RW]

Public Class Methods

new(path, uri, ref, revision=nil, &allow) click to toggle source
# File lib/bundler/source/git/git_proxy.rb, line 36
def initialize(path, uri, ref, revision=nil, &allow)
  @path     = path
  @uri      = uri
  @ref      = ref
  @revision = revision
  @allow    = allow || Proc.new { true }
end

Public Instance Methods

branch() click to toggle source
# File lib/bundler/source/git/git_proxy.rb, line 48
def branch
  @branch ||= allowed_in_path do
    git("branch") =~ /^\* (.*)$/ && $1.strip
  end
end
checkout() click to toggle source
# File lib/bundler/source/git/git_proxy.rb, line 61
def checkout
  if path.exist?
    return if has_revision_cached?
    Bundler.ui.info "Updating #{uri}"
    in_path do
      git %fetch --force --quiet --tags #{uri_escaped} "refs/heads/*:refs/heads/*"|
    end
  else
    Bundler.ui.info "Fetching #{uri}"
    FileUtils.mkdir_p(path.dirname)
    clone_command = %clone #{uri_escaped} "#{path}" --bare --no-hardlinks|
    clone_command = "#{clone_command} --quiet" if Bundler.ui.quiet?
    git clone_command
  end
end
contains?(commit) click to toggle source
# File lib/bundler/source/git/git_proxy.rb, line 54
def contains?(commit)
  allowed_in_path do
    result = git_null("branch --contains #{commit}")
    $? == 0 && result =~ /^\* (.*)$/
  end
end
copy_to(destination, submodules=false) click to toggle source
# File lib/bundler/source/git/git_proxy.rb, line 77
def copy_to(destination, submodules=false)
  unless File.exist?(destination.join(".git"))
    FileUtils.mkdir_p(destination.dirname)
    FileUtils.rm_rf(destination)
    git %clone --no-checkout "#{path}" "#{destination}"|
    File.chmod((0777 & ~File.umask), destination)
  end

  SharedHelpers.chdir(destination) do
    git %fetch --force --quiet --tags "#{path}"|
    git "reset --hard #{@revision}"

    if submodules
      git "submodule update --init --recursive"
    end
  end
end
revision() click to toggle source
# File lib/bundler/source/git/git_proxy.rb, line 44
def revision
  @revision ||= allowed_in_path { git("rev-parse #{ref}").strip }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.