Class: Roasted::Provider::Brew

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Brew

Returns a new instance of Brew.



12
13
14
15
16
17
# File 'lib/roasted/provider/brew.rb', line 12

def initialize(options)
  @action = options.delete(:action)
  @formula = options.delete(:formula)
  
  @options = options
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



5
6
7
# File 'lib/roasted/provider/brew.rb', line 5

def action
  @action
end

#formulaObject

Returns the value of attribute formula.



4
5
6
# File 'lib/roasted/provider/brew.rb', line 4

def formula
  @formula
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/roasted/provider/brew.rb', line 6

def options
  @options
end

Class Method Details

.create(options) ⇒ Object



8
9
10
# File 'lib/roasted/provider/brew.rb', line 8

def self.create(options)
  return new(options)
end

Instance Method Details

#installObject



19
20
21
22
23
24
25
26
# File 'lib/roasted/provider/brew.rb', line 19

def install
  # Simple, check if we have brew installed
  install_brew unless File.executable?("/usr/local/bin/brew")
  
  unless File.directory?("/usr/local/Cellar/#{@formula}")
    system("/usr/local/bin/brew install #{@formula}")
  end
end

#install_brewObject



28
29
30
# File 'lib/roasted/provider/brew.rb', line 28

def install_brew
  system '/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"'
end