Skip to content
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

Setup script tweaks #11365

Merged
merged 2 commits into from
Aug 9, 2023
Merged

Conversation

dacook
Copy link
Member

@dacook dacook commented Aug 9, 2023

What? Why?

Reduces unnecessary Bundler output, and speeds up the script.

Screen Shot 2023-08-09 at 10 24 14 am

BTW This handy script can be run at any time to prepare your environment after pulling the latest changes on master, including gems, node packages and database migrations.

What should we test?

If you have already installed the latest gems today, you can first remove one to test that it gets installed again. Eg:

gem uninstall ransack # randomly chosen gem
bin/setup

Release notes

Changelog Category: Technical changes

The title of the pull request will be included in the release notes.

bundle install always shows a very long list of all gems. But we really only want to know about the new gems being installed. Thankfully there's an option for that.
The log:clear task seems to take quite a bit of time. At least we can speed up a bit by only booting up Rails once.

I'm more likely to run the script if it's quick ;)
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

Comment on lines -30 to +31
puts "\n== Preparing database =="
system! "bin/rails db:prepare"

puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
puts "\n== Preparing database, removing old logs and tempfiles =="
system! "bin/rails db:prepare log:clear tmp:clear"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected Spring to skip the boot time but I did observe this slowness as well. I wonder why...

@@ -4,6 +4,8 @@ require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)

BUNDLE_ENV = { "BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES"=> "true" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BUNDLE_ENV = { "BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES"=> "true" }
BUNDLE_ENV = { "BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES" => "true" }

@mkllnk
Copy link
Member

mkllnk commented Aug 9, 2023

Works on my machine! Test passed.

I think I hesitated changing these things in the past because whenever we update Rails it may suggest a newer version of this script. And the more changes there are to the original, the more we have to review to see if the new version has any improvements compared to our version. But rails upgrades are quite rare...

@mkllnk mkllnk merged commit d149f71 into openfoodfoundation:master Aug 9, 2023
50 checks passed
@dacook
Copy link
Member Author

dacook commented Aug 9, 2023

whenever we update Rails it may suggest a newer version of this script

Oh yeah, I forgot about that. For the small benefit it may not be worth the extra maintenance.
🤷 Not big difference either way I guess.

@jibees
Copy link
Contributor

jibees commented Aug 9, 2023

BTW This handy script can be run at any time to prepare your environment after pulling the latest changes on master, including gems, node packages and database migrations.

Oh nice! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants