I have an app that consists of many modules which are linked using cocoapods. The linked modules are detected at runtime. Now I want to be able to add and remove modules from the buildserver. What I need to do now is remove or add dependencies to the Podfile before installing.
I think it would be very nice if I could write the depencies in a separate file per target and include those in the Podfile. That way I don't need to modify the Podfile when building. I'm looking for something like the #include preprocessor directive in C but I learned that the include and require functions in ruby work much different. My best success so far was to try load
but it fails with Invalid 'Podfile' file: undefined method 'pod' for main:Object.
.
Is there any possibility to include a file?
Not sure if this is supported or not, but it does work if you create a function in your module file which is called from the main Podfile. Podfile:
platform :ios, '9.0'
use_frameworks!
load 'ModulePods.rb'
abstract_target 'CommonPods' do
module_pods
pod 'SAMKeychain'
target 'Target' do
pod 'RealmSwift
end
end
ModulePods.rb:
def module_pods
pod 'ReachabilitySwift', '4.1.0'
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With