使用cocoapods建立本地私有庫

現(xiàn)在某個(gè)文件夾下面使用pod spec create ManageLocalCode就會在那個(gè)庫下面建立一個(gè)非常完整的文件,里面有很多選項(xiàng)可以填寫,如果你需要添加就把“#”號去除。

這是我的目錄


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.

#

#你引入庫所在的位置

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)去,但是一般來說我們的工具也是分模塊的可能就會用下面的那一種

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就可以了。途中可能會有錯(cuò)誤,一般都是一些語法錯(cuò)誤,還有就是文件的路徑錯(cuò)誤問題。還有就是好像是需要用git庫(不怎么確定),反正我的是git庫,其實(shí)只是用sourecetree建立一個(gè)git庫指向這個(gè)文件夾而已。

這是本地使用cocoapods管理私有庫的一些用法。

然后還有使用指向自己的github的一些類庫,然后就是指向公司(自己服務(wù)器)svn或者git的一些用法,應(yīng)該類似。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容