class Arkrb::CLI

Public Instance Methods

backup() click to toggle source
# File lib/arkrb/cli.rb, line 67
def backup
  ark_server(options[:instance]).backup!
end
broadcast(message) click to toggle source
# File lib/arkrb/cli.rb, line 109
def broadcast(message)
  ark_server(options[:instance]).broadcast message
end
checkmodupdates() click to toggle source
# File lib/arkrb/cli.rb, line 127
def checkmodupdates
  ark_server(options[:instance]).mod_updates_available?
end
checkupdate() click to toggle source
# File lib/arkrb/cli.rb, line 121
def checkupdate
  ark_server(options[:instance]).update_available?
end
disablemod(mod_id) click to toggle source
# File lib/arkrb/cli.rb, line 85
def disablemod(mod_id)
  ark_server(options[:instance]).disable_mod mod_id
end
enablemod(mod_id) click to toggle source
# File lib/arkrb/cli.rb, line 79
def enablemod(mod_id)
  ark_server(options[:instance]).enable_mod mod_id
end
install(name = nil) click to toggle source
# File lib/arkrb/cli.rb, line 14
def install(name = nil)
  if options[:list] || name.nil?
    arkmanager_status = (find_executable('arkmanager').nil?) ? 'Not Installed'.red : 'Installed'.green
    ark_install_status = (ark_installed?(options[:instance])) ? 'Installed'.green : 'Not Installed'.red
    # arkmanager_status = 'Not Installed'.red
    printf format("%-20s Status %21s\n", 'APP_NAME', 'Description')
    print_status('ark_manager', arkmanager_status, 'Installs ark-server-tools; Install with: ark_rb install tools')
    print_status('ark_server', ark_install_status, 'Installs the ark server; Install with: ark_rb install ark')
  end
  unless name.nil?
    case name.to_sym
      when :arkmanager, :ark_manager, :tools
        Arkrb.install.server_tools
      when :ark
        Arkrb.install.ark(options[:instance], false)
      else
        # do nothing
    end
  end
end
installmod(mod_id) click to toggle source
# File lib/arkrb/cli.rb, line 91
def installmod(mod_id)
  ark_server(options[:instance]).install_mod mod_id
end
rcon(command) click to toggle source
# File lib/arkrb/cli.rb, line 115
def rcon(command)
  ark_server(options[:instance]).rcon_cmd command
end
reinstallmod(mod_id) click to toggle source
# File lib/arkrb/cli.rb, line 103
def reinstallmod(mod_id)
  ark_server(options[:instance]).reinstall_mod mod_id
end
restart() click to toggle source
# File lib/arkrb/cli.rb, line 49
def restart
  ark_server(options[:instance]).restart!
end
saveworld() click to toggle source
# File lib/arkrb/cli.rb, line 73
def saveworld
  ark_server(options[:instance]).save_world!
end
start() click to toggle source
# File lib/arkrb/cli.rb, line 37
def start
  ark_server(options[:instance]).start!
end
status() click to toggle source
# File lib/arkrb/cli.rb, line 55
def status
  ark_server(options[:instance]).status!
end
stop() click to toggle source
# File lib/arkrb/cli.rb, line 43
def stop
  ark_server(options[:instance]).stop!
end
uninstallmod(mod_id) click to toggle source
# File lib/arkrb/cli.rb, line 97
def uninstallmod(mod_id)
  ark_server(options[:instance]).uninstall_mod mod_id
end
update() click to toggle source
# File lib/arkrb/cli.rb, line 61
def update
  ark_server(options[:instance]).update!
end

Private Instance Methods

ark_installed?(instance = 'main') click to toggle source

@return [Boolean]

# File lib/arkrb/cli.rb, line 134
def ark_installed?(instance = 'main')
  Arkrb.install.ark_installed?(instance)
end
ark_server(instance = 'main') click to toggle source

@return [Arkrb::Server]

# File lib/arkrb/cli.rb, line 139
def ark_server(instance = 'main')
  Arkrb::Server.new(instance, false)
end
print_status(item, status, how_to) click to toggle source