Closed jamesstidard closed 5 years ago
Hm 🤔
Never had the opportunity to work with Linuxbrew. So, have no idea how it works.
But, I know that brew bundle dump
has flags for what to output:
» brew bundle dump --help
Usage: brew bundle subcommand
Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App
Store.
--file= read the Brewfile from this file. Use
--file=- to output to stdin/stdout.
--global read the Brewfile from ~/.Brewfile.
brew bundle [install] [-v|--verbose] [--no-upgrade]
[--file=path|--global]
Install or upgrade all dependencies in a Brewfile.
-v, --verbose print the output from commands as they are
run.
--no-upgrade don't run brew upgrade on outdated
dependencies. Note they may still be
upgraded by brew install if needed.
brew bundle dump [--force] [--describe] [--no-restart]
[--file=path|--global]
Write all installed casks/formulae/taps into a Brewfile.
--force overwrite an existing Brewfile.
--describe output a description comment above each
line. This comment will not be output if
the dependency does not have a description.
--no-restart do not add restart_service to formula
lines.
brew bundle cleanup [--force] [--zap] [--file=path|--global]
Uninstall all dependencies not listed in a Brewfile.
--force actually perform the cleanup operations.
--zap casks will be removed using the zap
command instead of uninstall.
brew bundle check [--no-upgrade] [--file=path|--global] [--verbose]
Check if all dependencies are installed in a Brewfile.
--no-upgrade ignore outdated dependencies.
-v, --verbose output and check for all missing
dependencies.
brew bundle exec command
Run an external command in an isolated build environment.
brew bundle list [--all|--brews|--casks|--taps|--mas]
[--file=path|--global]
List all dependencies present in a Brewfile. By default, only brew dependencies
are output.
--all output all dependencies.
--brews output Homebrew dependencies.
--casks output Homebrew Cask dependencies.
--taps output tap dependencies.
--mas output Mac App Store dependencies.
We can add an option to pass flags to the command call: brew_bundle_dump_flags: ['--brews', '--casks', '--taps']
PRs are welcome.
Yeah that sounds like the way to go. I’ll have a read about the plugin protocol and submit a PR. Cheers
Took a shot at this. Unfortunately it didn't turn out as simple as I expected. brew bundle
doesn't accept those same filters that brew bundle list
does.
The output of the list is also not in the Brewfile format, so ended up abandoning that route. I also got the impression from this ticket that this use case doesn't really have the support of the maintainers.
Anyway, the simplest way I could think of implementing it was to use the HOMEBREW_BUNDLE_X_SKIP
environment variables that bundle does respect. From that ticket above, I make sure to use the id value instead of the name for all mas entries.
I've also gone with just include
as the option, where you can provide a whitelist of the types you want to install e.g. include: ['tap', 'brew']
would do it for linuxbrew. Defaults to include all. Would be easy to switch to exclude instead or some else - if you have a preference.
I guess it might also be possible to detect linuxbrew vs homebrew systems and have the defaults make sense for that system. i.e. all for Mac and just taps and brews for linux.
Anyway, let me know what you think and if maybe this is do too much. It was a larger change than I had anticipated.
I like the idea and the implementation. Thanks again!
Closed by https://github.com/sobolevn/dotbot-brewfile/pull/3
Hi,
I was wondering if it's possible to detect / handle if the machine is either using linuxbrew or homebrew.
I use both linux and macOS and I use brew on both to keep the same package manager. However, the Brewfile I produce will have
mas
andcask
entires. Do you have a recommended way of handling this for this plugin?Thanks for the plugin.