lib/rake/delphi/liblist.rb in rake-delphi-0.0.18 vs lib/rake/delphi/liblist.rb in rake-delphi-0.0.19
- old
+ new
@@ -1,29 +1,45 @@
# encoding: utf-8
require 'rake/helpers/filelist'
+require 'rake/common/logger'
module Rake
module Delphi
class LibList < FileList
def read_ignored_libs
libs = []
file = (ENV['RAKE_DIR'] || Rake.original_dir) + '/.rake.ignored.libs'
- return libs unless File.exists?(file)
+ unless File.exists?(file)
+ Logger.trace(Logger::TRACE, "File #{file} not found")
+ return libs
+ end
+ Logger.trace(Logger::TRACE, "Reading #{file}")
IO.readlines(file).each do |line|
# skip comment lines (started with # or ;)
- next if /^\s*[#;]/.match(line)
+ if /^\s*[#;]/.match(line)
+ Logger.trace(Logger::TRACE, "Line #{line} ignored as a comment")
+ next
+ end
libs << FileList.get_ignored_dir_pattern(line.chomp)
end
libs
end
alias_method :initialize_base, :initialize
def initialize(*patterns)
initialize_base(patterns)
- @exclude_patterns |= read_ignored_libs
- @exclude_procs << proc { |fn| File.file?(fn) }
+ @exclude_patterns_libs = read_ignored_libs
+ @exclude_procs << proc do |fn|
+ ! File.directory?(fn)
+ end << proc do |fn|
+ @exclude_patterns_libs.any? do |pat|
+ match = fn =~ pat
+ Logger.trace(Logger::TRACE, "Dir #{fn} match pattern /#{pat}/. Ignored") if match
+ match
+ end
+ end
end
end
end
end