CocoaPods / CocoaPods/Xcodeproj

What's the best way to create a structure of nested groups?

Open
#931 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
2.4k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

Let's assume that I'm in a group `A`. Now I want to create a structure:
```
A
-- B
---- C
```

Is there any function that makes this task easy? Or do I have to split the path and go group by group and create it?

That's what I managed to achieve so far:
```ruby
def add_group(project, group_path)
splitted_path = group_path.split("/")

for i in 1..(splitted_path.length - 2)
current_path = splitted_path[0..i].join("/")
new_group_path = current_path + "/" + splitted_path[i + 1]
parent_group = find_group_by_absolute_dir_path(project, current_path)

parent_group.new_group(splitted_path[i + 1], new_group_path) unless parent_group.nil?
end

project.save
end
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the group methods used in the issue's add_group example, especially find_group_by_absolute_dir_path and new_group. Determine whether the existing API already supports creating A/B/C in one operation; done should be a clear supported approach for building the nested structure, with its behavior verified for the shown path.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.