Consolidate how Rails version is fetched for dummy-app and sandbox#202
Conversation
| rm -rf ./dummy-app | ||
| rails ${RAILS_VERSION:+_${RAILS_VERSION}_} new dummy-app \ | ||
| rails_version=`bundle exec ruby -e'require "rails"; puts Rails.version'` | ||
| rails _${rails_version}_ new dummy-app \ |
There was a problem hiding this comment.
I've had issues with using this setup calling bundle exec, inside the script, thoughts on doing it the other way around and updating the sandbox instead?
Using the env var seems more adaptable to different situations and the Gemfile would be based on an environment variable anyway.
There was a problem hiding this comment.
The issue is that in the script context, $RAILS_VERSION is expected to be an actual version, like 7.0 or 6.2. However, in other places of the Solidus ecosystem is expected to be a semver reference, like ~> 7.0. See docker config on main Solidus or the CircleCI orb as examples. (I use docker for development, and my docker-compose file had the env var; that was how it hit me 😅).
Do you recall which problem you found with bundle exec? At first sight, it looks like the safest way to get the actual version that we're using.
There was a problem hiding this comment.
No I think it was related to versions of bundler one nested into the other, but I don't have any reference, let's go with this code and if the problem comes up again we can switch to another solution 👍
Summary
We use now the same that it's used for the sandbox.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: