[BioRuby-cvs] bioruby/lib/bio/shell setup.rb, 1.1, 1.2 script.rb, 1.1, 1.2

Katayama Toshiaki k at dev.open-bio.org
Wed Mar 28 20:21:28 UTC 2007


Update of /home/repository/bioruby/bioruby/lib/bio/shell
In directory dev.open-bio.org:/tmp/cvs-serv8522/shell

Modified Files:
	setup.rb script.rb 
Log Message:
* enhanced to store :mode in Bio::Shell.cache
* changed to execute bioruby script directly (instead of chdir to workdir etc.)
  and core.rb is modified to print messages to STDERR, user can capture
  result of the BioRuby script (STDOUT only) by
    % bioruby foo/bar/script.rb > result.txt
  however, this change also introduces possible problem that if the script
  depends on the serialized objects stored in shell/session/object file,
  user must chdir by him/her-self to the bioruby project directory
  so that bioruby shell can find shell/ directory in it.


Index: setup.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/setup.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** setup.rb	24 Dec 2006 08:32:08 -0000	1.1
--- setup.rb	28 Mar 2007 20:21:26 -0000	1.2
***************
*** 23,34 ****
  
      # load configuration and plugins
!     Dir.chdir(@workdir)
      Bio::Shell.configure
      Bio::Shell.cache[:workdir] = @workdir
  
      # set default to irb mode
!     @mode ||= :irb
  
!     case @mode
      when :web
        # setup rails server
--- 23,34 ----
  
      # load configuration and plugins
!     Dir.chdir(@workdir) if @workdir
      Bio::Shell.configure
      Bio::Shell.cache[:workdir] = @workdir
  
      # set default to irb mode
!     Bio::Shell.cache[:mode] = @mode || :irb
  
!     case Bio::Shell.cache[:mode]
      when :web
        # setup rails server
***************
*** 87,92 ****
      elsif File.file?(arg)
        # run file as a bioruby shell script
!       @workdir = File.join(File.dirname(arg), "..")
!       @script = File.basename(arg)
        @mode = :script
      else
--- 87,92 ----
      elsif File.file?(arg)
        # run file as a bioruby shell script
!       @workdir = nil
!       @script = arg
        @mode = :script
      else

Index: script.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/script.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** script.rb	24 Dec 2006 08:32:08 -0000	1.1
--- script.rb	28 Mar 2007 20:21:26 -0000	1.2
***************
*** 16,20 ****
        Bio::Shell.cache[:binding] = TOPLEVEL_BINDING
        Bio::Shell.load_session
!       eval(File.read(File.join(Bio::Shell.script_dir, script)), TOPLEVEL_BINDING)
        exit
      end
--- 16,20 ----
        Bio::Shell.cache[:binding] = TOPLEVEL_BINDING
        Bio::Shell.load_session
!       eval(File.read(script), TOPLEVEL_BINDING)
        exit
      end




More information about the bioruby-cvs mailing list