Class: KuberKit::Tools::FilePresenceChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/tools/file_presence_checker.rb

Constant Summary collapse

FileNotFound =
Class.new(KuberKit::Error)

Instance Method Summary collapse

Instance Method Details

#check_dir!(dir_path) ⇒ Object



19
20
21
22
23
24
# File 'lib/kuber_kit/tools/file_presence_checker.rb', line 19

def check_dir!(dir_path)
  unless dir_exists?(dir_path)
    raise FileNotFound, "Directory not found at path: #{dir_path}"
  end
  true
end

#check_file!(file_path) ⇒ Object



8
9
10
11
12
13
# File 'lib/kuber_kit/tools/file_presence_checker.rb', line 8

def check_file!(file_path)
  unless file_exists?(file_path)
    raise FileNotFound, "File not found at path: #{file_path}"
  end
  true
end

#dir_exists?(dir_path) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/kuber_kit/tools/file_presence_checker.rb', line 26

def dir_exists?(dir_path)
  local_shell.dir_exists?(dir_path)
end

#file_exists?(file_path) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/kuber_kit/tools/file_presence_checker.rb', line 15

def file_exists?(file_path)
  local_shell.file_exists?(file_path)
end