lib/sct/docker/docker.rb in sct-0.1.6 vs lib/sct/docker/docker.rb in sct-0.1.7

- old
+ new

@@ -58,11 +58,11 @@ # Set the current PWD as a volume on the specified path in the container ### def self.setPwdAsVolume(volume_path) pwd = `pwd -P` - if self.operatingSystem() == "Windows" + if Sct::Config.operatingSystem == Sct::Config::WINDOWS pwd=self.convertPath(pwd) end addVolume(pwd, volume_path) end @@ -198,43 +198,25 @@ def self.addToCommandString(command_string, append) return command_string + append.gsub(/\r?\n/, "") + " " end ### - # Check the operating system on which this command is being run - ### - def self.operatingSystem() - proc = `uname -a` - - case proc - when /Microsoft/ - os = "Windows" - when /Darwin/ - os = "MacOS" - else - os = "Ubuntu" - end - - return os - end - - ### # Get the actual home path of the user. This may be different depending on the operating system ### def self.getTrueHomePath home_path = `echo ~` - if self.operatingSystem() == "Windows" + if Sct::Config.operatingSystem == Sct::Config::WINDOWS home_path = self.convertPath(`cmd.exe /c echo %userprofile%`, false) end return home_path end ### # Convert the unix paths to Windows paths for Windows systems ### def self.convertPath(path, to_native=true) - if self.operatingSystem() == "Windows" && to_native + if Sct::Config.operatingSystem == Sct::Config::WINDOWS && to_native return path.gsub(/\/mnt\/c/, 'C:/').gsub(/\/\//, '/').gsub(/\\\\/, "/").gsub(/\r\n?/, '') else return path.gsub(/C:\\/, '/mnt/c').gsub(/\\\\/, "/").gsub(/\\/, '/').gsub(/\r\n?/, '') end end