制作cocoapods公共代码库公共repo组件

1. 注册一个GitHub账户

2. 创建一个仓库

3. 打开终端,跳入你需要存放代码的文件夹(git的本地仓库)

4. git clone github.com/xxx/xxx.git

5. 将要分享的代码copy到git的本地仓库中

6. git add . 添加所有文件到本地仓库中

7. git commit -m "说明" commit到GitHub

8. git push origin master 推到GitHub上

9. 如果没有注册cocoapods需要注册pod trunk register [email protected] 'Your Name' --description='macbook pro'

10. pod spec create xxx 创建podspec文件

11. 修改podspec文件

  • a) spec.name pod库的名字

  • b) spec.version pod库的版本

  • c) spec.license pod库的开源类型

  • d) spec.summary pod库的简介

  • e) spec.homepage pod库的首页(一般为库在github的URL)

  • f) spec.author pod库的作者

  • g) spec.source pod库的资源URL(一般为当前代码在GitHub的URL)(和homepage不同的是,它有个后缀.git)

  • h) spec.source_files pod库的文件路径

  • i) spec.requires_arc pod库的代码是否是arc的

  • j) spec.platform pod库的对应的苹果版本 (示例 :ios, "9.0" )

  • k) spec.dependency pod库依赖的其他库(选填)

12. git tag -a 0.0.1 -m "更新版本0.0.1"

13. git push origin 0.0.1

14. 可以选择同时验证本地和远程pod spec lint --allow-warnings

15. pod trunk push xxx.podspec --allow-warnings

16. 完成

Podspec示例如下:

Pod::Spec.new do |spec|

spec.name = "PodBase"

spec.version = "1.0.1"

spec.license = { :type => "MIT", :file => "LICENSE" }

spec.summary = "组件化私有库测试"

spec.homepage = "https://github.com/jishaowei"

spec.author = { "xiaofengwork" => "[email protected]" }

spec.source = { :git => "https://github.com/jishaowei/podbasetest.git", :tag => spec.version }

spec.source_files = "Classes/**/*.{h,m}"

spec.requires_arc = true

spec.platform = :ios, "9.0"

spec.dependency "JSONKit"

end

转载于:https://juejin.im/post/5d0a24f95188257e6b1b3d2a

猜你喜欢

转载自blog.csdn.net/weixin_34356555/article/details/93179373