Class: Xcake::TargetFileReferenceGenerator
- Inherits:
-
Generator
show all
- Defined in:
- lib/xcake/generator/target_file_reference_generator.rb
Overview
This generator processes the files to add to the project from the
include_files and exclude_files
Instance Attribute Summary
Attributes inherited from Generator
#context
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Generator
plugins_location
Methods included from Visitor
#item_name, #leave, #visit
Methods included from Plugin
included
Methods included from Dependency
included
Constructor Details
Returns a new instance of TargetFileReferenceGenerator.
8
9
10
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 8
def initialize(context)
@context = context
end
|
Class Method Details
.dependencies ⇒ Object
12
13
14
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 12
def self.dependencies
[TargetGenerator]
end
|
Instance Method Details
#include_file_for_path_and_target(path, target) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 32
def include_file_for_path_and_target(path, target)
file_reference = @context.file_reference_for_path(path)
native_target = @context.native_object_for(target)
build_phase_symbol = PathClassifier.classification_for_path(path)
if PathClassifier.should_create_build_phase_for_classification?(build_phase_symbol)
build_phase_class = Xcodeproj::Project::Object.const_get(build_phase_symbol)
build_phase = native_target.build_phase_by_class(build_phase_class)
build_phase.add_file_reference(file_reference)
end
end
|
#visit_target(target) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 16
def visit_target(target)
paths_to_include = Dir.glob(target.include_files).map do |f|
Pathname.new(f).cleanpath.to_s
end
paths_to_exclude = Dir.glob(target.exclude_files).map do |f|
Pathname.new(f).cleanpath.to_s
end
paths = paths_to_include - paths_to_exclude
paths.each do |p|
include_file_for_path_and_target(p, target) if PathClassifier.should_include_path?(p)
end
end
|