Skip to content

Commit

Permalink
Run bundle check || bundle install after hanami install
Browse files Browse the repository at this point in the history
To ensure any new Gemfile entries are installed
  • Loading branch information
cllns committed Nov 7, 2023
1 parent 6f91d15 commit 193ce31
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/hanami/cli/commands/gem/new.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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("check").successful? || bundle.exec("install")
else
raise HanamiInstallError.new(result.err)
end
end
end
end
Expand Down

0 comments on commit 193ce31

Please sign in to comment.