Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ def run
raise UsageError, "`--install` cannot be used with `install`, `upgrade` or no subcommand."
end

Bundle::Commands::Install.run(global:, file:, no_upgrade:, verbose:, force:, output: $stderr, quiet: true)
redirect_stdout($stderr) do
Bundle::Commands::Install.run(global:, file:, no_upgrade:, verbose:, force:, quiet: true)
end
end

case subcommand
Expand Down
4 changes: 2 additions & 2 deletions lib/bundle/commands/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ module Install
module_function

def run(global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false,
output: $stdout, quiet: false)
quiet: false)
@dsl = Brewfile.read(global:, file:)
Bundle::Installer.install(
@dsl.entries,
global:, file:, no_lock:, no_upgrade:, verbose:, force:, output:, quiet:,
global:, file:, no_lock:, no_upgrade:, verbose:, force:, quiet:,
) || exit(1)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/bundle/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Installer
module_function

def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false,
output: $stdout, quiet: false)
quiet: false)
success = 0
failure = 0

Expand Down Expand Up @@ -42,10 +42,10 @@ def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false
next if Bundle::Skipper.skip? entry

preinstall = if cls.preinstall(*args, **options, no_upgrade:, verbose:)
output.puts Formatter.success("#{verb} #{name}")
puts Formatter.success("#{verb} #{name}")
true
else
output.puts "Using #{name}" unless quiet
puts "Using #{name}" unless quiet
false
end

Expand All @@ -66,7 +66,7 @@ def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false

unless quiet
dependency = Bundle::Dsl.pluralize_dependency(success)
output.puts Formatter.success "Homebrew Bundle complete! #{success} Brewfile #{dependency} now installed."
puts Formatter.success "Homebrew Bundle complete! #{success} Brewfile #{dependency} now installed."
end

true
Expand Down
4 changes: 4 additions & 0 deletions spec/stub/extend/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ module Kernel
def with_env(_hash)
yield if block_given?
end

def redirect_stdout(_file)
yield if block_given?
end
end