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
Misc: auth-devise, extracted frontend gem, sqlite #188
Conversation
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 |
@@ -50,7 +50,7 @@ fi | |||
cd ./sandbox | |||
cat <<RUBY >> Gemfile | |||
gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH' | |||
gem 'solidus_auth_devise', '>= 2.1.0' | |||
<%= "gem 'solidus_auth_devise', '>= 2.1.0'" unless file_name == 'solidus_auth_devise' %> |
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.
What about removing this line and switching --with-authentication
to true
in the solidus installer?
--with-authentication=false \ |
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.
Good call, I'll try that
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.
@waiting-for-dev done, an explanation on why we didn't do it before is in the last commit, but basically it boils down to 3017ed6.
65942ce
to
9dc5752
Compare
988f708
to
c9844fe
Compare
@@ -6,6 +6,10 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |||
branch = ENV.fetch('SOLIDUS_BRANCH', 'master') | |||
gem 'solidus', github: 'solidusio/solidus', branch: branch | |||
|
|||
# The solidus_frontend gem has been pulled out since v3.2 | |||
gem 'solidus_frontend', github: 'solidusio/solidus_frontend' if branch == 'master' |
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.
As that's the template for extensions, I think we don't need to add solidus_frontend to the Gemfile at all. What do you think?
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.
This is intended as a live support gem for extension development, that means any extension is supposed to be regularly regenerating the support files (very similarly to what happens with rails app:update
), so we should support the transition for existing gem that often rely on it.
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.
Hmm, I see it makes sense. Maybe we can detect if the file doesn't exist and then not add those lines?
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.
I see what you mean, is that ok if I reserve this change for a different PR?
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.
With this change my extensions Gemfile
suddenly has a dependency to solidus_frontend
although it does not depend on it after I ran bundle exec rake
. I would prefer that the extensions Gemfile
would not get mutated on CIs like that. Is there a way to disable solidus_frontend
completely? Ie. with SOLIDUS_FRONTEND=false
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.
@tvdeyen, I'd also prefer not adding solidus_frontend
for new extensions. However, to work around your issue, as that's generated code you can just remove the solidus_frontend Gemfile line, right?
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.
However, to work around your issue, as that's generated code you can just remove the solidus_frontend Gemfile line, right?
Exactly, that's the intent of having a generator instead of mandating a solution.
I would add that this whole setup is not covering the new frontend in any way and we'll probably need to come back to it once we start testing all extensions (that require it) with the new one.
|
||
echo | ||
echo "🚀 Sandbox app successfully created for $extension_name!" | ||
echo "🚀 Using $RAILSDB and Solidus $BRANCH" |
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.
Do we want to remove this line? It could be informative if you haven't specified the variables yourself.
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.
No strong feelings, I just wanted to reduce the visual noise, but I'll re-add it with the additional info
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.
I don't have a strong opinion about it, either, so do as you think it's better 🙂
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.
Ended up inlining usage and instruction messages near each other at the beginning of the script
echo "🚀 This app is intended for test purposes." | ||
test -z "$DB" && echo "- Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter" | ||
test -z "$SOLIDUS_BRANCH" && echo "- Use 'export SOLIDUS_BRANCH=[master|v3.2|...]' to control the Solidus version" | ||
test -z "$SOLIDUS_FRONTEND" && echo "- Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend" |
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.
Again, as it's for new extensions, maybe it's not worth it and we should just generate with solidus_starter_frontend. Thoughts?
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.
It's for supporting existing extensions rather than only creating new ones
@@ -183,7 +183,7 @@ def bundle_install | |||
bundle_path = "#{gem_root}/vendor/bundle" | |||
|
|||
command = 'bundle install' | |||
command += " --path=#{bundle_path.shellescape}" if File.exist?(bundle_path) | |||
command = "env BUNDLE_PATH=#{bundle_path.shellescape} #{command}" if File.exist?(bundle_path) |
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.
Can we just inline bundle install
instead of overriding the command
variable. I think it's less confusing.
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.
Fixed by a later commit bc2ecca5
@@ -50,7 +55,6 @@ fi | |||
cd ./sandbox | |||
cat <<RUBY >> Gemfile | |||
gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH' | |||
gem 'solidus_auth_devise', '>= 2.1.0' |
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.
We can remove the first commit from this PR to have a cleaner git history.
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.
Many thanks for all the improvements, @elia! I just left some comments.
Since Solidus v3.2 the frontend gem is in its own repo.
Default to the legacy frontend as it's the one used in most existing extensions, and let the transition be opt-in.
Don't add solidus_auth_devise to the sandbox app if it's the current extension. In 3017ed6 solidus_auth_devise was added directly to the gemfile in order to support solidus prior to v2.11. Since we don't need to support it anymore we can safely use the official `--with-authentication` option now.
Rails 7 doesn't work with an in-memory sqlite, and the extensions Orb v0.4 supports a file-based executor which helps keeping the CI footprint small.
The option is deprecated and now makes the command fail instead of just printing a warning.
Rails started setting eager_load to true when the CI env var is set. rails/rails@db0ee287eed
Using the --path CLI option was deprecated but now aborts the command, used to just print a warning.
Also support the DEBUG env variable in addition to the `$DEBUG` global ruby variable.
c9844fe
to
6151c6d
Compare
Be sure to include recent fixes.
a47c8fd
to
b794ef0
Compare
The code is generated by solidus_dev_support not by my extension. I know added solidus_frontend conditionally into the local Gemfile.
That's ok for now, but preferably solidus_dev_support would not mutate the extension Gemfile it it does not depend on frontend..
|
Oh, I see what you mean. You're running it on an existing extension. I think you're right. |
Yes, it is an existing extension and I just updated it to support Solidus 3.2. I have a default require "bundler"
Bundler::GemHelper.install_tasks
require "solidus_dev_support/rake_tasks"
SolidusDevSupport::RakeTasks.install
task default: "extension:specs" and the rake task suddenly started to add
Even for new extensions I do not think this is the right approach. Shouldn't we just point to the right gem in the |
@tvdeyen no strings attached to that code, given the goal we can find alternative solutions to it: The goal was to ensure we're grabbing the Would adding |
I do not see why this should fix the issue with that the Rake task from solidus_dev_support adds the line to the What am I missing? 🤔 |
So, to recap what is happening (not just for me, but for all extensions that update their code to Solidus 3.2 and that uses
is calling the default Rake task added by # Rakefile
require "bundler"
Bundler::GemHelper.install_tasks
require "solidus_dev_support/rake_tasks"
SolidusDevSupport::RakeTasks.install
task default: "extension:specs" That installs a new dummy app into the extensions and runs specs on it. So far, so good. With the change of this PR the rake task that install the dummy app suddenly adds gem "solidus_frontend", "~> 3.2" to the It was not before this change. Preferably it would not do that unless the extension is using Am I missing something? |
Oh I see, I'm not sure that this change is the culprit although it looks like it at first analysis. The change in this PR will only be applied to an existing extension if you run What you're seeing I think is most likely something related to the solidus installer. Of course this is just an hypothesis, we need to verify 🕵️ |
@elia my guess that this line is the culprit I assume that the app generator is adding this line to the |
@tvdeyen 🤔 I think I'm still failing to see how that is different from before… my assumption being that a solidus install has always depended on solidus_frontend, is there a way I can reproduce the error locally on some extension? |
Summary
A few minor fixes and updates after the release of v3.2
Checklist