Class: Sambot::DeveloperWorkflow::Brew

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

Instance Method Summary collapse

Instance Method Details

#configureObject



7
8
9
10
11
12
# File 'lib/sambot/developer_workflow/brew.rb', line 7

def configure
  UI.debug("Updating Homebrew formulas and casks")
  update
  tap('caskroom/cask')
  update
end

#install_cask(cask, binary) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/sambot/developer_workflow/brew.rb', line 26

def install_cask(cask, binary)
  result = `which #{binary}`
  if result
    UI.info("Not installing the Homebrew cask #{cask} as the corresponding binary is already available")
  else
    `brew cask install #{cask}`
  end
end

#install_formula(formula, binary) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/sambot/developer_workflow/brew.rb', line 35

def install_formula(formula, binary)
  result = `which #{binary}`
  if result
    UI.info("Not installing the Homebrew formula #{formula} as the corresponding binary is already available")
  else
    `brew install #{formula}`
  end
end

#tap(name) ⇒ Object



20
21
22
23
24
# File 'lib/sambot/developer_workflow/brew.rb', line 20

def tap(name)
  Bundler.with_clean_env do
    `brew tap #{name}`
  end
end

#updateObject



14
15
16
17
18
# File 'lib/sambot/developer_workflow/brew.rb', line 14

def update
  Bundler.with_clean_env do
    `brew update`
  end
end