Class: Xcake::FileReferenceInstaller

Inherits:
Object
  • Object
show all
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.

Instance Attribute Summary collapse

Visitable collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Visitor

#item_name, #leave, #visit

Methods included from Plugin

included

Methods included from Dependency

included

Constructor Details

#initialize(context) ⇒ FileReferenceInstaller



13
14
15
# File 'lib/xcake/file_reference_installer.rb', line 13

def initialize(context)
  @context = context
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



11
12
13
# File 'lib/xcake/file_reference_installer.rb', line 11

def context
  @context
end

Class Method Details

.can_install_node(_node) ⇒ Boolean

This should be overidden by subclasses.



28
29
30
# File 'lib/xcake/file_reference_installer.rb', line 28

def self.can_install_node(_node)
  true
end

.plugins_locationObject



17
18
19
# File 'lib/xcake/file_reference_installer.rb', line 17

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.



42
43
# File 'lib/xcake/file_reference_installer.rb', line 42

def add_file_reference_to_target(_file_reference, _target)
end

#visit_node(node) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/xcake/file_reference_installer.rb', line 47

def visit_node(node)
  native_group = @context.native_object_for(node)

  file_reference = native_group[node.component] ||
                   native_group.new_reference(node.component)

  node.targets.each do |t|
    add_file_reference_to_target(file_reference, t)
  end
end