sct/lib/sct/commands/dev.rb in sct-1.4.0 vs sct/lib/sct/commands/dev.rb in sct-1.5.0
- old
+ new
@@ -1,28 +1,25 @@
require 'yaml'
module Sct
class DevCommand
+ @@dc = system("docker compose version", out: "/dev/null", err: "/dev/null") ? "docker compose" : "docker-compose"
+
@@file = "docker-compose.dev.yml"
def error message
UI.error message
exit 1
end
- def dc_system
- return executer = system("which docker-compose") ? 'docker-compose' : 'docker compose'
- end
-
def dc command, env = {}
- system env, "#{dc_system} -f ~/development/spend-cloud/docker-compose.yml #{command}"
+ system env, "#{@@dc} -f ~/development/spend-cloud/docker-compose.yml #{command}"
end
def dc_dev command, env = {}
-
- system env, "#{dc_system} -f #{@@file} #{command}"
+ system env, "#{@@dc} -f #{@@file} #{command}"
end
def manifest
if !File.exist? @@file
error "Could not find file '#{@@file}'."
@@ -30,12 +27,9 @@
YAML.load File.read @@file
end
def execute args, options
-
- UI.message('Trying to start development environment')
-
services = manifest["services"].to_a
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?