Sha256: ac4a41106164f5ae8f15a6996aedd1fdb4169ac9521e8d64e1861a8f79c41834

Contents?: true

Size: 906 Bytes

Versions: 3

Compression:

Stored size: 906 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/ai

# 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 for status codes 50+, 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.info "Quitting the AI...".red
  abort
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
csd-0.1.7 bin/ai
csd-0.1.6 bin/ai
csd-0.1.5 bin/ai