Skip to content

Instantly share code, notes, and snippets.

@notjosh
Created April 12, 2015 17:46
Show Gist options
  • Save notjosh/a461e095825de017a353 to your computer and use it in GitHub Desktop.
Save notjosh/a461e095825de017a353 to your computer and use it in GitHub Desktop.
# ...
post_install do |rep|
# merge Pods acknowledgements with submodules/externals acknowledgements
merge_acknowledgements({
:base => 'Clue/Resources/Settings.bundle/External-Acknowledgments.plist',
:include => 'Pods/Target Support Files/Pods-Clue/Pods-Clue-acknowledgements.plist',
},
'Clue/Resources/Settings.bundle/Acknowledgments.plist',
)
end
def merge_acknowledgements(config, destination)
require 'cfpropertylist'
base_data = CFPropertyList::List.new(:file => config[:base])
included_data = CFPropertyList::List.new(:file => config[:include])
base = CFPropertyList.native_types(base_data.value)
included = CFPropertyList.native_types(included_data.value)
included['PreferenceSpecifiers'].each do | acknowledgement |
next if ['acknowledgments', 'acknowledgements'].include?(acknowledgement['Title'].downcase)
base['PreferenceSpecifiers'].push(acknowledgement)
end
destination_data = CFPropertyList::List.new
destination_data.value = CFPropertyList.guess(base)
destination_data.save(destination, CFPropertyList::List::FORMAT_XML)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment