Module: Rerun::System

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

Instance Method Summary collapse

Instance Method Details

#app_nameObject



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.expand_path(".").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?

Returns:

  • (Boolean)


26
27
28
# File 'lib/system.rb', line 26

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

#growlcmdObject



30
31
32
# File 'lib/system.rb', line 30

def growlcmd
  `which growlnotify`.chomp
end

#iconObject



39
40
41
42
43
44
45
46
47
# File 'lib/system.rb', line 39

def icon
  libdir = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}/lib"
  $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)

  rails_sig_file = File.expand_path(".")+"/config/boot.rb" 
  puts rails_sig_file
  return "#{libdir}/../icons/rails_red_sml.png" if File.exists? rails_sig_file
  return nil
end