Class: Gitlab::Ci::Pipeline::Chain::Config::Content::Source

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/pipeline/chain/config/content/source.rb

Constant Summary collapse

DEFAULT_YAML_FILE =
'.gitlab-ci.yml'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(pipeline, command) ⇒ Source

Returns a new instance of Source.


16
17
18
19
# File 'lib/gitlab/ci/pipeline/chain/config/content/source.rb', line 16

def initialize(pipeline, command)
  @pipeline = pipeline
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command


14
15
16
# File 'lib/gitlab/ci/pipeline/chain/config/content/source.rb', line 14

def command
  @command
end

Instance Method Details

#ci_config_pathObject


39
40
41
# File 'lib/gitlab/ci/pipeline/chain/config/content/source.rb', line 39

def ci_config_path
  @ci_config_path ||= project.ci_config_path.presence || DEFAULT_YAML_FILE
end

#contentObject

Raises:

  • (NotImplementedError)

27
28
29
# File 'lib/gitlab/ci/pipeline/chain/config/content/source.rb', line 27

def content
  raise NotImplementedError
end

#exists?Boolean

Returns:

  • (Boolean)

21
22
23
24
25
# File 'lib/gitlab/ci/pipeline/chain/config/content/source.rb', line 21

def exists?
  strong_memoize(:exists) do
    content.present?
  end
end

#projectObject


35
36
37
# File 'lib/gitlab/ci/pipeline/chain/config/content/source.rb', line 35

def project
  @project ||= @pipeline.project
end

#sourceObject

Raises:

  • (NotImplementedError)

31
32
33
# File 'lib/gitlab/ci/pipeline/chain/config/content/source.rb', line 31

def source
  raise NotImplementedError
end