Class: Dapp::GitRepo::Remote

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/git_repo/remote.rb

Overview

Normal Git repo

Instance Attribute Summary

Attributes inherited from Base

#application, #name

Instance Method Summary collapse

Methods inherited from Base

#branch, #commit_at, #container_path, #exist_in_commit?, #git_bare, #latest_commit, #path

Constructor Details

#initialize(application, name, url:) ⇒ Remote

Returns a new instance of Remote.



5
6
7
8
9
10
11
12
13
# File 'lib/dapp/git_repo/remote.rb', line 5

def initialize(application, name, url:)
  super(application, name)

  @url = url

  application.project.log_secondary_process(application.project.t(code: 'process.git_artifact_clone', data: { name: name }), short: true) do
    git "clone --bare --depth 1 #{url} #{path}"
  end unless File.directory?(path)
end

Instance Method Details

#cleanup!Object



21
22
23
24
# File 'lib/dapp/git_repo/remote.rb', line 21

def cleanup!
  super
  FileUtils.rm_rf path
end

#fetch!(branch = 'master') ⇒ Object



15
16
17
18
19
# File 'lib/dapp/git_repo/remote.rb', line 15

def fetch!(branch = 'master')
  application.project.log_secondary_process(application.project.t(code: 'process.git_artifact_fetch', data: { name: name }), short: true) do
    git_bare "fetch origin #{branch}:#{branch}"
  end unless application.ignore_git_fetch || application.project.dry_run?
end