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

Version Path
dev-2.0.85 lib/dev_environment.rb
dev-2.0.77 lib/dev_environment.rb
dev-2.0.76 lib/dev_environment.rb
dev-2.0.75 lib/dev_environment.rb
dev-2.0.74 lib/dev_environment.rb
dev-2.0.73 lib/dev_environment.rb
dev-2.0.72 lib/dev_environment.rb
dev-2.0.71 lib/dev_environment.rb
dev-2.0.70 lib/dev_environment.rb
dev-2.0.69 lib/dev_environment.rb
dev-2.0.68 lib/dev_environment.rb
dev-2.0.67 lib/dev_environment.rb
dev-2.0.66 lib/dev_environment.rb
dev-2.0.64 lib/dev_environment.rb
dev-2.0.63 lib/dev_environment.rb
dev-2.0.62 lib/dev_environment.rb
dev-2.0.61 lib/dev_environment.rb
dev-2.0.60 lib/dev_environment.rb
dev-2.0.59 lib/dev_environment.rb
dev-2.0.58 lib/dev_environment.rb