Closed jhonny-me closed 2 years ago
Hi @jhonny-me 👋
I strongly advise you not to integrate it with Xcode Build Phase (and this is a super valid point I should raise in the README file, thanks for this)
There are two main reasons for this:
bundler
in general. If you've ever had to deal with any other Run Script in your Build Phase that used any other bundle-powered gem (like rake, fastlane, etc), you'll have those same issues. It's not easy to workaround those issues, and they're unstable, and often environment-specific (meaning not friendly with a larger team, specially if your team uses different setups like different shell versions, ruby version managers, etc).Unfortunately, this means Arkana must be run outside of your normal build pipeline, when using Xcode UI. When building programmatically this can be easily changed to simply adding a step to your scripts to run Arkana before any build_app
in fastlane or xcodebuild
.
I hope you find this information useful! Let me know if you have more questions, happy to answer them 😊
Hi, @rogerluan thanks for the quick response. Not sure about your refer to Xcode UI
, but here is my setup, the arkana command is in the Generate Keys
script, which is required since I need to update the output according to input CONFIGURATION at each run from Xcode, or do you suggest another way to implement?
(I was on a existing project and migrating from a self-implemented openssl bash script to Arkana)
By Xcode UI I mean just the regular Xcode.app :) (I just wasn't sure if you were building via CLI e.g. fastlane, xcodebuild, etc)
I need to update the output according to input CONFIGURATION at each run from Xcode […] or do you suggest another way to implement?
There are 3 paths here:
bundle arkana …etc
in Terminal before running your builds in Xcode.If you really want to attempt to actually fix the bundler issues, this is one of the solutions you can do: update your shell script inside that Generate Keys
to something like:
source ~/.zshrc # <-- this is the key
tmp=${CONFIGURATION#*(} # remove prefix ending in "("
env=${tmp%)*} # remove suffix starting with ")"
bundle exec arkana -d ".env.${env}"
However, do note that this makes a bunch of assumptions, like that the device running that build uses zsh (default in macOS since Catalina but still a variable), and that the ~/.zshrc
will have the right commands to set up your preferred Ruby Version Manager (e.g. set the PATH correctly, startup rvm or rbenv or your other Ruby Version Manager).
This is a flaky setup, I don't recommend it. But it could work out for you and your team.
Yeas, it worked for my case. Much appreciated @rogerluan.
I'm going to close this one.
Hi, I find arkana very useful and was successfully to switch between different environment sets.
But when I try to integrate this to Xcode Build Phase:
I get ERROR
/Library/Ruby/Site/2.6.0/rubygems.rb:265:in
find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)`Here is the output of
gem environment
also in Build Phase:Im on MacOS 13.0 Xcode 14.0