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

Isaac picture Isaac · Aug 30, 2016 · Viewed 19.2k times · Source

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.

Answer

M.Sprind picture M.Sprind · Feb 10, 2017

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