Class: Dapp::GitRepo::Remote
Overview
Normal Git repo
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #cleanup! ⇒ Object
- #fetch!(branch = nil) ⇒ Object
-
#initialize(dimg, name, url:) ⇒ Remote
constructor
A new instance of Remote.
Methods inherited from Base
#branch, #commit_at, #container_path, #git_bare, #latest_commit, #old_git_bare, #path
Constructor Details
#initialize(dimg, name, url:) ⇒ Remote
Returns a new instance of Remote.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dapp/git_repo/remote.rb', line 5 def initialize(dimg, name, url:) super(dimg, name) @url = url dimg.project.log_secondary_process(dimg.project.t(code: 'process.git_artifact_clone', data: { name: name }), short: true) do begin Rugged::Repository.clone_at(url, path, bare: true) rescue Rugged::NetworkError => e raise Error::Rugged, code: :rugged_network_error, data: { message: e., url: url } end end unless File.directory?(path) end |
Instance Method Details
#cleanup! ⇒ Object
26 27 28 29 |
# File 'lib/dapp/git_repo/remote.rb', line 26 def cleanup! super FileUtils.rm_rf path end |
#fetch!(branch = nil) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/dapp/git_repo/remote.rb', line 19 def fetch!(branch = nil) branch ||= self.branch dimg.project.log_secondary_process(dimg.project.t(code: 'process.git_artifact_fetch', data: { name: name }), short: true) do .fetch('origin', [branch]) end unless dimg.ignore_git_fetch || dimg.project.dry_run? end |