lib/wolf_core/utils/file_utils.rb
module WolfCore module FileUtils module_function def require_relative_folder(*folders) folder_files = File.join(*folders, '**', '*.rb') files_to_require = Dir[folder_files].sort safe_require(files_to_require) end def safe_require(missing_files) while missing_files.any? files_to_require = missing_files missing_files = [] files_to_require.each do |file| begin require_relative file rescue NameError missing_files << file end end end end def delete_files(*args) pattern = File.join(*args) files_to_delete = Dir.glob(pattern) files_to_delete.each do |file| File.delete(file) puts "File deleted: #{file}" end puts "File Deleting Process Finished! (#{files_to_delete.size} files deleted)" end end end