chore: align ark-suac app and refresh appstore zip

This commit is contained in:
Joachim Friberg
2026-03-23 21:23:16 +01:00
parent 9c4265b429
commit 9c5ea400fb
36 changed files with 1611 additions and 3 deletions
@@ -0,0 +1,15 @@
module AsaCtrl
module Cli
class CliInterface
def initialize(opts)
@opts = opts
print_help! if opts[:help]
end
def print_help!
raise "Help not implemented!"
end
end
end
end
@@ -0,0 +1,34 @@
module AsaCtrl
module Cli
class ModsInterface < CliInterface
def initialize(opts)
super(opts)
execute!
end
def execute!
if @opts[:enable]
enable_mod!
end
exit! AsaCtrl::ExitCodes::OK
end
def enable_mod!
mod_id = @opts[:enable]
AsaCtrl::Mods::Database.get_instance.enable_mod!(mod_id)
puts "Enabled mod id '#{mod_id}' successfully. The server will download the mod upon startup."
rescue AsaCtrl::Errors::ModAlreadyEnabledError
AsaCtrl::Cli.exit_with_error!("This mod is already enabled! Use 'asa-ctrl mods --list' to see what mods are currently enabled.",
AsaCtrl::ExitCodes::MOD_ALREADY_ENABLED)
end
def print_help!
puts "Usage: asa-ctrl mods [--install] (--dry-run)"
exit! AsaCtrl::ExitCodes::OK
end
end
end
end
@@ -0,0 +1,42 @@
module AsaCtrl
module Cli
class RconInterface < CliInterface
def initialize(opts)
super(opts)
execute!
end
def execute!
if @opts[:exec]
run_command!
end
exit! AsaCtrl::ExitCodes::OK
end
def run_command!
rcon_command = @opts[:exec]
response = AsaCtrl::Rcon.exec_command!('127.0.0.1', AsaCtrl::Rcon.identify_port, rcon_command, AsaCtrl::Rcon.identify_password)
if response[:id] == AsaCtrl::Rcon::PacketTypes::RESPONSE_VALUE
puts response[:body]
else
AsaCtrl::Cli.exit_with_error!("Rcon command execution failed: #{response}",
AsaCtrl::ExitCodes::RCON_COMMAND_EXECUTION_FAILED)
end
rescue AsaCtrl::Errors::RconPasswordNotFoundError
AsaCtrl::Cli.exit_with_error!("Could not read RCON password. Make sure it is properly configured, either as start parameter ?ServerAdminPassword=mypass or " \
"in GameUserSettings.ini in the [ServerSettings] section as ServerAdminPassword=mypass", AsaCtrl::ExitCodes::RCON_PASSWORD_NOT_FOUND)
rescue AsaCtrl::Errors::RconAuthenticationError
AsaCtrl::Cli.exit_with_error!("Could not execute this RCON command. Authentication failed (wrong server password).",
AsaCtrl::ExitCodes::RCON_PASSWORD_WRONG)
end
def print_help!
puts "Usage: asa-ctrl rcon [--exec]"
exit! AsaCtrl::ExitCodes::OK
end
end
end
end
@@ -0,0 +1,23 @@
module AsaCtrl
module Cli
HELP_ARGUMENT = '--help'
HELP_DESCRIPTION = 'Prints a help message'
def self.passed_command(args)
if ARGV.size == 0
[]
else
[ARGV[0]]
end
end
def self.print_usage
puts "Usage: asa-ctrl [rcon] (--help)"
end
def self.exit_with_error!(message, code)
$stderr.puts "Error: #{message}"
exit! code
end
end
end