Sha256: be8b7ce615fb83e030596fc63d8596636ac336dd561ffac971adf16dde324bc8

Contents?: true

Size: 802 Bytes

Versions: 49

Compression:

Stored size: 802 Bytes

Contents

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!

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

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

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

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

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
punchblock-2.7.5 spec/capture_warnings.rb
punchblock-2.7.3 spec/capture_warnings.rb
punchblock-2.7.2 spec/capture_warnings.rb
punchblock-2.7.1 spec/capture_warnings.rb
punchblock-2.7.0 spec/capture_warnings.rb
punchblock-2.6.0 spec/capture_warnings.rb
punchblock-2.5.3 spec/capture_warnings.rb
punchblock-2.5.2 spec/capture_warnings.rb
punchblock-2.5.1 spec/capture_warnings.rb
punchblock-2.5.0 spec/capture_warnings.rb
punchblock-2.4.2 spec/capture_warnings.rb
punchblock-2.4.0 spec/capture_warnings.rb
punchblock-2.3.1 spec/capture_warnings.rb
punchblock-2.3.0 spec/capture_warnings.rb
punchblock-2.2.2 spec/capture_warnings.rb
punchblock-2.2.1 spec/capture_warnings.rb
punchblock-2.2.0 spec/capture_warnings.rb
punchblock-2.1.1 spec/capture_warnings.rb
punchblock-2.1.0 spec/capture_warnings.rb
punchblock-2.0.2 spec/capture_warnings.rb