lib/environment.rb in dev-2.0.45 vs lib/environment.rb in dev-2.0.46
- old
+ new
@@ -1,49 +1,49 @@
-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|
- if !ENV[v].nil?
- if(ENV[v].include?(';'))
- ENV[v].split(';').each{|d|
- return d if File.exists?(d)
- }
- else
- return ENV[v].gsub('\\','/')
- end
- end
- }
- dir=home
- return dir
- end
+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|
+ if !ENV[v].nil?
+ if(ENV[v].include?(';'))
+ ENV[v].split(';').each{|d|
+ return d if File.exists?(d)
+ }
+ else
+ return ENV[v].gsub('\\','/')
+ end
+ end
+ }
+ dir=home
+ return dir
+ end
end
\ No newline at end of file