-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sandbox default solidus branch #192
Fix sandbox default solidus branch #192
Conversation
When an uninitialized variable is given to `-n`, it is treated as not NULL. The variable must be quoted for correct results. `[ -n "$SOLIDUS_BRANCH" ]` It is also recommended for variable comparisons in general as it can produce incorrect results for `! -z`. References: - https://tldp.org/LDP/abs/html/comparison-ops.html - https://tldp.org/LDP/abs/html/comparison-ops.html#STRTEST This meant that before, when running this file with no SOLIDUS_BRANCH variable, $BRANCH would end up NULL and the branch in the Gemfile would be an empty string. This caused an error, whereas instead, it should have defaulted to `master`. Error: ``` fatal: Needed a single revision Git error: command `git rev-parse --verify ''` in directory /Users/ryanwoods/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/cache/bundler/git/solidus-169f1ecb1aee2122950e6d586daf2410f62df66e has failed. Revision does not exist in the repository https://github.com/solidusio/solidus.git. Maybe you misspelled it? If this error persists you could try removing the cache directory '/Users/ryanwoods/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/cache/bundler/git/solidus-169f1ecb1aee2122950e6d586daf2410f62df66e' The git source https://github.com/solidusio/solidus.git is not yet checked out. Please run `bundle install` before trying to start your application ```
-z string is null, that is, has zero length -n string is not null. Reference: - https://tldp.org/LDP/abs/html/comparison-ops.html
It looks like this PR is missing a label to determine the type of change it introduces. The maintainer should add one of the following labels:
Additionally, the maintainer may also want to add one of the following:
Once the correct labels have been set, simply remove the |
It would probably be good to update some extension's sandbox script after this change. Note, I may soon make another PR to change the As another note, from my understanding, each extension copies the |
I am unable to change the label @waiting-for-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing it, @RyanofWoods!
Yeah, at this point, the purpose of the sandbox application is to be used as a starting point, so I wouldn't change anything for now. |
This pulls the fix from upstream (solidus_dev_support). - solidusio/solidus_dev_support#192
This pulls the fix from upstream (solidus_dev_support). - solidusio/solidus_dev_support#192
Fixes the
sandbox.tt
file script not defaulting to themaster
Solidus when noSOLIDUS_BRANCH
variable is given.Summary
When an uninitialized variable is given to
-n
, it is treated as notNULL. The variable must be quoted for correct results.
[ -n "$SOLIDUS_BRANCH" ]
It is also recommended for variable comparisons in general as it can
produce incorrect results for
! -z
.References:
This meant that before, when running this file with no SOLIDUS_BRANCH
variable, $BRANCH would end up NULL and the branch in the Gemfile would
be an empty string. This caused an error, whereas instead, it should
have defaulted to
master
.Error:
Checklist
To test this, I commented out half of the
sandbox.tt
file after (extension_name="<%= file_name %>"
) and ran:It logged that the
master
branch was being used andsolidus_frontend
and no debug mode was used.I then ran:
Which logged that the

v.3.2
Solidus branch was being used andsolidus_starter_frontend
for the frontend 👍 It also correctly used the debug mode.