Sha256: 2b69f0c16c4307e8042241aa0d174a30bdd0b5b6937302a7e7ffc7175452f66c

Contents?: true

Size: 782 Bytes

Versions: 7

Compression:

Stored size: 782 Bytes

Contents

# encoding: utf-8

require 'tempfile'
stderr_file = Tempfile.new "ahn.stderr"
$stderr.reopen stderr_file.path
current_dir = Dir.pwd

at_exit do
  stderr_file.rewind
  lines = stderr_file.read.split("\n").uniq
  stderr_file.close!

  ahn_warnings, other_warnings = lines.partition { |line| line.include?(current_dir) && !line.include?('vendor') && line.include?('warning') }

  if ahn_warnings.any?
    puts
    puts "-" * 30 + " AHN Warnings: " + "-" * 30
    puts
    puts ahn_warnings.join("\n")
    puts
    puts "-" * 75
    puts
  end

  if other_warnings.any?
    File.open('tmp/warnings.txt', 'w') { |f| f.write other_warnings.join("\n") }
    puts
    puts "Non-AHN warnings written to tmp/warnings.txt"
    puts
  end

  exit 1 if ahn_warnings.any? # fail the build...
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adhearsion-2.0.1 spec/capture_warnings.rb
adhearsion-2.0.0 spec/capture_warnings.rb
adhearsion-2.0.0.rc5 spec/capture_warnings.rb
adhearsion-2.0.0.rc4 spec/capture_warnings.rb
adhearsion-2.0.0.rc3 spec/capture_warnings.rb
adhearsion-2.0.0.rc2 spec/capture_warnings.rb
adhearsion-2.0.0.rc1 spec/capture_warnings.rb