sct/lib/sct/commands/dev.rb in sct-1.1.1 vs sct/lib/sct/commands/dev.rb in sct-1.1.2
- old
+ new
@@ -27,19 +27,10 @@
end
def execute args, options
services = manifest["services"].to_a
- if services.length != 1
- error "Currently sct only supports a single service declaration in '#{@@file}'. Contact the infra guild if you consider this a limitation."
- end
-
- service, service_spec = services.first
-
- container = service_spec["container_name"]
- command = service_spec["command"] || ""
-
if Sct::Helper.is_windows?
host_machine_IP = (options.wsl_debugger ? `hostname -I | awk '{print $1}'` : `powershell.exe -c '(Test-Connection -ComputerName $env:computername -count 1).ipv4address.IPAddressToString' | dos2unix`).chomp
elsif Sct::Helper.is_mac_os?
host_machine_IP = `ipconfig getifaddr $(route get 8.8.8.8 | awk '/interface: / {print $2; }')`.chomp
else
@@ -64,14 +55,23 @@
if options.pull or options.build
system "docker image prune -f"
end
- return unless dc "rm --stop --force #{service}"
+ for service, settings in services
+ return unless dc "rm --stop --force #{service}"
+ end
- dc_dev "run --rm --service-ports --name #{container} #{service} #{command}", env
+ begin
+ dc_dev "up", env
+ rescue SystemExit, Interrupt
+ end
- dc "up --detach #{service}"
+ dc_dev "rm --force --stop"
+
+ for service, settings in services
+ dc "up --detach #{service}"
+ end
end
end
end