Module: RSCM::Platform

Defined in:
lib/rscm/platform.rb

Class Method Summary collapse

Class Method Details

.familyObject



5
6
7
8
9
10
11
12
# File 'lib/rscm/platform.rb', line 5

def family
  target_os = Config::CONFIG["target_os"] or ""
  return "powerpc-darwin" if target_os.downcase =~ /darwin/
  return "mswin32"  if target_os.downcase =~ /32/
  return "cygwin" if target_os.downcase =~ /cyg/
  return "freebsd" if target_os.downcase =~ /freebsd/
  raise "Unsupported OS: #{target_os}"
end

.prompt(dir = Dir.pwd) ⇒ Object



20
21
22
# File 'lib/rscm/platform.rb', line 20

def prompt(dir=Dir.pwd)
  prompt = "#{dir.gsub(/\//, File::SEPARATOR)} #{user}$"
end

.userObject



15
16
17
# File 'lib/rscm/platform.rb', line 15

def user
  family == "mswin32" ? ENV['USERNAME'] : ENV['USER']
end