From 3f05bfb8abe703196022f6e7ff4c970595b8183e Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 13 Jan 2024 15:11:41 -0800 Subject: [PATCH] Better bin setup (#35) * Set up .env file first, before running Rails commands * Properly indent multi-line strings passed to say_status --- template/bin/setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/bin/setup b/template/bin/setup index bac8843..bf62345 100755 --- a/template/bin/setup +++ b/template/bin/setup @@ -4,12 +4,12 @@ # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this method. def setup! + env ".env", from: ".env.sample" run "bundle install" if bundle_needed? run "overcommit --install" if overcommit_installable? run "bin/rails db:prepare" if database_present? run "yarn install" if yarn_needed? run "bin/rails tmp:create" if tmp_missing? - env ".env", from: ".env.sample" run "bin/rails restart" if git_safe_needed? @@ -84,7 +84,7 @@ end def say_status(label, message, color = :green) label = label.to_s.rjust(12) - puts [colorize(label, color), message].join(" ") + puts [colorize(label, color), message.gsub(/^/, " " * 13).strip].join(" ") end def colorize(str, color)