mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									9b52ae2e64
								
							
						
					
					
						commit
						287a34ae0d
					
				
					 856 changed files with 13989 additions and 13989 deletions
				
			
		| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
#
 | 
			
		||||
#   shell/builtin-command.rb - 
 | 
			
		||||
#   shell/builtin-command.rb -
 | 
			
		||||
#   	$Release Version: 0.7 $
 | 
			
		||||
#   	$Revision$
 | 
			
		||||
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
 | 
			
		||||
#
 | 
			
		||||
# --
 | 
			
		||||
#
 | 
			
		||||
#   
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
require "shell/filter"
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ class Shell
 | 
			
		|||
    def initialize(sh, *opts)
 | 
			
		||||
      super sh
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    def each(rs = nil)
 | 
			
		||||
      # do nothing
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ class Shell
 | 
			
		|||
      super sh
 | 
			
		||||
      @strings = strings
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    def each(rs = nil)
 | 
			
		||||
      rs =  @shell.record_separator unless rs
 | 
			
		||||
      for str  in @strings
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ class Shell
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    def each(rs = nil)
 | 
			
		||||
      if @pattern[0] == ?/ 
 | 
			
		||||
      if @pattern[0] == ?/
 | 
			
		||||
	@files = Dir[@pattern]
 | 
			
		||||
      else
 | 
			
		||||
	prefix = @shell.pwd+"/"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
#
 | 
			
		||||
#   shell/command-controller.rb - 
 | 
			
		||||
#   shell/command-controller.rb -
 | 
			
		||||
#   	$Release Version: 0.7 $
 | 
			
		||||
#   	$Revision$
 | 
			
		||||
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
 | 
			
		||||
#
 | 
			
		||||
# --
 | 
			
		||||
#
 | 
			
		||||
#   
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
require "e2mmap"
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ class Shell
 | 
			
		|||
      for m in CommandProcessor.instance_methods(false) - NoDelegateMethods
 | 
			
		||||
	add_delegate_command_to_shell(m)
 | 
			
		||||
      end
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      def self.method_added(id)
 | 
			
		||||
	add_delegate_command_to_shell(id)
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ class Shell
 | 
			
		|||
    # Shell#test
 | 
			
		||||
    #
 | 
			
		||||
    # -
 | 
			
		||||
    #	
 | 
			
		||||
    #
 | 
			
		||||
    # CommandProcessor#foreach(path, rs)
 | 
			
		||||
    #	  path: String
 | 
			
		||||
    #	  rs:	String - record separator
 | 
			
		||||
| 
						 | 
				
			
			@ -168,7 +168,7 @@ class Shell
 | 
			
		|||
    #	  sh["e", "foo"]
 | 
			
		||||
    #	  sh[:exists?, "foo"]
 | 
			
		||||
    #	  sh["exists?", "foo"]
 | 
			
		||||
    #	  
 | 
			
		||||
    #
 | 
			
		||||
    alias top_level_test test
 | 
			
		||||
    def test(command, file1, file2=nil)
 | 
			
		||||
      file1 = expand_path(file1)
 | 
			
		||||
| 
						 | 
				
			
			@ -211,11 +211,11 @@ class Shell
 | 
			
		|||
    # CommandProcessor#mkdir(*path)
 | 
			
		||||
    #	  path: String
 | 
			
		||||
    #	same as Dir.mkdir()
 | 
			
		||||
    #	  
 | 
			
		||||
    #
 | 
			
		||||
    def mkdir(*path)
 | 
			
		||||
      @shell.check_point
 | 
			
		||||
      notify("mkdir #{path.join(' ')}")
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      perm = nil
 | 
			
		||||
      if path.last.kind_of?(Integer)
 | 
			
		||||
	perm = path.pop
 | 
			
		||||
