| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b2cf017 commit 85dbfa0
34 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,3 +18,4 @@ tmp | |||
| 18 | 18 | .bundle | |
| 19 | 19 | crash.log | |
| 20 | 20 | npm-debug.log | |
| 21 | + build.txt | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,5 +26,9 @@ group :staging do | |||
| 26 | 26 | end | |
| 27 | 27 | ||
| 28 | 28 | 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' | ||
| 30 | 34 | end | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,10 +10,19 @@ GEM | |||
| 10 | 10 | addressable (2.3.8) | |
| 11 | 11 | awesome_print (1.6.1) | |
| 12 | 12 | 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) | ||
| 13 | 21 | colorator (0.1) | |
| 14 | 22 | colored (1.2) | |
| 15 | 23 | cri (2.7.0) | |
| 16 | 24 | colored (~> 1.2) | |
| 25 | + diff-lcs (1.2.5) | ||
| 17 | 26 | dotenv (2.0.2) | |
| 18 | 27 | ethon (0.8.0) | |
| 19 | 28 | ffi (>= 1.3.0) | |
@@ -32,7 +41,8 @@ GEM | |||
| 32 | 41 | activesupport | |
| 33 | 42 | html-pipeline (>= 1.11) | |
| 34 | 43 | rouge (~> 1.8) | |
| 35 | - html-proofer (2.5.2) | ||
| 44 | + html-proofer (2.6.1) | ||
| 45 | + activesupport (~> 4.2) | ||
| 36 | 46 | addressable (~> 2.3) | |
| 37 | 47 | colored (~> 1.2) | |
| 38 | 48 | mercenary (~> 0.3.2) | |
@@ -66,14 +76,20 @@ GEM | |||
| 66 | 76 | jekyll-watch (1.3.0) | |
| 67 | 77 | listen (~> 3.0) | |
| 68 | 78 | json (1.8.3) | |
| 79 | + jsonlint (0.1.0) | ||
| 80 | + oj (~> 2) | ||
| 69 | 81 | kramdown (1.9.0) | |
| 70 | 82 | liquid (3.0.6) | |
| 71 | 83 | listen (3.0.5) | |
| 72 | 84 | rb-fsevent (>= 0.9.3) | |
| 73 | 85 | rb-inotify (>= 0.9) | |
| 74 | 86 | mercenary (0.3.5) | |
| 87 | + mime-types (3.0) | ||
| 88 | + mime-types-data (~> 3.2015) | ||
| 89 | + mime-types-data (3.2015.1120) | ||
| 75 | 90 | mini_portile2 (2.0.0) | |
| 76 | 91 | minitest (5.8.3) | |
| 92 | + multi_json (1.11.2) | ||
| 77 | 93 | multipart-post (2.0.0) | |
| 78 | 94 | nanoc (4.0.2) | |
| 79 | 95 | cri (~> 2.3) | |
@@ -88,6 +104,7 @@ GEM | |||
| 88 | 104 | mini_portile2 (~> 2.0.0.rc2) | |
| 89 | 105 | octokit (4.2.0) | |
| 90 | 106 | sawyer (~> 0.6.0, >= 0.5.3) | |
| 107 | + oj (2.14.1) | ||
| 91 | 108 | page-toc-filter (0.0.1) | |
| 92 | 109 | html-pipeline (~> 2.0) | |
| 93 | 110 | nokogiri (~> 1.6.4) | |
@@ -96,16 +113,36 @@ GEM | |||
| 96 | 113 | rack-protection (1.5.3) | |
| 97 | 114 | rack | |
| 98 | 115 | rack-ssl-enforcer (0.2.9) | |
| 116 | + rack-test (0.6.3) | ||
| 117 | + rack (>= 1.0) | ||
| 99 | 118 | rake (10.3.2) | |
| 100 | 119 | rb-fsevent (0.9.6) | |
| 101 | 120 | rb-inotify (0.9.5) | |
| 102 | 121 | ffi (>= 0.5.0) | |
| 103 | 122 | 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) | ||
| 104 | 136 | safe_yaml (1.0.4) | |
| 105 | 137 | sass (3.4.19) | |
| 106 | 138 | sawyer (0.6.0) | |
| 107 | 139 | addressable (~> 2.3.5) | |
| 108 | 140 | 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) | ||
| 109 | 146 | sinatra (1.4.6) | |
| 110 | 147 | rack (~> 1.4) | |
| 111 | 148 | rack-protection (~> 1.4) | |
@@ -127,6 +164,9 @@ GEM | |||
| 127 | 164 | activesupport (> 3.0) | |
| 128 | 165 | octokit (> 2.1.0) | |
| 129 | 166 | warden (> 1.0) | |
| 167 | + websocket (1.2.2) | ||
| 168 | + xpath (2.0.0) | ||
| 169 | + nokogiri (~> 1.3) | ||
| 130 | 170 | yell (2.0.5) | |
| 131 | 171 | ||
| 132 | 172 | PLATFORMS | |
@@ -135,18 +175,22 @@ PLATFORMS | |||
| 135 | 175 | DEPENDENCIES | |
| 136 | 176 | awesome_print (= 1.6.1) | |
| 137 | 177 | builder (~> 3.2) | |
| 178 | + capybara (= 2.4.4) | ||
| 138 | 179 | extended-markdown-filter (~> 0.4) | |
| 139 | 180 | gemoji (= 2.1.0) | |
| 140 | 181 | github-markdown (= 0.6.9) | |
| 141 | 182 | html-pipeline-rouge_filter (~> 1.0) | |
| 142 | - html-proofer (~> 2.5) | ||
| 183 | + html-proofer (~> 2.6) | ||
| 143 | 184 | jekyll-auth (~> 2.0) | |
| 185 | + jsonlint (= 0.1.0) | ||
| 144 | 186 | nanoc (~> 4.0) | |
| 145 | 187 | nanoc-conref-fs (~> 0.5) | |
| 146 | 188 | nanoc-html-pipeline (= 0.3.3) | |
| 147 | 189 | nokogiri (~> 1.6.0) | |
| 148 | 190 | page-toc-filter (~> 0.0.1) | |
| 149 | 191 | rake (= 10.3.2) | |
| 192 | + rspec (= 3.1) | ||
| 193 | + selenium-webdriver (= 2.45.0) | ||
| 150 | 194 | ||
| 151 | 195 | BUNDLED WITH | |
| 152 | 196 | 1.10.6 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,17 @@ task :build do | |||
| 21 | 21 | end | |
| 22 | 22 | ||
| 23 | 23 | 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 | ||
| 25 | 35 | ||
| 26 | 36 | desc "Run the HTML-Proofer" | |
| 27 | 37 | task :run_proofer do | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | --- | |
| 2 | 2 | title: GitHub Developer | |
| 3 | 3 | layout: overview | |
| 4 | + hide_from_search: true | ||
| 4 | 5 | --- | |
| 5 | 6 | ||
| 6 | 7 | <div class="wrapper feature"> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,10 +1,12 @@ | |||
| 1 | 1 | [ | |
| 2 | 2 | <% @items.select { |item| !item.attributes[:hide_from_search] }.each do |item| %> | |
| 3 | 3 | <% 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') %> | ||
| 4 | 6 | { | |
| 5 | 7 | "title": "<%= clean_for_json(item[:title]) %>", | |
| 6 | 8 | <%# Split off the directory name, join, then remove the '.md' extension %> | |
| 7 | - "url": "/<%= item[:filename].split('/')[1..-1].join('/')[0..-4] %>/", | ||
| 9 | + "url": "/<%= @path %>/", | ||
| 8 | 10 | "body": "<%= clean_for_json(item.compiled_content) %>" | |
| 9 | 11 | }, | |
| 10 | 12 | <% end %> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,10 +34,4 @@ echo "NPM version: ${NPM_VERSION}" | |||
| 34 | 34 | echo "PATH: ${PATH}" | |
| 35 | 35 | echo "" | |
| 36 | 36 | ||
| 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 | ||
| Original file line number | Diff line number | Diff 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 | ||
| Original file line number | Diff line number | Diff 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. | ||
| Original file line number | Diff line number | Diff 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 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments