Sha256: dd289465ac09fc0a3cc02d4801cf66181f3ff04370d29506bdc2765be53c1955
Contents?: true
Size: 845 Bytes
Versions: 2
Compression:
Stored size: 845 Bytes
Contents
#!/usr/bin/env ruby require "./lib/kommando" require "yaml" loops=if ARGV[0] ARGV[0].to_i else -1 end docker_compose=YAML.load(File.read("docker-compose.yml")) services = docker_compose["services"].keys Kommando.run("docker-compose build", { output: true }).when(:failed) { raise "build failed" } ks = [] for service in services k = Kommando.new "docker-compose up #{service}" k.run_async ks << k end def cleanup(ks) ks.map(&:kill) Kommando.run "docker-compose down" end loop do puts "loops: #{loops}" loops = loops - 1 for k in ks do cmd=k.instance_variable_get(:@cmd) puts "#{cmd} (#{(k.code ? "STOP" : "RUNNING")})" if k.code puts k.out cleanup(ks) exit 1 end end print "-"*20; puts " #{DateTime.now.to_s}" sleep 2 if loops == 0 cleanup(ks) exit 0 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kommando-0.1.2 | bin/matrix |
kommando-0.1.1 | bin/matrix |