* lib/shell.rb: Document some methods of Shell. Patch by Carol
Nichols. [Ruby 1.9 - Bug #5417] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d5e7b3972c
commit
92af97c607
@ -1,3 +1,8 @@
|
|||||||
|
Sat Oct 8 03:17:51 2011 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* lib/shell.rb: Document some methods of Shell. Patch by Carol
|
||||||
|
Nichols. [Ruby 1.9 - Bug #5417]
|
||||||
|
|
||||||
Fri Oct 7 17:54:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Oct 7 17:54:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/test/unit/assertions.rb (assert_send, assert_not_send):
|
* lib/test/unit/assertions.rb (assert_send, assert_not_send):
|
||||||
|
24
lib/shell.rb
24
lib/shell.rb
@ -19,6 +19,7 @@ require "shell/error"
|
|||||||
require "shell/command-processor"
|
require "shell/command-processor"
|
||||||
require "shell/process-controller"
|
require "shell/process-controller"
|
||||||
|
|
||||||
|
# Shell implements an idiomatic Ruby interface for common UNIX shell commands.
|
||||||
class Shell
|
class Shell
|
||||||
@RCS_ID='-$Id: shell.rb,v 1.9 2002/03/04 12:01:10 keiju Exp keiju $-'
|
@RCS_ID='-$Id: shell.rb,v 1.9 2002/03/04 12:01:10 keiju Exp keiju $-'
|
||||||
|
|
||||||
@ -51,10 +52,25 @@ class Shell
|
|||||||
@verbose = val if val
|
@verbose = val if val
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Creates a new Shell instance with the current working directory
|
||||||
|
# set to +path+.
|
||||||
def cd(path)
|
def cd(path)
|
||||||
new(path)
|
new(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the directories in the current shell's PATH environment variable
|
||||||
|
# as an array of directory names. This sets the system_path for all
|
||||||
|
# instances of Shell.
|
||||||
|
#
|
||||||
|
# Example: If in your current shell, you did:
|
||||||
|
#
|
||||||
|
# $ echo $PATH
|
||||||
|
# /usr/bin:/bin:/usr/local/bin
|
||||||
|
#
|
||||||
|
# Running this method in the above shell would then return:
|
||||||
|
#
|
||||||
|
# ["/usr/bin", "/bin", "/usr/local/bin"]
|
||||||
|
#
|
||||||
def default_system_path
|
def default_system_path
|
||||||
if @default_system_path
|
if @default_system_path
|
||||||
@default_system_path
|
@default_system_path
|
||||||
@ -63,6 +79,10 @@ class Shell
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Sets the system_path that new instances of Shell should have as their
|
||||||
|
# initial system_path.
|
||||||
|
#
|
||||||
|
# +path+ should be an array of directory name strings.
|
||||||
def default_system_path=(path)
|
def default_system_path=(path)
|
||||||
@default_system_path = path
|
@default_system_path = path
|
||||||
end
|
end
|
||||||
@ -104,6 +124,9 @@ class Shell
|
|||||||
|
|
||||||
attr_reader :system_path
|
attr_reader :system_path
|
||||||
|
|
||||||
|
# Sets the system path (the Shell instance's PATH environment variable).
|
||||||
|
#
|
||||||
|
# +path+ should be an array of directory name strings.
|
||||||
def system_path=(path)
|
def system_path=(path)
|
||||||
@system_path = path
|
@system_path = path
|
||||||
rehash
|
rehash
|
||||||
@ -139,6 +162,7 @@ class Shell
|
|||||||
# Shell#mkdir
|
# Shell#mkdir
|
||||||
# Shell#rmdir
|
# Shell#rmdir
|
||||||
|
|
||||||
|
# Returns the current working directory.
|
||||||
attr_reader :cwd
|
attr_reader :cwd
|
||||||
alias dir cwd
|
alias dir cwd
|
||||||
alias getwd cwd
|
alias getwd cwd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user