lib/pdd/sources.rb in pdd-0.4.1 vs lib/pdd/sources.rb in pdd-0.5

- old
+ new

@@ -36,18 +36,19 @@ @magic = FileMagic.new(FileMagic::MAGIC_MIME) end # Fetch all sources. def fetch - files = Rake::FileList.new(@dir + '/**/*') do |list| + files = Rake::FileList.new(File.join(@dir, '**/*')) do |list| @exclude.each do |ptn| - Rake::FileList.new(@dir + '/' + ptn).each do |f| + Rake::FileList.new(File.join(@dir, ptn)).each do |f| list.exclude(f) end end - end + end.to_a + PDD.log.info "#{files.size} file(s) found" types = [/^text\//, /application\/xml/] - files.to_a + files .select { |f| types.index { |re| @magic.file(f) =~ re } } .map do |file| Source.new(file, file[@dir.length + 1, file.length]) end end