Module: Candelabra::OSX::InstanceMethods
- Defined in:
- lib/candelabra/osx.rb
Instance Method Summary collapse
-
#has_installer? ⇒ Boolean
Simple check to determine if home brew is installed.
-
#install(lib) ⇒ Object
Installs the requested package using home brew.
-
#installer_path ⇒ Object
Gets the path of home brew.
-
#notify ⇒ Object
Notify the user using growl.
- #notify? ⇒ Boolean
- #os ⇒ Object
Instance Method Details
#has_installer? ⇒ Boolean
Simple check to determine if home brew is installed
Example:
Candelabra::Install.has_installer?
# => On osx it should be true
# => On ubuntu it should be false
Returns true if home brew is there
45 46 47 |
# File 'lib/candelabra/osx.rb', line 45 def has_installer? !installer_path.nil? end |
#install(lib) ⇒ Object
Installs the requested package using home brew. If the package is already installed home brew will not install it
Example:
Candelabra::Install.install 'pianobar'
# => brew installs pianobar
Returns standard output from home brew
20 21 22 |
# File 'lib/candelabra/osx.rb', line 20 def install lib %x[brew install #{lib}] if has_installer? end |
#installer_path ⇒ Object
Gets the path of home brew. If it’s somewere on your system this finds it. Candelabra assumes that you don’t use sudo to install the brew packages
Example:
Candelabra::Install.brew_path
# => /usr/local/bin/brew
Returns a string
33 34 35 |
# File 'lib/candelabra/osx.rb', line 33 def installer_path %x[which brew].chomp end |
#notify ⇒ Object
Notify the user using growl
58 59 60 |
# File 'lib/candelabra/osx.rb', line 58 def notify %x[growlnotify --image #{art_work} -t "Pianobar - #{stationName}" -m "Now Playing: #{artist} - #{title}"] if notify? end |
#notify? ⇒ Boolean
53 54 55 |
# File 'lib/candelabra/osx.rb', line 53 def notify? !%x[which growlnotify].chomp.nil? end |
#os ⇒ Object
49 50 51 |
# File 'lib/candelabra/osx.rb', line 49 def os 'OSX' end |