.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