Sha256: 7880070ddc9470841b4f478e2b176152a933885625ea63a0bff0f33e2be8c965

Contents?: true

Size: 837 Bytes

Versions: 5

Compression:

Stored size: 837 Bytes

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)
    git ['clone', '--mirror', remote, git_dir.to_s]
  end

  def fetch
    git ['fetch', '--prune'], :git_dir => git_dir.to_s
  end

  def exist?
    @path.exist?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
r10k-2.2.2 lib/r10k/git/shellgit/bare_repository.rb
r10k-2.2.1 lib/r10k/git/shellgit/bare_repository.rb
r10k-2.2.0 lib/r10k/git/shellgit/bare_repository.rb
r10k-2.1.1 lib/r10k/git/shellgit/bare_repository.rb
r10k-2.1.0 lib/r10k/git/shellgit/bare_repository.rb