-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for Continous Integration
- Loading branch information
1 parent
289270c
commit bd9f22f
Showing
9 changed files
with
156 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/_site | ||
/_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: ruby | ||
rvm: | ||
- 2.1 | ||
python: | ||
- 2.7 | ||
install: | ||
- sudo pip install html5validator | ||
- bundle install | ||
script: | ||
- bundle exec jekyll build | ||
- ./script/cibuild | ||
env: | ||
global: | ||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'github-pages' | ||
gem 'jekyll-redirect-from' | ||
gem 'html-proofer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
cd "$DIR" | ||
echo "------------------------------------------------------------------------" | ||
echo "* Task #1: html5validator" | ||
./filter-html5validator | ||
echo | ||
echo "------------------------------------------------------------------------" | ||
echo "* Task #2: htmlproof" | ||
./filter-htmlproof | ||
echo | ||
echo "------------------------------------------------------------------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
cd "$DIR" | ||
source "$DIR/filter-lib.sh" | ||
|
||
filter_errors() { | ||
grep -v "Bad value “X-UA-Compatible” for attribute “http-equiv” on element “meta”" #| | ||
#grep " error: " | ||
} | ||
|
||
filter_html5validator() { | ||
filter_it "$DIR/../_site/" "html5validator --blacklist docs" | ||
} | ||
|
||
filter_html5validator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
cd "$DIR" | ||
source "$DIR/filter-lib.sh" | ||
|
||
filter_errors() { | ||
grep -v "linking to /docs/stable/elixir/Kernel.html#%7C%3E/2, but %7C%3E/2 does not exist" | | ||
grep -vP "internally linking to \/docs\/.*, which does not exist" | | ||
grep -vP "trying to find hash of \/docs\/.*, but .* does not exist" | | ||
|
||
filter_more_errors | | ||
|
||
#delete every file hat has no error (that is, anything file that is not follow by a line starting with " * ") | ||
perl -0777 -pe 's/\- .*\n(?!\s+\*\s+)//g' | ||
} | ||
|
||
filter_more_errors() { | ||
perl -CSAD -ne ' | ||
BEGIN { | ||
my $current_file = ""; | ||
} | ||
if ( /^- / ) { | ||
$current_file = $_; | ||
} elsif ( $current_file =~ /getting_started/ ) { | ||
s/\s+\*\s+no favicon specified\n//; | ||
} | ||
' $1 | ||
} | ||
|
||
filter_success() { | ||
perl -CSAD -pe "s/\|\s+Error:\s+HTML-Proofer found \d+ failures?\!//g" | | ||
perl -0777 -CSAD -pe "s/\n{3,}/\n\n/g" | ||
} | ||
|
||
filter_htmlproof() { | ||
filter_it "$DIR/../" "bundle exec htmlproof ./_site --file-ignore /docs/ --only-4xx --check-favicon --check-html --check-external-hash" | ||
} | ||
|
||
filter_htmlproof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
TEMP_DIR=$(mktemp -dt "$(basename $0).XXXXXXXXXX") | ||
|
||
STDOUT="$TEMP_DIR/htmlproof_stdout" | ||
STDERR="$TEMP_DIR/htmlproof_stderr" | ||
STDERR_PRE="$TEMP_DIR/htmlproof_stderr_pre" | ||
|
||
clean_temp_files() { | ||
rm -rf "$TEMP_DIR" 2> /dev/null | ||
} | ||
|
||
function validate() { | ||
local cmd="$1" | ||
echo "$cmd" && | ||
$cmd 1>"$STDOUT" 2>"$STDERR_PRE" | ||
cat "$STDERR_PRE" | filter_errors >"$STDERR" | ||
} | ||
|
||
filter_success() { | ||
perl -0777 -CSAD -pe "s/\n{3,}/\n\n/g" | ||
} | ||
|
||
# filter_it <full_path_dir> <command> | ||
filter_it() { | ||
local dir=$(readlink -f "$1") | ||
pushd "$dir" 1> /dev/null | ||
pwd | ||
validate "$2" | ||
errors=$(<"$STDERR") | ||
length=${#errors} | ||
if [ "$length" -gt 0 ]; then | ||
echo "ERROR: Documents are not valid" >&2 | ||
echo | ||
cat "$STDERR" >&2 | ||
clean_temp_files | ||
popd 1> /dev/null | ||
return 1 | ||
else | ||
cat "$STDOUT" | filter_success | ||
echo | ||
echo "OK: Documents successfully validated" | ||
cat "$STDERR" >&2 | ||
clean_temp_files | ||
popd 1> /dev/null | ||
return 0 | ||
fi | ||
} |