#!/usr/bin/env ruby
#
# = BioRuby shell - command line interface for the BioRuby library
#
# Copyright::   Copyright (C) 2005, 2006
#               Toshiaki Katayama <k@bioruby.org>
# License::     The Ruby License
#
# $Id: bioruby,v 1.19 2007/04/05 23:35:39 trevor Exp $
#

begin
  require 'rubygems'
  require_gem 'bio', '>= 1.1.0'
rescue LoadError
end
require 'bio/shell'

# required to run commands (getseq, ls etc.)
include Bio::Shell

# setup command line options, working directory, and irb configurations
Bio::Shell::Setup.new

# loading workspace and command history
Bio::Shell.load_session

# main loop
if Bio::Shell.cache[:rails]
  Bio::Shell.cache[:rails].join
else
  Signal.trap("SIGINT") do
    Bio::Shell.cache[:irb].signal_handle
  end

  catch(:IRB_EXIT) do
    Bio::Shell.cache[:irb].eval_input
  end
end

# saving workspace, command history and configuration before exit
Bio::Shell.save_session

