class Vx::Builder::ScriptBuilderV2::Stage

Attributes

chdir[R]
environment[R]
name[R]
tasks[R]
vars[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/vx/builder/script_builder_v2.rb, line 31
def initialize(options = {})
  @name        = options[:name]
  @environment = options[:environment] || {}
  @tasks       = []
  @vars        = {}
  @chdir       = nil
end

Public Instance Methods

add_env(name, value, options = {}) click to toggle source
# File lib/vx/builder/script_builder_v2.rb, line 47
def add_env(name, value, options = {})
  if options[:hidden]
    @environment[name] = "!#{value}"
  else
    @environment[name] = value
  end
end
add_task(name, value) click to toggle source
# File lib/vx/builder/script_builder_v2.rb, line 39
def add_task(name, value)
  @tasks.push(name => value)
end
add_var(name, value) click to toggle source
# File lib/vx/builder/script_builder_v2.rb, line 59
def add_var(name, value)
  @vars[name] = value
end
chdir!(dir) click to toggle source
# File lib/vx/builder/script_builder_v2.rb, line 55
def chdir!(dir)
  @chdir = dir
end
tasks?() click to toggle source
# File lib/vx/builder/script_builder_v2.rb, line 43
def tasks?
  @tasks.any?
end
to_hash() click to toggle source
# File lib/vx/builder/script_builder_v2.rb, line 63
def to_hash
  h = { "name" => name }
  h.merge!("chdir" => chdir) if chdir
  h.merge!("vars" => vars) if vars.any?
  h.merge!( "environment" => environment ) if environment.any?
  h.merge!("tasks" => tasks) if tasks?
  h
end