[BioRuby-cvs] bioruby/lib/bio command.rb,1.1,1.2

Katayama Toshiaki k at pub.open-bio.org
Sun Oct 30 11:41:39 EST 2005


Update of /home/repository/bioruby/bioruby/lib/bio
In directory pub.open-bio.org:/tmp/cvs-serv29121/lib/bio

Modified Files:
	command.rb 
Log Message:
* converted to RDoc


Index: command.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** command.rb	16 Aug 2005 09:38:34 -0000	1.1
--- command.rb	30 Oct 2005 16:41:37 -0000	1.2
***************
*** 1,7 ****
  #
! # bio/command.rb - useful methods for external command execution
  #
! #   Copyright (C) 2003-2005 GOTO Naohisa <ng at bioruby.org>
! #   Copyright (C) 2004 KATAYAMA Toshiaki <k at bioruby.org>
  #
  #  This library is free software; you can redistribute it and/or
--- 1,13 ----
  #
! # = bio/command.rb - general methods for external command execution
  #
! # Copyright::	Copyright (C) 2003-2005
! # 		Naohisa Goto <ng at bioruby.org>
! #		Toshiaki Katayama <k at bioruby.org>
! # License::	LGPL
! #
! #  $Id$
! #
! #--
  #
  #  This library is free software; you can redistribute it and/or
***************
*** 19,23 ****
  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 25,29 ----
  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #++
  #
  
***************
*** 26,29 ****
--- 32,42 ----
  module Bio
  module Command
+ 
+ # = Bio::Command::Tools
+ #
+ # Bio::Command::Tools is a collection of useful methods for execution
+ # of external commands or web applications. Any wrapper class for
+ # applications shall include this class. Note that all methods below
+ # are private except for some methods.
  module Tools
  
***************
*** 35,38 ****
--- 48,52 ----
    private
  
+   # Escape special characters in command line string for cmd.exe on Windows.
    def escape_shell_windows(str)
      str = str.to_s
***************
*** 45,48 ****
--- 59,63 ----
    end
  
+   # Escape special characters in command line string for UNIX shells.
    def escape_shell_unix(str)
      str = str.to_s
***************
*** 51,54 ****
--- 66,70 ----
    end
  
+   # Escape special characters in command line string.
    def escape_shell(str)
      case RUBY_PLATFORM
***************
*** 60,63 ****
--- 76,80 ----
    end
  
+   # Generate command line string with special characters escaped.
    def make_command_line(ary)
      case RUBY_PLATFORM
***************
*** 69,80 ****
--- 86,107 ----
    end
  
+   # Generate command line string with special characters escaped
+   # for cmd.exe on Windows.
    def make_command_line_windows(ary)
      ary.collect { |str| escape_shell_windows(str) }.join(" ")
    end
  
+   # Generate command line string with special characters escaped
+   # for UNIX shells.
    def make_command_line_unix(ary)
      ary.collect { |str| escape_shell_unix(str) }.join(" ")
    end
  
+   # Executes the program.  Automatically select popen for Windows
+   # environment and open3 for the others.
+   #
+   # If block is given, yield the block with input and output IO objects.
+   # Note that in some platform, inn and out are the same object.
+   # Please be careful to do inn.close and out.close.
    def call_command_local(cmd, query = nil, &block)
      case RUBY_PLATFORM
***************
*** 86,89 ****
--- 113,119 ----
    end
  
+   # Executes the program via IO.popen for OS which doesn't support fork.
+   # If block is given, yield the block with IO objects.
+   # The two objects are the same because of limitation of IO.popen.
    def call_command_local_popen(cmd, query = nil)
      str = make_command_line(cmd)
***************
*** 101,104 ****
--- 131,139 ----
    end
  
+   # Executes the program via Open3.popen3
+   # If block is given, yield the block with input and output IO objects.
+   #
+   # From the view point of security, this method is recommended
+   # rather than exec_local_popen.
    def call_command_local_open3(cmd, query = nil)
      cmd = cmd.collect { |x| x.to_s }
***************
*** 121,200 ****
    end
  
    attr_reader :errorlog
    public :errorlog
  
! end #module Tools
! end #module Command
  end # module Bio
  
- 
- =begin
- 
- = Bio::Command
- 
- = Bio::Command::Tools
- 
-  Bio::Command::Tools is a collection of useful methods for execution
-  of external commands or web applications. Any wrapper class for
-  applications shall include this class. Note that all methods below
-  are private except for some methods.
- 
- --- Bio::Command::Tools#escape_shell(str)
- 
-       Escape special characters in command line string.
- 
- --- Bio::Command::Tools#escape_shell_unix(str)
- 
-       Escape special characters in command line string for UNIX shells.
- 
- --- Bio::Command::Tools#escape_shell_windows(str)
- 
-       Escape special characters in command line string for cmd.exe on Windows.
- 
- --- Bio::Command::Tools#make_command_line(ary)
- 
-       Generate command line string with special characters escaped.
- 
- --- Bio::Command::Tools#make_command_line_unix(ary)
- 
-       Generate command line string with special characters escaped
-       for UNIX shells.
- 
- --- Bio::Command::Tools#make_command_line_windows(ary)
- 
-       Generate command line string with special characters escaped
-       for cmd.exe on Windows.
- 
- --- Bio::Command::Tools#exec_command_local(cmd, query = nil)
- --- Bio::Command::Tools#exec_command_local(cmd) {|inn, out| ... }
- 
-       Executes the program.  Automatically select popen for Windows
-       environment and open3 for the others.
- 
-       If block is given, yield the block with input and output IO objects.
-       Note that in some platform, inn and out are the same object.
-       Please be careful to do inn.close and out.close.
- 
- --- Bio::Command::Tools#exec_command_local_popen(cmd, query = nil)
- --- Bio::Command::Tools#exec_command_local_popen(cmd) {|io, io| ... }
- 
-       Executes the program via IO.popen for OS which doesn't support
-       fork.
-       If block is given, yield the block with IO objects.
-       The two objects are the same because of limitation of IO.popen.
- 
- --- Bio::Command::Tools#exec_command_local_open3(cmd, query = nil)
- --- Bio::Command::Tools#exec_command_local_open3(cmd) {|inn, out| ... }
- 
-       Executes the program via Open3.popen3
-       If block is given, yield the block with input and output IO objects.
- 
-       From the view point of security, this method is recommended
-       rather than exec_local_popen.
- 
- --- Bio::Command::Tools#errorlog
- 
-       Shows the latest stderr of the program execution.
-       Note that this method may be thread unsafe.
- 
- =end
--- 156,166 ----
    end
  
+   # Shows the latest stderr of the program execution.
+   # Note that this method may be thread unsafe.
    attr_reader :errorlog
    public :errorlog
  
! end # module Tools
! end # module Command
  end # module Bio
  



More information about the bioruby-cvs mailing list