Sha256: 5df728b36dd42c7a0742b5a0b30ea632dc831fff8812b45706481d5896cb380e

Contents?: true

Size: 1.07 KB

Versions: 70

Compression:

Stored size: 1.07 KB

Contents

require 'r10k/git/shellgit'
require 'r10k/git/shellgit/base_repository'

# Create and manage Git bare repositories.
class R10K::Git::ShellGit::BareRepository < R10K::Git::ShellGit::BaseRepository

  # @param basedir [String] The base directory of the Git repository
  # @param dirname [String] The directory name of the Git repository
  def initialize(basedir, dirname)
    @path = Pathname.new(File.join(basedir, dirname))
  end

  # @return [Pathname] The path to this Git repository
  def git_dir
    @path
  end

  # @return [Pathname] The path to the objects directory in this Git repository
  def objects_dir
    @path + "objects"
  end

  def clone(remote)
    proxy = R10K::Git.get_proxy_for_remote(remote)

    R10K::Git.with_proxy(proxy) do
      git ['clone', '--mirror', remote, git_dir.to_s]
    end
  end

  def fetch(remote_name='origin')
    remote = remotes[remote_name]
    proxy = R10K::Git.get_proxy_for_remote(remote)

    R10K::Git.with_proxy(proxy) do
      git ['fetch', remote_name, '--prune'], :git_dir => git_dir.to_s
    end
  end

  def exist?
    @path.exist?
  end
end

Version data entries

70 entries across 70 versions & 2 rubygems

Version Path
r10k-5.0.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-4.1.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-4.0.2 lib/r10k/git/shellgit/bare_repository.rb
r10k-4.0.1 lib/r10k/git/shellgit/bare_repository.rb
r10k-4.0.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-4.0.0.pre lib/r10k/git/shellgit/bare_repository.rb
r10k-3.16.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.15.4 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.15.3 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.15.2 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.15.1 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.15.0 lib/r10k/git/shellgit/bare_repository.rb
akerl-r10k-3.14.2.1 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.14.2 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.14.1 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.14.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.13.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.12.1 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.12.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-3.11.0 lib/r10k/git/shellgit/bare_repository.rb