Class: XCRes::ResourcesAnalyzer::LooseResourcesAnalyzer

Inherits:
BaseResourcesAnalyzer show all
Defined in:
lib/xcres/analyzer/resources_analyzer/loose_resources_analyzer.rb

Overview

A LooseResourcesAnalyzer scans the project for resources, which are loosely placed in the project or in a group and should be included in the output file.

Constant Summary

Constants inherited from BaseResourcesAnalyzer

BaseResourcesAnalyzer::FILTER_WORDS

Instance Attribute Summary

Attributes inherited from Analyzer

#logger, #options, #sections, #target

Instance Method Summary collapse

Methods inherited from BaseResourcesAnalyzer

#build_images_section_data, #build_section_data, #filter_device_specific_image_paths, #find_files_in_dir, #find_image_files, #key_from_path

Methods inherited from Analyzer

#filter_exclusions, #find_file_refs_by_extname, #initialize, #is_file_ref_included_in_application_target?, #new_section, #project, #resources_files

Methods included from FileHelper

#basename_without_ext

Constructor Details

This class inherits a constructor from XCRes::Analyzer

Instance Method Details

#analyzeObject



12
13
14
15
# File 'lib/xcres/analyzer/resources_analyzer/loose_resources_analyzer.rb', line 12

def analyze
  @sections = [build_section_for_loose_images]
  super
end

#build_section_for_loose_imagesSection

Build a section for loose image resources in the project

Returns:



25
26
27
28
29
30
31
32
33
# File 'lib/xcres/analyzer/resources_analyzer/loose_resources_analyzer.rb', line 25

def build_section_for_loose_images
  image_files = find_image_files(resources_files.map(&:path))

  log "Found #%s image files in project.", image_files.count

  data = build_images_section_data(image_files, use_basename: [:key, :path])

  new_section('Images', data)
end

#exclude_file_patternsObject



17
18
19
# File 'lib/xcres/analyzer/resources_analyzer/loose_resources_analyzer.rb', line 17

def exclude_file_patterns
  super + ['Default.*', 'Default@2x.*', 'Default-568h@2x.*']
end