module CocoaPodsAcknowledgements

Constants

VERSION

Public Class Methods

save_metadata(metadata, plist_path, project, sandbox, user_target_uuid) click to toggle source
# File lib/cocoapods_acknowledgements.rb, line 5
def self.save_metadata(metadata, plist_path, project, sandbox, user_target_uuid)
  if defined? Xcodeproj::Plist.write_to_path
    Xcodeproj::Plist.write_to_path(metadata, plist_path)
  else
    Xcodeproj.write_plist(metadata, plist_path)
  end

  # Find a root folder in the users Xcode Project called Pods, or make one
  cocoapods_group = project.main_group["Pods"]
  unless cocoapods_group
    cocoapods_group = project.main_group.new_group("Pods", sandbox.root)
  end

  # Add the example plist to the found CocoaPods group
  plist_pathname = Pathname.new(File.expand_path(plist_path))
  file_ref = cocoapods_group.files.find { |file| file.real_path == plist_pathname }
  unless file_ref
    file_ref = cocoapods_group.new_file(plist_path)
  end

  # Ensure that the plist is added to target
  target = project.objects_by_uuid[user_target_uuid]
  unless target.resources_build_phase.files_references.include?(file_ref)
    target.add_resources([file_ref])
  end

  project.save
end
settings_bundle_in_project(project) click to toggle source
# File lib/cocoapods_acknowledgements.rb, line 34
def self.settings_bundle_in_project(project)
  file = project.files.find { |f| f.path =~ /Settings\.bundle$/ }
  file.real_path.to_path unless file.nil?
end