You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working on a CI for a client, we have accumulated a few Podfile snippets that need to be injected in most projects for working around various quirks of my client's in-house infra. At the moment these snippets are manually applied and commited every time a new project boots up, but this is an error prone process.
I am working to automate the injection at CI build time. In particular, our primary snippet is getting added to the post_install block. Instead, without commiting changes to the Podfile I'd like to achieve the same effect by injecting some appropriate Ruby into the Podfile before calling pod install.
Details
The specific code we're attempting to inject looks like this:
post_install do |installer|
installer.pods_project.targets.each do |target|
...
target.build_configurations.each do |config|
...
# Block we're trying to inject
if !signed_targets.include?(target.name)
puts "SET #{target.name}-#{config.name} NO SIGN"
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
end
end
Attempted solutions
Without much knowledge of Ruby or CocoaPods internals, here's the main approach I'm taking:
Create code_to_inject.rb somewhere, and
Inject load 'path/to/code_to_inject.rb at the bottom of Podfile. i.e.sed -i ... Podfile
However, I'm unsure whether this approach is reasonable at all. Specifically, I also don't know what the code_to_inject.rb snippet should look like. Naïvely shoving a post_install block in it results in errors, since post_install appears only callable once.
Questions
Is the basic strategy above sane?
If so, then what should the code_to_inject.rb contain?
Is loading the ruby a good way of injecting?
The text was updated successfully, but these errors were encountered:
Overview
Working on a CI for a client, we have accumulated a few
Podfile
snippets that need to be injected in most projects for working around various quirks of my client's in-house infra. At the moment these snippets are manually applied and commited every time a new project boots up, but this is an error prone process.I am working to automate the injection at CI build time. In particular, our primary snippet is getting added to the
post_install
block. Instead, without commiting changes to thePodfile
I'd like to achieve the same effect by injecting some appropriate Ruby into thePodfile
before callingpod install
.Details
The specific code we're attempting to inject looks like this:
Attempted solutions
Without much knowledge of Ruby or CocoaPods internals, here's the main approach I'm taking:
code_to_inject.rb
somewhere, andload 'path/to/code_to_inject.rb
at the bottom ofPodfile
. i.e.sed -i ... Podfile
However, I'm unsure whether this approach is reasonable at all. Specifically, I also don't know what the
code_to_inject.rb
snippet should look like. Naïvely shoving apost_install
block in it results in errors, sincepost_install
appears only callable once.Questions
code_to_inject.rb
contain?load
ing the ruby a good way of injecting?The text was updated successfully, but these errors were encountered: