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

3

18

I'm in the middle of some CocoaPods project trying to build my own private Pod, reachable via "pod install" from my main project. It's a Swift project, and everything seemed to be working, reading the appropriate tutorials, etc...

I have to say I've been using cocoapods for some time, but I'm kind of new building my own pods and storing them in my private gitlab space.

And that seems to be my problem: Apparently I don't know how to properly store my recently created pod on my gitlab space. Additionaly, running "pod install" can't fetch my podspec file.

What I have now is a main project, with a Podfile. In this project I have the next simple definition for my pods (2 public (SpkinKit and MBProgressHUD) and 1 private, 'commons'): My Podfile is this one:

# 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

If I type "pod install --verbose" I get the following output:

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`

This crash doesn't allow the pod to get downloaded, and the process stops here.

What seems to be wrong? As far as I understand I DO have a podspec file in that gitlab path route. Look at this screenshot:

File Structure inside my Gitlab

The URL scheme I'm using is the SSH flavoured one, that is the one appearing on the root of my gitlab project homepage (not the HTTP/HTTPS one). This is a limitation of the project, so I can't use the HTTP one.

OTOH I think my SSH credentials (and key setup) are stored ok on my machine. Why? because I try using a ssh shell against that URL, from the command line, and I can see "Welcome myusername" on screen without specifying any username and password (Then the gitlab machine logouts that shell for security reasons, but that's another theme. That's expected behaviour).

Whatever, I'm still not sure what exact URL format/path should I use in my base app Podfile.

Inside gitlab I have my files and podspec file stored with the structure shown in the last screenshot, but I'm still not 100% sure if I've setup everything ok.

The contents of my commons.podspec file are these:

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" => "[email protected]" }


  # 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

Any hint?

Thanks.

Easily answered 30/8, 2016 at 9:34 Comment(0)
S
19

The only thing you need to do is change :path => to :git => and it should download the pod from your repo.

Sainthood answered 10/2, 2017 at 11:44 Comment(1)
How? Please explain moreInfluent
U
0

You need a separate repository to host your pod specs.

  1. Create the repository
  2. Add the PodSpec repository to your machine pod repo add PodSpecs [Your PodSpecs Git URL]
  3. Push your pod spec to the repo pod repo push PodSpecs your.podspec

Source of info: https://www.raywenderlich.com/99386/create-cocoapod-swift

Urogenous answered 30/8, 2016 at 10:6 Comment(2)
That's what I ran before all my trouble: pod repo add ios_commons_pod ssh://git@numeric_ip:2222/myusername/ios_commons_pod.git And then pod repo push ios_commons_pod commons.podspec --allow-warnings (The allow-warning thing is because my license files are still fake and non existant)Easily
Looking at it, I think your problem is that you need to create an actual PodSpec repository that stores your versioned pod specs. I have updated my answer to show the basics of this and also included a link to the tutorial I used when creating a private pod the other week (although based on your PodSpec file I think you have already seen this tutorial :-P)Urogenous
C
0

In your podfile you have: pod 'commons', :path => 'ssh://git@internal_ip_numeric_address_of_my_gitlab_machine:2222/myusername/ios_commons_pod.git'

It needs to be: pod 'commons', :git => 'ssh://git@internal_ip_numeric_address_of_my_gitlab_machine:2222/myusername/ios_commons_pod.git'

Use :path to point to a pod on your computer, use :git to point to a repository.

Condiment answered 22/8, 2022 at 14:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.