@@ -35,6 +35,20 @@ def initialize(base_dir)
3535 @last_msg = ""
3636 end
3737
38+ # Guess whether a file is part of the vendor bundle (indicating we should ignore it).
39+ #
40+ # This assumes the vendor bundle will be at `vendor/bundle` and not some other location
41+ # @param path [String] The path to check
42+ # @return [Array<String>] The paths of the found files
43+ def vendor_bundle? ( path )
44+ # TODO: look for Gemfile, look for .bundle/config and get BUNDLE_PATH from there?
45+ base = File . join ( @base_dir , "vendor" )
46+ real = File . join ( File . realpath ( @base_dir ) , "vendor" )
47+ return true if path . start_with? ( base )
48+ return true if path . start_with? ( real )
49+ false
50+ end
51+
3852 # Get a list of all CPP source files in a directory and its subdirectories
3953 # @param some_dir [String] The directory in which to begin the search
4054 # @return [Array<String>] The paths of the found files
@@ -52,6 +66,7 @@ def cpp_files
5266 cpp_files_in ( @base_dir ) . reject do |p |
5367 next true if File . dirname ( p ) . include? ( tests_dir )
5468 next true if File . dirname ( p ) . include? ( real_tests_dir )
69+ next true if vendor_bundle? ( p )
5570 end
5671 end
5772
@@ -84,7 +99,8 @@ def test_files
8499 def header_dirs
85100 real = File . realpath ( @base_dir )
86101 all_files = Find . find ( real ) . reject { |path | File . directory? ( path ) }
87- files = all_files . select { |path | HPP_EXTENSIONS . include? ( File . extname ( path ) ) }
102+ unbundled = all_files . reject { |path | vendor_bundle? ( path ) }
103+ files = unbundled . select { |path | HPP_EXTENSIONS . include? ( File . extname ( path ) ) }
88104 ret = files . map { |path | File . dirname ( path ) } . uniq
89105 ret
90106 end
0 commit comments