说明文件(Sepcification)
说明文件描述了一个版本的pod库。它描述了库的详内容,诸如去哪里获取源码,使用什么文件,应用编译设置,以及其它的一般元数据如它的名字、版本和描述。
一个基本的说明文件能使用pod spec create命令生成。
说明文件的DSL(描述语言)提供了很强的扩展性和动态性,而且,DSL采用了"协议优于配置"的规则,因此它能非常地简单,如下:
Pod::Spec.new do |spec| spec.name = 'Reachability' spec.version = '3.1.0' spec.license = { :type => 'BSD' } spec.homepage = 'https://github.com/tonymillion/Reachability' spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' } spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.' spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' } spec.source_files = 'Reachability.{h,m}' spec.framework = 'SystemConfiguration' end也可以非常的详细,如下:
Pod::Spec.new do |spec| spec.name = 'Reachability' spec.version = '3.1.0' spec.license = { :type => 'BSD' } spec.homepage = 'https://github.com/tonymillion/Reachability' spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' } spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.' spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' } spec.module_name = 'Rich' spec.ios.deployment_target = '9.0' spec.osx.deployment_target = '10.10' spec.source_files = 'Reachability/common/*.swift' spec.ios.source_files = 'Reachability/ios/*.swift', 'Reachability/extensions/*.swift' spec.osx.source_files = 'Reachability/osx/*.swift' spec.framework = 'SystemConfiguration' spec.ios.framework = 'UIKit' spec.osx.framework = 'AppKit' spec.dependency 'SomeOtherPod' end