lib/CLIntegracon/file_tree_spec.rb in clintegracon-0.8.0 vs lib/CLIntegracon/file_tree_spec.rb in clintegracon-0.8.1
- old
+ new
@@ -203,12 +203,13 @@
# Applies the in the context configured transformations.
#
def transform_paths!
glob_all.each do |path|
context.transformers_for(path).each do |transformer|
- transformer.call(path)
+ transformer.call(path) if path.exist?
end
+ path.rmtree if context.ignores?(path) && path.exist?
end
end
# Searches recursively for all files and take care for including hidden files
# if this is configured in the context.
@@ -218,11 +219,11 @@
#
# @return [Array<Pathname>]
#
def glob_all(path=nil)
Dir.chdir path || '.' do
- Dir.glob("**/*", context.include_hidden_files? ? File::FNM_DOTMATCH : 0).sort.map do |p|
- Pathname(p)
+ Pathname.glob("**/*", context.include_hidden_files? ? File::FNM_DOTMATCH : 0).sort.reject do |p|
+ %w(. ..).include?(p.basename.to_s)
end
end
end
# Compares two files to check if they are identical and produces a clear diff