Sha256: cb60cbaad1f0969e12edf86d94c0106a3109eccd9690660b284d9c1901e0c4eb

Contents?: true

Size: 1014 Bytes

Versions: 4

Compression:

Stored size: 1014 Bytes

Contents

module Rerun
  module System

    def mac?
      RUBY_PLATFORM =~ /darwin/i
    end

    def windows?
       RUBY_PLATFORM =~ /mswin/i
    end

    def linux?
       RUBY_PLATFORM =~ /linux/i
    end

    # do we have growl or not?
    def growl_available?
      mac? && (growlcmd != "")
    end

    def growlcmd
      growlnotify = `which growlnotify`.chomp
      # todo: check version of growlnotify and warn if it's too old
      growlnotify
    end

    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

    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

  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
rerun-cj-0.10.1 lib/rerun/system.rb
rerun-cj-0.10.0 lib/rerun/system.rb
rerun-0.10.0 lib/rerun/system.rb
rerun-0.9.0 lib/rerun/system.rb