Class: Xcodeproj::Project::Object::PBXGroup
- Inherits:
-
Object
- Object
- Xcodeproj::Project::Object::PBXGroup
- Defined in:
- lib/synx/xcodeproj_ext/project/object/pbx_group.rb
Instance Method Summary collapse
- #all_groups ⇒ Object
- #excluded_from_sync? ⇒ Boolean
- #groups_containing_forward_slash ⇒ Object
- #move_entries_not_in_xcodeproj ⇒ Object
- #sort_by_name ⇒ Object
- #sync(group) ⇒ Object
Instance Method Details
#all_groups ⇒ Object
73 74 75 |
# File 'lib/synx/xcodeproj_ext/project/object/pbx_group.rb', line 73 def all_groups children.select { |child| child.is_a?(Xcodeproj::Project::Object::PBXGroup)} end |
#excluded_from_sync? ⇒ Boolean
33 34 35 |
# File 'lib/synx/xcodeproj_ext/project/object/pbx_group.rb', line 33 def excluded_from_sync? project.group_exclusions.include?(hierarchy_path) end |
#groups_containing_forward_slash ⇒ Object
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/synx/xcodeproj_ext/project/object/pbx_group.rb', line 137 def groups_containing_forward_slash found_groups = [] groups.each do |group| unless group.excluded_from_sync? found_groups << group if group.basename.include?("/") found_groups |= group.groups_containing_forward_slash end end found_groups end |
#move_entries_not_in_xcodeproj ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/synx/xcodeproj_ext/project/object/pbx_group.rb', line 51 def move_entries_not_in_xcodeproj if excluded_from_sync? Synx::Tabber.puts "#{basename}/ (excluded)".yellow elsif real_path.exist? Synx::Tabber.puts "#{basename}/".green Synx::Tabber.increase real_path.children.each do |entry_pathname| unless project.has_object_for_pathname?(entry_pathname) handle_unused_entry(entry_pathname) end end all_groups.each(&:move_entries_not_in_xcodeproj) Synx::Tabber.decrease end end |
#sort_by_name ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/synx/xcodeproj_ext/project/object/pbx_group.rb', line 37 def sort_by_name children.sort! do |x, y| if x.isa == 'PBXGroup' && !(y.isa == 'PBXGroup') -1 elsif !(x.isa == 'PBXGroup') && y.isa == 'PBXGroup' 1 elsif x.display_name && y.display_name x.display_name <=> y.display_name else 0 end end end |
#sync(group) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/synx/xcodeproj_ext/project/object/pbx_group.rb', line 6 def sync(group) ensure_internal_consistency(group) # Make sure we don't belong to any other groups if excluded_from_sync? Synx::Tabber.puts "#{basename}/ (excluded)".yellow else Synx::Tabber.puts "#{basename}/".green Synx::Tabber.increase squash_duplicate_file_references # Child directories may not exist yet (and may be different for # each file) if this is a localized group, so we do the mkpath call # inside the loops. files.each do |pbx_file| pbx_file.work_pathname.dirname.mkpath pbx_file.sync(self) end all_groups.each do |group| group.work_pathname.dirname.mkpath group.sync(self) end sync_path sort_by_name if project.sort_by_name Synx::Tabber.decrease end end |