Sha256: 527f0f0811c8442073987064056fb9a57c0ae68da252eb20d8be569f1840337d

Contents?: true

Size: 675 Bytes

Versions: 6

Compression:

Stored size: 675 Bytes

Contents

require 'rbconfig'

module RSCM
  module Platform
    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
    module_function :family
    
    def user
      family == "mswin32" ? ENV['USERNAME'] : ENV['USER']
    end
    module_function :user
    
    def prompt(dir=Dir.pwd)
      prompt = "#{dir.gsub(/\//, File::SEPARATOR)} #{user}$"
    end
    module_function :prompt
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rscm-0.4.2 lib/rscm/platform.rb
rscm-0.4.5 lib/rscm/platform.rb
rscm-0.5.0 lib/rscm/platform.rb
rscm-0.4.3 lib/rscm/platform.rb
rscm-0.5.1 lib/rscm/platform.rb
rscm-0.4.4 lib/rscm/platform.rb