Class: R10K::Git::ShellGit::BareRepository
- Inherits:
-
BaseRepository
- Object
- BaseRepository
- R10K::Git::ShellGit::BareRepository
- 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, Logging::SYSLOG_LEVELS_MAP
Instance Method Summary collapse
- #clone(remote) ⇒ Object
- #exist? ⇒ Boolean
- #fetch(remote_name = 'origin') ⇒ Object
-
#git_dir ⇒ Pathname
The path to this Git repository.
-
#initialize(basedir, dirname) ⇒ BareRepository
constructor
A new instance of BareRepository.
-
#objects_dir ⇒ Pathname
The path to the objects directory in this Git repository.
Methods inherited from BaseRepository
#branches, #is_branch?, #is_tag?, #ref_type, #remotes, #resolve, #tags
Methods included from Logging
add_outputters, debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Constructor Details
#initialize(basedir, dirname) ⇒ BareRepository
Returns a new instance of BareRepository.
9 10 11 |
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 9 def initialize(basedir, dirname) @path = Pathname.new(File.join(basedir, dirname)) end |
Instance Method Details
#clone(remote) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 23 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 |
#exist? ⇒ Boolean
40 41 42 |
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 40 def exist? @path.exist? end |
#fetch(remote_name = 'origin') ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 31 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 |
#git_dir ⇒ Pathname
Returns The path to this Git repository.
14 15 16 |
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 14 def git_dir @path end |
#objects_dir ⇒ Pathname
Returns The path to the objects directory in this Git repository.
19 20 21 |
# File 'lib/r10k/git/shellgit/bare_repository.rb', line 19 def objects_dir @path + "objects" end |