From 6f8692ba4d17edbb8a6018fb7d4c05f0956b42b6 Mon Sep 17 00:00:00 2001 From: ChristianBundy Date: Sun, 10 Nov 2013 16:27:36 -0600 Subject: [PATCH] brew-bundle: add new command to support Brewfiles. Closes Homebrew/homebrew#24107. Signed-off-by: Mike McQuaid --- Library/Contributions/cmd/brew-bundle.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 Library/Contributions/cmd/brew-bundle.rb diff --git a/Library/Contributions/cmd/brew-bundle.rb b/Library/Contributions/cmd/brew-bundle.rb new file mode 100755 index 0000000000..31dd4d2644 --- /dev/null +++ b/Library/Contributions/cmd/brew-bundle.rb @@ -0,0 +1,17 @@ +# Looks for a Brewfile and runs each line as a brew command. For example: +# +# tap foo/bar +# install spark +# +# Saving the above commands in a Brewfile and running `brew bundle` will run +# the commands `brew tap foo/bar` and `brew install spark` automagically. +# +# Current discussion: https://github.com/mxcl/homebrew/pull/24107 + +raise "Cannot find Brewfile" if not File.exist?('Brewfile') +File.readlines('Brewfile').each do |line| + command = line.chomp + if not command.empty? and not command.chars.first == '#' + `brew #{command}` + end +end