class Brew
Attributes
dependencies[R]
Public Class Methods
new(thor, config, project_name)
click to toggle source
# File lib/leap/support/brew.rb, line 4 def initialize(thor, config, project_name) @dependencies = extract_dependencies(config, project_name) @thor = thor end
Public Instance Methods
eligible?()
click to toggle source
# File lib/leap/support/brew.rb, line 9 def eligible? !RbConfig::CONFIG['host_os'].match(/darwin|mac os/).nil? end
install()
click to toggle source
# File lib/leap/support/brew.rb, line 13 def install @thor.say 'Installing brew', :green exec('ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"') end
install_dependencies()
click to toggle source
# File lib/leap/support/brew.rb, line 18 def install_dependencies @dependencies.each do |dependency| local_package = `brew list | grep #{dependency}` if local_package.empty? @thor.say "Installing #{dependency}", :green exec("brew install #{dependency}") end end.empty? and begin @thor.say "No dependencies found in leap config", :red end end
present?()
click to toggle source
# File lib/leap/support/brew.rb, line 30 def present? !(find_executable 'brew').nil? end
Private Instance Methods
extract_dependencies(config, project_name)
click to toggle source
# File lib/leap/support/brew.rb, line 35 def extract_dependencies(config, project_name) config.fetch('dependencies') do if File.exists? "./#{project_name}/.leap/config" YAML.load_file("./#{project_name}/.leap/config")['dependencies'] else [] end end end