module Rerun::System

Public Instance Methods

app_name() click to toggle source
# File lib/rerun/system.rb, line 39
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) click to toggle source
# File lib/rerun/system.rb, line 53
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
    %x#{s}`
  end
end
growl?() click to toggle source

do we have growl or not?

# File lib/rerun/system.rb, line 31
def growl?
  mac? && (growlcmd != "")
end
growlcmd() click to toggle source
# File lib/rerun/system.rb, line 35
def growlcmd
  %xwhich growlnotify`.chomp
end
icon() click to toggle source
# File lib/rerun/system.rb, line 44
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"
  return "#{libdir}/../icons/rails_red_sml.png" if File.exists? rails_sig_file
  return nil
end
linux?() click to toggle source
# File lib/rerun/system.rb, line 26
def linux?
   RUBY_PLATFORM =~ /linux/i
end
mac?() click to toggle source
# File lib/rerun/system.rb, line 4
def mac?
  # puts "RUBY_PLATFORM=#{RUBY_PLATFORM}"
  RUBY_PLATFORM =~ /darwin/i
end
osx_foundation?() click to toggle source
# File lib/rerun/system.rb, line 9
def osx_foundation?
  mac? and begin
    if $osx_foundation.nil?
      require 'osx/foundation'
      OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework'
      $osx_foundation = true
    end
    $osx_foundation
  rescue LoadError
    $osx_foundation = false
  end
end
windows?() click to toggle source
# File lib/rerun/system.rb, line 22
def windows?
   RUBY_PLATFORM =~ /mswin/i
end