module Arkrb

Constants

ARK_SERVER_TOOLS_MD5
BASH_EXEC
CURL_EXEC
USER_HOME
VERSION

Public Class Methods

executable(path = " click to toggle source

@return [String]

# File lib/arkrb.rb, line 15
def self.executable(path = "#{USER_HOME}/bin")
  old_mkmf_log = MakeMakefile::Logging.instance_variable_get(:@logfile)
  MakeMakefile::Logging.instance_variable_set(:@logfile, '/dev/null')
  arkmanager_exec = find_executable0('arkmanager', path)
  MakeMakefile::Logging.instance_variable_set(:@logfile, old_mkmf_log)
  raise Arkrb::Error::ArkManagerExecutableNotFound, 'We could not find the ark_rb binary! Please install it by running Arkrb.install.server_tools or executing the command `ark_rb install tools``' if arkmanager_exec.nil?
  arkmanager_exec
end
execute(command, command_opts = '', instance = 'main', sanitize = false) click to toggle source

@return [Integer, String]

# File lib/arkrb.rb, line 25
def self.execute(command, command_opts = '', instance = 'main', sanitize = false)
  exec_this = format('%s %s %s @%s', executable, command.to_s.tr('_', ''), command_opts, instance)
  stdin, stdout, stderr = Open3.popen3(exec_this)
  output = stdout.read.chomp
  errors = stderr.read.chomp
  errors += 'Your ARK server exec could not be found.' if output =~ /#{'ARK server exec could not be found'}/im

  Arkrb::ErrorParsing.new.sanitize!(command, errors) unless errors.strip.empty?

  if sanitize
    output_parsing = Arkrb::OutputParsing.new
    output_parsing.sanitize!(command, output)
  else
    puts output
    puts errors
  end

end
install() click to toggle source

@return [Arkrb::Install]

# File lib/arkrb.rb, line 10
def self.install
  Arkrb::Install.new
end