This commit is contained in:
Benoit Daloze 2019-05-30 22:11:22 +02:00
Родитель c55db6aa27
Коммит e935a3227d
3 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -19,6 +19,3 @@ PLATFORMS
DEPENDENCIES
rake (~> 10.0)
rspec (~> 2.14.1)
BUNDLED WITH
1.16.1

Просмотреть файл

@ -190,7 +190,7 @@ def verify_commits(impl)
puts "Manually check commit messages:"
print "Press enter >"
STDIN.gets
sh "git", "log", "master..."
system "git", "log", "master..."
end
end

13
spec/mspec/tool/tag_from_output.rb Normal file → Executable file
Просмотреть файл

@ -1,3 +1,5 @@
#!/usr/bin/env ruby
# Adds tags based on error and failures output (e.g., from a CI log),
# without running any spec code.
@ -8,14 +10,12 @@ tags_dir = %w[
abort 'Could not find tags directory' unless tags_dir
output = ARGF.readlines
# Remove leading "[exec] " from JRuby logs
output = output.map { |line| line.sub(/^\[exec\] /, '') }
NUMBER = /^\d+\)$/
ERROR_OR_FAILED = / (ERROR|FAILED)$/
SPEC_FILE = /^(\/.+_spec\.rb)\:\d+/
failures = output.slice_before(NUMBER).select { |number, error_line, *rest|
output.slice_before(NUMBER).select { |number, error_line, *rest|
number =~ NUMBER and error_line =~ ERROR_OR_FAILED
}.each { |number, error_line, *rest|
description = error_line.match(ERROR_OR_FAILED).pre_match
@ -31,9 +31,8 @@ failures = output.slice_before(NUMBER).select { |number, error_line, *rest|
Dir.mkdir(dir) unless Dir.exist?(dir)
tag_line = "fails:#{description}"
unless File.exist?(tags_file) and File.readlines(tags_file, chomp: true).include?(tag_line)
File.open(tags_file, 'a') do |f|
f.puts tag_line
end
lines = File.exist?(tags_file) ? File.readlines(tags_file, chomp: true) : []
unless lines.include?(tag_line)
File.write(tags_file, (lines + [tag_line]).join("\n") + "\n")
end
}