Class: PBXProjParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ccios/pbxproj_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_path) ⇒ PBXProjParser

Returns a new instance of PBXProjParser.



7
8
9
10
11
12
13
# File 'lib/ccios/pbxproj_parser.rb', line 7

def initialize(source_path)
  @source_path = source_path
  if project_path.nil?
    raise "[Error] There is no xcodeproj at path #{@source_path}"
  end
  @project = Xcodeproj::Project.open(project_path)
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



5
6
7
# File 'lib/ccios/pbxproj_parser.rb', line 5

def project
  @project
end

#source_pathObject

Returns the value of attribute source_path.



5
6
7
# File 'lib/ccios/pbxproj_parser.rb', line 5

def source_path
  @source_path
end

Instance Method Details

#app_groupObject



27
28
29
# File 'lib/ccios/pbxproj_parser.rb', line 27

def app_group
  classes_group["App"]
end

#classes_groupObject



23
24
25
# File 'lib/ccios/pbxproj_parser.rb', line 23

def classes_group
  @project.groups.find { |g| g.display_name === "Classes" }
end

#coordinator_groupObject



35
36
37
# File 'lib/ccios/pbxproj_parser.rb', line 35

def coordinator_group
  classes_group["Coordinator"]
end

#core_groupObject



31
32
33
# File 'lib/ccios/pbxproj_parser.rb', line 31

def core_group
  classes_group["Core"]
end

#data_groupObject



43
44
45
# File 'lib/ccios/pbxproj_parser.rb', line 43

def data_group
  classes_group["Data"]
end

#interactor_groupObject



39
40
41
# File 'lib/ccios/pbxproj_parser.rb', line 39

def interactor_group
  core_group["Interactor"]
end

#main_targetObject



19
20
21
# File 'lib/ccios/pbxproj_parser.rb', line 19

def main_target
  @project.targets.first
end

#project_pathObject



15
16
17
# File 'lib/ccios/pbxproj_parser.rb', line 15

def project_path
  Dir.glob("#{@source_path}/*.xcodeproj").first
end

#saveObject



47
48
49
# File 'lib/ccios/pbxproj_parser.rb', line 47

def save
  @project.save
end