Module: Helpers
- Defined in:
- lib/helpers.rb
Class Method Summary collapse
- .get_install_path(path, game) ⇒ Object
- .get_steamcmd_login(steam_user, steam_password) ⇒ Object
- .remote_cmd(connection, command) ⇒ Object
- .steamcmd_exists?(path = "/usr/games/steamcmd", binary = "steamcmd") ⇒ Boolean
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.get_steamcmd_login(steam_user, steam_password) steam_login = if steam_user.nil? "+login anonymous" else "+login #{steam_user} #{steam_password}" end steam_login 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
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 |