class Shoestring::Homebrew
Attributes
block[R]
brew_cmd[R]
name[R]
url[R]
Public Class Methods
new(name, url, brew_cmd, &block)
click to toggle source
# File lib/shoestring/homebrew.rb, line 5 def initialize(name, url, brew_cmd, &block) @name = name @url = url @brew_cmd = brew_cmd @block = block end
Public Instance Methods
check()
click to toggle source
# File lib/shoestring/homebrew.rb, line 12 def check if block.call puts "#{name}: check!" else puts "You need to setup #{name} #{url}" if ::Bundler.with_clean_env { system('brew -v') } install_with_homebrew else install_homebrew install_with_homebrew end end end
Private Instance Methods
abort_message()
click to toggle source
# File lib/shoestring/homebrew.rb, line 50 def abort_message abort "Install #{name} and rerun" end
install_homebrew()
click to toggle source
# File lib/shoestring/homebrew.rb, line 28 def install_homebrew puts "Homebrew is not installed. Automatically install (y/n)" if STDIN.gets.strip == 'y' ::Bundler.with_clean_env do system('ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"') || abort("Could not install homebrew'. Please try manually http://mxcl.github.io/homebrew/") end else abort_message end end
install_with_homebrew()
click to toggle source
# File lib/shoestring/homebrew.rb, line 39 def install_with_homebrew puts "Automatically install using homebrew (y/n)" if STDIN.gets.strip == 'y' ::Bundler.with_clean_env do system("brew update && brew install #{brew_cmd}") || abort("Could not run 'brew install #{brew_cmd}'. Please try manually") end else abort_message end end