Sha256: 2f7032fae57acfb21f28d78222e28b97fc2208131b358f7adba610799b06cc11
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'exogenesis/abstract_package_manager' # Manages Homebrew - the premier package manager for Mac OS class Homebrew < AbstractPackageManager # Expects an array of packages to install, a package can either be: # * A String: Then it will just install the package with this name # * An Object with a single key value pair. The key is the name of the package, the value is an array of options passed to it def initialize(brews) @brews = brews end def update puts "Updating Homebrew..." `brew update` puts "Upgrading the following apps: #{`brew outdated`}" `brew upgrade` end def install @brews.each do |brew| if brew.class == String install_package brew else name = brew.keys.first options = brew[name] install_package name, options end end end private def install_package(name, options = []) print "Installing #{name}... " status = `brew install #{name} #{options.join}` raise "No formula for #{name}" if status.include? "No available formula" if status.include? "already installed" puts "Already Installed!" else puts "Installed!" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exogenesis-0.0.1 | lib/exogenesis/homebrew.rb |