module Platform

vim: tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab

Public Class Methods

is_darwin() click to toggle source
# File lib/platform.rb, line 12
def self.is_darwin
        !RUBY_PLATFORM.match("darwin").nil?
end
is_linux() click to toggle source
# File lib/platform.rb, line 8
def self.is_linux
        !RUBY_PLATFORM.match("linux").nil?
end
is_nix() click to toggle source
# File lib/platform.rb, line 4
def self.is_nix
        !RUBY_PLATFORM.match("linux|darwin").nil?
end
open(path) click to toggle source
# File lib/platform.rb, line 16
def self.open(path)
        command = "start #{path}"
        if self.is_linux
                command = "xdg-open #{path}"
        elsif self.is_darwin
                command = "open #{path}"
        end
        sh command
end
runtime(cmd, runtime='v4.0.30319') click to toggle source
# File lib/platform.rb, line 40
def self.runtime(cmd, runtime='v4.0.30319')
        command = cmd
        if self.is_nix
                command = "mono --runtime=#{runtime} #{cmd}"
        end
        command
end
start(command) click to toggle source

src.chromium.org/chrome/trunk/deps/third_party/xdg-utils/scripts/xdg-terminal

#https://github.com/ssokolow/profile/blob/master/supplemental/xdg-terminal
        #http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true
# File lib/platform.rb, line 30
def self.start(command)
        if self.is_linux
                command = "xterm -e '#{command}'"
        elsif self.is_darwin
                command = "Terminal -e '#{command}'"
        else
                command = "start #{command}"
        end
end
switch(arg) click to toggle source
# File lib/platform.rb, line 48
def self.switch(arg)
        sw = self.is_nix ? " -" : " /"
        sw + arg
end