LoginSignup
1
1

More than 5 years have passed since last update.

Rubyでインストール済みのhomebrew packageのリストからBrewfileを生成するスクリプト

Posted at

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'
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1