Skip to content

Commit 85dbfa0

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent b2cf017 commit 85dbfa0

34 files changed

+273
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ tmp
1818
.bundle
1919
crash.log
2020
npm-debug.log
21+
build.txt

Gemfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ group :staging do
2626
end
2727

2828
group :test do
29-
gem 'html-proofer', '~> 2.5'
29+
gem 'capybara', '2.4.4'
30+
gem 'html-proofer', '~> 2.6'
31+
gem 'rspec', '3.1'
32+
gem 'selenium-webdriver', '2.45.0'
33+
gem 'jsonlint', '0.1.0'
3034
end

Gemfile.lock

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ GEM
1010
addressable (2.3.8)
1111
awesome_print (1.6.1)
1212
builder (3.2.2)
13+
capybara (2.4.4)
14+
mime-types (>= 1.16)
15+
nokogiri (>= 1.3.3)
16+
rack (>= 1.0.0)
17+
rack-test (>= 0.5.4)
18+
xpath (~> 2.0)
19+
childprocess (0.5.8)
20+
ffi (~> 1.0, >= 1.0.11)
1321
colorator (0.1)
1422
colored (1.2)
1523
cri (2.7.0)
1624
colored (~> 1.2)
25+
diff-lcs (1.2.5)
1726
dotenv (2.0.2)
1827
ethon (0.8.0)
1928
ffi (>= 1.3.0)
@@ -32,7 +41,8 @@ GEM
3241
activesupport
3342
html-pipeline (>= 1.11)
3443
rouge (~> 1.8)
35-
html-proofer (2.5.2)
44+
html-proofer (2.6.1)
45+
activesupport (~> 4.2)
3646
addressable (~> 2.3)
3747
colored (~> 1.2)
3848
mercenary (~> 0.3.2)
@@ -66,14 +76,20 @@ GEM
6676
jekyll-watch (1.3.0)
6777
listen (~> 3.0)
6878
json (1.8.3)
79+
jsonlint (0.1.0)
80+
oj (~> 2)
6981
kramdown (1.9.0)
7082
liquid (3.0.6)
7183
listen (3.0.5)
7284
rb-fsevent (>= 0.9.3)
7385
rb-inotify (>= 0.9)
7486
mercenary (0.3.5)
87+
mime-types (3.0)
88+
mime-types-data (~> 3.2015)
89+
mime-types-data (3.2015.1120)
7590
mini_portile2 (2.0.0)
7691
minitest (5.8.3)
92+
multi_json (1.11.2)
7793
multipart-post (2.0.0)
7894
nanoc (4.0.2)
7995
cri (~> 2.3)
@@ -88,6 +104,7 @@ GEM
88104
mini_portile2 (~> 2.0.0.rc2)
89105
octokit (4.2.0)
90106
sawyer (~> 0.6.0, >= 0.5.3)
107+
oj (2.14.1)
91108
page-toc-filter (0.0.1)
92109
html-pipeline (~> 2.0)
93110
nokogiri (~> 1.6.4)
@@ -96,16 +113,36 @@ GEM
96113
rack-protection (1.5.3)
97114
rack
98115
rack-ssl-enforcer (0.2.9)
116+
rack-test (0.6.3)
117+
rack (>= 1.0)
99118
rake (10.3.2)
100119
rb-fsevent (0.9.6)
101120
rb-inotify (0.9.5)
102121
ffi (>= 0.5.0)
103122
rouge (1.10.1)
123+
rspec (3.1.0)
124+
rspec-core (~> 3.1.0)
125+
rspec-expectations (~> 3.1.0)
126+
rspec-mocks (~> 3.1.0)
127+
rspec-core (3.1.7)
128+
rspec-support (~> 3.1.0)
129+
rspec-expectations (3.1.2)
130+
diff-lcs (>= 1.2.0, < 2.0)
131+
rspec-support (~> 3.1.0)
132+
rspec-mocks (3.1.3)
133+
rspec-support (~> 3.1.0)
134+
rspec-support (3.1.2)
135+
rubyzip (1.1.7)
104136
safe_yaml (1.0.4)
105137
sass (3.4.19)
106138
sawyer (0.6.0)
107139
addressable (~> 2.3.5)
108140
faraday (~> 0.8, < 0.10)
141+
selenium-webdriver (2.45.0)
142+
childprocess (~> 0.5)
143+
multi_json (~> 1.0)
144+
rubyzip (~> 1.0)
145+
websocket (~> 1.0)
109146
sinatra (1.4.6)
110147
rack (~> 1.4)
111148
rack-protection (~> 1.4)
@@ -127,6 +164,9 @@ GEM
127164
activesupport (> 3.0)
128165
octokit (> 2.1.0)
129166
warden (> 1.0)
167+
websocket (1.2.2)
168+
xpath (2.0.0)
169+
nokogiri (~> 1.3)
130170
yell (2.0.5)
131171

132172
PLATFORMS
@@ -135,18 +175,22 @@ PLATFORMS
135175
DEPENDENCIES
136176
awesome_print (= 1.6.1)
137177
builder (~> 3.2)
178+
capybara (= 2.4.4)
138179
extended-markdown-filter (~> 0.4)
139180
gemoji (= 2.1.0)
140181
github-markdown (= 0.6.9)
141182
html-pipeline-rouge_filter (~> 1.0)
142-
html-proofer (~> 2.5)
183+
html-proofer (~> 2.6)
143184
jekyll-auth (~> 2.0)
185+
jsonlint (= 0.1.0)
144186
nanoc (~> 4.0)
145187
nanoc-conref-fs (~> 0.5)
146188
nanoc-html-pipeline (= 0.3.3)
147189
nokogiri (~> 1.6.0)
148190
page-toc-filter (~> 0.0.1)
149191
rake (= 10.3.2)
192+
rspec (= 3.1)
193+
selenium-webdriver (= 2.45.0)
150194

