Module: Helpers

Defined in:
lib/helpers.rb

Class Method Summary collapse

Class Method Details

.get_install_path(path, game) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/helpers.rb', line 18

def self.get_install_path(path, game)
  install_path = if path.nil?
    puts "Install path was not provided: defaulting to /opt/#{game}".yellow
   "/opt/#{game}"
  else
   path
  end
  install_path
end

.get_steamcmd_login(steam_user, steam_password) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/helpers.rb', line 28

def self.(steam_user, steam_password)
   = if steam_user.nil?
    "+login anonymous"
    else
      "+login #{steam_user} #{steam_password}"
    end
  
end

.remote_cmd(connection, command) ⇒ Object



4
5
6
# File 'lib/helpers.rb', line 4

def self.remote_cmd(connection, command)
  system("ssh #{connection} '#{command}'")
end

.steamcmd_exists?(path = "/usr/games/steamcmd", binary = "steamcmd") ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
# File 'lib/helpers.rb', line 8

def self.steamcmd_exists?(path = "/usr/games/steamcmd", binary = "steamcmd")
  if system("stat #{path}")
    true
  elsif system("which #{binary}")
    true
  else
    false
  end
end