Sha256: c3c61fcd98f4ed868c32c8272d54e1f2f8eaf5dbdfe78bc6bb2d1e5987ab8219

Contents?: true

Size: 942 Bytes

Versions: 1

Compression:

Stored size: 942 Bytes

Contents

#!/usr/bin/env ruby

# NOTE: If you would like to execute this file as a developer
#       but not install the CSD gem, you can use this command:
#       ruby -I path/to/csd/lib path/to/csd/bin/tta

# First, let's load the RubyGems framework and the CSD gem.
# Even though RubyGems is already loaded for Ruby >= 1.9,
# we want to go sure here and load it to provide robustness
require 'rubygems'
require 'csd'

begin
  # Running the CSD library and telling it who started it
  CSD.bootstrap :executable => 'ai'
rescue CSD::Error::CSDError => e
  # Here we catch CSD internal errors and exit with the propriate status code
  # We output the error message only for status codes 50 and higher, because they are rather severe
  CSD.ui.error e.message unless e.status_code <= 49
  exit e.status_code
rescue Interrupt
  # Lastly, close the AI gracefully on abnormal termination
  CSD.ui.separator
  CSD.ui.info "Quitting the AI...".red
  exit 1
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csd-0.1.10 bin/ai