Sha256: 9897f44df7a3b33855cd35b8c68d570282c2780f573e4f030ec40914e177a1e0

Contents?: true

Size: 1002 Bytes

Versions: 10

Compression:

Stored size: 1002 Bytes

Contents

require 'open3'

Dir.chdir File.dirname(__FILE__)

watch(/(?:lib|test).*\.rb$/)  { |something|

  Dir['lib/**/*.rb'].inject(true) do |check, path|
    Open3.popen3('ruby', '-c', path) { |_, o, stderr|
      errors = stderr.read

      if errors.empty? then check
      else
        puts errors
        false
      end
    }
  end and begin
  
    messages = Dir['test/**/test_*.rb'].inject([]) do |messages, path|
      if path !~ /test_helper\.rb$/
        Open3.popen3('rake test') do |_, o, e|
          puts e.read, message = o.read

          result = message.split($/).last
          tests, assertions, failures, errors =
              result.split(', ').map! { |r| r.to_i }

          failures ||= 0
          errors ||= 0

          unless failures.zero? and errors.zero?
#            Open3.popen3(bad_message) { |i, *| i << message[0, 160] }
          else
#            system(good_message)
          end

          messages << message
        end
      end

      messages
    end


  end

}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
xbel-0.2.7 .watchr
xbel-0.2.6 .watchr
xbel-0.2.5 .watchr
xbel-0.2.4 .watchr
xbel-0.2.3 .watchr
xbel-0.2.2 .watchr
xbel-0.2.1 .watchr
xbel-0.2.0 .watchr
xbel-0.1.2 .watchr
xbel-0.1.1 .watchr