From 1a8a47cbb93a3dff1532261de0151ef5ab785740 Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Mon, 6 Nov 2023 20:49:39 -0700 Subject: [PATCH] Run bundle check || bundle install after hanami install To ensure any new Gemfile entries are installed --- lib/hanami/cli/commands/gem/new.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/hanami/cli/commands/gem/new.rb b/lib/hanami/cli/commands/gem/new.rb index 3dd1f4f0..9b86b965 100644 --- a/lib/hanami/cli/commands/gem/new.rb +++ b/lib/hanami/cli/commands/gem/new.rb @@ -103,7 +103,7 @@ def call(app:, head: HEAD_DEFAULT, skip_install: SKIP_INSTALL_DEFAULT, skip_asse end out.puts "Running Hanami install..." - run_install_commmand!(head: head) + run_install_command!(head: head) end end end @@ -116,10 +116,14 @@ def call(app:, head: HEAD_DEFAULT, skip_install: SKIP_INSTALL_DEFAULT, skip_asse attr_reader :generator attr_reader :system_call - def run_install_commmand!(head:) + def run_install_command!(head:) head_flag = head ? " --head" : "" bundler.exec("hanami install#{head_flag}").tap do |result| - raise HanamiInstallError.new(result.err) unless result.successful? + if result.successful? + bundler.exec("bundle check || bundle install") + else + raise HanamiInstallError.new(result.err) + end end end end