CocoaPods 建立私有仓库

这里有个坑首先须要注意,建立私有cocoapods仓库须要两个git仓库,即代码仓库,Specs文件仓库.git

1、建立私有库github

1.建立本身源码仓库,假设是A.git;测试

2.对A仓库:spa

git add .资源

git commit -m "commit msg"源码

git tag -a 1.0.0it

git push tag -all编译

3.建立Specs仓库B.git;class

4.添加私有repo到CocoaPods中:date

pod repo add B B.git

5.进入A仓库的目录建立Specs文件:

pod spec create A A.git

此时A仓库目录下有A.podspec文件;

6.编辑A.Spec文件;

7.A目录下验证A.Spec:

pod lib lint --verbose --allow-warnings

8.提交Spec:

pod repo push B A.podspec

 

2、使用私有库

1.在须要使用私有库的项目中,编辑podFile:

source 'B.git'

pod 'A'

2.终端中pod install 便可

 

3、高级

1.若私有cocoapods A 依赖另外一个私有cocoapods C:

pod spec lint --verbose --allow-warnings --sources='C_Specs.git,https://github.com/CocoaPods/Specs'

其中C_Specs.git是私有cocoapods C的Specs文件仓库地址;

2.若私有cocoapods中含有xib文件,须要将xib文件做为资源文件,而不能做为源码文件,不然导入安装后会编译不过。

s.resources = ["images/*.png", "classes/MyView.xib"];

3.方便测试当前库源码是否OK:

在使用私有cocoapods的仓库中,

修改pod 'A' 为 pod 'A', :path => 'XXXXXX'      #指定路径,其中XXXXX为A仓库的本地路径。

而后执行:pod update

相关文章
相关标签/搜索