Class: LiooooUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/utils.rb,
lib/version.rb,
lib/sigcheck.rb,
lib/time_utils.rb

Defined Under Namespace

Modules: SigCheck, TimeUtils

Constant Summary collapse

LiooooUtilsServer =
UDPSocket.open { |s| s.connect('64.233.187.99', 1); s.addr.last }
VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.build_log_dir(source, target) ⇒ Object



9
10
11
12
# File 'lib/utils.rb', line 9

def build_log_dir source, target
  cmd = "ln -sf #{source} #{target}"
  ShellExec.exec! cmd
end

.is_dev?Boolean

check if is development mac

Returns:

  • (Boolean)


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

def is_dev?
  LiooooUtilsServer =~/^192.168/
end

.is_linux?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/utils.rb', line 41

def is_linux?
  os == :linux
end

.is_mac?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/utils.rb', line 37

def is_mac?
  os == :macosx
end

.is_win?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/utils.rb', line 45

def is_win?
  os == :windows
end

.osObject

get os type



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/utils.rb', line 21

def os
  host_os = RbConfig::CONFIG['host_os']
  case host_os
    when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
      :windows
    when /darwin|mac os/
      :macosx
    when /linux/
      :linux
    when /solaris|bsd/
      :unix
    else
      raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
  end
end

.usernameObject

get the os user name



50
51
52
# File 'lib/utils.rb', line 50

def username
  ENV['USER']
end