lib/bio/shell/core.rb in bio-1.4.3.0001 vs lib/bio/shell/core.rb in bio-1.5.0
- old
+ new
@@ -3,11 +3,10 @@
#
# Copyright:: Copyright (C) 2005, 2006
# Toshiaki Katayama <k@bioruby.org>
# License:: The Ruby License
#
-# $Id:$
#
module Bio::Shell::Core
SHELLDIR = "shell"
@@ -193,11 +192,11 @@
return dir
end
def find_flat_dir(dbname)
dir = File.join(bioflat_dir, dbname.to_s.strip)
- if File.exists?(dir)
+ if File.exist?(dir)
return dir
else
return nil
end
end
@@ -207,11 +206,11 @@
def load_config
load_config_file(config_file)
end
def load_config_file(file)
- if File.exists?(file)
+ if File.exist?(file)
STDERR.print "Loading config (#{file}) ... "
if hash = YAML.load(File.read(file))
@config.update(hash)
end
STDERR.puts "done"
@@ -310,11 +309,11 @@
warn "Error: Load aborted : #{$!}"
end
end
def load_object_file(file)
- if File.exists?(file)
+ if File.exist?(file)
STDERR.print "Loading object (#{file}) ... "
begin
bind = Bio::Shell.cache[:binding]
hash = Marshal.load(File.read(file))
hash.each do |k, v|
@@ -392,11 +391,11 @@
load_history_file(history_file)
end
end
def load_history_file(file)
- if File.exists?(file)
+ if File.exist?(file)
STDERR.print "Loading history (#{file}) ... "
File.open(file).each do |line|
unless line[/^# /]
Readline::HISTORY.push line.chomp
end
@@ -457,10 +456,10 @@
@script_end = Readline::HISTORY.size - 2
end
def save_script
if @script_begin and @script_end and @script_begin <= @script_end
- if File.exists?(script_file)
+ if File.exist?(script_file)
message = "Overwrite script file (#{script_file})? [y/n] "
else
message = "Save script file (#{script_file})? [y/n] "
end
if ask_yes_or_no(message)