/TwelveTwentyToolkit.podspec Secret
-
-
Save alloy/38a3400bffc0837af5f3 to your computer and use it in GitHub Desktop.
Pod::Spec.new do |s| | |
s.name = 'TwelveTwentyToolkit' | |
s.version = '0.0.1' | |
s.summary = 'The Twelve Twenty Toolkit of reusable Objective-C classes.' | |
s.homepage = 'http://twelvetwenty.nl' | |
s.license = 'MIT' | |
s.author = { 'Eric-Paul Lecluse' => 'epologee@gmail.com', 'Jankees van Woezik' => 'jankeesvw@gmail.com' } | |
s.source = { :git => 'https://github.com/TwelveTwenty/TwelveTwentyToolkit-ObjC.git', :commit => :head } | |
s.platform = :ios, '5.0' | |
s.source_files = 'TwelveTwentyToolkit/TwelveTwentyToolkit.h' | |
s.requires_arc = true | |
s.preferred_dependency = 'CoreGraphics' | |
s.subspec 'CoreGraphics' do |cg| | |
cg.frameworks = 'UIKit','QuartzCore' | |
cg.source_files = 'TwelveTwentyToolkit/CoreGraphics/*' | |
end | |
s.subspec 'CoreData' do |cd| | |
cd.frameworks = 'CoreData' | |
cd.source_files = 'TwelveTwentyToolkit/CoreData/*' | |
end | |
s.subspec 'AddressBook' do |uab| | |
uab.frameworks = 'AddressBook' | |
uab.dependency 'TwelveTwentyToolkit/CoreData' | |
uab.source_files = 'TwelveTwentyToolkit/AddressBook','TwelveTwentyToolkit/AddressBook/Entities','TwelveTwentyToolkit/AddressBook/Entities/Abstract' | |
uab.preserve_path = 'TwelveTwentyToolkit/AddressBook/TTUnifiedAddressBook.xcdatamodeld' | |
def uab.post_install(target_installer) | |
momd_relative = 'TwelveTwentyToolkit/AddressBook/TTUnifiedAddressBook.momd' | |
momd_full = config.project_pods_root + momd_relative | |
unless momd_full.exist? | |
puts "\nCompiling TwelveTwentyToolkit/AddressBook Core Data model\n".yellow if config.verbose? | |
model = config.project_pods_root + 'TwelveTwentyToolkit/AddressBook/TTUnifiedAddressBook.xcdatamodeld' | |
command = "xcrun momc '#{model}' '#{momd_full}'" | |
command << " 2>&1 > /dev/null" unless config.verbose? | |
unless system(command) | |
raise ::Pod::Informative, "Failed to compile TwelveTwentyToolkit/AddressBook Core Data model" | |
end | |
end | |
File.open(File.join(config.project_pods_root, target_installer.target_definition.copy_resources_script_name), 'a') do |file| | |
file.puts "install_resource '#{momd_relative}'" | |
end | |
end | |
end | |
end |
No, making it available to the user in Xcode would make it harder. I’ve fixed the spelling error: moms_full
-> momd_full
Right, now the compile hangs at Xcode I think, [...]/Pods/TwelveTwentyToolkit/AddressBook/TTUnifiedAddressBook.xcdatamodeld:0: error: Could not create bundle folder for versioned model at '[...]/Pods/TwelveTwentyToolkit/AddressBook/TTUnifiedAddressBook.momd'
. Sorry for all this...
Did anyone figure this out? I'm still hacking away the ruby script above and it's just becoming a pandora's box... I'm thinking I might just implement the data model in code, using this resource: http://www.cocoanetics.com/2012/04/creating-a-coredata-model-in-code/
I was able to get a core data model integrated with the Pod I've been developing by using the podspec settings in this bug - basically it's:
s.resources = '[path_to_data_model_enclosing_folder]/*.{xcdatamodeld,xcdatamodel}' s.preserve_paths = [path_to_data_model_enclosing_folder]/*'
There's about zero documentation on this functionality, though, so your mileage may vary.
Take a look at the following:
CocoaPods/Xcodeproj#81 (comment)
https://github.com/Ashton-W/CoreDataPodSample
This would do however, if the code would run.
undefined local variable or method
moms_full' for #<Pod::Specification for TwelveTwentyToolkit/AddressBook (0.0.1)> ~/.cocoapods/twelvetwenty/TwelveTwentyToolkit/0.0.1/TwelveTwentyToolkit.podspec:33:in
post_install'