def search_for_host_specific_file(path)
      directory = File.dirname path
      filename = File.basename path
      extension = File.extname path
      basename = filename.chomp(extension)
      if Dir.exist? directory
        files = Dir.entries(directory)

        file = files.grep(/^#{filename}\.#{hostname.downcase}$/).first
        return File.join directory, file unless file.nil?

        extension.gsub!(/^\./, '\.')
        regex = /^#{basename}\.#{hostname.downcase}#{extension}$/
        file = files.grep(regex).first
        return File.join directory, file unless file.nil?
      end
      nil
    end
def search_for_host_specific_file(path)
      directory = File.dirname path
      filename = File.basename path
      extension = File.extname path
      basename = filename.chomp(extension)
      if Dir.exist? directory
        files = Dir.entries(directory)

        file = files.grep(/^#{filename}\.#{hostname.downcase}$/).first
        return File.join directory, file unless file.nil?

        extension.gsub!(/^\./, '\.')
        regex = /^#{basename}\.#{hostname.downcase}#{extension}$/
        file = files.grep(regex).first
        return File.join directory, file unless file.nil?
      end
      nil
    end
Will look for files with the naming pattern `filename.hostname.ext`.
 @param path [String] path to the non-host-specific file
 rubocop:disable Metrics/MethodLength