brew/Library/Homebrew/bundle/whalebrew_dumper.rb
Mike McQuaid dea26d02b7
Import documentation for brew bundle
This was in the (soon to be archived) Homebrew/homebrew-bundle
repository's `README`. There's some good content here that doesn't
cleanly fit into the `brew` manpage so let's move it here.

While we're here, let's de-emphasize `whalebrew` as it's not
widely used and add commented-out deprecation warnings for its future
deprecation.
2025-03-19 10:53:00 +00:00

29 lines
789 B
Ruby

# typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
module Homebrew
module Bundle
module WhalebrewDumper
module_function
def reset!
@images = nil
end
def images
return [] unless Bundle.whalebrew_installed?
# odeprecated "`brew bundle` `whalebrew` support", "using `whalebrew` directly"
@images ||= `whalebrew list 2>/dev/null`.split("\n")
.reject { |line| line.start_with?("COMMAND ") }
.map { |line| line.split(/\s+/).last }
.uniq
end
def dump
images.map { |image| "whalebrew \"#{image}\"" }.join("\n")
end
end
end
end