Workflow optimization for updating cocoapods internal dependencies?

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

Let's say I'm working on Project A , and while working on it, I find a fix in DependencyB , so I am changing the code in this dependency while still in ProjectA Xcode.

What would be the best workflow to make changes to this dependency in your own repository and then update this dependency in Project A ?

I would really like to somehow: avoid , fully automate, or simplify the next workflow (which is PITA)

Worflow to avoid

  • git clone git@github.com :Organization/DependencyB.git
  • Make changes to the project dependencies ( the same changes that were made when fixing the problem that was discovered while working on Project A )

  • Update DependencyB.podspec File

     s.version = "0.1.7" s.source = { :git => "https://github.com/Organization/DependencyB.git", :tag => "0.1.7" } 
  • Commit and flag this dependency 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 
  • Update the repository of private cocoapods (which I saved in ~/ )

     cd ~/.cocoapods/OrganizationPrivateRepo/CoverFlux mkdir 0.1.7 cd 0.1.7 
  • copy the updated DependencyB.podspec to the organization's private repo (cloned into ~/.cocoapods )

     ~/.cocoapods/OrganizationPrivateRepo/DependencyB/0.1.7/CoverFlux.podspec 
  • Commit the changes to the private repository and click on the remote

     cd ~/.cocoapods/OrganizationPrivateRepo/ git commit -am 'Added version 0.1.7 to DependencyB spec' git push origin master 
  • Finally, go to the Project A start folder and update

     pod update 

Note:

Project. Podkayl is as follows:

  platform :ios, '6.0' pod 'DependencyB' 
+6
source share
1 answer

Here are some tips to streamline your workflow. In addition to this, you may need to consider creating additional scripts.

Firstly, I recommend saving the podspec file to the root of your project. So, DependencyB.git will have a DependencyB.podspec file.

Simplify step 3

Change the source tag for the version link. Thus, you only need to change the version string 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 the 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 in the line, giving way:

 pod push OrganizationPrivateRepo 

Step 4

Finally, I think simplification of step 4 is possible, but this is one of those things that varies between organizations and individual developers, as it is part of their workflow. For example, I usually pass in an IDE from my environment.

Such scripts can be integrated into podspec to 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 changes to DependencyB twice. You can customize CocoaPods symbolic link. In the Projectfile Podfile, specify the following:

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

Now you can edit files in DependencyB from ProjectA. After making this change, you will need to run pod update . After this, changes to the source will be available immediately, as this is a symbolic link. I am having trouble running Git commits from Xcode while doing this, but other than that it works well.

+4
source

Source: https://habr.com/ru/post/951588/


All Articles