Module: Rerun::System
- Included in:
- Runner
- Defined in:
- lib/system.rb
Instance Method Summary collapse
- #app_name ⇒ Object
- #growl(title, body, background = true) ⇒ Object
-
#growl? ⇒ Boolean
do we have growl or not?.
- #growlcmd ⇒ Object
- #icon ⇒ Object
Instance Method Details
#app_name ⇒ Object
34 35 36 37 |
# File 'lib/system.rb', line 34 def app_name # todo: make sure this works in non-Mac and non-Unix environments File.(".").gsub(/^.*\//, '').capitalize end |
#growl(title, body, background = true) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/system.rb', line 49 def growl(title, body, background = true) if growl? icon ? icon_str = "--image \"#{icon}\"" : icon_str = "" s = "#{growlcmd} -H localhost -n \"#{app_name}\" -m \"#{body}\" \"#{app_name} #{title}\" #{icon_str}" s += " &" if background `#{s}` end end |
#growl? ⇒ Boolean
do we have growl or not?
26 27 28 |
# File 'lib/system.rb', line 26 def growl? mac? && (growlcmd != "") end |
#growlcmd ⇒ Object
30 31 32 |
# File 'lib/system.rb', line 30 def growlcmd `which growlnotify`.chomp end |
#icon ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/system.rb', line 39 def icon libdir = "#{File.(File.dirname(File.dirname(__FILE__)))}/lib" $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir) rails_sig_file = File.(".")+"/config/boot.rb" puts rails_sig_file return "#{libdir}/../icons/rails_red_sml.png" if File.exists? rails_sig_file return nil end |