=begin
 ******************************************************************************
 * Copyright 1990-2009 MBARI
 * MBARI Proprietary Information. All rights reserved.
 ******************************************************************************
 * Summary  : Define the Benthic Rover Ruby load-path based on environment
 *            variables
 * Filename : rover_environment.rb
 * Author   : Henthorn
 * Project  : Benthic Rover
 * Version  : 1
 * Created  : Oct 2008
 * Modified :
=end

##
# Define Benthic Rover Ruby environment based on environment variables
#
# Usage: The following line should be first executable line of code in
# Benthic Rover code files.
#
# require "#{ENV['ROVER_HOME']}/rover_environment"

class RoverEnvironment

  ##
  #  Set LOAD_PATH variable using environment variables
  def self.setPath
    sep = File::SEPARATOR
    
    # Use ESP code
    #$LOAD_PATH.unshift("#{sep}home#{sep}henthorn#{sep}ESP#{sep}gen2#{sep}software#{sep}esp#{sep}lib#{sep}")
    $LOAD_PATH.unshift("#{sep}cf#{sep}gen2#{sep}software#{sep}esp#{sep}lib#{sep}")
    
    # Use Rover code
    home = ENV['ROVER_HOME']
    $LOAD_PATH.unshift(home)
  end

  # Self-executing
  RoverEnvironment.setPath
end

##
# Standalone unit test
#
if(__FILE__ == $0)
  puts ("Rover home dir is #{ENV['ROVER_HOME']}")
  puts ("LOAD_PATH is #{$LOAD_PATH}")
end
