class Indocker::Artifacts::Git

Attributes

branch[R]
files[R]
name[R]
remote_name[R]
remote_url[R]

Public Class Methods

new(name:, remote_name:, remote_url:, branch:, files: [], source_path: nil, target_path: nil) click to toggle source
# File lib/indocker/artifacts/git.rb, line 4
def initialize(name:, remote_name:, remote_url:, branch:, files: [], source_path: nil, target_path: nil)
  @name        = name
  @remote_name = remote_name
  @remote_url  = remote_url
  @branch      = branch

  @files = build_all_files(
    files:       files,
    source_path: source_path,
    target_path: target_path,
  )
end

Public Instance Methods

build_source_path(path) click to toggle source
# File lib/indocker/artifacts/git.rb, line 34
def build_source_path(path)
  File.join(self.repository.clone_path, path)
end
is_git?() click to toggle source
# File lib/indocker/artifacts/git.rb, line 30
def is_git?
  true
end
project_name(url) click to toggle source
# File lib/indocker/artifacts/git.rb, line 26
def project_name(url)
  url.split('/').last.gsub('.git', '')
end
repository() click to toggle source
# File lib/indocker/artifacts/git.rb, line 17
def repository
  @repository ||= Indocker::Repositories::Git.new(@name).setup(
    remote_name: remote_name,
    remote_url:  remote_url,
    branch:      branch,
    clone_path:  "/tmp/#{Indocker.configuration.name}/artifacts/git/#{project_name(remote_url)}/#{branch}"
  )
end