Class: Toft::FileChecker

Inherits:
Object
  • Object
show all
Includes:
CommandExecutor
Defined in:
lib/toft/file_checker.rb

Instance Method Summary collapse

Methods included from CommandExecutor

#cmd, #cmd!

Constructor Details

#initialize(rootfs, path) ⇒ FileChecker

Returns a new instance of FileChecker.



8
9
10
11
# File 'lib/toft/file_checker.rb', line 8

def initialize(rootfs, path)
  @rootfs = rootfs
  @path = path
end

Instance Method Details

#directory?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/toft/file_checker.rb', line 17

def directory?
  filetype == "directory"
end

#exist?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/toft/file_checker.rb', line 13

def exist?
  test("-e")
end

#filetypeObject



21
22
23
# File 'lib/toft/file_checker.rb', line 21

def filetype
  stat("%F")
end

#groupObject



29
30
31
# File 'lib/toft/file_checker.rb', line 29

def group
  stat("%G")
end

#modeObject



33
34
35
# File 'lib/toft/file_checker.rb', line 33

def mode
  stat("%a")
end

#ownerObject



25
26
27
# File 'lib/toft/file_checker.rb', line 25

def owner
  stat("%U")
end