Method: Fuzz.iterate_paths

Defined in:
lib/fuzz/fuzz.rb

.iterate_paths(paths) ⇒ Object



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/fuzz/fuzz.rb', line 339

def self.iterate_paths(paths)
  paths.inject(true) do |result, path|
    if File.readable?(path) && (!File.symlink?(path) || follow_symlink?)
      if File.directory?(path)
        rc = handle_object(dirobj = Fuzz::DirObject.new(path))
        log_verbose(%Q{Iterating #{path}})
        if options.recurse && !excluded?(dirobj)
          rc = iterate_paths(Dir.glob(File.join(path, '*'))) && rc
        end
        rc
      elsif File.file?(path)
        handle_object(Fuzz::FileObject.new(path))
      else
        true
      end
    else
      log_warning(File.readable?(path) ? %Q{Cannot read #{path}} : %Q{Cannot follow symlink #{path}})
      false
    end && result
  end
end