Class: Xcake::PathClassifier

Inherits:
Object
  • Object
show all
Defined in:
lib/xcake/path_classifier.rb

Overview

This class handles classifing the files and how Xcake should handle them.

Constant Summary collapse

EXTENSION_MAPPINGS =
{
  PBXFrameworksBuildPhase: %w(.a .dylib .so .framework).freeze,
  PBXHeadersBuildPhase: %w(.h .hpp).freeze,
  PBXSourcesBuildPhase: %w(.c .m .mm .cpp .cc .swift .xcdatamodeld .intentdefinition .java).freeze,
  PBXResourcesBuildPhase: %w(.xcassets).freeze
}.freeze

Class Method Summary collapse

Class Method Details

.classification_for_path(path) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/xcake/path_classifier.rb', line 29

def self.classification_for_path(path)
  classification = EXTENSION_MAPPINGS.detect do |_key, ext_group|
    ext_group.any? { |ext| File.extname(path) == ext }
  end

  return :PBXResourcesBuildPhase if classification.nil?

  classification.first
end

.should_create_build_phase_for_classification?(classification) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/xcake/path_classifier.rb', line 39

def self.should_create_build_phase_for_classification?(classification)
  classification != :PBXHeadersBuildPhase
end

.should_include_path?(path) ⇒ Boolean

Note:

This should be overidden

by subclasses.

into the project

Parameters:

Returns:

  • (Boolean)

    true if classifier thinks the path should be included



22
23
24
25
26
27
# File 'lib/xcake/path_classifier.rb', line 22

def self.should_include_path?(path)
  return false if locale_container?(path)
  return false if inside_classified_container?(path)

  true
end