[BioRuby-cvs] bioruby/lib/bio/shell setup.rb,1.5,1.6

Katayama Toshiaki k at dev.open-bio.org
Tue Jun 26 01:43:26 UTC 2007


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

Modified Files:
	setup.rb 
Log Message:
* changed to Dir.chdir only on mkdir/save instead of start up time


Index: setup.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/setup.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** setup.rb	20 Jun 2007 23:48:58 -0000	1.5
--- setup.rb	26 Jun 2007 01:43:24 -0000	1.6
***************
*** 20,29 ****
  
      # setup working directory
!     setup_workdir
  
      # load configuration and plugins
!     Dir.chdir(@workdir) if @workdir
!     Bio::Shell.configure
!     Bio::Shell.cache[:workdir] = @workdir
  
      # set default to irb mode
--- 20,28 ----
  
      # setup working directory
!     workdir = setup_workdir
  
      # load configuration and plugins
!     #Dir.chdir(workdir) if workdir # changed not chdir
!     Bio::Shell.configure(workdir)
  
      # set default to irb mode
***************
*** 78,116 ****
        arg = nil
      end
!     
      if arg.nil?
!       # run in current directory
!       @workdir = current_workdir
      elsif File.directory?(arg)
!       # run in existing directory
!       @workdir = arg
      elsif File.file?(arg)
!       # run file as a bioruby shell script
!       @workdir = nil
        @script = arg
        @mode = :script
      else
        # run in new directory
!       @workdir = install_workdir(arg)
      end
-   end
  
!   def current_workdir
! =begin
!     unless File.exists?(Bio::Shell.datadir)
!       message = "Are you sure to start new session in this directory? [y/n] "
!       unless Bio::Shell.ask_yes_or_no(message)
!         exit
!       end
!     end
! =end
!     savedir = "#{ENV['HOME']}/.bioruby"
!     FileUtils.mkdir_p(savedir)
!     return savedir
    end
  
    def install_workdir(workdir)
      FileUtils.mkdir_p(workdir)
-     return workdir
    end
  
--- 77,104 ----
        arg = nil
      end
! 
      if arg.nil?
!       # run in the current directory
!       workdir = "#{ENV['HOME']}/.bioruby"
!       install_workdir(workdir)
      elsif File.directory?(arg)
!       # run in the existing directory
!       workdir = arg
      elsif File.file?(arg)
!       # run file as a bioruby shell script (slightly tricky)
!       workdir = File.join(File.dirname(arg), "..")
        @script = arg
        @mode = :script
      else
        # run in new directory
!       workdir = arg
!       install_workdir(workdir)
      end
  
!     return workdir
    end
  
    def install_workdir(workdir)
      FileUtils.mkdir_p(workdir)
    end
  




More information about the bioruby-cvs mailing list