Sha256: f291e4ddd3e88f8b52ee70f2854960fae8468aba835daf685be74d503e66a79a
Contents?: true
Size: 1.07 KB
Versions: 30
Compression:
Stored size: 1.07 KB
Contents
class Environment < Hash def initialize self[:home]=Environment.home self[:machine]=Environment.machine self[:user]=Environment.user end def self.home ["USERPROFILE","HOME"].each {|v| return ENV[v].gsub('\\','/') unless ENV[v].nil? } dir="~" dir=ENV["HOME"] unless ENV["HOME"].nil? dir=ENV["USERPROFILE"].gsub('\\','/') unless ENV["USERPROFILE"].nil? return dir end def self.machine if !ENV['COMPUTERNAME'].nil? return ENV['COMPUTERNAME'] end machine = `hostname` machine = machine.split('.')[0] if machine.include?('.') return machine.strip end def self.user return ENV['USER'] if !ENV['USER'].nil? #on Unix ENV['USERNAME'] end def self.dev_root ["DEV_HOME","DEV_ROOT"].each {|v| return ENV[v].gsub('\\','/') unless ENV[v].nil? } dir=home return dir end end class File def self.amalgamate filename,source File.open(filename,'w'){|file| source.each{|source_file| file.puts IO.read(source_file) } } end end
Version data entries
30 entries across 30 versions & 1 rubygems