Class: Brewmaster::BrewCollection
- Inherits:
-
Object
- Object
- Brewmaster::BrewCollection
- Defined in:
- lib/brewmaster/brew_collection.rb
Class Method Summary collapse
-
.installed ⇒ Object
anything installed, that’s not in our list anymore def extras @extras ||= self.class.installed - @formulae end.
- .outdated ⇒ Object
Instance Method Summary collapse
-
#initialize(names) ⇒ BrewCollection
constructor
A new instance of BrewCollection.
- #install_missing ⇒ Object
- #install_updates ⇒ Object
-
#missing ⇒ Object
anything not installed, excluding the outdated.
-
#outdated ⇒ Object
anything outdated that we want installed that is not pinned.
Constructor Details
#initialize(names) ⇒ BrewCollection
Returns a new instance of BrewCollection.
3 4 5 6 |
# File 'lib/brewmaster/brew_collection.rb', line 3 def initialize(names) @names = names @formulae = names.map {|name| Formula.factory(name)} end |
Class Method Details
.installed ⇒ Object
anything installed, that’s not in our list anymore def extras
@extras ||= self.class.installed - @formulae
end
39 40 41 42 |
# File 'lib/brewmaster/brew_collection.rb', line 39 def self.installed # `ls #{HOMEBREW_CELLAR}`.split Formula.installed end |
.outdated ⇒ Object
44 45 46 |
# File 'lib/brewmaster/brew_collection.rb', line 44 def self.outdated Homebrew.outdated_brews end |
Instance Method Details
#install_missing ⇒ Object
8 9 10 11 12 |
# File 'lib/brewmaster/brew_collection.rb', line 8 def install_missing Homebrew.perform_preinstall_checks missing.each {|f| Homebrew.install_formula(f)} end |
#install_updates ⇒ Object
14 15 16 17 18 |
# File 'lib/brewmaster/brew_collection.rb', line 14 def install_updates Homebrew.perform_preinstall_checks outdated.each {|f| Homebrew.upgrade_formula(f)} end |
#missing ⇒ Object
anything not installed, excluding the outdated
25 26 27 |
# File 'lib/brewmaster/brew_collection.rb', line 25 def missing @missing ||= @formulae.select {|f| !f.installed?} - self.class.outdated end |
#outdated ⇒ Object
anything outdated that we want installed that is not pinned
30 31 32 |
# File 'lib/brewmaster/brew_collection.rb', line 30 def outdated @outdated ||= @formulae & self.class.outdated.select {|f| !f.pinned?} end |