Module: Rerun::System
- Included in:
- Runner
- Defined in:
- lib/rerun/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
- #linux? ⇒ Boolean
- #mac? ⇒ Boolean
- #windows? ⇒ Boolean
Instance Method Details
#app_name ⇒ Object
27 28 29 30 |
# File 'lib/rerun/system.rb', line 27 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
39 40 41 42 43 44 45 46 |
# File 'lib/rerun/system.rb', line 39 def growl(title, body, background = true) if growl? icon_str = ("--image \"#{icon}\"" if icon) s = "#{growlcmd} -n \"#{app_name}\" -m \"#{body}\" \"#{app_name} #{title}\" #{icon_str}" s += " &" if background `#{s}` end end |
#growl? ⇒ Boolean
do we have growl or not?
17 18 19 |
# File 'lib/rerun/system.rb', line 17 def growl? mac? && (growlcmd != "") end |
#growlcmd ⇒ Object
21 22 23 24 25 |
# File 'lib/rerun/system.rb', line 21 def growlcmd growlnotify = `which growlnotify`.chomp # todo: check version of growlnotify and warn if it's too old growlnotify end |
#icon ⇒ Object
32 33 34 35 36 37 |
# File 'lib/rerun/system.rb', line 32 def icon here = File.(File.dirname(__FILE__)) icondir = File.("#{here}/../../icons") rails_sig_file = File.(".")+"/config/boot.rb" "#{icondir}/rails_red_sml.png" if File.exists? rails_sig_file end |
#linux? ⇒ Boolean
12 13 14 |
# File 'lib/rerun/system.rb', line 12 def linux? RUBY_PLATFORM =~ /linux/i end |
#mac? ⇒ Boolean
4 5 6 |
# File 'lib/rerun/system.rb', line 4 def mac? RUBY_PLATFORM =~ /darwin/i end |
#windows? ⇒ Boolean
8 9 10 |
# File 'lib/rerun/system.rb', line 8 def windows? RUBY_PLATFORM =~ /mswin/i end |