mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/shell.rb, lib/shell/process-controller.rb,
lib/shell/command-processor.rb: translate Japanese comments into English. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4578a096d1
commit
491c26f3ef
4 changed files with 30 additions and 30 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu May 17 19:17:11 2001 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* lib/shell.rb, lib/shell/process-controller.rb,
|
||||||
|
lib/shell/command-processor.rb: translate Japanese comments into
|
||||||
|
English.
|
||||||
|
|
||||||
Thu May 17 19:07:14 2001 Akinori MUSHA <knu@iDaemons.org>
|
Thu May 17 19:07:14 2001 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* doc/shell.rd.jp: RD'ify and make some fixes.
|
* doc/shell.rd.jp: RD'ify and make some fixes.
|
||||||
|
|
11
lib/shell.rb
11
lib/shell.rb
|
@ -123,10 +123,10 @@ class Shell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# ほとんどのShell Command は CommandProcessor により定義される.
|
# Most Shell commands are defined via CommandProcessor
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dir関連メソッド
|
# Dir related methods
|
||||||
#
|
#
|
||||||
# Shell#cwd/dir/getwd/pwd
|
# Shell#cwd/dir/getwd/pwd
|
||||||
# Shell#chdir/cd
|
# Shell#chdir/cd
|
||||||
|
@ -143,7 +143,8 @@ class Shell
|
||||||
attr :dir_stack
|
attr :dir_stack
|
||||||
alias dirs dir_stack
|
alias dirs dir_stack
|
||||||
|
|
||||||
# イテレータとして呼ばれると一時的にcdすることになる.
|
# If called as iterator, it restores the current directory when the
|
||||||
|
# block ends.
|
||||||
def chdir(path = nil)
|
def chdir(path = nil)
|
||||||
if iterator?
|
if iterator?
|
||||||
cwd_old = @cwd
|
cwd_old = @cwd
|
||||||
|
@ -202,7 +203,7 @@ class Shell
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# process 管理
|
# process management
|
||||||
#
|
#
|
||||||
def jobs
|
def jobs
|
||||||
@process_controller.jobs
|
@process_controller.jobs
|
||||||
|
@ -213,7 +214,7 @@ class Shell
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# command 定義
|
# command definitions
|
||||||
#
|
#
|
||||||
def Shell.def_system_command(command, path = command)
|
def Shell.def_system_command(command, path = command)
|
||||||
CommandProcessor.def_system_command(command, path)
|
CommandProcessor.def_system_command(command, path)
|
||||||
|
|
|
@ -65,14 +65,14 @@ class Shell
|
||||||
# CommandProcessor#expand_path(path)
|
# CommandProcessor#expand_path(path)
|
||||||
# path: String
|
# path: String
|
||||||
# return: String
|
# return: String
|
||||||
# pwdからみた絶対パスを返す
|
# returns the absolute path for <path>
|
||||||
#
|
#
|
||||||
def expand_path(path)
|
def expand_path(path)
|
||||||
@shell.expand_path(path)
|
@shell.expand_path(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# File関連コマンド
|
# File related commands
|
||||||
# Shell#foreach
|
# Shell#foreach
|
||||||
# Shell#open
|
# Shell#open
|
||||||
# Shell#unlink
|
# Shell#unlink
|
||||||
|
@ -87,7 +87,7 @@ class Shell
|
||||||
# Same as:
|
# Same as:
|
||||||
# File#foreach (when path is file)
|
# File#foreach (when path is file)
|
||||||
# Dir#foreach (when path is directory)
|
# Dir#foreach (when path is directory)
|
||||||
# pathはpwdからの相対パスになる
|
# path is relative to pwd
|
||||||
#
|
#
|
||||||
def foreach(path = nil, *rs)
|
def foreach(path = nil, *rs)
|
||||||
path = "." unless path
|
path = "." unless path
|
||||||
|
@ -108,7 +108,7 @@ class Shell
|
||||||
# Same as:
|
# Same as:
|
||||||
# File#open (when path is file)
|
# File#open (when path is file)
|
||||||
# Dir#open (when path is directory)
|
# Dir#open (when path is directory)
|
||||||
# modeはpathがファイルの時だけ有効
|
# mode has an effect only when path is a file
|
||||||
#
|
#
|
||||||
def open(path, mode)
|
def open(path, mode)
|
||||||
path = expand_path(path)
|
path = expand_path(path)
|
||||||
|
@ -181,7 +181,7 @@ class Shell
|
||||||
alias [] test
|
alias [] test
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dir関連メソッド
|
# Dir related methods
|
||||||
#
|
#
|
||||||
# Shell#mkdir
|
# Shell#mkdir
|
||||||
# Shell#rmdir
|
# Shell#rmdir
|
||||||
|
@ -454,18 +454,11 @@ class Shell
|
||||||
#
|
#
|
||||||
# CommandProcessor.install_system_commands(pre)
|
# CommandProcessor.install_system_commands(pre)
|
||||||
# pre: String - command name prefix
|
# pre: String - command name prefix
|
||||||
# define CommandProcessor.command() from all command of
|
# defines every command which belongs in default_system_path via
|
||||||
# default_system_path. If a method exists, and names of it and
|
# CommandProcessor.command(). It doesn't define already defined
|
||||||
# the target command are the same, the method is not defined.
|
# methods twice. By default, "pre_" is prefixes to each method
|
||||||
# Default action prefix "sys_" to the method name. The character
|
# name. Characters that may not be used in a method name are
|
||||||
# which is not forgiven as a method name (when the first char is
|
# all converted to '_'. Definition errors are just ignored.
|
||||||
# alphabet or char is alpha-numeric) converts into ``_''. A
|
|
||||||
# definition error is ignored.
|
|
||||||
# (Meaning same in Japanese: default_system_path上にのるコマンドを定
|
|
||||||
# 義する. すでに同名のメソッドが存在する時は, 定義を行なわない. デ
|
|
||||||
# フォルトでは, 全てのメソッドには接頭子"sys_"をつける. メソッド名
|
|
||||||
# として許されないキャラクタ(英数時以外とメソッド名の先頭が数値に
|
|
||||||
# なる場合)は, 強制的に``_''に変換する. 定義エラーは無視する.)
|
|
||||||
#
|
#
|
||||||
def self.install_system_commands(pre = "sys_")
|
def self.install_system_commands(pre = "sys_")
|
||||||
defined_meth = {}
|
defined_meth = {}
|
||||||
|
|
|
@ -102,7 +102,7 @@ class Shell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# jobのスケジュールの追加
|
# schedule a command
|
||||||
def add_schedule(command)
|
def add_schedule(command)
|
||||||
@jobs_sync.synchronize(:EX) do
|
@jobs_sync.synchronize(:EX) do
|
||||||
ProcessController.activate(self)
|
ProcessController.activate(self)
|
||||||
|
@ -114,7 +114,7 @@ class Shell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# job を開始する
|
# start a job
|
||||||
def start_job(command = nil)
|
def start_job(command = nil)
|
||||||
@jobs_sync.synchronize(:EX) do
|
@jobs_sync.synchronize(:EX) do
|
||||||
if command
|
if command
|
||||||
|
@ -127,7 +127,7 @@ class Shell
|
||||||
@active_jobs.push command
|
@active_jobs.push command
|
||||||
command.start
|
command.start
|
||||||
|
|
||||||
# そのjobをinputとするjobも開始する
|
# start all jobs that input from the job
|
||||||
for job in @waiting_jobs
|
for job in @waiting_jobs
|
||||||
start_job(job) if job.input == command
|
start_job(job) if job.input == command
|
||||||
end
|
end
|
||||||
|
@ -146,7 +146,7 @@ class Shell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# jobの終了
|
# terminate a job
|
||||||
def terminate_job(command)
|
def terminate_job(command)
|
||||||
@jobs_sync.synchronize(:EX) do
|
@jobs_sync.synchronize(:EX) do
|
||||||
@active_jobs.delete command
|
@active_jobs.delete command
|
||||||
|
@ -157,7 +157,7 @@ class Shell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# jobの強制終了
|
# kill a job
|
||||||
def kill_job(sig, command)
|
def kill_job(sig, command)
|
||||||
@jobs_sync.synchronize(:SH) do
|
@jobs_sync.synchronize(:SH) do
|
||||||
if @waiting_jobs.delete command
|
if @waiting_jobs.delete command
|
||||||
|
@ -177,7 +177,7 @@ class Shell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# すべてのjobの実行終了待ち
|
# wait for all jobs to terminate
|
||||||
def wait_all_jobs_execution
|
def wait_all_jobs_execution
|
||||||
@job_monitor.synchronize do
|
@job_monitor.synchronize do
|
||||||
begin
|
begin
|
||||||
|
@ -190,7 +190,7 @@ class Shell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# 簡単なfork
|
# simple fork
|
||||||
def sfork(command, &block)
|
def sfork(command, &block)
|
||||||
pipe_me_in, pipe_peer_out = IO.pipe
|
pipe_me_in, pipe_peer_out = IO.pipe
|
||||||
pipe_peer_in, pipe_me_out = IO.pipe
|
pipe_peer_in, pipe_me_out = IO.pipe
|
||||||
|
@ -237,7 +237,7 @@ class Shell
|
||||||
command.notify "warn: job(%id) was done already waitipd."
|
command.notify "warn: job(%id) was done already waitipd."
|
||||||
_pid = true
|
_pid = true
|
||||||
ensure
|
ensure
|
||||||
# プロセス終了時にコマンド実行が終わるまで待たせるため.
|
# when the process ends, wait until the command termintes
|
||||||
if _pid
|
if _pid
|
||||||
else
|
else
|
||||||
command.notify("notice: Process finishing...",
|
command.notify("notice: Process finishing...",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue