rcmdnk's blog

Brew-fileに追加ファイルを読み込める設定を追加
File Manager

New Brewfile’s command file has been added to Brew-file.

Sponsored Links

file commands

In Brew-file for Brewfile management, new command file has been added as an Brewfile’s format.

In Brewfile, you can use file like:

Brewfile
1
2
3
# Additional files
file ~/.Brewfile
file ./${HOST}.Brewfile

Then, Brew-file picks up settings in ~/.Brewfile and ./${HOST}.Brewfile, too.

In the path for additional files, such ~ can be used as $HOME, and any environmental variables, like $HOST, can be used.

If the path is relative, the path starts from the directory in which the original Brewfile is stored.

If you have Brewfile in the original path,

/usr/local/Library/Brewfile

then ./${HOST}.Brewfile is

/usr/local/Library/${HOST}.Brewfile

You can use file nesting, too.

There is another command, brewfile, which works exactly as same as file.

For example, if you want to divide Cask settings, then write

file ./Cask.Brewfile

in the main Brewfile, and prepare Cask.Brewfile with Cask settings.

If you want to use different settings for the different Mac, such ${HOST}.Brewfile is useful.

Or you can use ~/.Brewfile in each Mac for special settings.

If the corresponding file is not found, Brew-file just ignores it. Therefore, you can use same Brewfile in Mac, which has ~/.Brewfile and doesn’t have ~/.Brewfile.

When a such init command is executed, first Brew-file prepares a list of packages installed by Homebrew.

Next, check packages in the additional files, and if the additional files have not installed packages, they are deleted from the additional files.

On the other hand, packages listed in the additional files are removed from the list.

Then, the additional files are restored, and remaining packages in the list are written out to main Brewfile.

To refer files used by Brew-file, you can use new Brew-file command, get_files:

$ brew file get_files
/usr/local/Library/rcmdnk_Brewfile/Brewfile
/usr/local/Library/rcmdnk_Brewfile/mymac.Brewfile
/Users/user/.Brewfile

Recent other updates:

Brew-file update: completion, wrapper commands

Sponsored Links
Sponsored Links

« Brew-file update: completion, wrapper commands Comparison of window.onload and jQuery's $(document).ready »

}