Cocoapods and SVN - xcode

How can I use the pods files from a remote SVN server, a private server protected by username and password, after creating the complete structure needed for Cocoapods ?
thanks
Update
Move the all sources inside a sub-directory named with version of sources (eg trunk/2.0.0) and declare it on pod like below :
pod 'MyLibrary', :svn => 'http://svn-your-ip/svn/MyLibrary/trunk/2.0.0'

The easiest variant would be to create a local checkout, and then reference the path like so:
pod 'AFNetworking', :path => '~/Documents/AFNetworking'

Related

How do I access a branch via a Podfile's source statement?

Scenario: I have a source which by default is the master branch of that source. I want to be able to access a custom branch.
platform :ios, '11.0'
#use_modular_headers!
source 'https://gitw.RicSite.com/digital/mobile/ios/NativeApps/Fast/Ric-Cocoapods.git', :branch => 'AlamoFire/5.4.2'
source 'https://github.com/CocoaPods/Specs.git'
The 'source' doesn't allow for an extra parameter: 'branch'.
But I don't want to access the 'master' (default) until I merge.
Is there a solution?
Try
pod 'YourPod', :git=> 'https://gitw.RicSite.com/digital/mobile/ios/NativeApps/Fast/Ric-Cocoapods.git', :branch=> 'AlamoFire/5.4.2'
for the pod you need. This is how I do this

How to specify a username for a private pod

