/homebrew-dotfile-generator

A custom generator for your homebrew dotfiles

Primary LanguageJavaScript

Note: This repo was deprecated after: Homebrew/legacy-homebrew#32952

Homebrew Dotfile Generator

You can run homebrew scripts from dotfiles.

This mini app will scan all of your brew formulae, brew-casks and locally installed Applications, and generate 3 custom homebrew dotfiles. It creates:

  • a .brew file for running standard homebrew actions
  • a Brewfile which uses the new brew bundle feature to store a list of formulae for re-installing
  • a Caskfile for homebrew-cask. Which also uses the new brew bundle feature. This will load casks in the same way that the Brewfile will load formulae

Examples

Here's an example of each generated file:

Installation

This assumes you have homebrew installed. If you don't. That's a good place to start.

  git clone https://github.com/seethroughtrees/homebrew-dotfile-generator.git
  cd homebrew-dotfile-generator
  npm install

Usage

Make sure your homebrew is up to date.

brew update

Then just type node app to generate your script files.

node app

Options

Specify Path

By default, the files will be generated in the current directory. But you can specify an install directory (like your home directory) with the -p flag.

node app -p ~/Desktop
Force Option

Also, the files will not overwrite automatically. I did this as a safety precaution. If you want to overwrite, just pass the -f flag.

node app -f
Set Homebrew-Cask directory

Homebrew-Cask gives you the option to specify the /Applications directory if you want to install your casks directly into that folder. If you pass the -a flag, Homebrew Dotfile Generator will add the --appdir flag directly into your script.

node app -a

Using your dotfiles

You can use the .brew file by running it as a shell script in your terminal.

sh ~/.brew

Run your Brewfile by using the new brew bundle command.

brew bundle /pathto/Brewfile

Run your CaskFile the same way:

brew bundle /pathto/CaskFile

Helpful Links

Contributing

Feel like making this better? Great. Please just add tests to any changes. You can run the tests with npm test.

They're written with testem, Mocha and Chai.

Send any pull-requests to the incoming branch please.