151195
BUNDLED WITH
152196
1.10.6

Rakefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@ task :build do
2121
end
2222

2323
desc "Test the output"
24-
task :test => [:remove_tmp_dir, :remove_output_dir, :build, :run_proofer]
24+
task :test => [:remove_tmp_dir, :remove_output_dir, :build] do
25+
Rake::Task['spec'].invoke
26+
Rake::Task['run_proofer'].invoke
27+
end
28+
29+
desc "Run Rspec"
30+
task :spec do
31+
require 'rspec/core/rake_task'
32+
RSpec::Core::RakeTask.new(:rspec)
33+
Rake::Task['rspec'].invoke
34+
end
2535

2636
desc "Run the HTML-Proofer"
2737
task :run_proofer do

content/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: GitHub Developer
33
layout: overview
4+
hide_from_search: true
45
---
56

67
<div class="wrapper feature">

content/search/search-index.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
[
22
<% @items.select { |item| !item.attributes[:hide_from_search] }.each do |item| %>
33
<% next if item[:filename].nil? || !item[:filename].end_with?('.md') %>
4+
<% @path = item[:filename].split('/')[1..-1].join('/')[0..-4] %>
5+
<% @path.chomp!('/index') if @path.end_with?('/index') %>
46
{
57
"title": "<%= clean_for_json(item[:title]) %>",
68
<%# Split off the directory name, join, then remove the '.md' extension %>
7-
"url": "/<%= item[:filename].split('/')[1..-1].join('/')[0..-4] %>/",
9+
"url": "/<%= @path %>/",
810
"body": "<%= clean_for_json(item.compiled_content) %>"
911
},
1012
<% end %>

script/cibuild

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,4 @@ echo "NPM version: ${NPM_VERSION}"
3434
echo "PATH: ${PATH}"
3535
echo ""
3636

37-
# bootstrap gem environment changes
38-
cd "$RACK_ROOT"
39-
echo 'Bootstrapping gems...'
40-
script/bootstrap
41-
42-
echo "==> Running tests…"
43-
bundle exec rake test
37+
script/test

script/test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
# Usage: script/test
3+
# Run test suite
4+
#
5+
6+
set -e
7+
8+
cd "$(dirname "$0")/.."
9+
10+
[ -z "$DEBUG" ] || set -x
11+
12+
export RACK_ROOT=$(cd "$(dirname $0)"/.. && pwd)
13+
14+
export RAILS_ENV="test" RACK_ENV="test"
15+
16+
script/bootstrap
17+
18+
echo "===> Running tests..."
19+
20+
if [ -n "$JANKY_ID" ]; then
21+
xvfb-run -a bundle exec rake test
22+
else
23+
bundle exec rake test
24+
fi

spec/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### What's in the *spec* folder?
2+
3+
This folder contains (almost) our entire test suite. We split these tests into different subfolders in this directory.
4+
5+
In addition, we use [HTML-Proofer](https://github.com/gjtorikian/html-proofer) to validate our built site. More on this below.
6+
7+
The tests in this directory include:
8+
9+
* The *content* folder contains tests which are run over our Markdown and YAML files before they are built. These tests include:
10+
* Ensuring that reusables are written correctly.
11+
* Ensuring that there are no Liquid errors.
12+
* Ensuring that there are no search errors.
13+
* The *features* folder contains tests that deal with how the site functions. These tests include:
14+
* Whether the search links are valid.
15+
* Whether the sidebar is working.
16+
* Whether redirects are working.
17+
18+
There are two more types of tests that are controlled by HTML-Proofer:
19+
20+
* HTML-Proofer validates that our *internal* content is working. That means that internal links are working, our images have alt tags, etc.
21+
* HTML-Proofer also validates our *external* content. That means URLs to external websites, external images, etc.

spec/content/validity_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
describe 'Validity' do
4+
it 'has no Liquid errors' do
5+
failed_files = []
6+
Dir.glob('output/**/*.html').each do |html_path|
7+
html = File.read(html_path)
8+
failed_files.push(html_path) if html =~ /Liquid error/
9+
end
10+
unless failed_files.empty?
11+
fail "Found files with broken Liquid syntax!\n\nThe following files are broken:\n #{failed_files.join("\n")}"
12+
end
13+
end
14+
15+
it 'has no unresolved conrefs' do
16+
failed_files = []
17+
Dir.glob('output/**/*.html').each do |html_path|
18+
html = File.read(html_path)
19+
failed_files.push(html_path) if html =~ /{{ site.data/
20+
end
21+
unless failed_files.empty?
22+
fail "Found #{failed_files.length} files with unresolved conrefs! These are conrefs that still say `{{ site.data` in the output.\n\nThe following files are not resolving: #{failed_files.join("\n")}"
23+
end
24+
end
25+
26+
it 'has a working search' do
27+
output = `jsonlint output/search/search-index.json`
28+
fail output unless output.empty?
29+
end
30+
end

0 commit comments

Comments
 (0)