class TerraformDevKit::OS

Public Class Methods

convert_to_local_path(path) click to toggle source

If running on Windows, this function converts a path separated with forward slashes (the default for Ruby) into a path that uses backslashes.

# File lib/TerraformDevKit/os.rb, line 31
def self.convert_to_local_path(path)
  path.gsub(
    File::SEPARATOR,
    File::ALT_SEPARATOR || File::SEPARATOR)
end
env_path_separator() click to toggle source
# File lib/TerraformDevKit/os.rb, line 16
def self.env_path_separator
  case host_os
  when 'linux', 'darwin'
    ':'
  when 'windows'
    ';'
  end
end
host_os() click to toggle source
# File lib/TerraformDevKit/os.rb, line 3
def self.host_os
  case RUBY_PLATFORM
  when /linux/
    'linux'
  when /darwin/
    'darwin'
  when /mingw/
    'windows'
  else
    raise 'Cannot determine OS'
  end
end
join_env_path(path1, path2) click to toggle source
# File lib/TerraformDevKit/os.rb, line 25
def self.join_env_path(path1, path2)
  "#{path1}#{env_path_separator}#{path2}"
end