sqlitecocoapods连串教程—spec文件

cocoapods序列教程—安装与使用
cocoapods连串教程—Podfile文件
cocoapods序列教程—Podfile.lock文件 和 Spec
Repo

cocoapods体系教程—spec文件
cocoapods类别教程—原理篇
cocoapods体系教程—让自己的开源框架襄助cocoapods
cocoapods系列教程—模块化设计
cocoapods序列教程—创设私有pods

上边介绍spec文件的详尽设置.基本上是按照官网翻译过来的,有哪些窘迫还望带领

  • name

spec.name = 'AFNetworking'
  • 版本

spec.version = '0.0.1'
  • 支持的cocoapods的版本

spec.cocoapods_version = '>= 0.36'
  • 部署消息,依照个体需要填写

spec.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }

spec.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"
$(SRCROOT)/libs/Frameworks/Huoyan"' }   

spec.xcconfig  = { 'LIBRARY_SEARCH_PATHS' => '"$(PODS_ROOT)/iOS_Util/iOS_Util/AMR/lib"' }

spec.xcconfig  = { "HEADER_SEARCH_PATHS" => "${PODS_ROOT}/boost" }
  • 作者音讯

spec.author = 'Darth Vader'

设若有三个作者,可以这么写

spec.authors = 'Darth Vader', 'Wookiee'

spec.authors = { 'Darth Vader' => 'darthvader@darkside.com',
                 'Wookiee'     => 'wookiee@aggrrttaaggrrt.com' }
  • 多媒体地址,假如地方是twitter,公布版本会有通告

spec.social_media_url = 'https://twitter.com/cocoapods'

spec.social_media_url = 'https://groups.google.com/forum/#!forum/cocoapods'
  • 准许,一般MIT,默认与spec文件在同等目录下

spec.license = 'MIT'
  • 点名许可文件

spec.license = { :type => 'MIT', :file => 'MIT-LICENSE.txt' }

指定许可文件的始末

spec.license = { :type => 'MIT', :text => <<-LICENSE
                   Copyright 2012
                   Permission is granted to...
                 LICENSE
               }
  • 连串主页

spec.homepage = 'http://www.example.com'
  • 类型git地址,tag值与spec.verison版本一样

spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git',
                :tag => spec.version.to_s }

花色git地址,tag值以v开始,协助子模块(子模块是git的子模块)

spec.source = { :git => 'https://github.com/typhoon-framework/Typhoon.git',
                :tag => "v#{spec.version}", :submodules => true }

项目svn地址

spec.source = { :svn => 'http://svn.code.sf.net/p/polyclipping/code', :tag => '4.8.8' }

品类压缩包地址

spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip' }

指定压缩包地址,并校验hash值,帮忙sha1 和 sha256

spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip',
                :sha1 => '7e21857fe11a511f472cfd7cfa2d979bd7ab7d96' }

点名为当地地址

podspec :path => '/Documents/PrettyKit/PrettyKit.podspec'
  • 简介

spec.summary = 'Computes the meaning of life.'
  • 详细描述

spec.description = <<-DESC

                   这里写描述内容

                   DESC
  • 单个截图

spec.screenshot  = 'http://dl.dropbox.com/u/378729/MBProgressHUD/1.png'
  • 五个截图

spec.screenshots = [ 'http://dl.dropbox.com/u/378729/MBProgressHUD/1.png',
                     'http://dl.dropbox.com/u/378729/MBProgressHUD/2.png' ]
  • 文档表明

spec.documentation_url = 'http://www.example.com/docs.html'
  • prepare_command,在pod文件下载完毕之后,执行的吩咐,原文如下

A bash script that will be executed after the Pod is downloaded. This command can be used to create, delete and modify any file downloaded and will be ran before any paths for other file attributes of the specification are collected.

This command is executed before the Pod is cleaned and before the Pods project is created. The working directory is the root of the Pod.

If the pod is installed with the :path option this command will not be executed.

单个命令

spec.prepare_command = 'ruby build_files.rb'

多条命令

spec.prepare_command = <<-CMD
                        sed -i 's/MyNameSpacedHeader/Header/g' ./**/*.h
                        sed -i 's/MyNameOtherSpacedHeader/OtherHeader/g' ./**/*.h
                   CMD
  • 是不是过期

spec.deprecated = true
  • 支撑的阳台,尽管不写默认补助具有平台

