将框架中的主要文件放入到一个指定文件夹中,好比叫Classes或者Lib均可以 html
cd /Users/lxf/xxxx/LXFPhotoHelper
复制代码
git init
复制代码
git add .
复制代码
git commit -m '描述'
复制代码
git remote add origin https://github.com/LinXunFeng/xxx.git
复制代码
git push origin master
复制代码
若是出现以下提示git
fatal: unable to access 'https://github.com/xxx/xxx.git/': The requested URL returned error: 403
复制代码
缘由是本地缓存了用户名和密码 编辑.git目录下的config文件github
vi .git/config
复制代码
找到url那一行,在github.com前加上用户名后保存,再从新执行推送操做sql
url = https://LinXunFeng@github.com/LinXunFeng/xxx.git
复制代码
// 具体说明能够执行`git tag --help`后查看
// git tag -a '版本号' -m 'tag描述'
// 注意一下,这里打的标签只是在本地
git tag '0.0.1'
复制代码
// 只推着指定版本
// git push origin 版本号
git push --tags
复制代码
// 名称通常与工程名称保持一致
pod spec create 框架名称
复制代码
s.name = "LXFPhotoHelper(仓库名称)"
s.version = "0.0.1(版本号,这里跟下面s.source中的tag有关)"
s.summary = "对你本身仓库的简单描述,不要写太多字"
s.description = "这个是详细描述,这里须要注意的是,这里文字的长度须要比 s.summary的要长,否则会出现警告"
s.homepage = "仓库首页地址,如https://github.com/LinXunFeng/LXFPhotoHelper"
s.license = "MIT"
s.author = { "LinXunFeng" => "598600855@qq.com" }
# source存放的地址是代码的真正地址
s.source = { :git => "仓库对应的git地址,如https://github.com/LinXunFeng/LXFPhotoHelper.git", :tag => "#{s.version}" }
# pod install时真正下载下来的文件路径,这里指定的是你仓库下的Classes目录中的全部.h和.m文件(填写的是相对地址)
# ** 通配目录
s.source_files = "Classes", "Classes/**/*.{h,m}"
# s.library = "sqlite3" # 框架依赖系统的sqlite3
复制代码
也能够上官网的手册【Podspec Syntax Reference】上查看json
这里须要咱们注意的是s.version= "0.0.1"
,这里的版本号要与刚刚打的tag一致缓存
// --verbose 打印详情信息
// pod trunk register 邮箱 '你的名称' --verbose
pod trunk register 598600855@qq.com 'LinXunFeng' --verbose
复制代码
而后去验证邮箱 bash
pod trunk push 名称.podspec
执行pod trunk push
后会有一个审核的过程,若是提示没有经过,有ERROR就修改好后从新push,若是只是WARN能够选择在pod trunk push
后面加上--allow-warnings
来忽略它们微信
pod trunk push LXFPhotoHelper.podspec --allow-warnings
复制代码
若是出现以下信息,则说明你的框架名字已被占用,得从新改个名字~ 因此,在建立你本身的cocoapods仓库时最好是到cocoapods.org上先查一下有没有相同名字的框架
[!] You (xxx@qq.com) are not allowed to push new versions for this pod. The owners of this pod are yyy@qq.com.
复制代码
上传成功后会自动帮咱们更新本地仓库,若是没法搜索到本身的框架,能够先删掉本地的索引文件后再搜索一次ide
rm ~/Library/Caches/CocoaPods/search_index.json
复制代码
当使用pod search 命令能够搜索本身的框架时, 那么就意味着审核经过了