Class: Dapp::Build::Stage::SourceBase

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/build/stage/source_base.rb

Overview

Base of source stages

Direct Known Subclasses

Source1, Source1Archive, Source2, Source3, Source4, Source5

Constant Summary collapse

GITARTIFACT_IMAGE =
'dappdeps/gitartifact:0.1.3'.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#application, #next_stage, #prev_stage

Instance Method Summary collapse

Methods inherited from Base

#build!, #dependencies, #dependencies_empty?, #initialize, #save_in_cache!, #signature

Methods included from Mod::Logging

#image_info, #log_build, #log_image_commands, #log_image_info, #should_be_introspected?, #should_be_not_present?, #should_be_skipped?, #size_difference?

Methods included from Helper::Trivia

class_to_lowercase, #class_to_lowercase, #delete_file, #kwargs

Methods included from Helper::Sha256

#hashsum, #paths_content_hashsum, #sha256

Constructor Details

This class inherits a constructor from Dapp::Build::Stage::Base

Instance Attribute Details

#next_source_stage ⇒ Object

Returns the value of attribute next_source_stage.



6
7
8
# File 'lib/dapp/build/stage/source_base.rb', line 6

def next_source_stage
  @next_source_stage
end

#prev_source_stage ⇒ Object

Returns the value of attribute prev_source_stage.



6
7
8
# File 'lib/dapp/build/stage/source_base.rb', line 6

def prev_source_stage
  @prev_source_stage
end

Instance Method Details

#dependencies_stage ⇒ Object



18
19
20
# File 'lib/dapp/build/stage/source_base.rb', line 18

def dependencies_stage
  prev_stage
end

#empty? ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/dapp/build/stage/source_base.rb', line 35

def empty?
  dependencies_stage.empty?
end

#image ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dapp/build/stage/source_base.rb', line 22

def image
  super do |image|
    image.add_volumes_from gitartifact_container
    image.add_command 'export PATH=/.dapp/deps/gitartifact/bin:$PATH'

    application.git_artifacts.each do |git_artifact|
      image.add_volume "#{git_artifact.repo.path}:#{git_artifact.repo.container_path}:ro"
      image.add_command git_artifact.send(apply_command_method, self)
    end
    yield image if block_given?
  end
end

#layer_commit(git_artifact) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/dapp/build/stage/source_base.rb', line 39

def layer_commit(git_artifact)
  commits[git_artifact] ||= begin
    if dependencies_stage && dependencies_stage.image.tagged?
      dependencies_stage.image.labels[git_artifact.full_name]
    else
      git_artifact.latest_commit
    end
  end
end