2013-11-11 14:07:18 +00:00
|
|
|
# brew-bundle.rb
|
|
|
|
# Looks for a "Brewfile" in the current directory and runs each line
|
|
|
|
# as a brew command.
|
2013-11-10 16:27:36 -06:00
|
|
|
#
|
2013-11-11 14:07:18 +00:00
|
|
|
# For example, given a Brewfile with the following contents:
|
2013-11-10 16:27:36 -06:00
|
|
|
# tap foo/bar
|
|
|
|
# install spark
|
|
|
|
#
|
2013-11-11 14:07:18 +00:00
|
|
|
# Running `brew bundle` will run the commands `brew tap foo/bar`
|
|
|
|
# and `brew install spark`.
|
|
|
|
|
|
|
|
raise 'Cannot find Brewfile' unless File.exist? 'Brewfile'
|
2013-11-10 16:27:36 -06:00
|
|
|
|
|
|
|
File.readlines('Brewfile').each do |line|
|
2013-11-11 14:07:18 +00:00
|
|
|
command = line.chomp
|
|
|
|
next if command.empty?
|
|
|
|
next if command.chars.first == '#'
|
|
|
|
|
|
|
|
system "brew #{command}"
|
2013-11-10 16:27:36 -06:00
|
|
|
end
|