Module: Rerun::System

Included in:
Runner
Defined in:
lib/rerun/system.rb

Instance Method Summary collapse

Instance Method Details

#growl(title, body, background = true) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/rerun/system.rb', line 34

def growl(title, body, background = true)
  if growl_available?
    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_available?Boolean

do we have growl or not?



17
18
19
# File 'lib/rerun/system.rb', line 17

def growl_available?
  mac? && (growlcmd != "")
end

#growlcmdObject



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

#iconObject



27
28
29
30
31
32
# File 'lib/rerun/system.rb', line 27

def icon
  here = File.expand_path(File.dirname(__FILE__))
  icondir = File.expand_path("#{here}/../../icons")
  rails_sig_file = File.expand_path(".")+"/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