chore: align ark-suac app and refresh appstore zip
This commit is contained in:
+15
@@ -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
|
||||
+34
@@ -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
|
||||
+42
@@ -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
|
||||
Reference in New Issue
Block a user