From 4241d44de87d8f04f593f683e913980bc746b3d6 Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Wed, 9 Nov 2016 18:06:38 -0800 Subject: Add support for checking YAML validity using Travis CI --- tests/yaml.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/yaml.rb (limited to 'tests/yaml.rb') diff --git a/tests/yaml.rb b/tests/yaml.rb new file mode 100644 index 00000000..bf0c3797 --- /dev/null +++ b/tests/yaml.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +require 'yaml'; +$file_count = 0; +markdown_files = Dir["./**/*.html.markdown"] +markdown_files.each do |file| + begin + YAML.load_file(file) + $file_count = $file_count + 1 + rescue Exception => msg + puts msg + end +end +files_failed = markdown_files.length - $file_count +if files_failed != 0 + puts "FAILURE!!! #{files_failed} files were unable to be parsed!" + puts "Please check the YAML headers for the documents that failed!" + exit 1 +else + puts "Success. All #{$file_count} were checked" + exit 0 +end -- cgit v1.2.3 From 58ffb4057fcd67e5c0ba33f76344cc8ad927c72b Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Wed, 9 Nov 2016 20:24:10 -0800 Subject: Add UTF-8 check test --- tests/yaml.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests/yaml.rb') diff --git a/tests/yaml.rb b/tests/yaml.rb index bf0c3797..9f21016f 100644 --- a/tests/yaml.rb +++ b/tests/yaml.rb @@ -3,19 +3,19 @@ require 'yaml'; $file_count = 0; markdown_files = Dir["./**/*.html.markdown"] markdown_files.each do |file| - begin - YAML.load_file(file) - $file_count = $file_count + 1 - rescue Exception => msg - puts msg - end + begin + YAML.load_file(file) + $file_count = $file_count + 1 + rescue Exception => msg + puts msg + end end files_failed = markdown_files.length - $file_count if files_failed != 0 - puts "FAILURE!!! #{files_failed} files were unable to be parsed!" - puts "Please check the YAML headers for the documents that failed!" - exit 1 + puts "FAILURE!!! #{files_failed} files were unable to be parsed!" + puts "Please check the YAML headers for the documents that failed!" + exit 1 else - puts "Success. All #{$file_count} were checked" - exit 0 + puts "Success. All #{$file_count} files were verified valid YAML" + exit 0 end -- cgit v1.2.3 From bb5e514321732ee6fac150cdbfb587cca5c20433 Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Wed, 9 Nov 2016 22:15:03 -0800 Subject: Update rakefile so that it will return an exit code of 1 if there is a failure (Travis CI needs this). Make ISO-8859* encoding detections notices not failures --- tests/yaml.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/yaml.rb') diff --git a/tests/yaml.rb b/tests/yaml.rb index 9f21016f..0ed918e0 100644 --- a/tests/yaml.rb +++ b/tests/yaml.rb @@ -16,6 +16,6 @@ if files_failed != 0 puts "Please check the YAML headers for the documents that failed!" exit 1 else - puts "Success. All #{$file_count} files were verified valid YAML" + puts "All #{$file_count} files were verified valid YAML" exit 0 end -- cgit v1.2.3