brew-bundle: general cleanup.
This commit is contained in:
		
							parent
							
								
									6f8692ba4d
								
							
						
					
					
						commit
						f81ee0320b
					
				@ -1,17 +1,20 @@
 | 
			
		||||
# Looks for a Brewfile and runs each line as a brew command. For example:
 | 
			
		||||
# brew-bundle.rb
 | 
			
		||||
# Looks for a "Brewfile" in the current directory and runs each line
 | 
			
		||||
# as a brew command.
 | 
			
		||||
#
 | 
			
		||||
# For example, given a Brewfile with the following contents:
 | 
			
		||||
# 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
 | 
			
		||||
# Running `brew bundle` will run the commands `brew tap foo/bar`
 | 
			
		||||
# and `brew install spark`.
 | 
			
		||||
 | 
			
		||||
raise 'Cannot find Brewfile' unless File.exist? 'Brewfile'
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
  command = line.chomp
 | 
			
		||||
  next if command.empty?
 | 
			
		||||
  next if command.chars.first == '#'
 | 
			
		||||
 | 
			
		||||
  system "brew #{command}"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user