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.
- #lookup_commit(commit) ⇒ Object
Methods inherited from Base
#branch, #commit_at, #container_path, #diff, #file_exist_in_tree?, #git_bare, #latest_commit, #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 18 19 |
# 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_remote_error, data: { message: e., url: url } rescue Rugged::SslError => e raise Error::Rugged, code: :rugged_remote_error, data: { message: e., url: url } end end unless File.directory?(path) end |
Instance Method Details
#cleanup! ⇒ Object
28 29 30 31 |
# File 'lib/dapp/git_repo/remote.rb', line 28 def cleanup! super FileUtils.rm_rf path end |
#fetch!(branch = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/dapp/git_repo/remote.rb', line 21 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 |