2014-09-25 69 views
1

我想分享一個私人SDK,使用我們可以在所有項目中使用的spec repo和cocoapods。如何設置私人cocoapod私下共享我們的SDK

我通過創建一個新的Cocoatouch靜態庫Xcode項目創建了一個虛擬/測試SDK(DummySDK)。項目中沒有代碼。我沒有添加pod文件或任何其他代碼。

我將該項目添加到bitbucket (https://bitbucket.org/foo/dummysdk)。該項目文件位於https://bitbucket.org/foo/dummysdk/DummySDK.xcodeproj和.h文件位於https://bitbucket.org/grantspilsbury/dummysdk/dummysdk/dummysdk.h

然後我加了一個許可證文件,並將其推到位鬥(https://bitbucket.org/foo/dummysdk/license.txt),以及針對版本的標籤1.0。

我然後在https://bitbucket.org/foo/podspecs/PodSpec/1.0/PodSpec.podspec

Pod::Spec.new do |s| 
    s.name   = 'PodSpec' 
    s.version  = '1.0' 
    s.summary  = 'Lightweight ad mediation for iOS' 
    s.author = { 
    'Grant' => '[email protected]' 
    } 
    s.source = { 
    :git => 'https://[email protected]/foo/testsdk.git', 
    :tag => '1.0' 
    } 
    s.source_files = 'Source/*.{h,m}' 
    s.homepage  = "http://www.testsdk.com" 
    s.license  = "MIT" 
    s.license  = { :type => "MIT", :file => "license.txt" } 
    s.requires_arc = true 
end 

然後我跑的命令> ~/Source/PodSpecs/PodSpec/1.0$ pod repo add PodSpecs https://bitbucket.org/foo/podspecs(從那裏spec文件位於)

然後我跑加入下列規格文件來到位桶(作爲紅寶石文件) >~/.cocoapods/repos/PodSpecs$ pod repo lint .(從spec文件

的根文件夾我得到的輸出消息:

Linting spec repo `PodSpecs` 
. 
Analyzed 1 podspecs files. 
All the specs passed validation. 

我再刪除,因爲我加了早些時候的許可文件

pod repo remove PodSpecs 

再次添加的規範文件,然後跑> ~/Source/PodSpecs/PodSpec/1.0$ pod repo add PodSpecs https://bitbucket.org/foo/podspecs

我然後試圖通過運行來推動莢規範文件:

>~/Source/PodSpecs/PodSpec/1.0$ pod repo push PodSpecs PodSpec.podspec --verbose 

我收到以下消息:

Validating spec 
[!] The `PodSpec.podspec` specification does not validate. 

/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/repo/push.rb:91:in `rescue in block in validate_podspec_files' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/repo/push.rb:88:in `block in validate_podspec_files' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/repo/push.rb:85:in `each' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/repo/push.rb:85:in `validate_podspec_files' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/repo/push.rb:42:in `run' 
/Library/Ruby/Gems/2.0.0/gems/claide-0.6.1/lib/claide/command.rb:281:in `run' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command.rb:48:in `run' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:33:in `<top (required)>' 
/usr/bin/pod:23:in `load' 
/usr/bin/pod:23:in `<main>' 

我也試過>~/Source/PodSpecs/PodSpec/1.0$ pod repo push PodSpecs PodSpec.podspec --allow-warnings

,並得到了消息:

Validating spec 
[!] The `PodSpec.podspec` specification does not validate. 

這是據我得到了。我還需要知道如何將sdk包含到其他項目中,我假設使用podfile?

我也試圖改變莢規範文件名DummySDK和使用,在吊艙規範文件:

Pod::Spec.new do |s| 
     s.name   = 'DummySDK' 
     s.version  = '1.0' 
     s.summary  = 'Lightweight ad mediation for iOS' 
     s.author = { 
     'Grant' => '[email protected]' 
     } 
     s.source = { 
     :git => 'https://[email protected]/foo/testsdk.git', 
     :tag => '1.0' 
     } 
     s.source_files = 'Source/*.{h,m}' 
     s.homepage  = "http://www.testsdk.com" 
     s.license  = "MIT" 
     s.license  = { :type => "MIT", :file => "license.txt" } 
     s.requires_arc = true 
    end 

但得到的錯誤:

~/.cocoapods/repos/PodSpecs$ pod spec lint 

-> DummySDK (1.0) 
    - ERROR | [OSX] [xcodebuild] 2014-09-25 11:06:37.481 xcodebuild[6872:2403] error: InputFile /Applications/Xcode 2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/SDKSettings.plist 0 1377395452 1100 33188... malformed line 7; 'InputFile' should have exactly five arguments 
    - ERROR | The `source_files` pattern did not match any file. 
    - ERROR | [iOS] [xcodebuild] 2014-09-25 11:06:40.900 xcodebuild[6918:3d07] error: InputFile /Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/SDKSettings.plist 0 1407358670 911 33188... malformed line 7; 'InputFile' should have exactly five arguments 
    - ERROR | [iOS] [xcodebuild] 2014-09-25 11:06:40.902 xcodebuild[6918:3d07] error: InputFile /Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/SDKSettings.plist 0 1407358670 911 33188... malformed line 7; 'InputFile' should have exactly five arguments 

Analyzed 1 podspec. 

編輯

在我的sdk倉庫中有代碼,但沒有什麼意義。

即。.h文件看起來像這樣:

// 
// DummySDK.h 
// DummySDK 
// 
// Created by Grant Spilsbury on 2014/09/25. 
// Copyright (c) 2014 Grant Spilsbury. All rights reserved. 
// 

#import <Foundation/Foundation.h> 

@interface DummySDK : NSObject 

@end 

的SDK庫的整個文件結構如下:

/dummysdk 
/dummysdk/DummySDK 
/dummysdk/DummySDK/DummySDK.h 
/dummysdk/DummySDK/DummySDK.m 
/dummysdk/DummySDK.xcodeproj 
/dummysdk/DummySDK.xcodeproj/project.xcworkspace 
/dummysdk/DummySDK.xcodeproj/xcuserdata 
/dummysdk/DummySDK.xcodeproj/project.pbxproj 
/dummysdk/DummySDKTests 

我改名的Xcode這似乎解決了一個問題,但我現在得到以下皮棉錯誤:

~/.cocoapods/repos/PodSpecs$ pod spec lint . 

-> DummySDK 
――― MARKDOWN TEMPLATE ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 

### Report 

* What did you do? 

* What did you expect to happen? 

* What happened instead? 


### Stack 

``` 
    CocoaPods : 0.33.1 
     Ruby : ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13] 
    RubyGems : 2.0.14 
     Host : Mac OS X 10.9.4 (13E28) 
     Xcode : 6.0 (6A313) 
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib 
Repositories : Cocoapods - https://bitbucket.org/afrozaar/specs @ df68442fba9e1d7259248b1f2d46cc00835c6114 
       PodSpecs - https://bitbucket.org/grantspilsbury/podspecs @ f3547e07e39e8a804c3a4238415cc86e5908d95f 
       master - https://github.com/CocoaPods/Specs.git @ b99e5bad41d73c1c575dc2237ac7e7eab55b0dcc 
``` 

### Error 

``` 
REST::DisconnectedError - end of file reached 
/Library/Ruby/Gems/2.0.0/gems/nap-0.8.0/lib/rest/request.rb:190:in `rescue in perform' 
/Library/Ruby/Gems/2.0.0/gems/nap-0.8.0/lib/rest/request.rb:187:in `perform' 
/Library/Ruby/Gems/2.0.0/gems/nap-0.8.0/lib/rest/request.rb:200:in `perform' 
/Library/Ruby/Gems/2.0.0/gems/nap-0.8.0/lib/rest.rb:41:in `head' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.33.1/lib/cocoapods-core/http.rb:63:in `perform_head_request' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.33.1/lib/cocoapods-core/http.rb:13:in `block in get_actual_url' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.33.1/lib/cocoapods-core/http.rb:12:in `loop' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.33.1/lib/cocoapods-core/http.rb:12:in `get_actual_url' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.33.1/lib/cocoapods-core/http.rb:43:in `validate_url' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/validator.rb:232:in `validate_url' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/validator.rb:247:in `validate_homepage' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/validator.rb:199:in `perform_extensive_analysis' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/validator.rb:71:in `validate' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/spec.rb:93:in `block in run' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/spec.rb:86:in `each' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command/spec.rb:86:in `run' 
/Library/Ruby/Gems/2.0.0/gems/claide-0.6.1/lib/claide/command.rb:281:in `run' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods/command.rb:48:in `run' 
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:33:in `<top (required)>' 
/usr/bin/pod:23:in `load' 
/usr/bin/pod:23:in `<main>' 
``` 

――― TEMPLATE END ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 

[!] Oh no, an error occurred. 

Search for existing github issues similar to yours: 
https://github.com/CocoaPods/CocoaPods/search?q=end+of+file+reached&type=Issues 

If none exists, create a ticket, with the template displayed above, on: 
https://github.com/CocoaPods/CocoaPods/issues/new 

Don't forget to anonymize any private data! 

回答

1

所以我看到您的最終皮棉兩個問題:

  • error: InputFile消息與有關Xcode 6的問題相關,請參閱https://github.com/CocoaPods/CocoaPods/issues/2394#issuecomment-56658587 - 作爲解決方法,您可以將您的Xcode 2.app重命名爲不包含空格的其他內容。

  • source_files相關信息表示.h.m文件實際上存在於您的Source目錄中。你說「這個項目還沒有代碼」很早,那肯定會導致皮棉失敗。

+0

我改名爲xcode,似乎解決了這個問題。請查看關於空文件的更新後的文章 – grabury 2014-09-25 11:11:25

+0

看起來在驗證規範中的主頁時出現了一些問題,可能是臨時連接問題。 – NeoNacho 2014-09-25 16:08:25