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

Inherits:
Object
  • Object
show all
Defined in:
lib/xcake/xcodeproj_ext/PBXGroup.rb

Instance Method Summary collapse

Instance Method Details

#child_for_path(path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/xcake/xcodeproj_ext/PBXGroup.rb', line 7

def child_for_path(path)
   path = path.split('/').keep_if do |c|
     c != '.'
   end unless path.is_a?(Array)

   child_name = path.shift
   child = children.find { |c| c.display_name == child_name }

   if child.nil?
     child = new_group(child_name)
     child.path = child_name
   end

   if path.empty?
     child
   else
     child.child_for_path(path)
   end
end

#dirnameObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/xcake/xcodeproj_ext/PBXGroup.rb', line 27

def dirname
  return '.' if parent.is_a? Xcake::Xcode::Project
  return '.' if parent.is_a? PBXProject
  return parent.dirname.to_s if is_a? PBXVariantGroup

  if display_name
    "#{parent.dirname}/#{display_name}"
  else
    parent.dirname.to_s
  end
end