module ForemanMaintain::Concerns::DirectoryMarker
Public Instance Methods
find_marked_directory(directory)
click to toggle source
# File lib/foreman_maintain/concerns/directory_marker.rb, line 10 def find_marked_directory(directory) find_dir_containing_file(directory, mark_name) end
mark_name()
click to toggle source
# File lib/foreman_maintain/concerns/directory_marker.rb, line 14 def mark_name cls = self.class.name.split('::').last.downcase ".#{cls}_directory_mark" end
with_marked_directory(directory) { || ... }
click to toggle source
# File lib/foreman_maintain/concerns/directory_marker.rb, line 4 def with_marked_directory(directory) mark_directory(directory) yield unmark_directory(directory) end
Private Instance Methods
mark_directory(directory)
click to toggle source
# File lib/foreman_maintain/concerns/directory_marker.rb, line 26 def mark_directory(directory) File.open(mark_file_path(directory), 'a') {} end
mark_file_path(directory)
click to toggle source
# File lib/foreman_maintain/concerns/directory_marker.rb, line 30 def mark_file_path(directory) File.join(directory, mark_name) end
unmark_directory(directory)
click to toggle source
# File lib/foreman_maintain/concerns/directory_marker.rb, line 21 def unmark_directory(directory) filename = mark_file_path(directory) File.delete(filename) if File.exist?(filename) end