Methods
- +
- /
- cd
- chdir
- chmod_r
- chown_r
- chroot
- cp_r
- delete
- directory?
- entries
- foreach
- new
- paths
- rm_r
- rm_rf
- rmdir
- unlink
Public Class methods
[ show source ]
# File lib/folio/directory.rb, line 7 def initialize(path=nil) super(path || Dir.pwd) raise FileNotFound unless ::File.directory?(@path) end
Public Instance methods
Join paths.
This method is also aliased as
+
[ show source ]
# File lib/folio/directory.rb, line 75 def /(fname) FileObject[path, fname] end
Alias for chdir
This method is also aliased as
cd
[ show source ]
# File lib/folio/directory.rb, line 51 def chdir(&block) ::Dir.chdir(path, &block) end
[ show source ]
# File lib/folio/directory.rb, line 37 def chmod_r(mode) util.chmod_r(mode, path) end
alias_method :chmod_R, :chmod_r
[ show source ]
# File lib/folio/directory.rb, line 42 def chown_r(user, group) util.chown_r(user, group, path) end
[ show source ]
# File lib/folio/directory.rb, line 56 def chroot(&block) ::Dir.chroot(path, &block) end
Copy recursively.
[ show source ]
# File lib/folio/directory.rb, line 18 def cp_r(dest) util.cp_r(path, dest) end
Alias for rmdir
[ show source ]
# File lib/folio/directory.rb, line 12 def directory? ; true ; end
[ show source ]
# File lib/folio/directory.rb, line 61 def entries ::Dir.entries(path) end
[ show source ]
# File lib/folio/directory.rb, line 65 def foreach(&block) ::Dir.foreach(path, &block) end
TODO: use enumerator (?)
[ show source ]
# File lib/folio/directory.rb, line 70 def paths (::Dir.entries(path) - ['.', '..']).collect{ |f| FileObject[path, f] } end
[ show source ]
# File lib/folio/directory.rb, line 29 def rm_r util.rm_r(path) end
[ show source ]
# File lib/folio/directory.rb, line 33 def rm_rf(list) util.rm_rf(path) end
[ show source ]
# File lib/folio/directory.rb, line 22 def rmdir util.rmdir(path) end
Alias for rmdir