Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimizing workflow to update internally owned cocoapods dependencies?

Let's say I have a main Project A with several cocoapods dependencies (which are internally owned by our organization's cocoapods repo).

Let's say I'm working on Project A, and while working on it I find a fix on a DependencyB, so I modify the code in that dependency while still being on ProjectA's Xcode project.

What would be the best workflow to push the changes on that dependency to it's own repository and then updating that dependency in Project A?

I would really like some ways so avoid, completely automate or simplify the following workflow (which is a PITA)

Worflow to avoid

  1. git clone [email protected]:Organization/DependencyB.git
  2. Make your changes in the dependency project (the same changes that where made while fixing the issue that I found while working on Project A)

  3. Update the DependencyB.podspec file

    s.version = "0.1.7"
    s.source = { :git => "https://github.com/Organization/DependencyB.git", :tag => "0.1.7" }
    
  4. Commit & Tag this dependency's version

    git add -A
    git commit -m 'Made some changes'
    git tag -a 0.1.7 -m 'This is an awesome tag :D'
    git push origin master
    git push --tags origin
    
  5. Update the organiazation's private cocoapods repo (which I stored in ~/)

    cd ~/.cocoapods/OrganizationPrivateRepo/CoverFlux
    mkdir 0.1.7
    cd 0.1.7
    
  6. copy the updated DependencyB.podspec to the organiation's private repo (cloned in ~/.cocoapods)

    ~/.cocoapods/OrganizationPrivateRepo/DependencyB/0.1.7/CoverFlux.podspec
    
  7. Commit changes in the private repository & push to remote

    cd ~/.cocoapods/OrganizationPrivateRepo/
    git commit -am 'Added version 0.1.7 to DependencyB spec'
    git push origin master
    
  8. Finally proceed to the initial's 'Project A' folder and update

    pod update
    

Note:

Project's A podfile looks like:

    platform :ios, '6.0'
    pod 'DependencyB'
like image 460
Goles Avatar asked Aug 12 '13 22:08

Goles


1 Answers

Here are some tips to simplify your workflow. Beyond these, you might need to consider making some additional scripts.

First, I recommend that you keep your podspec file located at the root of your project. So, DependencyB.git would have the file DependencyB.podspec.

Simplify Step 3

Change your source tag to reference the version. This way, you only need to change the version line in your podspec.

s.source = { :git => "https://github.com/Organization/DependencyB.git", :tag => "#{s.version}" }

Simplify Steps 5, 6, and 7

Run the following from your DependencyB.git directory. (Assuming you have your podspec there as I suggested above)

pod push OrganizationPrivateRepo DependencyB.podspec

If DependencyB.podspec is the only podspec file, you don't even need to include it on the line, yielding:

pod push OrganizationPrivateRepo

Step 4

Finally, I think that simplifying Step 4 is possible, but is one of those things that varies between organizations and individual developers as it is part of their workflow. For example, I normally commit from my IDE.

Such scripts could be integrated into the podspec so that they update the s.version value. Or alternatively, get the correct tag from the s.version value.

UPDATE: Simplify Step 2

It looks like you are making a change twice to DependencyB. You can have CocoaPods setup a symbolic link. In ProjectA's Podfile, set the following:

pod 'DependencyB', :path => "../path/to/DependencyB'

You can now edit the files in DependencyB from ProjectA. You will need to run pod update after making this change. After that, the changes to the source will be available immediately since it is a symbolic link. I have had trouble making Git commits from Xcode when doing this, but other than that it works well.

like image 159
David V Avatar answered Oct 01 '22 03:10

David V