Class: Xcake::XcodeprojContext

Inherits:
Object
  • Object
show all
Includes:
Context
Defined in:
lib/xcake/context/xcodeproj_context.rb

Instance Attribute Summary collapse

Attributes included from Context

#object_hash

Instance Method Summary collapse

Methods included from Context

#native_object_for

Instance Attribute Details

#projectObject

Returns the value of attribute project.



7
8
9
# File 'lib/xcake/context/xcodeproj_context.rb', line 7

def project
  @project
end

Instance Method Details

#create_object_for(dsl_object) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/xcake/context/xcodeproj_context.rb', line 9

def create_object_for(dsl_object)
  case dsl_object
  when Project
    create_object_for_project(dsl_object)
  when Target
    create_object_for_target(dsl_object)
  when Configuration
    create_object_for_configuration(dsl_object)
  when Node
    create_object_for_node(dsl_object)
  else
    nil
  end
end

#create_object_for_configuration(configuration) ⇒ Object



35
36
37
# File 'lib/xcake/context/xcodeproj_context.rb', line 35

def create_object_for_configuration(configuration)
  @project.new_configuration(configuration)
end

#create_object_for_node(node) ⇒ Object



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

def create_object_for_node(node)
  @project.new_group(node)
end

#create_object_for_project(project) ⇒ Object



24
25
26
27
28
29
# File 'lib/xcake/context/xcodeproj_context.rb', line 24

def create_object_for_project(project)
  # TODO: Make setup of project testable
  @project = Xcode::Project.new("./#{project.name}.xcodeproj", true)
  @project.setup_for_xcake
  @project
end

#create_object_for_target(target) ⇒ Object



31
32
33
# File 'lib/xcake/context/xcodeproj_context.rb', line 31

def create_object_for_target(target)
  @project.new_target(target)
end

#file_reference_for_path(path) ⇒ Object



43
44
45
# File 'lib/xcake/context/xcodeproj_context.rb', line 43

def file_reference_for_path(path)
  @project.reference_for_path(path) || @project.new_file_reference(path)
end