Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have multiple pods in one git repo

Context

We are developing a large software platform which includes Android, Server, Web and iOS (with others to come). To keep all of our code up to date with each other we keep it all in one Master repo (this is very important as we share a model across all platforms so commits can be affecting many different platforms).

To handle the iOS side we've decided to break the project down into modular pods so that we can easily share them across our other libraries (also pods), and so that when we release it is easy for our clients to include our api in their existing projects (i.e. we want to use the cocoapods structure for all of the wonderful benefits cocoapods provides).

To accomplish this I've gone about setting up a private spec repo and pod specs for each of our projects.

tl;dr: We've got one master git repo that holds all of our code (multiple platforms, including multiple different pods). We want to keep this structure but also be able to create pods from the code within the repo.

Question

The issue I'm running into is all the documentation I can find for pod specs say you have to use this format:

spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => spec.version.to_s }

the only part that trips me up is that our repo does not only contain one pod (let alone just iOS code).

Is it possible to do something like:

spec.source = { :git => 'https://github.com/MyCompany/Master/MyCompanyCoreDir', :tag => spec.version.to_s }

We really appreciate any help

Cheers

Indigo

like image 963
Zenton Avatar asked Dec 19 '14 06:12

Zenton


People also ask

Can you have multiple projects in one Git repo?

Yes. You can put multiple projects in one Git repository but they would need to be on different branches within that repo.

Can multiple people own a repository?

The free/Individual version allows for up to three "collaborators". That should be exactly what you're looking for. The team versions, on the other hand, allow for multiple collaborators AND "user management". If you wanted finer control over what collaborators can and cannot do, you'd need a team version.


1 Answers

It is possible to have multiple cocoapods on single Git repository.

Just as you said, you can specify different sources for each that lead to specific pod code.

In order for this to work, you have to also set proper source_files in spec, for example: s.source_files = 'SomePodDirectory/*.swift'.

You can even manage multiple versions of each pod by using something like this for source: s.source = { :git => 'https://github.com/MyCompany/Repository.git', :tag => 'SomePodName-v'+String(s.version) }.

In that case you should create proper tags on Git (for example SomePodName-v1.0.0).

like image 116
tadija Avatar answered Oct 05 '22 22:10

tadija