class Environment
Public Class Methods
dev_root()
click to toggle source
# File lib/environment.rb, line 34 def self.dev_root ["DEV_HOME","DEV_ROOT"].each {|v| return ENV[v].gsub('\\','/') unless ENV[v].nil? } dir=home #dir=ENV["DEV_ROOT"].gsub('\\','/') unless ENV["DEV_ROOT"].nil? return dir end
home()
click to toggle source
# File lib/environment.rb, line 9 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
machine()
click to toggle source
# File lib/environment.rb, line 19 def self.machine if !ENV['COMPUTERNAME'].nil? return ENV['COMPUTERNAME'] end machine = `hostname` machine = machine.split('.')[0] if machine.include?('.') return machine.strip end
new()
click to toggle source
# File lib/environment.rb, line 3 def initialize self[:home]=Environment.home self[:machine]=Environment.machine self[:user]=Environment.user end
user()
click to toggle source
# File lib/environment.rb, line 29 def self.user return ENV['USER'] if !ENV['USER'].nil? #on Unix ENV['USERNAME'] end