.h #import <Foundation/Foundation.h> @interface PodTest : NSObject +(void)test; @end .m #import "PodTest.h" @implementation PodTest +(void)test { NSLog(@"hello world"); } @end
$cd ~/
$pod spec create xl_test
$vim xl_test.podspec
:%d
Pod::Spec.new do |s| s.name = "xl_test" s.version = "1.5" #当前版本 s.summary = "xl_testa ad ha va " #描述 s.homepage = "https://github.com/goingta/MyPodDemo" #库文件主页地址 s.license = “caimao" s.author = { "tanqilong" => "tanqilong@huobi.com" } #k开发者 s.source = { :git => "http://git.caimaodev.com/tanqilong/pod_test.git", :tag => "1.5" } #文件的git地址,以及当前版本对应的tag,这个1.5就是我刚刚标注的 s.source_files = 'PodTest/PodTest/*.{h,m}' #文件所在的目录,后面*.{h.m}是一个正则表达式,目录我下面会有解释 s.resources = 'PodTest/PodTest/*.xib' #资源文件所在的目录图片,xib等 s.framework = 'UIKit' #当前这个库所依赖的系统的库 s.platform = :ios s.requires_arc = true #是否支持arc end
:wq
$ pod spec lint xl_test.podspec --allow-warnings
$pod repo add mypod http://git.caimaodev.com/tanqilong/PrivateCocoapodsSpec.git
$pod repo list
master - Type: git (master) - URL: https://github.com/CocoaPods/Specs.git - Path: /Users/tanqilong/.cocoapods/repos/master mypod - Type: git (master) - URL: http://git.caimaodev.com/tanqilong/PrivateCocoapodsSpec.git - Path: /Users/tanqilong/.cocoapods/repos/mypod
则代表添加成功,上面master是github用到的,下面mypod就是咱们刚刚私有的.他们都讲用于管理描述库的spec文件ios
$ pod repo push mypod xl_test.podspec --allow-warnings
$ open ~/.cocoapods/repos
$ cd ~/desktop/TestCocoaPods
$ pod search xl_test
source 'https://github.com/CocoaPods/Specs.git' source 'http://git.caimaodev.com/tanqilong/PrivateCocoapodsSpec.git' platform :ios, '8.0' target 'TestCocoaPods' do pod 'xl_test', '~> 1.5' end
$pod install