Sha256: 4299a73f61d5c3d2561fcb267d0842f8fcd06aa8405eb07f86e3489f7cd27407

Contents?: true

Size: 1.29 KB

Versions: 476

Compression:

Stored size: 1.29 KB

Contents

# vim: syntax=ruby
# From http://pastie.caboo.se/115692, linked from rickbradley

require 'autotest/redgreen'
require 'autotest/timestamp'

Autotest.send(:alias_method, :real_find_files, :find_files)
Autotest.send(:define_method, :find_files) do |*args|
  real_find_files.reject do |k, v|
    if (ENV['AUTOTEST'] and !ENV['AUTOTEST'].empty?)
      !Regexp.new(ENV['AUTOTEST']).match(k)
    end
  end
end

module Autotest::Growl

  def self.growl title, msg, img, pri=0, sticky=""
    system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
  end

  Autotest.add_hook :ran_command do |at|
    image_root = "~/.autotest_images"
    results = [at.results].flatten.join("\n")
    output = results.slice(/(\d+)\stests,\s(\d+)\sassertions,\s(\d+)\sfailures,\s(\d+)\serrors/)
    if output
      if $~[3].to_i > 0 || $~[4].to_i > 0
        growl "FAIL", "#{output}", "#{image_root}/fail.png", 2
      else
        growl "Pass", "#{output}", "#{image_root}/pass.png"
      end
    end

    output = results.slice(/(\d+)\sexamples,\s(\d+)\sfailures?(,\s+\d+\s+pending)?/)
    if output
      if $~[2].to_i > 0 || $~[4].to_i > 0
        growl "FAIL", "#{output}", "#{image_root}/fail.png", 2
      else
        growl "Pass", "#{output}", "#{image_root}/pass.png"
      end
    end
  end
end

Version data entries

476 entries across 476 versions & 4 rubygems

Version Path
puppet-5.5.22 ext/autotest/config
puppet-5.5.22-x86-mingw32 ext/autotest/config
puppet-5.5.22-x64-mingw32 ext/autotest/config
puppet-5.5.22-universal-darwin ext/autotest/config
puppet-5.5.21 ext/autotest/config
puppet-5.5.21-x86-mingw32 ext/autotest/config
puppet-5.5.21-x64-mingw32 ext/autotest/config
puppet-5.5.21-universal-darwin ext/autotest/config
puppet-5.5.20 ext/autotest/config
puppet-5.5.20-x86-mingw32 ext/autotest/config
puppet-5.5.20-x64-mingw32 ext/autotest/config
puppet-5.5.20-universal-darwin ext/autotest/config
puppet-5.5.19 ext/autotest/config
puppet-5.5.19-x86-mingw32 ext/autotest/config
puppet-5.5.19-x64-mingw32 ext/autotest/config
puppet-5.5.19-universal-darwin ext/autotest/config
puppet-5.5.18 ext/autotest/config
puppet-5.5.18-x86-mingw32 ext/autotest/config
puppet-5.5.18-x64-mingw32 ext/autotest/config
puppet-5.5.18-universal-darwin ext/autotest/config