On July 22, run pod install --repo-update. Most of the time CDN repo works great, however sometimes it returns either 404 or 500 status codes which leads to failed pod installation. Is there a way to specify git repo as an optional fallback specs repo that will be used when CDN is unreachable?
Install all pod dependencies correctly.
Received following errors due to CDN error:
[19:09:00]: â–¸ Updating local specs repositories
[19:09:00]: â–¸ [!] CDN: cocoapods- Repo update failed - 2312 error(s):
[19:09:00]: â–¸ CDN: cocoapods- Relative path couldn't be downloaded: CocoaPods-version.yml Response: 500
(other errors mentioning 500 response code)
CocoaPods : 1.7.4
Ruby : ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-darwin18]
RubyGems : 2.6.14.3
Host : Mac OS X 10.14.5 (18F132)
Xcode : 10.2.1 (10E1001)
Git : git version 2.20.1 (Apple Git-117)
Ruby lib dir : /Users/rostyslav/.rbenv/versions/2.4.5/lib
Repositories :
master - https://github.com/CocoaPods/Specs.git @ f085f117e81fa6c3f99a51b44f317674321414f6
Executable Path: /Users/rostyslav/.rbenv/versions/2.4.5/bin/pod
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.3.1
cocoapods-try : 1.1.0
using_bundler = defined? Bundler
unless using_bundler
puts "\nPlease re-run using:".red
puts " bundle exec pod install\n\n"
exit(1)
end
platform :ios, '11.0'
workspace 'Workspace.xcworkspace'
project 'Common/Common.xcodeproj'
project 'Project1/Project1.xcodeproj'
project 'Project2/Project2.xcodeproj'
inhibit_all_warnings!
use_frameworks!
supports_swift_versions '>= 4.0', '<= 5.0'
install! 'cocoapods',
:generate_multiple_pod_projects => true,
:incremental_installation => true
source 'https://cdn.cocoapods.org/'
def common_analytics_pods
pod 'Fabric'
pod 'Crashlytics'
end
def common_mvvm_pods
pod 'Dip'
end
def common_networking
pod 'TRON', branch: "master", git: "https://github.com/MLSDev/TRON.git"
pod 'SwiftyJSON'
pod 'AlamofireImage', branch: "master", git: "https://github.com/Alamofire/AlamofireImage.git"
end
def common_ui_pods
pod 'DTTableViewManager'
pod 'DTCollectionViewManager'
pod 'LoadableViews'
pod 'JGProgressHUD'
pod 'PhoneNumberKit', '~> 2.6'
pod 'Ariadne'
pod 'AloeStackView'
pod 'SwiftMessages'
end
def common_code_generation_pods
pod 'Sourcery'
pod 'SwiftGen'
pod 'SwiftLint'
end
def common_rx_pods
pod 'RxSwift'
pod 'RxCocoa'
pod 'RxOptional'
pod 'RxGesture'
pod 'Action'
pod 'RxKeyboard'
end
def common_tests_pods
pod 'RxTest'
pod 'RxBlocking'
end
def common_storage_pods
pod 'KeychainSwift', '~> 15.0'
end
def common_sugar_pods
pod 'Then'
end
target 'Common' do
project 'Common/Common.xcodeproj'
# RxSwift
common_rx_pods
# UIKit
common_ui_pods
# CodeGeneration
pod 'SwiftGen'
# Storage
common_storage_pods
# Network
common_networking
# MVVM
common_mvvm_pods
# Syntactic sugar
common_sugar_pods
# Analytics
pod 'Crashlytics'
target 'CommonTests' do
project 'Common/Common.xcodeproj'
common_tests_pods
end
end
abstract_target 'AT' do
target 'CoreProject1' do
project 'Project1/Project1.xcodeproj'
# RxSwift
common_rx_pods
# Code Generation
common_code_generation_pods
# UIKit
pod 'StatefulViewController'
pod 'CVCalendar'
common_ui_pods
# MVVM
common_mvvm_pods
# Navigation
pod 'GoogleMaps'
pod 'GooglePlaces'
# Network
pod 'EasyMapping'
pod 'AlamofireImage', branch: "master", git: "https://github.com/Alamofire/AlamofireImage.git"
pod 'ActionCableClient', branch: "master", git: "https://github.com/danielrhodes/Swift-ActionCableClient.git"
common_networking
# Syntactic sugar
common_sugar_pods
# Storage
common_storage_pods
# Analytics
pod 'Firebase/Core'
common_analytics_pods
target 'TestsProject1' do
project 'Project1/Project1.xcodeproj'
common_tests_pods
pod 'Nimble'
pod 'Datez'
end
target 'Project1' do
project 'Project1/Project1.xcodeproj'
end
target 'Proto' do
project 'Project1/Project1.xcodeproj'
end
end
target 'CoreProject2' do
project 'Project2/Project2.xcodeproj'
# RxSwift
common_rx_pods
# CodeGeneration
common_code_generation_pods
# UIKit
common_ui_pods
pod 'AlignedCollectionViewFlowLayout'
# MVVM
common_mvvm_pods
# Networking
common_networking
# Analytics
pod 'Firebase/Core'
# Storage
common_storage_pods
# Syntactic sugar
common_sugar_pods
target 'TestsHelper' do
project 'Project2/Project2.xcodeproj'
target 'TestsProject2' do
project 'Project2/Project2.xcodeproj'
common_tests_pods
end
end
target 'Project2' do
project 'Project2/Project2.xcodeproj'
common_analytics_pods
end
end
end
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
# CocoaPods 1.7.0.beta.2 wrongly sets architecture flag to ARCH64 instead of using standard architecture option, which leads to warnings.
target.build_configurations.each do |configuration|
configuration.build_settings.delete('ARCHS')
end
# Sets build settings for additional Debug schemes, for example FooDebug
target.build_configurations.each do |configuration|
if configuration.name.include? 'Debug'
configuration.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = ['-Onone']
configuration.build_settings['GCC_OPTIMIZATION_LEVEL'] = ['0']
configuration.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = 'DEBUG'
configuration.build_settings['SWIFT_COMPILATION_MODE'] = 'singlefile'
configuration.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
configuration.build_settings['VALIDATE_PRODUCT'] = 'NO'
end
end
end
# Sets build settings for additional Debug schemes, for example FooDebug
project.build_configurations.each do |configuration|
if configuration.name.include? 'Debug'
project.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'YES'
project.build_settings(configuration.name)['ENABLE_TESTABILITY'] = 'YES'
end
end
end
end
Can you not add the master repo as git in your Podfile
source 'https://github.com/CocoaPods/Specs.git'
?
I can, but that would cause the git repo to update each time pod install --repo-update is executed even when CDN repo is online, which would eliminate speed improvement from using CDN. What I am looking for is a way to specify CDN as some sort of a primary repo and git as a secondary. The secondary slower repo would only be updated and used if for whatever reason primary repo failed.
This is not currently supported. You can either use both and therefore both will need to be updated once --repo-update is invoked or you can use just one.
You can only circumvent this by invoking pod repo update [NAME] _before_ you invoke pod install (without --repo-update) but pod install does not currently offer a way to exclude a repo from updating once --repo-update is passed.
Thanks for the idea. The following script solves the problem:
pod repo update cocoapods-
if [ $? -ne 0 ]; then
echo "Failed to update CDN Specs repo. Falling back on Git repo."
pod repo update master
fi
pod install
Thank you for filing!