Class: Xcodeproj::Project::Object::PBXGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/xccache/xcodeproj/group.rb

Instance Method Summary collapse

Instance Method Details

#ensure_synced_group(name: nil, path: nil) ⇒ Object



11
12
13
# File 'lib/xccache/xcodeproj/group.rb', line 11

def ensure_synced_group(name: nil, path: nil)
  synced_groups.find { |g| g.name == name } || new_synced_group(name: name, path: path)
end

#new_synced_group(name: nil, path: nil) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/xccache/xcodeproj/group.rb', line 15

def new_synced_group(name: nil, path: nil)
  path = path.relative_path_from(project.dir) unless path.relative?
  synced_group = project.new(PBXFileSystemSynchronizedRootGroup)
  synced_group.path = path.to_s
  synced_group.name = name || path.basename.to_s
  self << synced_group
  synced_group
end

#synced_groupsObject



7
8
9
# File 'lib/xccache/xcodeproj/group.rb', line 7

def synced_groups
  children.grep(PBXFileSystemSynchronizedRootGroup)
end