Class: IronWorkerNG::Feature::Common::SetEnv::Feature

Inherits:
Base
  • Object
show all
Defined in:
lib/iron_worker_ng/feature/common/set_env.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#container_add, #rebase

Constructor Details

#initialize(code, key, value) ⇒ Feature

Returns a new instance of Feature.



9
10
11
12
13
14
# File 'lib/iron_worker_ng/feature/common/set_env.rb', line 9

def initialize(code, key, value)
  super(code)

  @key = key
  @value = value
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



6
7
8
# File 'lib/iron_worker_ng/feature/common/set_env.rb', line 6

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/iron_worker_ng/feature/common/set_env.rb', line 7

def value
  @value
end

Instance Method Details

#build_commandObject



20
21
22
23
24
25
26
# File 'lib/iron_worker_ng/feature/common/set_env.rb', line 20

def build_command
  if @code.remote_build_command || @code.full_remote_build
    "set_env \"#{@key}\", \"#{@value.to_s.gsub('"','\\"')}\""
  else
    nil
  end
end

#bundle(container) ⇒ Object



16
17
18
# File 'lib/iron_worker_ng/feature/common/set_env.rb', line 16

def bundle(container)
  container.runner_add "export #{@key}=\"#{@value.to_s.gsub('"','\\"')}\""
end