I am setting up a private pod that will be used across our team. In my podfile I have something like:
pod 'MySDK', :git => 'https://myusername#bitbucket/...git'
Is there a way to replace myusername with the username that downloaded the current project.
I can get the current username by parsing the url from
git config --get remote.origin.url
Plan B is to make a script that modifies the podfile before running pod install. I am curious if I can make it without this extra step?
This is what I came up, below is part of my podfile
#try to keep the current git user in the pod url
remoteUrl = %x|git config --get remote.origin.url|
username = remoteUrl.scan(/[A-Z0-9._%+-]+#[A-Z0-9.-]+\.[A-Z]{2,4}/i).first
podUrl = "https://#{username}/mycompany/myrepo.git"
puts podUrl
pod 'MySDK', :git => podUrl, :commit => 'commitid'
Works great for me! Respect to all cocopods devs that made it so customizable!

Different result on CocoaPod install with identical Podspecs for EarlGrey 2.0 app

I am trying to figure out why I get two different results after running pod install on what should be identical podspec files. The component is called EarlGreyApp, which had a 2.0.0 release this year. The podspec for the 2.0.0 release is here in the earlgrey2 branch of the EarlGrey repo: https://github.com/google/EarlGrey/blob/earlgrey2/EarlGreyApp.podspec
When I have this defined in the podfile (I am using Demo/EarlGreyExample to reproduce) :
target 'EarlGreyExampleSwift' do
pod 'EarlGreyApp', '2.0.0'
end
It correctly modifies this section of EarlGreyExample.xcodeproj/project.pbxproj to reference EarlGrepApp's AppFramework.framework component:
/* Begin PBXShellScriptBuildPhase section */
4D216774E658C2E4470F936E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-EarlGreyExampleSwift/Pods-EarlGreyExampleSwift-frameworks.sh",
"${PODS_ROOT}/EarlGreyApp/AppFramework.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppFramework.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-EarlGreyExampleSwift/Pods-EarlGreyExampleSwift-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
However when I change the podfile to point to the branch:
target 'EarlGreyExampleSwift' do
pod 'EarlGreyApp', :git => 'https://github.com/google/EarlGrey.git', :branch => 'earlgrey2'
end
The above section does not get generated into the project.pbxproj file.
I am at a loss to explain why as the podspec registered for EarlGreyApp should be the same. When I do pod spec cat EarlGreyApp I see the same contents as what is in the earlgrey2 branch.
pod spec cat EarlGreyApp --show-all
Shows me that there are only two Podspecs available, 2.0.0 and 2.0.0-rc
Any ideas on what the difference could be?
The reason for this is because the Podspec is not published through the earlgrey2 branch it is published through the earlgrey2pod branch.
The reason for this is some users want to use EarlGrey without CocoaPods and some want to use it with. The two branches have subtle differences to allow for both use cases (compiling issues).
Additionally there are further intricacies with CocoaPods when you do a manual pod install, as you did when you referenced the github directly. I would recommend not trying that. Since EarlGreyApp is compiled as a Framework you cannot just do that unfortunately (you can with EarlGreyTest which is compiled from source). CocoaPods has poor undefined behavior in this regard.

Not getting success after publish cocoaPod libray push

pod repo push iOS_FS iOS_FS.podspec
Validating spec
-> iOS_FS (0.1.0)
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
And trying to add in my project pod 'iOS_FS'. it's not working saying not available. How get know whether my library has been publish successfully or not.
I am able to create own iOS cocoa pod. follow below steps.
How to create your own pod file and shared it with other developers.
Create and public own pod.
Step 1:-
Create pod file in a local directory by running the below command.
pod spec create podspecificationfileName
Example:
pod spec create iOSUtilis
After creating file do configuration of target version, tag, code sync, dependency of other framework.
Step 2: once you make sure your code is compiling and well working
Create tag of your branch like below
git tag 0.0.1
git push origin 0.0.1
And update tag number in iOSUtilis.podspec file
Step 3: run command:
pod spec lint iOSUtilis.podspec
Result will be:
iOSUtilis.podspec passed validation
Step 4: publish you pod to online
Run command.
pod trunk push iOSUtilis.podspec
Result will be:
🎉 Congrats
🚀 iOSLoader (0.0.1) successfully published
📅 September 28th, 20:27
🌎 https://cocoapods.org/pods/iOSLoader
👍 Tell your friends!
MacBook-Pro:iOSUtilis chandrakant$
How to create another version of pod.
Step 1: Just make changes in your code and validate the working.
Step 2. Create another version of tag
git tag 0.0.2
git push origin tag 0.0.2
Step 3. Update new tag version in iOSUtils.podspec
Run command
pod spec lint iOSUtils.podspec
Still getting error fix
Delete tag
git tag -d tagName
git push origin tagName
Clear cache
pod cache clean --all
Fix error in origin branch and again create tag and do the remaining process when get success “iOSUtilis.podspec passed validation”
Step 4. Final step
Run command
pod trunk push iOSUtils.podspec

RestKit 0.2 not logging

I'm updating my app to use RestKit 0.2pre3, but on the process I lost the logging system that RestKit provides, it simply doesn't show anything anymore. I use cocoapods to install RestKit.
This is my Podfile
platform :ios , '5.1'
pod 'SSPullToRefresh'
pod 'MBProgressHUD'
pod 'Facebook-iOS-SDK'
pod 'TestFlightSDK'
pod 'SDWebImage'
pod 'KISSmetrics'
pod 'CustomBadge'
pod 'GoogleAnalytics-iOS-SDK'
pod 'JSONKit'
pod 'LibComponentLogging-Core'
pod 'LibComponentLogging-LogFile'
pod 'LibComponentLogging-qlog'
pod 'LibComponentLogging-pods'
pod 'RestKit/Testing'
pod 'RestKit'
pod 'OHAttributedLabel'
And, of course, in my code I'm calling
RKLogConfigureByName("RestKit", RKLogLevelTrace);
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
RKLogConfigureByName("RestKit/CoreData", RKLogLevelDebug);
I can even make successful request and get objects mapped, but I can't watch what is my server returning, how the mapping process is performed or anything and this is vital.
I think the problem is that something is misconfigured in LCL but I can't find any clues about it.
Any ideas where the problem could be?
After a long debugging I found that LCL now comes with a set of default configurations and on LCLLogFileConfig.h I had:
// Tell LCLLogFile whether it should mirror the log messages to stderr.
#define _LCLLogFile_MirrorMessagesToStdErr /* (BOOL) */ \
NO
I set it to YES and now everything is working fine.
This behavior is caused by the following 2 pods in the Podfile:
pod 'LibComponentLogging-pods'
pod 'LibComponentLogging-LogFile'
The LibComponentLogging-pods pod causes an integration of RestKit's logging with the LibComponentLogging files which are installed via the Podfile, e.g. RestKit's log components can now be configured via the standard lcl_configure... configuration functions and RestKit will use the log writer which is configured via the Podfile (instead of its built-in log writer).
The LibComponentLogging-LogFile pod chooses the file-based log writer for LibComponentLogging. By default, this log writer doesn't mirror its messages to stderr. _LCLLogFile_MirrorMessagesToStdErr in LCLLogFileConfig.h can be used to change this behavior.

Resources