| 
						 | 
				
			
			@ -236,7 +236,7 @@ class Shell
 | 
			
		|||
    # CommandProcessor#rmdir(*path)
 | 
			
		||||
    #	  path: String
 | 
			
		||||
    #	same as Dir.rmdir()
 | 
			
		||||
    #	  
 | 
			
		||||
    #
 | 
			
		||||
    def rmdir(*path)
 | 
			
		||||
      @shell.check_point
 | 
			
		||||
      notify("rmdir #{path.join(' ')}")
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +256,7 @@ class Shell
 | 
			
		|||
    #	example:
 | 
			
		||||
    #	  print sh.system("ls", "-l")
 | 
			
		||||
    #	  sh.system("ls", "-l") | sh.head > STDOUT
 | 
			
		||||
    # 
 | 
			
		||||
    #
 | 
			
		||||
    def system(command, *opts)
 | 
			
		||||
      if opts.empty?
 | 
			
		||||
	if command =~ /\*|\?|\{|\}|\[|\]|<|>|\(|\)|~|&|\||\\|\$|;|'|`|"|\n/
 | 
			
		||||
| 
						 | 
				
			
			@ -338,7 +338,7 @@ class Shell
 | 
			
		|||
    def notify(*opts, &block)
 | 
			
		||||
      Shell.notify(*opts) {|mes|
 | 
			
		||||
	yield mes if iterator?
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	mes.gsub!("%pwd", "#{@cwd}")
 | 
			
		||||
	mes.gsub!("%cwd", "#{@cwd}")
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -383,10 +383,10 @@ class Shell
 | 
			
		|||
     	          SystemCommand.new(@shell, '#{path}', *opts)
 | 
			
		||||
               end]), nil, __FILE__, __LINE__ - 1)
 | 
			
		||||
      rescue SyntaxError
 | 
			
		||||
	Shell.notify "warn: Can't define #{command} path: #{path}." 
 | 
			
		||||
	Shell.notify "warn: Can't define #{command} path: #{path}."
 | 
			
		||||
      end
 | 
			
		||||
      Shell.notify "Define #{command} path: #{path}.", Shell.debug?
 | 
			
		||||
      Shell.notify("Definition of #{command}: ", d, 
 | 
			
		||||
      Shell.notify("Definition of #{command}: ", d,
 | 
			
		||||
	     Shell.debug.kind_of?(Integer) && Shell.debug > 1)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -418,7 +418,7 @@ class Shell
 | 
			
		|||
                          @shell.__send__(:#{command},
 | 
			
		||||
                                          *(CommandProcessor.alias_map[:#{ali}].call *opts))
 | 
			
		||||
	                end]), nil, __FILE__, __LINE__ - 1)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
	else
 | 
			
		||||
           args = opts.collect{|opt| '"' + opt + '"'}.join(",")
 | 
			
		||||
           eval((d = %Q[def #{ali}(*opts)
 | 
			
		||||
| 
						 | 
				
			
			@ -426,22 +426,22 @@ class Shell
 | 
			
		|||
                        end]), nil, __FILE__, __LINE__ - 1)
 | 
			
		||||
	end
 | 
			
		||||
      rescue SyntaxError
 | 
			
		||||
	Shell.notify "warn: Can't alias #{ali} command: #{command}." 
 | 
			
		||||
	Shell.notify "warn: Can't alias #{ali} command: #{command}."
 | 
			
		||||
	Shell.notify("Definition of #{ali}: ", d)
 | 
			
		||||
	raise
 | 
			
		||||
      end
 | 
			
		||||
      Shell.notify "Define #{ali} command: #{command}.", Shell.debug?
 | 
			
		||||
      Shell.notify("Definition of #{ali}: ", d, 
 | 
			
		||||
      Shell.notify("Definition of #{ali}: ", d,
 | 
			
		||||
	     Shell.debug.kind_of?(Integer) && Shell.debug > 1)
 | 
			
		||||
      self
 | 
			
		||||
    end
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
    def self.unalias_command(ali)
 | 
			
		||||
      ali = ali.id2name if ali.kind_of?(Symbol)
 | 
			
		||||
      @alias_map.delete ali.intern
 | 
			
		||||
      undef_system_command(ali)
 | 
			
		||||
    end
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
    #
 | 
			
		||||
    # CommandProcessor.def_builtin_commands(delegation_class, command_specs)
 | 
			
		||||
    #	  delegation_class: Class or Module
 | 
			
		||||
| 
						 | 
				
			
			@ -472,7 +472,7 @@ class Shell
 | 
			
		|||
		    #{delegation_class}.#{meth}(#{call_arg_str})
 | 
			
		||||
		 end]
 | 
			
		||||
	Shell.notify "Define #{meth}(#{arg_str})", Shell.debug?
 | 
			
		||||
	Shell.notify("Definition of #{meth}: ", d, 
 | 
			
		||||
	Shell.notify("Definition of #{meth}: ", d,
 | 
			
		||||
		     Shell.debug.kind_of?(Integer) && Shell.debug > 1)
 | 
			
		||||
	eval d
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -513,7 +513,7 @@ class Shell
 | 
			
		|||
 | 
			
		||||
    #----------------------------------------------------------------------
 | 
			
		||||
    #
 | 
			
		||||
    #  class initializing methods  - 
 | 
			
		||||
    #  class initializing methods  -
 | 
			
		||||
    #
 | 
			
		||||
    #----------------------------------------------------------------------
 | 
			
		||||
    def self.add_delegate_command_to_shell(id)
 | 
			
		||||
| 
						 | 
				
			
			@ -561,7 +561,7 @@ class Shell
 | 
			
		|||
      normal_delegation_file_methods = [
 | 
			
		||||
	["atime", ["FILENAME"]],
 | 
			
		||||
	["basename", ["fn", "*opts"]],
 | 
			
		||||
	["chmod", ["mode", "*FILENAMES"]], 
 | 
			
		||||
	["chmod", ["mode", "*FILENAMES"]],
 | 
			
		||||
	["chown", ["owner", "group", "*FILENAME"]],
 | 
			
		||||
	["ctime", ["FILENAMES"]],
 | 
			
		||||
	["delete", ["*FILENAMES"]],
 | 
			
		||||
| 
						 | 
				
			
			@ -584,7 +584,7 @@ class Shell
 | 
			
		|||
      alias_method :rm, :delete
 | 
			
		||||
 | 
			
		||||
      # method related FileTest
 | 
			
		||||
      def_builtin_commands(FileTest, 
 | 
			
		||||
      def_builtin_commands(FileTest,
 | 
			
		||||
		   FileTest.singleton_methods(false).collect{|m| [m, ["FILENAME"]]})
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
#
 | 
			
		||||
#   shell/error.rb - 
 | 
			
		||||
#   shell/error.rb -
 | 
			
		||||
#   	$Release Version: 0.7 $
 | 
			
		||||
#   	$Revision$
 | 
			
		||||
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
 | 
			
		||||
#
 | 
			
		||||
# --
 | 
			
		||||
#
 | 
			
		||||
#   
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
require "e2mmap"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
#
 | 
			
		||||
#   shell/filter.rb - 
 | 
			
		||||
#   shell/filter.rb -
 | 
			
		||||
#   	$Release Version: 0.7 $
 | 
			
		||||
#   	$Revision$
 | 
			
		||||
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
 | 
			
		||||
#
 | 
			
		||||
# --
 | 
			
		||||
#
 | 
			
		||||
#   
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
class Shell
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ class Shell
 | 
			
		|||
    def input=(filter)
 | 
			
		||||
      @input = filter
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    def each(rs = nil)
 | 
			
		||||
      rs = @shell.record_separator unless rs
 | 
			
		||||
      if @input
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
#
 | 
			
		||||
#   shell/process-controller.rb - 
 | 
			
		||||
#   shell/process-controller.rb -
 | 
			
		||||
#   	$Release Version: 0.7 $
 | 
			
		||||
#   	$Revision$
 | 
			
		||||
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
 | 
			
		||||
#
 | 
			
		||||
# --
 | 
			
		||||
#
 | 
			
		||||
#   
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
require "forwardable"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +26,7 @@ class Shell
 | 
			
		|||
    class<<self
 | 
			
		||||
      extend Forwardable
 | 
			
		||||
 | 
			
		||||
      def_delegator("@ProcessControllersMonitor", 
 | 
			
		||||
      def_delegator("@ProcessControllersMonitor",
 | 
			
		||||
		    "synchronize", "process_controllers_exclusive")
 | 
			
		||||
 | 
			
		||||
      def active_process_controllers
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +118,7 @@ class Shell
 | 
			
		|||
    def waiting_jobs
 | 
			
		||||
      @waiting_jobs
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    def jobs_exist?
 | 
			
		||||
      @jobs_sync.synchronize(:SH) do
 | 
			
		||||
	@active_jobs.empty? or @waiting_jobs.empty?
 | 
			
		||||
| 
						 | 
				
			
			@ -158,7 +158,7 @@ class Shell
 | 
			
		|||
	else
 | 
			
		||||
	  command = @waiting_jobs.shift
 | 
			
		||||
#	  command.notify "job(%id) pre-start.", @shell.debug?
 | 
			
		||||
	  
 | 
			
		||||
 | 
			
		||||
	  return unless command
 | 
			
		||||
	end
 | 
			
		||||
	@active_jobs.push command
 | 
			
		||||
| 
						 | 
				
			
			@ -253,7 +253,7 @@ class Shell
 | 
			
		|||
	  end
 | 
			
		||||
 | 
			
		||||
	  pid = fork {
 | 
			
		||||
	    Thread.list.each do |th| 
 | 
			
		||||
	    Thread.list.each do |th|
 | 
			
		||||
#	      th.kill unless [Thread.main, Thread.current].include?(th)
 | 
			
		||||
	      th.kill unless Thread.current == th
 | 
			
		||||
	    end
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +261,7 @@ class Shell
 | 
			
		|||
	    STDIN.reopen(pipe_peer_in)
 | 
			
		||||
	    STDOUT.reopen(pipe_peer_out)
 | 
			
		||||
 | 
			
		||||
	    ObjectSpace.each_object(IO) do |io| 
 | 
			
		||||
	    ObjectSpace.each_object(IO) do |io|
 | 
			
		||||
	      if ![STDIN, STDOUT, STDERR].include?(io)
 | 
			
		||||
		io.close unless io.closed?
 | 
			
		||||
	      end
 | 
			
		||||
| 
						 | 
				
			
			@ -295,9 +295,9 @@ class Shell
 | 
			
		|||
			   "You can use Shell#transact or Shell#check_point for more safe execution.")
 | 
			
		||||
	    redo
 | 
			
		||||
	  end
 | 
			
		||||
	  
 | 
			
		||||
 | 
			
		||||
#	  command.notify "job(%id) pre-pre-finish.", @shell.debug?
 | 
			
		||||
	  @job_monitor.synchronize do 
 | 
			
		||||
	  @job_monitor.synchronize do
 | 
			
		||||
#	    command.notify "job(%id) pre-finish.", @shell.debug?
 | 
			
		||||
	    terminate_job(command)
 | 
			
		||||
#	    command.notify "job(%id) pre-finish2.", @shell.debug?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
#
 | 
			
		||||
#   shell/system-command.rb - 
 | 
			
		||||
#   shell/system-command.rb -
 | 
			
		||||
#   	$Release Version: 0.7 $
 | 
			
		||||
#   	$Revision$
 | 
			
		||||
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
 | 
			
		||||
#
 | 
			
		||||
# --
 | 
			
		||||
#
 | 
			
		||||
#   
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
require "shell/filter"
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ class Shell
 | 
			
		|||
      super(sh)
 | 
			
		||||
      @command = command
 | 
			
		||||
      @opts = opts
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      @input_queue = Queue.new
 | 
			
		||||
      @pid = nil
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -140,9 +140,9 @@ class Shell
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    # ex)
 | 
			
		||||
    #    if you wish to output: 
 | 
			
		||||
    #    if you wish to output:
 | 
			
		||||
    #	    "shell: job(#{@command}:#{@pid}) close pipe-out."
 | 
			
		||||
    #	 then 
 | 
			
		||||
    #	 then
 | 
			
		||||
    #	    mes: "job(%id) close pipe-out."
 | 
			
		||||
    #    yorn: Boolean(@shell.debug? or @shell.verbose?)
 | 
			
		||||
    def notify(*opts, &block)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@
 | 
			
		|||
#
 | 
			
		||||
# --
 | 
			
		||||
#
 | 
			
		||||
#   
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
class Shell
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue