我在对私有 gitlab pod/project 容器执行 "pod install" 时收到一条 "No podspec found" 消息

I'm getting a "No podspec found" message when doing "pod install" against a private gitlab pod/project container

我正在进行一些 CocoaPods 项目,试图构建我自己的私人 Pod,可以通过 "pod install" 从我的主项目访问。 这是一个 Swift 项目,一切似乎都在工作,阅读适当的教程等...

我不得不说我已经使用 cocoapods 有一段时间了,但我有点新 构建 我自己的 pods 和将它们存储在我的私人 gitlab space.

这似乎是我的问题:显然我不知道如何在我的 gitlab space 上正确存储我最近创建的 pod。此外,运行 "pod install" 无法获取我的 podspec 文件。

我现在拥有的是一个主项目,带有一个 Podfile。在这个项目中,我的 pods 有下一个简单的定义(2 public(SpkinKit 和 MBProgressHUD)和 1 个私有的,'commons'): 我的 Podfile 是这个:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'

target 'MyBaseApp' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyBaseApp

  pod 'SpinKit'
  pod 'MBProgressHUD'
  pod 'commons', :path => 'ssh://git@internal_ip_numeric_address_of_my_gitlab_machine:2222/myusername/ios_commons_pod.git'

end

如果我输入 "pod install --verbose" 我会得到以下输出:

Fetching external sources
-> Fetching podspec for `commons` from `ssh://git@internal_ip_numeric_address_of_my_gitlab_machine:2222/myusername/ios_commons_pod.git`
[!] No podspec found for `commons` in `ssh://git@internal_ip_numeric_address_of_my_gitlab_machine:2222/myusername/ios_commons_pod.git`

此崩溃不允许下载 pod,进程在此处停止。

好像哪里不对?据我了解,我在该 gitlab 路径中确实有一个 podspec 文件。 看看这个截图:

我使用的 URL 方案是 SSH 风格的方案,即出现在我的 gitlab 项目主页根目录中的方案(不是 HTTP/HTTPS 方案)。 这是项目的限制,所以我不能使用HTTP。

OTOH 我认为我的 SSH 凭据(和密钥设置)在我的机器上存储正常。为什么?因为我尝试从命令行使用 ssh shell 来对抗 URL,并且我可以在屏幕上看到 "Welcome myusername" 而无需指定任何用户名和密码(然后 gitlab 机器注销 shell 出于安全原因,但这是另一个主题。这是预期的行为)。

无论如何,我仍然不确定我应该在我的基本应用程序 Podfile 中使用什么 URL format/path。

在 gitlab 中,我有我的文件和 podspec 文件存储在最后一个屏幕截图中显示的结构中,但我仍然不能 100% 确定我是否已设置一切正常。

我的 commons.podspec 文件的内容是这些:

Pod::Spec.new do |s|

  # 1
  s.platform = :ios
  s.ios.deployment_target = '8.0'
  s.name = "commons"
  s.summary = "commons test fw via pod."
  s.requires_arc = true

  # 2
  s.version = "0.1.0"

  # 3
  s.license = { :type => "MIT", :file => "LICENSE" }

  # 4 - Replace with your name and e-mail address
  s.author = { "Me" => "my@email.address.com" }


  # 5 - Replace this URL with your own Github page's URL (from the address bar)
  s.homepage = "http://internal_ip_numeric_address_of_my_gitlab_machine:8888/myusername"

  # 6 - Replace this URL with your own Git URL from "Quick Setup"
  s.source = { :git => "http://internal_ip_numeric_address_of_my_gitlab_machine:8888/myusername/ios_commons_pod.git", :tag => "#{s.version}"}

  # 7
  s.framework = "UIKit"
  s.dependency 'RNCryptor'

  # 8
  s.source_files = "commons/**/*.{swift}"

  # 9
  s.resources = "commons/**/*.{png,jpeg,jpg,xib,storyboard}"
end

有什么提示吗?

谢谢。

您需要一个单独的存储库来托管您的 pod 规范。

  1. 创建存储库
  2. 将 PodSpec 存储库添加到您的计算机 pod repo add PodSpecs [Your PodSpecs Git URL]
  3. 将您的 pod 规范推送到存储库 pod repo push PodSpecs your.podspec

信息来源:https://www.raywenderlich.com/99386/create-cocoapod-swift

您唯一需要做的就是将 :path => 更改为 :git =>,它应该会从您的存储库中下载 pod。