2014-09-25 35 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