lib/xcres/command/install_command.rb
def find_parent_group
    # Get main group and ensure that it exists
    main_group = project.main_group
    raise ArgumentError, "Didn't find main group" if main_group.nil?

    # Get target-specific group, if the default project layout is in use
    src_group = main_group.groups.find { |g| g.path == target.name }
    if src_group != nil
      log "Found target group, will use its path as base output path."
    else
      log "Didn't find target group, expected a group with path '#{target.name}'."
    end

    # Find 'Supporting Files' group
    groups = main_group.recursive_children_groups
    support_files_group = groups.find { |g| g.name == 'Supporting Files' }
    warn "Didn't find support files group" if support_files_group.nil?

    support_files_group || src_group || main_group
  end
# Find parent group, where the built files will been added to.
# It will return the first group, which was found of the following list.
#   * 'Supporting Files' group
#   * target-specific group
#   * main group
#
# @raise [ArgumentError]
#        if no main group exists, which means that the project is invalid
#
# @return [PBXGroup]
#
Find parent group, where the built files will been added to.
It will return the first group, which was found of the following list.
Find parent group where the built files will been added to . It will return the first group which was found of the following list .
def find_parent_group
    main_group = project.main_group
    raise ArgumentError, "Didn't find main group" if main_group.nil?
    src_group = main_group.groups.find { |g| g.path == target.name }
    if src_group != nil
      log "Found target group, will use its path as base output path."
    else
      log "Didn't find target group, expected a group with path '#{target.name}'."
    end
    groups = main_group.recursive_children_groups
    support_files_group = groups.find { |g| g.name == 'Supporting Files' }
    warn "Didn't find support files group" if support_files_group.nil?
    support_files_group || src_group || main_group
  end
def find_parent_group main_group = project . main_group raise ArgumentError , "Didn't find main group" if main_group . nil? src_group = main_group . groups . find { | g | g . path == target . name } if src_group != nil log "Found target group, will use its path as base output path." else log "Didn't find target group, expected a group with path '#{target.name}'." end groups = main_group . recursive_children_groups support_files_group = groups . find { | g | g . name == 'Supporting Files' } warn "Didn't find support files group" if support_files_group . nil? support_files_group || src_group || main_group end
Find parent group, where the built files will been added to.
Find parent group where the built files will been added to .
# Get main group and ensure that it exists # Get target-specific group, if the default project layout is in use # Find 'Supporting Files' group
None
PBXGroup
[ArgumentError] if no main group exists, which means that the project is invalid
[ ArgumentError ] if no main group exists which means that the project is invalid