Module: Candelabra::Ubuntu::InstanceMethods
- Defined in:
- lib/candelabra/ubuntu.rb
Instance Method Summary collapse
-
#has_installer? ⇒ Boolean
Simple check to determine if home apt_get is installed.
-
#install(lib) ⇒ Object
Installs the requested package using home apt_get.
-
#installer_path ⇒ Object
Gets the path of home apt-get.
- #notify ⇒ Object
- #notify? ⇒ Boolean
- #os ⇒ Object
Instance Method Details
#has_installer? ⇒ Boolean
Simple check to determine if home apt_get is installed
Example:
Candelabra::Install.has_apt_get?
# => On osx it should be true
# => On ubuntu it should be false
Returns true if home apt_get is there
46 47 48 |
# File 'lib/candelabra/ubuntu.rb', line 46 def has_installer? !installer_path.nil? end |
#install(lib) ⇒ Object
Installs the requested package using home apt_get. If the package is already installed home apt_get will not install it
Example:
Candelabra::Install.install 'pianobar'
# => sudo apt-get install pianobar
Returns standard output from home apt_get
21 22 23 |
# File 'lib/candelabra/ubuntu.rb', line 21 def install lib `gksudo apt-get install #{lib}` if has_installer? end |
#installer_path ⇒ Object
Gets the path of home apt-get. If it’s somewere on your system this finds it. Candelabra assumes that you don’t use sudo to install the apt_get packages
Example:
Candelabra::Install.apt_get_path
# => /usr/bin/apt-get
Returns a string
34 35 36 |
# File 'lib/candelabra/ubuntu.rb', line 34 def installer_path %x[which apt-get].chomp end |
#notify ⇒ Object
58 59 60 |
# File 'lib/candelabra/ubuntu.rb', line 58 def notify `notify-send -i #{File.realpath(art_work)} "Pianobar - #{stationName}" "Now Playing: #{ artist } - #{ title }"` end |
#notify? ⇒ Boolean
54 55 56 |
# File 'lib/candelabra/ubuntu.rb', line 54 def notify? !%x[which notify-send].chomp.nil? end |
#os ⇒ Object
50 51 52 |
# File 'lib/candelabra/ubuntu.rb', line 50 def os 'Ubuntu\Linux' end |