Sha256: c5c6e53258c806579a322eeab20ecfe33c004a4e259a624fda418f82754ac632

Contents?: true

Size: 835 Bytes

Versions: 29

Compression:

Stored size: 835 Bytes

Contents

module TerraformDevKit
  class OS
    def self.host_os
      case RUBY_PLATFORM
      when /linux/
        'linux'
      when /darwin/
        'darwin'
      when /mingw/
        'windows'
      else
        raise 'Cannot determine OS'
      end
    end

    def self.env_path_separator
      case host_os
      when 'linux', 'darwin'
        ':'
      when 'windows'
        ';'
      end
    end

    def self.join_env_path(path1, path2)
      "#{path1}#{env_path_separator}#{path2}"
    end

    # If running on Windows, this function converts a path separated with
    # forward slashes (the default for Ruby) into a path that uses backslashes.
    def self.convert_to_local_path(path)
      path.gsub(
        File::SEPARATOR,
        File::ALT_SEPARATOR || File::SEPARATOR)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
TerraformDevKit-0.4.0 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.8 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.7 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.6 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.5 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.4 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.3 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.2 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.1 lib/TerraformDevKit/os.rb
TerraformDevKit-0.3.1.pre.rc1 lib/TerraformDevKit/os.rb
TerraformDevKit-0.2.7 lib/TerraformDevKit/os.rb
TerraformDevKit-0.2.6 lib/TerraformDevKit/os.rb
TerraformDevKit-0.2.5 lib/TerraformDevKit/os.rb
TerraformDevKit-0.2.2 lib/TerraformDevKit/os.rb
TerraformDevKit-0.2.0 lib/TerraformDevKit/os.rb
TerraformDevKit-0.1.14 lib/TerraformDevKit/os.rb
TerraformDevKit-0.1.13 lib/TerraformDevKit/os.rb
TerraformDevKit-0.1.12 lib/TerraformDevKit/os.rb
TerraformDevKit-0.1.11 lib/TerraformDevKit/os.rb
TerraformDevKit-0.1.10 lib/TerraformDevKit/os.rb