class Deck::CommandLine::ContainerHelper
Attributes
container[R]
Public Class Methods
new(name, options)
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 4 def initialize(name, options) @options = options load_blueprint name end
Public Instance Methods
build_command()
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 15 def build_command command = raw_build_command process_meta command end
run_command()
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 10 def run_command command = @container.run_command process_meta command end
update_latest_tag()
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 20 def update_latest_tag process_meta "docker tag -f #{@container.image_name} #{@container.repository}/#{@container.name}:latest" end
Private Instance Methods
load_blueprint(name)
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 25 def load_blueprint(name) @container = Deck.send(:eval, File.read("#{@options[:dir]}/#{name}.deck")) process_variables end
process_meta(command)
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 31 def process_meta(command) result = command @container.meta.each do |_, v| result = v.process(result) if v.respond_to? :process end result end
process_variables()
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 40 def process_variables Hash[*(@options[:value].split(',').map { |item| item.split('=') }.flatten)].each do |key, value| @container.meta[:variable].set key, value end unless @options[:value].nil? or @options[:value].empty? @container end
raw_build_command()
click to toggle source
# File lib/deck/command_line/container_helper.rb, line 48 def raw_build_command <<-EOF docker build --rm -t #{@container.image_name} - <<DOCKERFILE #{@container.build_command} DOCKERFILE EOF end