现在某个文件夹下面使用pod spec create ManageLocalCode就会在那个库下面建立一个非常完整的文件,里面有很多选项可以填写,如果你需要添加就把“#”号去除。
这是我的目录
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.
# 你需要引入的具体文件,不知道为什么我的文件夹是引入进去了,但是文件一直引入不进去,突然又解决了,主要是很多的网上的路径写的有问题。比如现在我引入的根目录是CommonUtilities,然后需要引入的模块是StringUtilities,那么久直接写"StringUtilities/StringBaseTools.{h,m}"就行了。而不是"CommonUtilities/StringUtilities/StringBaseTools.{h,m}"
#s.source_files = "StringUtilities/StringBaseTools.{h,m}"
上面那种属于你要把所有的全部引入进去,但是一般来说我们的工具也是分模块的可能就会用下面的那一种
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.指向文件的路径,并且这个还是子模块
pod ‘ManageLocalCode/StringUtilities', :path => '~/Documents/IOSBase/CommonUtilities'
然后运行 pod install就可以了。途中可能会有错误,一般都是一些语法错误,还有就是文件的路径错误问题。还有就是好像是需要用git库(不怎么确定),反正我的是git库,其实只是用sourecetree建立一个git库指向这个文件夹而已。
这是本地使用cocoapods管理私有库的一些用法。
然后还有使用指向自己的github的一些类库,然后就是指向公司(自己服务器)svn或者git的一些用法,应该类似。