Class: Brew::HomeBrew

Inherits:
Object
  • Object
show all
Defined in:
lib/brew/home_brew.rb

Constant Summary collapse

DEFAULT_BREW_PATH =
'/usr/local/bin/brew'

Instance Method Summary collapse

Constructor Details

#initialize(brew_path: nil) ⇒ HomeBrew

Returns a new instance of HomeBrew.



18
19
20
21
# File 'lib/brew/home_brew.rb', line 18

def initialize(brew_path: nil)
  @brew_path = brew_path || DEFAULT_BREW_PATH
  raise HomeBrewNotInstalled unless File.executable?(@brew_path)
end

Instance Method Details

#info(formula = [], **kwargs) ⇒ Object



23
24
25
# File 'lib/brew/home_brew.rb', line 23

def info(formula = [], **kwargs)
  Commands::Info.new(brew_path, formula, **kwargs).execute!
end

#install(formula, **kwargs) ⇒ Object



27
28
29
# File 'lib/brew/home_brew.rb', line 27

def install(formula, **kwargs)
  Commands::Install.new(brew_path, formula, **kwargs).execute!
end

#list(formulae = [], **kwargs) ⇒ Object Also known as: ls



31
32
33
# File 'lib/brew/home_brew.rb', line 31

def list(formulae = [], **kwargs)
  Commands::List.new(brew_path, formulae, **kwargs).execute!
end

#search(text = nil, **kwargs) ⇒ Object



36
37
38
# File 'lib/brew/home_brew.rb', line 36

def search(text = nil, **kwargs)
  Commands::Search.new(brew_path, text, **kwargs).execute!
end

#uninstall(formula, **kwargs) ⇒ Object Also known as: rm, remove



40
41
42
# File 'lib/brew/home_brew.rb', line 40

def uninstall(formula, **kwargs)
  Commands::Uninstall.new(brew_path, formula, **kwargs).execute!
end

#update(**kwargs) ⇒ Object Also known as: up



46
47
48
# File 'lib/brew/home_brew.rb', line 46

def update(**kwargs)
  Commands::Update.new(brew_path, **kwargs).execute!
end

#upgrade(formula = [], **kwargs) ⇒ Object



51
52
53
# File 'lib/brew/home_brew.rb', line 51

def upgrade(formula = [], **kwargs)
  Commands::Upgrade.new(brew_path, formula, **kwargs).execute!
end