From 9d79c7cda71dc8ad92644fd63789309ab0ee0cbd Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 9 Aug 2023 10:26:11 +1000 Subject: [PATCH 1/2] Reduce bundler install output 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. --- bin/setup | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/setup b/bin/setup index bff486cc34..c6f6445017 100755 --- a/bin/setup +++ b/bin/setup @@ -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" } + def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end @@ -15,7 +17,7 @@ FileUtils.chdir APP_ROOT do puts "== Installing dependencies ==" system! "script/install-bundler" - system("bundle check") || system!("bundle install") + system("bundle check") || system!(BUNDLE_ENV, "bundle install") # Install JavaScript dependencies system("bin/yarn") From 91c874737a4c6f49964d31c532fb1174cbec243a Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 9 Aug 2023 10:28:41 +1000 Subject: [PATCH 2/2] Combine rake tasks to save time 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 ;) --- bin/setup | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bin/setup b/bin/setup index c6f6445017..f4afd7b265 100755 --- a/bin/setup +++ b/bin/setup @@ -27,11 +27,8 @@ FileUtils.chdir APP_ROOT do # FileUtils.cp "config/database.yml.sample", "config/database.yml" # end - 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" puts "\n== Restarting application server ==" # system! "bin/rails restart"