Sha256: 07fb2949dcd61d8e70bbe0e57274e245d107535cd2a2c8b3346f299ad0c587fd
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module Sct class Config WINDOWS = "Windows" MAC_OS = "MacOS" UBUNTU = "Ubuntu" def self.dir user = ENV["SUDO_USER"] || ENV["USER"] if `uname -a`.match?("Darwin") home = "/Users" else home = "/home" end return "#{home}/#{user}/.config/sct" end def self.path return File.expand_path(File.join(self.dir, 'config')) end def self.exists return File.exists?(Config.path) end def self.get(key) config = self.read if !config.key?(key) return nil end return config[key] end def self.read if !self.exists return {} end contents = File.read(self.path) return Sct::Helpers.to_hash(contents) end def self.operatingSystem proc = `uname -a` case proc when /Microsoft/ os = WINDOWS when /Darwin/ os = MAC_OS else os = UBUNTU end return os end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sct-0.1.7 | lib/sct/config.rb |