Module: Dapp::Dimg::Image::Argument

Included in:
Stage
Defined in:
lib/dapp/dimg/image/argument.rb

Instance Method Summary collapse

Instance Method Details

#add_change_cmd(value) ⇒ Object



21
22
23
# File 'lib/dapp/dimg/image/argument.rb', line 21

def add_change_cmd(value)
  add_change_option(:cmd, value)
end

#add_change_entrypoint(value) ⇒ Object



25
26
27
# File 'lib/dapp/dimg/image/argument.rb', line 25

def add_change_entrypoint(value)
  add_change_option(:entrypoint, value)
end

#add_change_env(**options) ⇒ Object



13
14
15
# File 'lib/dapp/dimg/image/argument.rb', line 13

def add_change_env(**options)
  add_change_option(:env, options)
end

#add_change_expose(value) ⇒ Object



9
10
11
# File 'lib/dapp/dimg/image/argument.rb', line 9

def add_change_expose(value)
  add_change_option(:expose, value)
end

#add_change_label(**options) ⇒ Object



17
18
19
# File 'lib/dapp/dimg/image/argument.rb', line 17

def add_change_label(**options)
  add_change_option(:label, options)
end

#add_change_onbuild(value) ⇒ Object



29
30
31
# File 'lib/dapp/dimg/image/argument.rb', line 29

def add_change_onbuild(value)
  add_change_option(:onbuild, value)
end

#add_change_user(value) ⇒ Object



37
38
39
# File 'lib/dapp/dimg/image/argument.rb', line 37

def add_change_user(value)
  add_change_option(:user, value)
end

#add_change_volume(value) ⇒ Object



5
6
7
# File 'lib/dapp/dimg/image/argument.rb', line 5

def add_change_volume(value)
  add_change_option(:volume, value)
end

#add_change_workdir(value) ⇒ Object



33
34
35
# File 'lib/dapp/dimg/image/argument.rb', line 33

def add_change_workdir(value)
  add_change_option(:workdir, value)
end

#add_command(*commands) ⇒ Object



57
58
59
# File 'lib/dapp/dimg/image/argument.rb', line 57

def add_command(*commands)
  @bash_commands.concat(commands.flatten)
end

#add_env(var, value) ⇒ Object



45
46
47
# File 'lib/dapp/dimg/image/argument.rb', line 45

def add_env(var, value)
  add_option(:env, "#{var}=#{value}")
end

#add_service_change_label(**options) ⇒ Object



41
42
43
# File 'lib/dapp/dimg/image/argument.rb', line 41

def add_service_change_label(**options)
  add_service_change_option(:label, options)
end

#add_service_command(*commands) ⇒ Object



61
62
63
# File 'lib/dapp/dimg/image/argument.rb', line 61

def add_service_command(*commands)
  @service_bash_commands.concat(commands.flatten)
end

#add_volume(value) ⇒ Object



49
50
51
# File 'lib/dapp/dimg/image/argument.rb', line 49

def add_volume(value)
  add_option(:volume, value)
end

#add_volumes_from(value) ⇒ Object



53
54
55
# File 'lib/dapp/dimg/image/argument.rb', line 53

def add_volumes_from(value)
  add_option(:'volumes-from', value)
end

#prepare_instructions(options) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/dapp/dimg/image/argument.rb', line 65

def prepare_instructions(options)
  options.map do |key, vals|
    case key
    when :cmd, :entrypoint then [vals]
    when :env, :label then vals.map(&method(:options_to_args)).flatten
    else vals
    end.map { |val| %(#{key.to_s.upcase} #{val}) }
  end.flatten
end