Created
April 12, 2015 17:46
-
-
Save notjosh/a461e095825de017a353 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
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