spec.platform = :ios //仅支持ios

帮助两个阳台

spec.ios.deployment_target = '6.0'

spec.osx.deployment_target = '10.8'
  • 凭借的第三方

spec.dependency 'AFNetworking', '~> 1.0'

指定某个平台的看重

spec.ios.dependency 'MBProgressHUD', '~> 0.5'
  • 是否是ARC,默认true,要是不是,会自行抬高-fno-objc-arc compiler flag

spec.requires_arc = true

部分是ARC

spec.requires_arc = false
spec.requires_arc = 'Classes/Arc'   //该文件夹下是ARC,其它非ARC
spec.requires_arc = ['Classes/*ARC.m', 'Classes/ARC.mm']
  • 凭借的系统的框架

spec.ios.framework = 'CFNetwork'

三个framework,用逗号分开

spec.frameworks = 'QuartzCore', 'CoreData'
  • weak_frameworks
    只要在高版本的OS中调用新增的功力,并且在低版本的OS中仍然能够运转,那么就要用到weak_frameworks.假若引用的一点类仍旧接口在低版本中并不帮助,对于不协理的接口,能够在运作的时候判断,这样程序不会出错,假诺不weak引用,程序在低版本下启动的时候就会崩溃掉

spec.weak_framework = 'MessageUI'
  • libraries 比如libz,sqlite3.0等,六个用逗号分开

spec.libraries = 'xml2', 'z'  //z表示libz.tdb,后缀不需要,lib开头的省略lib
  • compiler_flags

spec.compiler_flags = '-DOS_OBJECT_USE_OBJC=0', '-Wno-format'
  • prefix_header_contents 类似于pch,文件,三个用逗号隔开

spec.prefix_header_contents = '#import <UIKit/UIKit.h>', '#import <Foundation/Foundation.h>'

也足以如此写:

s.prefix_header_contents = <<-EOS
 #ifdef __OBJC__
 #import "SGExtension.h"    //SGExtension包含了所有头文件
 #endif 
EOS
end
  • 指定pch文件

spec.prefix_header_file = 'iphone/include/prefix.pch'
  • 源文件

spec.source_files = 'Classes/**/*.{h,m}'
spec.source_files = 'Classes/**/*.{h,m}', 'More_Classes/**/*.{h,m}'
  • 文本匹配
    • *配合所有文件
    • c*分外以名字C起初的文件
    • *c配合以名字c结尾的文本
    • *c*匹配所出名字包含c的文件
    • **文本夹以及递归子文件夹
    • ?轻易一个字符(注意是一个字符)
    • [set] 匹配五个字符,援助取反
    • {p,q} 匹配名字包括p 或者 q的公文

例子:

"JSONKit.?"    #=> ["JSONKit.h", "JSONKit.m"]   //JSONKit.字符
"*.[a-z][a-z]" #=> ["CHANGELOG.md", "README.md"]//.两个a-z的字母
"*.[^m]*"      #=> ["JSONKit.h"]                //.不是m的字符
"*.{h,m}"      #=> ["JSONKit.h", "JSONKit.m"]   //包含.h或者.m
"*"            #=> ["CHANGELOG.md", "JSONKit.h", "JSONKit.m", "README.md"]//所有文件
  • 公有头文件

spec.public_header_files = 'Headers/Public/*.h'
  • 私有头文件

spec.private_header_files = 'Headers/Private/*.h'
  • 祥和的要么第三方framework,比qqSDK的TencentOpenAPI.framework

spec.vendored_frameworks = 'MyFramework.framework','TheirFramework.framework'
  • 协调的如故第三方.a文件,比如微信SDK的.a文件

spec.vendored_libraries = 'libProj4.a', 'libJavaScriptCore.a'
  • 资源文件,比如图片

spec.ios.resource_bundle = { 'MapBox' => 'MapView/Map/Resources/*.png' }

多个路径        
spec.resource_bundles = {
    'MapBox' => ['MapView/Map/Resources/*.png'],
    'OtherResources' => ['MapView/Map/OtherResources/*.png']
  }

这种措施资源文件会被以bundle的花样参与到品种中去,官方提出拔取的办法,重假如避免与用户的命名模式争辨

  • 资源文件另一种艺术,这种相比较普遍

spec.resource = 'Resources/HockeySDK.bundle'
spec.resources = ['Images/*.png', 'Sounds/*']
网站地图xml地图