Sha256: a66f37169e1cad54cbe6b8ff77033499e96a48c53e028fb733a353a557fd26c4

Contents?: true

Size: 960 Bytes

Versions: 11

Compression:

Stored size: 960 Bytes

Contents

class Indocker::Artifacts::Git < Indocker::Artifacts::Base
  attr_reader :name, :remote_name, :remote_url, :branch, :files

  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

  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

  def project_name(url)
    url.split('/').last.gsub('.git', '')
  end

  def is_git?
    true
  end

  def build_source_path(path)
    File.join(self.repository.clone_path, path)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
indocker-0.3.9 lib/indocker/artifacts/git.rb
indocker-0.3.8 lib/indocker/artifacts/git.rb
indocker-0.3.7 lib/indocker/artifacts/git.rb
indocker-0.3.6 lib/indocker/artifacts/git.rb
indocker-0.3.5 lib/indocker/artifacts/git.rb
indocker-0.3.4 lib/indocker/artifacts/git.rb
indocker-0.3.3 lib/indocker/artifacts/git.rb
indocker-0.3.2 lib/indocker/artifacts/git.rb
indocker-0.3.1 lib/indocker/artifacts/git.rb
indocker-0.3.0 lib/indocker/artifacts/git.rb
indocker-0.1.17 lib/indocker/artifacts/git.rb