Class: Xcake::FileReferenceInstaller
- Includes:
- Dependency, Plugin, Visitor
- Defined in:
- lib/xcake/file_reference_installer.rb
Overview
This generator handles adding nodes to the project and creating a build phase for it.
Direct Known Subclasses
CompileSourceFileReferenceInstaller, CopyResourcesFileReferenceInstaller, HeaderFileReferenceInstaller, LinkLibraryFileReferenceInstaller
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
Visitable collapse
Class Method Summary collapse
-
.can_install_node(_node) ⇒ Boolean
This should be overidden by subclasses.
- .plugins_location ⇒ Object
Instance Method Summary collapse
-
#add_file_reference_to_target(_file_reference, _target) ⇒ Object
Adds file reference to the target.
-
#initialize(context) ⇒ FileReferenceInstaller
constructor
A new instance of FileReferenceInstaller.
Methods included from Visitor
Methods included from Plugin
Methods included from Dependency
Constructor Details
#initialize(context) ⇒ FileReferenceInstaller
Returns a new instance of FileReferenceInstaller.
15 16 17 |
# File 'lib/xcake/file_reference_installer.rb', line 15 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
13 14 15 |
# File 'lib/xcake/file_reference_installer.rb', line 13 def context @context end |
Class Method Details
.can_install_node(_node) ⇒ Boolean
This should be overidden by subclasses.
30 31 32 |
# File 'lib/xcake/file_reference_installer.rb', line 30 def self.can_install_node(_node) true end |
.plugins_location ⇒ Object
19 20 21 |
# File 'lib/xcake/file_reference_installer.rb', line 19 def self.plugins_location "#{File.dirname(__FILE__)}/file_reference_installer/*.rb" end |
Instance Method Details
#add_file_reference_to_target(_file_reference, _target) ⇒ Object
Adds file reference to the target.
This should be overidden in subclasses to add the file reference the correct build phase.
44 45 |
# File 'lib/xcake/file_reference_installer.rb', line 44 def add_file_reference_to_target(_file_reference, _target) end |
#visit_node(node) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/xcake/file_reference_installer.rb', line 49 def visit_node(node) # Tweak this to respect localizable files # # If ".lproj" is in file path # - Create variant group from File Component # - Files added to this group should have their path to be relative from # the first non-variatn group # # Otherwise normal behaviour native_group = @context.native_object_for(node.parent) # Make sure this is the correct parent in variant groups # # TODO: Remove this duplication of the .lproj and node path code. # Also remove need for the name hack. if node.parent.component.include?(".lproj") native_group.name = node.component group_path = Pathname.new node.parent.parent.path else group_path = Pathname.new node.parent.path end file_path = Pathname.new node.path node_location = file_path.relative_path_from group_path file_reference = native_group.new_reference(node_location) ###### node.targets.each do |t| add_file_reference_to_target(file_reference, t) end end |