Class: R10K::Git::ShellGit::BareRepository

Inherits:
BaseRepository show all
Defined in:
lib/r10k/git/shellgit/bare_repository.rb

Overview

Create and manage Git bare repositories.

Constant Summary

Constants included from Logging

Logging::LOG_LEVELS

Instance Method Summary collapse

Methods inherited from BaseRepository

#branches, #ref_type, #resolve, #tags

Methods included from Logging

debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level

Constructor Details

#initialize(basedir, dirname) ⇒ BareRepository

Returns a new instance of BareRepository.

Parameters:

  • basedir (String)

    The base directory of the Git repository

  • dirname (String)

    The directory name of the Git repository



14
15
16
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 14

def initialize(basedir, dirname)
  @path = Pathname.new(File.join(basedir, dirname))
end

Instance Method Details

#clone(remote) ⇒ Object



18
19
20
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 18

def clone(remote)
  git ['clone', '--mirror', remote, git_dir.to_s]
end

#exist?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 26

def exist?
  @path.exist?
end

#fetchObject



22
23
24
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 22

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

#git_dirPathname

Returns The path to this Git repository.

Returns:

  • (Pathname)

    The path to this Git repository



8
9
10
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 8

def git_dir
  @path
end