Class: IncludePathinator
Instance Method Summary collapse
- #augment_environment_header_files(headers) ⇒ Object
-
#collect_test_include_paths ⇒ Object
Gather together [:paths] that actually contain .h files.
- #lookup_test_directive_include_paths(filepath) ⇒ Object
- #setup ⇒ Object
- #validate_header_files_collection ⇒ Object
- #validate_test_build_directive_paths ⇒ Object
Instance Method Details
#augment_environment_header_files(headers) ⇒ Object
62 63 64 |
# File 'lib/ceedling/include_pathinator.rb', line 62 def augment_environment_header_files(headers) @configurator.redefine_element(:collection_all_headers, headers) end |
#collect_test_include_paths ⇒ Object
Gather together [:paths] that actually contain .h files
73 74 75 76 77 78 79 80 81 |
# File 'lib/ceedling/include_pathinator.rb', line 73 def collect_test_include_paths paths = [] @configurator.collection_paths_test.each do |path| headers = @file_wrapper.directory_listing( File.join( path, '*' + @configurator.extension_header ) ) paths << path if headers.length > 0 end return paths end |
#lookup_test_directive_include_paths(filepath) ⇒ Object
66 67 68 69 70 |
# File 'lib/ceedling/include_pathinator.rb', line 66 def lookup_test_directive_include_paths(filepath) # TODO: When Ceedling's base project path handling is resolved, enable this path redefinition # return @extractor.lookup_include_paths_list(filepath).map { |path| File.join( @base_path, path) } return @extractor.lookup_include_paths_list(filepath) end |
#setup ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/ceedling/include_pathinator.rb', line 15 def setup # TODO: When Ceedling's base project path handling is resolved, update this value to automatically # modify TEST_INCLUDE_PATH() locations relative to the working directory or project file location # @base_path = '.' # Alias for brevity @extractor = @test_context_extractor end |
#validate_header_files_collection ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ceedling/include_pathinator.rb', line 39 def validate_header_files_collection # Get existing, possibly minimal header file collection headers = @configurator.collection_all_headers # Get all paths specified by TEST_INCLUDE_PATH() directive in test files directive_paths = @extractor.lookup_all_include_paths # Add to collection of headers (Rake FileList) with directive paths and shallow wildcard matching on header file extension headers += @file_wrapper.instantiate_file_list( directive_paths.map { |path| File.join(path, '*' + EXTENSION_HEADER) } ) headers.resolve() headers.uniq! if headers.length == 0 error = "No header files found in project.\n" + "Add search paths to :paths ↳ :include in your project file and/or use #{UNITY_TEST_INCLUDE_PATH}() in your test files.\n" + "Verify header files with `ceedling paths:include` and\\or `ceedling files:include`." @loginator.log( error, Verbosity::COMPLAIN ) end return headers end |
#validate_test_build_directive_paths ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ceedling/include_pathinator.rb', line 24 def validate_test_build_directive_paths @extractor.inspect_include_paths do |test_filepath, include_paths| include_paths.each do |path| # TODO: When Ceedling's base project path handling is resolved, enable this path redefinition # path = File.join( @base_path, path ) unless @file_wrapper.exist?(path) error = "'#{path}' specified by #{UNITY_TEST_INCLUDE_PATH}() within #{test_filepath} not found" raise CeedlingException.new( error ) end end end end |