[BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.13,1.14
Katayama Toshiaki
k at pub.open-bio.org
Mon Nov 28 02:03:30 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio/shell
In directory pub.open-bio.org:/tmp/cvs-serv9454/lib/bio/shell
Modified Files:
core.rb
Log Message:
* open/close is renamed to load/save
* other method names are unified in core.rb for clean up
Index: core.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** core.rb 28 Nov 2005 02:08:22 -0000 1.13
--- core.rb 28 Nov 2005 07:03:28 -0000 1.14
***************
*** 61,67 ****
@config = {}
@cache = {}
load_config
load_plugin
- version_check
end
--- 61,68 ----
@config = {}
@cache = {}
+ check_version
+ check_marshal
load_config
load_plugin
end
***************
*** 72,76 ****
attr_accessor :cache
! def open
load_object
load_history
--- 73,77 ----
attr_accessor :cache
! def load
load_object
load_history
***************
*** 78,82 ****
end
! def close
closing_splash
save_history
--- 79,83 ----
end
! def save
closing_splash
save_history
***************
*** 86,98 ****
#--
! # *TODO* This works, but sometimes causes terminal collapse
! # how about to suppress loading messages?
! # or try to load @keggapi and @obda during this?
#++
! def opening_thread
begin
t1 = Thread.new do
! load_object
! load_history
end
t2 = Thread.new do
--- 87,109 ----
#--
! # *TODO* How to prevent terminal collapse and suppress loading messages?
#++
! def load_thread
! message = ''
begin
t1 = Thread.new do
! require 'stringio'
! sio = StringIO.new('')
! begin
! stdout_save = STDOUT.clone
! STDOUT.reopen(sio)
! load_object
! load_history
! ensure
! STDOUT.reopen(stdout_save)
! stdout_save.close
! message = sio.read
! sio.close
! end
end
t2 = Thread.new do
***************
*** 103,114 ****
rescue
end
end
### setup
! def version_check
if RUBY_VERSION < "1.8.2"
raise "BioRuby shell runs on Ruby version >= 1.8.2"
end
if @config[:marshal] and @config[:marshal] != MARSHAL
raise "Marshal version mismatch"
--- 114,129 ----
rescue
end
+ puts message
end
### setup
! def check_version
if RUBY_VERSION < "1.8.2"
raise "BioRuby shell runs on Ruby version >= 1.8.2"
end
+ end
+
+ def check_marshal
if @config[:marshal] and @config[:marshal] != MARSHAL
raise "Marshal version mismatch"
***************
*** 165,169 ****
def create_flat_dir(dbname)
if prefix = create_save_dir
! return prefix + BIOFLAT + dbname.to_s
else
return nil
--- 180,184 ----
def create_flat_dir(dbname)
if prefix = create_save_dir
! return prefix + BIOFLAT + dbname.to_s.strip
else
return nil
***************
*** 172,177 ****
def find_flat_dir(dbname)
! dir = SAVEDIR + BIOFLAT + dbname.to_s
! dir = USERDIR + BIOFLAT + dbname.to_s unless File.exists?(dir)
if File.exists?(dir)
return dir
--- 187,192 ----
def find_flat_dir(dbname)
! dir = SAVEDIR + BIOFLAT + dbname.to_s.strip
! dir = USERDIR + BIOFLAT + dbname.to_s.strip unless File.exists?(dir)
if File.exists?(dir)
return dir
***************
*** 448,470 ****
end
! def opening_splash
s = splash_message
l = s.length
c = ESC_SEQ
x = " "
print "\n"
if @config[:color]
! 0.step(l,2) do |i|
! l1 = l-i; l2 = l1/2; l4 = l2/2
! print "#{c[:n]}#{s[0,i]}#{x*l1}#{c[:y]}#{s[i,1]}\r"
! sleep(0.001)
! print "#{c[:n]}#{s[0,i]}#{x*l2}#{c[:g]}#{s[i,1]}#{x*(l1-l2)}\r"
! sleep(0.002)
! print "#{c[:n]}#{s[0,i]}#{x*l4}#{c[:r]}#{s[i,1]}#{x*(l2-l4)}\r"
! sleep(0.004)
! print "#{c[:n]}#{s[0,i+1]}#{x*l4}\r"
! sleep(0.008)
! end
end
if @config[:color]
--- 463,488 ----
end
! def splash_message_action
s = splash_message
l = s.length
c = ESC_SEQ
x = " "
+ 0.step(l,2) do |i|
+ l1 = l-i; l2 = l1/2; l4 = l2/2
+ STDERR.print "#{c[:n]}#{s[0,i]}#{x*l1}#{c[:y]}#{s[i,1]}\r"
+ sleep(0.001)
+ STDERR.print "#{c[:n]}#{s[0,i]}#{x*l2}#{c[:g]}#{s[i,1]}#{x*(l1-l2)}\r"
+ sleep(0.002)
+ STDERR.print "#{c[:n]}#{s[0,i]}#{x*l4}#{c[:r]}#{s[i,1]}#{x*(l2-l4)}\r"
+ sleep(0.004)
+ STDERR.print "#{c[:n]}#{s[0,i+1]}#{x*l4}\r"
+ sleep(0.008)
+ end
+ end
+ def opening_splash
print "\n"
if @config[:color]
! splash_message_action
end
if @config[:color]
More information about the bioruby-cvs
mailing list