Sha256: d5010ded87af77b9dd307e189e49a4db7283cb4d95ec5b928665a61bc707008f
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
require "pathname" module VagrantPlugins module DockerComposeProvisioner class DockerCompose def initialize(machine, config) @machine = machine @config = config end def build @machine.ui.detail(I18n.t(:docker_compose_build)) @machine.communicate.tap do |comm| comm.sudo("#{@config.executable} -f \"#{@config.yml}\" build") do |type, data| handle_comm(type, data) end end end def rm @machine.ui.detail(I18n.t(:docker_compose_rm)) @machine.communicate.tap do |comm| comm.sudo("#{@config.executable} -f \"#{@config.yml}\" rm --force") do |type, data| handle_comm(type, data) end end end def up @machine.ui.detail(I18n.t(:docker_compose_up)) @machine.communicate.tap do |comm| comm.sudo("#{@config.executable} -f \"#{@config.yml}\" up -d") do |type, data| handle_comm(type, data) end end end protected def handle_comm(type, data) data.chomp! return if data.empty? case type when :stdout; @machine.ui.detail(data) when :stderr; @machine.ui.error(data) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems