Coder Social home page Coder Social logo

superatomic / homebrew-bundle-extensions Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 2.0 15 KB

๐Ÿ—„ Command extensions for Homebrew that allow for easy modification of brew bundles.

Home Page: https://gh.superatomic.dev/homebrew-bundle-extensions

License: BSD 2-Clause "Simplified" License

Ruby 100.00%
brew brew-bundle brew-command brew-tap brewfile brewfiles bundle cli homebrew homebrew-command homebrew-tap tap

homebrew-bundle-extensions's Introduction

Hi, Iโ€™m superatomic! I like computers.

I have 8 years of experience (and counting!) with using Python. I also develop using other languages.

Contact me on Matrix at @atomic:envs.net or send an email to [email protected].

Notable Projects:

Contributions:

profile

languages

homebrew-bundle-extensions's People

Contributors

boldandbrad avatar ian-h-chamberlain avatar superatomic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

homebrew-bundle-extensions's Issues

`brew add` adds tap of `core` that is no longer needed

brew add appears to always add the core tap, which I guess is deprecated now?

$ touch bundle
$ brew add lnav --file bundle
==> Using Brewfile at '/Users/ianchamberlain/Downloads/bundle'
==> Added Tap homebrew/core to Brewfile
==> Added Formula lnav to Brewfile
$ brew bundle install --file bundle
Tapping homebrew/core
Error: Tapping homebrew/core is no longer typically necessary.
Add --force if you are sure you need it done.
Tapping homebrew/core has failed!
==> Downloading https://formulae.brew.sh/api/formula.jws.json

Using lnav
Homebrew Bundle failed! 1 Brewfile dependency failed to install.
$ 

Maybe the core tap could be special-cased to avoid being added, since it will cause subsequent installs from that file to fail without --force.

`brew add` fails with the error `Error: unknown keyword: prefer_loading_from_api`

To reproduce the error, simply run any brew add [FORMULA|CASK...] command, like so:

$ brew add coreutils
Error: unknown keyword: prefer_loading_from_api
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:54:in `to_formulae_and_casks'
/usr/local/Homebrew/Library/Taps/superatomic/homebrew-bundle-extensions/cmd/add.rb:35:in `add'
/usr/local/Homebrew/Library/Homebrew/brew.rb:93:in `<main>'

This error is caused by the method to_formulae_and_casks losing the prefer_loading_from_api argument. Removing it should resolve this error.

Add the ability to 'add' `mas` dependencies to Brewfile

Goal

Add the ability to add Brewfile lines of the following format: mas "name", id: 12345678

Assumptions

  1. The "name" value itself does not matter to mas for install, only the "id" does (mas install [ID])
  2. Recent versions of macOS prohibit mas from installing applications that have not been previously purchased/installed on a Mac by the active Apple ID - mas known issues

Potential Command Structures

  • brew add --mas [PARAM(S)]

    • Syntax is consistent with brew add --cask/formula
    • Requires refactor of existing code to implement
  • brew mas [PARAM(S)]

    • Not consistent with existing structure
    • Could require inconsistent implementation of eventual brew drop/brew mas drop
    • Does not require refactor of existing code to implement

Potential Params

  • Only [ID]

    • Easy for user to obtain via mas list if it was previously installed (Assumption 2)
    • brew add runs mas info [ID] to get the app's "name" automatically
  • Only [NAME]

    • Easy for user to obtain via mas list if it was previously installed (Assumption 2)
    • brew add runs mas search [NAME] to get the app's "id" automatically - might require parsing and user input if a direct match is not found
  • Both [NAME:ID]

    • Easy for user to obtain both via mas list if it was previously installed (Assumption 2)
    • brew add does not need to invoke mas info or mas search
    • Could make it difficult to support adding multiple mas dependencies at once (if we want to support that)

Inspiration/Reference

brew add fails if 'mas' dependencies are present in Brewfile

consider a Brewfile that contains the line:

mas 'Twitter', id: 1482454543

when running brew add wget, I get the following error:

Error: undefined method `<<' for nil:NilClass
/usr/local/Homebrew/Library/Taps/superatomic/homebrew-bundle-extensions/cmd/add.rb:62:in `block in add'
/usr/local/Homebrew/Library/Taps/superatomic/homebrew-bundle-extensions/cmd/add.rb:57:in `each'
/usr/local/Homebrew/Library/Taps/superatomic/homebrew-bundle-extensions/cmd/add.rb:57:in `add'
/usr/local/Homebrew/Library/Homebrew/brew.rb:110:in `<main>'

If I remove or comment out my mas dependencies, brew add completes just fine.

I don't think brew add needs to support adding new mas dependencies - as that would be more complex, but it should be able to handle them being present.

Add `brew drop` command

The brew drop [FORMULA|CASK...] command should remove a formula and/or cask from a Brewfile.

It will function as the opposite of the brew install and brew add relationship, being the equivalent of brew uninstall, but simply removing formulae, casks, and taps from a Brewfile instead of uninstalling them.

Previous content and additional discussion is in #1. This includes @boldandbrad's amazing idea to name the command brew drop.

Additionally, for when #4 is implemented, this command should also be able to remove mas app lines.

Important questions:

  • Should comments on the same line as the formula/cask be removed as well? Yes
  • Should regular expressions be used, or should the entire Brewfile be parsed into tokens? Regular expressions

Drop Casks does not work

When running brew drop equinox or brew drop --cask equinox (or any other cask) I get the following error:

Error: no implicit conversion of Array into String
/usr/local/Homebrew/Library/Homebrew/formulary.rb:217:in `exist?'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:217:in `resolve'
/usr/local/Homebrew/Library/Taps/superatomic/homebrew-bundle-extensions/cmd/drop.rb:67:in `block in drop'
/usr/local/Homebrew/Library/Taps/superatomic/homebrew-bundle-extensions/cmd/drop.rb:57:in `each'
/usr/local/Homebrew/Library/Taps/superatomic/homebrew-bundle-extensions/cmd/drop.rb:57:in `drop'
/usr/local/Homebrew/Library/Homebrew/brew.rb:93:in `<main>'

Line 67 in drop is the culprit:

brew_name_resolves_to_full_name = Formulary.resolve(brew.name).full_name == brew.full_name

Although this works wonderfully to avoid formulae conflicts, this does not work for casks. A slight oversight.

@superatomic are you aware of a similar function to Formulary.resolve that exists for Casks? If there isn't one, we could only perform the check for formulae and move on.

Let me know what you think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.