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.



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

def project
  @project
end

Instance Method Details

#create_object_for(dsl_object) ⇒ Object



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

def create_object_for(dsl_object)
  case dsl_object
  when BuildPhase
    create_object_for_build_phase(dsl_object)
  when BuildRule
    create_object_for_build_rule(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 Scheme
    create_object_for_scheme(dsl_object)
  end
end

#create_object_for_build_phase(build_phase) ⇒ Object



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

def create_object_for_build_phase(build_phase)
  @project.new(build_phase.build_phase_type)
end

#create_object_for_build_rule(build_rule) ⇒ Object



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

def create_object_for_build_rule(build_rule)
  @project.new(Xcodeproj::Project::Object::PBXBuildRule)
end

#create_object_for_configuration(configuration) ⇒ Object



52
53
54
# File 'lib/xcake/context/xcodeproj_context.rb', line 52

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

#create_object_for_project(project) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/xcake/context/xcodeproj_context.rb', line 35

def create_object_for_project(project)
  
  project_path = "./#{project.name}.xcodeproj"
  
  if File.exist?(project_path)
    FileUtils.remove_dir(project_path)
  end

  @project = Xcode::Project.new(project_path, true)
  @project.setup_for_xcake
  @project
end

#create_object_for_scheme(scheme) ⇒ Object



56
57
58
# File 'lib/xcake/context/xcodeproj_context.rb', line 56

def create_object_for_scheme(scheme)
  Xcode::Scheme.new
end

#create_object_for_target(target) ⇒ Object



48
49
50
# File 'lib/xcake/context/xcodeproj_context.rb', line 48

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

#file_reference_for_path(path) ⇒ Object



60
61
62
63
# File 'lib/xcake/context/xcodeproj_context.rb', line 60

def file_reference_for_path(path)
  pathname = Pathname.new path
  @project.file_reference_for_path(pathname)
end

#scheme_listObject



65
66
67
# File 'lib/xcake/context/xcodeproj_context.rb', line 65

def scheme_list
  @scheme_list ||= Xcode::SchemeList.new(@project)
end