class Fi::Dir
Public Class Methods
back()
click to toggle source
# File lib/fi/dir.rb, line 18 def self.back change(@history.pop || current) end
change(dir=home)
click to toggle source
# File lib/fi/dir.rb, line 13 def self.change(dir=home) @history << current ::Dir.chdir dir end
current()
click to toggle source
# File lib/fi/dir.rb, line 6 def self.current ::Dir.pwd end
delete(dir)
click to toggle source
# File lib/fi/dir.rb, line 35 def self.delete(dir) FileUtils.rm_r dir end
delete!(dir)
click to toggle source
# File lib/fi/dir.rb, line 39 def self.delete!(dir) FileUtils.rm_rf dir end
exist?(dirname)
click to toggle source
# File lib/fi/dir.rb, line 31 def self.exist?(dirname) ::Dir.exist? dirname end
home(user=nil)
click to toggle source
# File lib/fi/dir.rb, line 47 def self.home(user=nil) return ::Dir.home user if user ::Dir.home end
list(path=current)
click to toggle source
# File lib/fi/dir.rb, line 22 def self.list(path=current) directories = list! path directories.reject { |d| d =~ /^\./ } end
list!(path=current)
click to toggle source
# File lib/fi/dir.rb, line 27 def self.list!(path=current) ::Dir.entries Path.expand(path) end
new(*dirs)
click to toggle source
# File lib/fi/dir.rb, line 52 def initialize(*dirs) dirs.each do |dir| ::FileUtils.mkdir_p dir end end
rename(dirname, name)
click to toggle source
# File lib/fi/dir.rb, line 43 def self.rename(dirname, name) FileUtils.mv dirname, name end