現(xiàn)在某個(gè)文件夾下面使用pod spec create ManageLocalCode就會(huì)在那個(gè)庫(kù)下面建立一個(gè)非常完整的文件沪编,里面有很多選項(xiàng)可以填寫享怀,如果你需要添加就把“#”號(hào)去除。
這是我的目錄
Pod::Spec.new do |s|
# ―――? Spec Metadata? ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? These will help people to find your library, and whilst it
#? can feel like a chore to fill in it's definitely to your advantage. The
#? summary should be tweet-length, and the description more in depth.
#
s.name? ? ? ? = "ManageLocalCode"
s.version? ? ? = "0.0.1"
s.summary? ? ? = "a simple test"
# This description is used to generate tags and improve search results.
#? * Think: What does it do? Why did you write it? What is the focus?
#? * Try to keep it short, snappy and to the point.
#? * Write the description between the DESC delimiters below.
#? * Finally, don't worry about the indent, CocoaPods strips it!
s.homepage? ? = "https://github.com/smsouls/mor"
# s.screenshots? = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
# ―――? Spec License? ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? Licensing your code is important. See http://choosealicense.com for more info.
#? CocoaPods will detect a license file if there is a named LICENSE*
#? Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
#
s.license? ? ? = "MIT"
# s.license? ? ? = { :type => "MIT", :file => "FILE_LICENSE" }
# ――― Author Metadata? ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? Specify the authors of the library, with email addresses. Email addresses
#? of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
#? accepts just a name if you'd rather not provide an email address.
#
#? Specify a social_media_url where others can refer to, for example a twitter
#? profile URL.
#
s.author? ? ? ? ? ? = { "xiaopengyou" => "1111111111@qq.com" }
# Or just: s.author? ? = "xiaopengyou"
# s.authors? ? ? ? ? ? = { "xiaopengyou" => "1111111111@qq.com" }
# s.social_media_url? = "http://twitter.com/xiaopengyou"
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? If this Pod runs only on iOS or OS X, then specify the platform and
#? the deployment target. You can optionally include the target after the platform.
#
s.platform? ? = :ios, "8.0"
#? When using multiple platforms
# s.ios.deployment_target = "5.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? Specify the location from where the source should be retrieved.
#? Supports git, hg, bzr, svn and HTTP.
#
#你引入庫(kù)所在的位置
s.source? ? ? = { :git => "/Users/xiaopengyou/Documents/IOSBase/CommonUtilities" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? CocoaPods is smart about how it includes source code. For source files
#? giving a folder will include any swift, h, m, mm, c & cpp files.
#? For header files it will include any header in the folder.
#? Not including the public_header_files will make all headers public.
# 你需要引入的具體文件,不知道為什么我的文件夾是引入進(jìn)去了,但是文件一直引入不進(jìn)去,突然又解決了鸣戴,主要是很多的網(wǎng)上的路徑寫的有問題。比如現(xiàn)在我引入的根目錄是CommonUtilities瘟栖,然后需要引入的模塊是StringUtilities,那么久直接寫"StringUtilities/StringBaseTools.{h,m}"就行了葵擎。而不是"CommonUtilities/StringUtilities/StringBaseTools.{h,m}"
#s.source_files? = "StringUtilities/StringBaseTools.{h,m}"
上面那種屬于你要把所有的全部引入進(jìn)去,但是一般來(lái)說(shuō)我們的工具也是分模塊的可能就會(huì)用下面的那一種
s.subspec 'StringUtilities' do |string|
string.source_files = "StringUtilities/StringBaseTools.{h,m}"
end
#? s.exclude_files = "Classes/Exclude"
# s.public_header_files = "Classes/**/*.h"
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? A list of resources included with the Pod. These are copied into the
#? target bundle with a build phase script. Anything else will be cleaned.
#? You can preserve files from being cleaned, please don't preserve
#? non-essential files like tests, examples and documentation.
#
# s.resource? = "icon.png"
# s.resources = "Resources/*.png"
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? Link your library with frameworks, or libraries. Libraries do not include
#? the lib prefix of their name.
#
# s.framework? = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"
# s.library? = "iconv"
# s.libraries = "iconv", "xml2"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
#? If your library depends on compiler flags you can set them in the xcconfig hash
#? where they will only apply to your library. If you depend on other Podspecs
#? you can include multiple dependencies to ensure it works.
s.requires_arc = true
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency "JSONKit", "~> 1.4"
end
建立了以上的文件以后就可以在pod里面將路徑指向它
1.直接指向文件
pod ‘ManageLocalCode', :podspec => '~/Documents/IOSBase/CommonUtilities/ManageLocalCode.podspec'
2.指向文件的路徑半哟,并且這個(gè)還是子模塊
pod ‘ManageLocalCode/StringUtilities', :path => '~/Documents/IOSBase/CommonUtilities'
然后運(yùn)行 pod install就可以了酬滤。途中可能會(huì)有錯(cuò)誤,一般都是一些語(yǔ)法錯(cuò)誤寓涨,還有就是文件的路徑錯(cuò)誤問題盯串。還有就是好像是需要用git庫(kù)(不怎么確定),反正我的是git庫(kù)戒良,其實(shí)只是用sourecetree建立一個(gè)git庫(kù)指向這個(gè)文件夾而已体捏。
這是本地使用cocoapods管理私有庫(kù)的一些用法。
然后還有使用指向自己的github的一些類庫(kù)糯崎,然后就是指向公司(自己服務(wù)器)svn或者git的一些用法几缭,應(yīng)該類似。