2025-03-18 17:38:37 +00:00
|
|
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2025-03-24 21:55:47 +08:00
|
|
|
require "bundle/checker"
|
|
|
|
|
2025-03-18 17:38:37 +00:00
|
|
|
module Homebrew
|
|
|
|
module Bundle
|
|
|
|
module Commands
|
|
|
|
module Check
|
|
|
|
ARROW = "→"
|
|
|
|
FAILURE_MESSAGE = "brew bundle can't satisfy your Brewfile's dependencies."
|
|
|
|
|
2025-03-21 04:24:55 +00:00
|
|
|
def self.run(global: false, file: nil, no_upgrade: false, verbose: false)
|
2025-03-18 17:38:37 +00:00
|
|
|
output_errors = verbose
|
|
|
|
exit_on_first_error = !verbose
|
|
|
|
check_result = Homebrew::Bundle::Checker.check(
|
|
|
|
global:, file:,
|
|
|
|
exit_on_first_error:, no_upgrade:, verbose:
|
|
|
|
)
|
|
|
|
|
|
|
|
if check_result.work_to_be_done
|
|
|
|
puts FAILURE_MESSAGE
|
|
|
|
|
|
|
|
check_result.errors.each { |package| puts "#{ARROW} #{package}" } if output_errors
|
|
|
|
puts "Satisfy missing dependencies with `brew bundle install`."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
puts "The Brewfile's dependencies are satisfied."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|