Rubyでインストール済みのhomebrew packageのリストからBrewfileを生成するスクリプトを作成します。
用途
既にHomebrewのPackageを手動でインストール済みの環境から
Brewfileを作りたいケースで利用。
試行
プログラム
brewgen
#! /Users/tbpgr/.rbenv/shims/ruby
puts "cask_args appdir: '/Applications'"
taps = `brew tap`
taps.each_line.map{ |e|"tap '#{e.chomp}'" }.each(&method(:puts))
packages = `brew list -1`
packages.each_line.map{ |e|"brew '#{e.chomp}'" }.each(&method(:puts))
出力
$ ./brewgen
cask_args appdir: '/Applications'
tap 'caskroom/cask'
tap 'homebrew/bundle'
tap 'motemen/ghq'
tap 'peco/peco'
tap 'sanemat/font'
brew 'autoconf'
brew 'brew-cask'
# 中略
brew 'zeromq'
brew 'zsh'