class PBXProjParser

Attributes

source_path[RW]

Public Class Methods

new(source_path, config) click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 8
def initialize(source_path, config)
  @source_path = source_path
  @config = config
  @projects = {}
end

Public Instance Methods

app_project() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 14
def app_project
  project_for(@config.app.project)
end
app_target() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 51
def app_target
  target_for(app_project, @config.app.target)
end
coordinator_group() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 31
def coordinator_group
  path = @config.app.coordinator.group
  app_project[path]
end
core_project() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 18
def core_project
  project_for(@config.core.project)
end
core_target() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 55
def core_target
  target_for(core_project, @config.core.target)
end
data_project() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 22
def data_project
  project_for(@config.data.project)
end
data_target() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 59
def data_target
  target_for(data_project, @config.data.target)
end
interactor_group() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 36
def interactor_group
  path = @config.core.interactor.group
  core_project[path]
end
presenter_group() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 26
def presenter_group
  path = @config.app.presenter.group
  app_project[path]
end
repository_core_group() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 41
def repository_core_group
  path = @config.core.repository.group
  core_project[path]
end
repository_data_group() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 46
def repository_data_group
  path = @config.data.repository.group
  data_project[path]
end
save() click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 63
def save
  app_project.save
  core_project.save
  data_project.save
end

Private Instance Methods

project_for(path) click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 71
def project_for(path)
  module_project_path = File.join(source_path, path)
  resolved_module_project_path = Dir.glob(module_project_path).first
  if !File.exist?(resolved_module_project_path)
    raise "[Error] There is no xcodeproj at path #{module_project_path}"
  end
  @projects[module_project_path] ||= Xcodeproj::Project.open(resolved_module_project_path)
end
target_for(project, target_name) click to toggle source
# File lib/ccios/pbxproj_parser.rb, line 80
def target_for(project, target_name)
  if target_name.blank?
    project.targets.find { |t| t.product_type == "com.apple.product-type.application" }
  else
    project.targets.find { |t| t.name == target_name }
  end
end