Module: Buildkite::Pipelines::Helpers

Defined in:
lib/buildkite/pipelines/helpers.rb,
lib/buildkite/pipelines/helpers/key.rb,
lib/buildkite/pipelines/helpers/skip.rb,
lib/buildkite/pipelines/helpers/block.rb,
lib/buildkite/pipelines/helpers/label.rb,
lib/buildkite/pipelines/helpers/retry.rb,
lib/buildkite/pipelines/helpers/command.rb,
lib/buildkite/pipelines/helpers/plugins.rb,
lib/buildkite/pipelines/helpers/soft_fail.rb,
lib/buildkite/pipelines/helpers/depends_on.rb,
lib/buildkite/pipelines/helpers/timeout_in_minutes.rb

Defined Under Namespace

Modules: Block, Command, DependsOn, Key, Label, Plugins, Retry, Skip, SoftFail, TimeoutInMinutes

Constant Summary collapse

ATTRIBUTE_HELPERS =
{
  block: :Block,
  command: :Command,
  depends_on: :DependsOn,
  key: :Key,
  label: :Label,
  plugins: :Plugins,
  retry: :Retry,
  skip: :Skip,
  soft_fail: :SoftFail,
  timeout_in_minutes: :TimeoutInMinutes,
}.freeze

Class Method Summary collapse

Class Method Details

.prepend_attribute_helper(step_class, attribute) ⇒ Object



23
24
25
26
27
# File 'lib/buildkite/pipelines/helpers.rb', line 23

def self.prepend_attribute_helper(step_class, attribute)
  if ATTRIBUTE_HELPERS[attribute]
    step_class.prepend(const_get(ATTRIBUTE_HELPERS[attribute]))
  end
end

.sanitize(obj) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/buildkite/pipelines/helpers.rb', line 29

def self.sanitize(obj)
  case obj
  when Hash
    obj.transform_keys(&:to_s).transform_values { |value| sanitize(value) }
  when Array
    obj.map { |value| sanitize(value) }
  when Symbol, Pathname
    obj.to_s
  else
    obj
  end
end