Module: RPS

Defined in:
lib/rps.rb,
lib/rps/ui.rb,
lib/rps/cli.rb,
lib/rps/runner.rb,
lib/rps/version.rb,
lib/rps/bsd_process.rb,
lib/rps/linux_process.rb,
lib/rps/macosx_process.rb

Defined Under Namespace

Classes: BsdProcess, CLI, LinuxProcess, MacOSXProcess, Runner, UI

Constant Summary collapse

PLATFORMS =
{
  :linux  => "LinuxProcess",
  :macosx => "MacOSXProcess"
}
VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.allObject



38
39
40
41
# File 'lib/rps.rb', line 38

def self.all
  clazz = PLATFORMS[platform] or raise platform_message
  const_get(clazz).all
end

.check_platformObject



32
33
34
35
36
# File 'lib/rps.rb', line 32

def self.check_platform
  unless PLATFORMS.has_key? platform
    abort platform_message
  end
end

.platformObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rps.rb', line 12

def self.platform
  @platform ||= (
    host_os = RbConfig::CONFIG['host_os']
    case host_os
    when /mswin|msys|mingw32/
      :windows
    when /darwin|mac os/
      :macosx
    when /linux/
      :linux
    when /bsd/
      :bsd
    when /solaris/
      :solaris
    else
      raise "unknown os: #{host_os.inspect}"
    end
  )
end

.platform_messageObject



43
44
45
# File 'lib/rps.rb', line 43

def self.platform_message
  "rps only works on #{SUPPORTED_PLATFORMS.inspect} at the moment"
end