Skip to content

Instantly share code, notes, and snippets.

@onigra
Last active January 2, 2016 16:09
Show Gist options
  • Save onigra/8327788 to your computer and use it in GitHub Desktop.
Save onigra/8327788 to your computer and use it in GitHub Desktop.
brew listからBrewfileを作るスクリプトだけどそもそもbrewdlerを使った事が無かった
require 'open3'
formula = Open3.capture3("brew list")
File.open("Brewfile", "w") do |file|
file << "update\n"
file << "upgrade\n"
file << "\n"
formula[0].split(/\n/).each do |f|
file << "install #{f}\n"
end
file << "\n"
file << "clean\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment