class Shipper::Service
Attributes
name[R]
options[R]
path[R]
Public Class Methods
new(name, options)
click to toggle source
# File lib/shipper/service.rb, line 7 def initialize(name, options) @name = name @options = options @path = "#{Dir.pwd}/#{options['path']}" end
Public Instance Methods
ship!()
click to toggle source
# File lib/shipper/service.rb, line 13 def ship! executor.cd(path) options['before_build']&.each { |cmd| exec(cmd) } exec "docker build . -t #{options.fetch('repo')} #{build_args}".strip exec "docker push #{options.fetch('repo')}" end
Private Instance Methods
build_args()
click to toggle source
# File lib/shipper/service.rb, line 22 def build_args return nil if options['args'].nil? options['args'].map { |key, value| "--build-arg #{key}=#{value}" } .join(' ') end
exec(cmd)
click to toggle source
# File lib/shipper/service.rb, line 29 def exec(cmd) executor.exec(cmd) end
executor()
click to toggle source
# File lib/shipper/service.rb, line 33 def executor @executor ||= ::Shipper::Executor.new end