lib/pdk/module/build.rb in pdk-1.6.0 vs lib/pdk/module/build.rb in pdk-1.6.1

- old
+ new

@@ -86,10 +86,13 @@ # Clean up any files created during use of the PDK that shouldn't be part # of the built module (e.g. test fixtures). # # @return nil def cleanup_module + PDK::Util::Bundler.ensure_bundle! + PDK::Util::Bundler.ensure_binstubs!('rake') + PDK::Test::Unit.tear_down end # Combine the module name and version into a Forge-compatible dash # separated string. @@ -194,25 +197,27 @@ # Instantiate a new PathSpec class and populate it with the pattern(s) of # files to be ignored. # # @return [PathSpec] The populated ignore path matcher. def ignored_files - @ignored_files ||= if ignore_file.nil? - PathSpec.new - else - fd = File.open(ignore_file, 'rb:UTF-8') - data = fd.read - fd.close + @ignored_files ||= + begin + ignored = if ignore_file.nil? + PathSpec.new + else + fd = File.open(ignore_file, 'rb:UTF-8') + data = fd.read + fd.close - PathSpec.new(data) - end + PathSpec.new(data) + end - # Also ignore the target directory if it is in the module dir and not already ignored - if Find.find(@module_dir).include?(target_dir) && !@ignored_files.match(File.basename(target_dir) + '/') - @ignored_files = @ignored_files.add("\/#{File.basename(target_dir)}\/") - end + if File.realdirpath(target_dir).start_with?(File.realdirpath(module_dir)) + ignored = ignored.add("\/#{File.basename(target_dir)}\/") + end - @ignored_files + ignored + end end end end end