Class: Bundler::Source::Git::GitProxy

### Home Classes Methods

### In Files

- lib/bundler/source/git/git_proxy.rb

### Parent

Object

### Methods

- ::new
- #branch
- #checkout
- #contains?
- #copy_to
- #revision

### Files

- bundle
- bundle-config
- bundle-config.txt
- bundle-exec
- bundle-exec.txt
- bundle-install
- bundle-install.txt
- bundle-package
- bundle-package.txt
- bundle-platform
- bundle-platform.txt
- bundle-update
- bundle-update.txt
- bundle.txt
- gemfile.5.txt
- Executable
- Gemfile

### Class/Module Index

Quicksearch

- Bundler
- Bundler::BundlerError
- Bundler::CLI
- Bundler::Definition
- Bundler::DepProxy
- Bundler::Dependency
- Bundler::Deployment
- Bundler::Deprecate
- Bundler::DeprecatedError
- Bundler::Dsl
- Bundler::EndpointSpecification
- Bundler::Env
- Bundler::Environment
- Bundler::Fetcher
- Bundler::Fetcher::CertificateFailureError
- Bundler::Fetcher::FallbackError
- Bundler::Fetcher::SSLError
- Bundler::GemHelper
- Bundler::GemHelpers
- Bundler::GemInstaller
- Bundler::GemNotFound
- Bundler::GemfileError
- Bundler::GemfileNotFound
- Bundler::GemspecError
- Bundler::GitError
- Bundler::Graph
- Bundler::Graph::GraphVizClient
- Bundler::HTTPError
- Bundler::Index
- Bundler::Injector
- Bundler::InstallError
- Bundler::InstallHookError
- Bundler::Installer
- Bundler::InvalidOption
- Bundler::InvalidSpecSet
- Bundler::LazySpecification
- Bundler::LockfileError
- Bundler::LockfileParser
- Bundler::MarshalError
- Bundler::MatchPlatform
- Bundler::PathError
- Bundler::ProductionError
- Bundler::RemoteSpecification
- Bundler::Resolver
- Bundler::Resolver::SpecGroup
- Bundler::RubyDsl
- Bundler::RubyVersion
- Bundler::RubyVersionMismatch
- Bundler::RubygemsIntegration
- Bundler::RubygemsIntegration::AlmostModern
- Bundler::RubygemsIntegration::Ancient
- Bundler::RubygemsIntegration::Future
- Bundler::RubygemsIntegration::Gem
- Bundler::RubygemsIntegration::Gem::SourceIndex
- Bundler::RubygemsIntegration::Legacy
- Bundler::RubygemsIntegration::Modern
- Bundler::RubygemsIntegration::Transitional
- Bundler::Runtime
- Bundler::SecurityError
- Bundler::Settings
- Bundler::SharedHelpers
- Bundler::SimilarityDetector
- Bundler::Source
- Bundler::Source::Git
- Bundler::Source::Git::GitProxy
- Bundler::Source::Path
- Bundler::Source::Path::Installer
- Bundler::Source::Rubygems
- Bundler::SpecSet
- Bundler::SystemRubyVersion
- Bundler::UI
- Bundler::UI::RGProxy
- Bundler::UI::Shell
- Bundler::VersionConflict
- Gem
- Gem::Dependency
- Gem::Platform
- Gem::Requirement
- Gem::Specification
- Object

No matching classes.

# 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 12
    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 24
    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 37
    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 30
    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 53
    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

      Dir.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 20
    def revision
      @revision ||= allowed_in_path { git("rev-parse #{ref}").strip }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.