ライブラリ
- ビルトイン (88)
- fileutils (67)
- openssl (12)
-
rubygems
/ require _ paths _ builder (12) -
webrick
/ config (12)
モジュール
- FileUtils (67)
-
Gem
:: RequirePathsBuilder (12) - Kernel (24)
-
WEBrick
:: Config (12)
キーワード
- Config (12)
- FileHandler (12)
-
NEWS for Ruby 2
. 1 . 0 (12) -
absolute
_ path (12) -
cp
_ lr (7) -
cp
_ r (12) - dirname (4)
- irb (12)
-
ln
_ s (12) - load (12)
- move (12)
- mv (12)
- realpath (12)
- require (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) - symlink (12)
-
write
_ require _ paths _ file _ if _ needed (12)
検索結果
先頭5件
-
File
. absolute _ path(file _ name , dir _ string=nil) -> String (21195.0) -
file_name を絶対パスに変換した文字列を返します。
...
file_name を絶対パスに変換した文字列を返します。
相対パスの場合はカレントディレクトリを基準とします。
dir_string を渡した場合はそのディレクトリを基準とします。
File.expand_path と異なり、 file_name 先頭が "~" である場......#=> "/home/matz/work/bar"
p ENV["HOME"] #=> "/home/matz"
p File.absolute_path("..") #=> "/home/matz/work"
p File.absolute_path("..", "/tmp") #=> "/"
p File.absolute_path("~") #=> "/home/matz/work/bar/~"
p File.absolute_path("~foo") #=> "/home/matz/work/......bar/~foo"
//}
@see File.expand_path... -
File
. dirname(filename , level=1) -> String (21184.0) -
filename の一番後ろのスラッシュより前を文 字列として返します。スラッシュを含まないファイル名に対しては "."(カレントディレクトリ)を返します。
...
filename の一番後ろのスラッシュより前を文
字列として返します。スラッシュを含まないファイル名に対しては
"."(カレントディレクトリ)を返します。
//emlist[例][ruby]{
p File.dirname("dir/file.ext") # => "dir"
p File.dirname("file.ext")......# => "."
//}
File.dirname の動作は dirname(3)
に従います。
//emlist[例][ruby]{
p File.dirname("foo/bar/") # => "foo"
p File.dirname("foo//bar") # => "foo"
//}
level が指定されたときは、最後のlevel個を取り除いた文字列を返します。
//emlist[leve......lを指定する例][ruby]{
File.dirname("/home/gumby/work/ruby.rb", 2) # => "/home/gumby"
File.dirname("/home/gumby/work/ruby.rb", 4) # => "/"
//}
@param filename ファイル名を表す文字列を指定します。
@param level 末尾からいくつ取り除くかを指定します。
@raise A... -
File
. expand _ path(path , default _ dir = & # 39; . & # 39;) -> String (21066.0) -
path を絶対パスに展開した文字列を返します。 path が相対パスであれば default_dir を基準にします。
...変数 HOME が使われます)に、
~USER はそのユーザのホームディレクトリに展開されます。
//emlist[例][ruby]{
p Dir.getwd #=> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/home/matz/wor......k"
p File.expand_path("..", "/tmp") #=> "/"
p File.expand_path("~") #=> "/home/matz"
p File.expand_path("~foo") #=> "/home/foo"
//}
@param path パスを表す文字列を指定します。
@param default_dir path が相対パスであれば default_dir を基準に展開されま... -
File
. realpath(pathname , basedir = nil) -> String (21048.0) -
与えられた pathname に対応する絶対パスを返します。
...合に発生します。
//emlist[例][ruby]{
ENV["HOME"] # => "/home/matz"
File.symlink("testfile", "testlink")
File.realpath("testfile") # => "/home/matz/testfile"
File.realpath("testlink") # => "/home/matz/testfile"
File.realpath("..", "/tmp") # => "/"
//}... -
Dir
. home -> String | nil (18150.0) -
現在のユーザまたは指定されたユーザのホームディレクトリを返します。
...れたユーザのホームディレクトリを返します。
Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。
//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}
@see File.expand_path......されたユーザのホームディレクトリを返します。
Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。
//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}
@see File.expand_path... -
Dir
. home(user) -> String | nil (18150.0) -
現在のユーザまたは指定されたユーザのホームディレクトリを返します。
...れたユーザのホームディレクトリを返します。
Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。
//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}
@see File.expand_path......されたユーザのホームディレクトリを返します。
Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。
//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}
@see File.expand_path... -
Gem
:: RequirePathsBuilder # write _ require _ paths _ file _ if _ needed(spec = @spec , gem _ home = @gem _ home) (6303.0) -
必要であれば、'.require_paths' というファイルを Gem ごとに作成します。
必要であれば、'.require_paths' というファイルを Gem ごとに作成します。 -
WEBrick
:: Config :: FileHandler -> Hash (6112.0) -
WEBrick::HTTPServlet::FileHandler の設定のデフォルト値を保持したハッシュです。
...WEBrick::HTTPServlet::FileHandler の設定のデフォルト値を保持したハッシュです。
require 'webrick'
WEBrick::Config::FileHandler = {
:NondisclosureName => [".ht*", "*~"],
:FancyIndexing => false,
:HandlerTable => {},
:HandlerCallback =>......nil,
:DirectoryCallback => nil,
:FileCallback => nil,
:UserDir => nil, # e.g. "public_html"
:AcceptableLanguages => [] # ["en", "ja", ... ]
}
: :AcceptableLanguages
コンテンツの言語を選択するオプション。設定値は文字列の配列......クトリ名。値は文字列。
ユーザfooのホームディレクトリが/home/fooで、:UserDirにpublic_htmlを設定した場合、
クライアントから/~foo/index.htmlがリクエストされると/home/foo/public_html/index.htmlの内容を表示される。
この設定を有効に... -
FileUtils
. # cp _ lr(src , dest , noop: nil , verbose: nil , dereference _ root: true , remove _ destination: false) (3006.0) -
src へのハードリンク dest を作成します。 src がディレクトリの場合、再帰的にリンクします。 dest がディレクトリの場合、src へのハードリンク dest/src を作成します。
...ルかディレクトリです。
@param options :noop, :verbose, :dereference_root, :remove_destination が指定できます。
c:FileUtils#options
@raise ArgumentError dest が src に含まれる場合に発生します。
@raise Errno::EEXIST src が一つで dest がすでに......quire 'fileutils'
FileUtils.rm_r site_ruby + '/mylib', force: true
FileUtils.cp_lr 'lib/', site_ruby + '/mylib'
//}
//emlist[様々なファイルを対象ディレクトリにリンクする例][ruby]{
require 'fileutils'
FileUtils.cp_lr %w(mail.rb field.rb debug/), site_ruby + '/tmail'
FileUtils.......cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', noop: true, verbose: true
//}
//emlist[内容をリンクする例][ruby]{
require 'fileutils'
# ディレクトリそのものではなく、ディレクトリの内容をリンクしたい場合は、
# 以下のようになります。(たとえ... -
FileUtils
. # cp _ r(src , dest , options = {}) -> () (3006.0) -
src を dest にコピーします。src がディレクトリであったら再帰的に コピーします。その際 dest がディレクトリなら dest/src にコピーします。
...ます。
c:FileUtils#options
//emlist[][ruby]{
# installing ruby library "mylib" under the site_ruby
require 'fileutils'
FileUtils.rm_r(site_ruby + '/mylib', force: true)
FileUtils.cp_r('lib/', site_ruby + '/mylib')
# other sample
require 'fileutils'
FileUtils.cp_r(%w(mail.rb field.......rb debug/), site_ruby + '/tmail')
FileUtils.cp_r(Dir.glob('*.rb'), '/home/taro/lib/ruby',
noop: true, verbose: true)
//}...