Skip to content

Commit

Permalink
Add tests and update travis.yml (RocketChat#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchoeler authored and seanpackham committed Jan 31, 2018
1 parent 2b53bb0 commit 490729e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 46 deletions.
36 changes: 12 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
language: node_js
node_js: '4'
install:
- npm i -g gulp
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
language: ruby
rvm:
- 2.4
sudo: false

branches:
only:
- master
before_script:
- chmod 600 .travis/deploy-key
- mv .travis/deploy-key ~/.ssh/id_rsa
- git clone https://github.com/RocketChat/Rocket.Chat.Docs.Generator.git /tmp/generator
install:
- bundle install --jobs=3 --retry=3 --deployment
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
script:
- export SRC_DIR=`pwd`
- cd /tmp/generator
- ln -s $SRC_DIR src
- npm i
- gulp build
before_install:
- echo -e "Host $DEPLOY_HOST\n\tHostName $DEPLOY_HOST\n\tStrictHostKeyChecking no\n\tUser github\n\tIdentityFile ~/.ssh/id_rsa\n" >> ~/.ssh/config
- openssl aes-256-cbc -K $encrypted_0da79f095df9_key -iv $encrypted_0da79f095df9_iv -in .travis/deploy-key.enc -out .travis/deploy-key -d
- bundle exec mdl ./ -i -g
- bundle exec "rake test"
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
source 'https://rubygems.org'

gem 'github-pages', group: :jekyll_plugins
source 'https://rubygems.org'
gem 'github-pages', '>=104', group: :jekyll_plugins

group :development, :test do
gem 'rake'
gem 'anemone'
gem "html-proofer"
gem 'mdl'
end
46 changes: 33 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ GEM
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.17.7)
colorize (0.8.1)
commonmarker (0.17.7.1)
ruby-enum (~> 0.5)
concurrent-ruby (1.0.5)
ethon (0.11.0)
ffi (>= 1.3.0)
execjs (2.7.0)
faraday (0.13.1)
faraday (0.14.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.18)
forwardable-extended (2.6.0)
gemoji (3.0.0)
github-pages (172)
github-pages (175)
activesupport (= 4.2.9)
github-pages-health-check (= 1.3.5)
jekyll (= 3.6.2)
Expand Down Expand Up @@ -64,7 +65,7 @@ GEM
jekyll-theme-time-machine (= 0.1.0)
jekyll-titles-from-headings (= 0.5.0)
jemoji (= 0.8.1)
kramdown (= 1.14.0)
kramdown (= 1.16.2)
liquid (= 4.0.0)
listen (= 3.0.6)
mercenary (~> 0.3)
Expand All @@ -80,7 +81,16 @@ GEM
html-pipeline (2.7.1)
activesupport (>= 2)
nokogiri (>= 1.4)
i18n (0.9.1)
html-proofer (3.7.6)
activesupport (>= 4.2, < 6.0)
addressable (~> 2.3)
colorize (~> 0.8)
mercenary (~> 0.3.2)
nokogiri (~> 1.8.1)
parallel (~> 1.3)
typhoeus (~> 0.7)
yell (~> 2.0)
i18n (0.9.3)
concurrent-ruby (~> 1.0)
jekyll (3.6.2)
addressable (~> 2.4)
Expand Down Expand Up @@ -187,23 +197,30 @@ GEM
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (>= 3.0)
kramdown (1.14.0)
kramdown (1.16.2)
liquid (4.0.0)
listen (3.0.6)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9.7)
mdl (0.4.0)
kramdown (~> 1.12, >= 1.12.0)
mixlib-cli (~> 1.7, >= 1.7.0)
mixlib-config (~> 2.2, >= 2.2.1)
mercenary (0.3.6)
mini_portile2 (2.3.0)
minima (2.1.1)
jekyll (~> 3.3)
minitest (5.10.3)
minitest (5.11.3)
mixlib-cli (1.7.0)
mixlib-config (2.2.4)
multipart-post (2.0.0)
net-dns (0.8.0)
nokogiri (1.8.1)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
octokit (4.7.0)
octokit (4.8.0)
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.0)
parallel (1.12.1)
pathutil (0.16.1)
forwardable-extended (~> 2.6)
public_suffix (2.0.5)
rake (12.3.0)
Expand All @@ -216,7 +233,7 @@ GEM
i18n
rubyzip (1.2.1)
safe_yaml (1.0.4)
sass (3.5.3)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
Expand All @@ -232,14 +249,17 @@ GEM
tzinfo (1.2.4)
thread_safe (~> 0.1)
unicode-display_width (1.3.0)
yell (2.0.7)

PLATFORMS
ruby

DEPENDENCIES
anemone
github-pages
github-pages (>= 104)
html-proofer
mdl
rake

BUNDLED WITH
1.16.0
1.16.1
22 changes: 15 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ task :check_links do
broken = Hash.new { |h, k| h[k] = [] }

puts 'Checking links'

store.each_value do |page|
print '.'

if page.code != 200
referrers = store.pages_linking_to(page.url)

referrers.each do |referrer|
broken[referrer] << page
end
end
end

puts "\n\nPages with broken links:"

broken.each do |referrer, pages|
puts "\n#{referrer.url}"

pages.each do |page|
puts " HTTP #{page.code} #{page.url}"
end
Expand All @@ -40,6 +40,14 @@ end
desc 'Check named markdown files contain permalink'
task :check_named_markdown do
puts 'Named markdown files missing permalinks:'

sh 'grep -rL --include="*.md" --exclude="README.md" "permalink:" .'
end

require 'html-proofer'

task :test do
sh "bundle exec jekyll build"
options = { :assume_extension => true, :allow_hash_href => true }
HTMLProofer.check_directory("./_site", options).run
end
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ whitelist:
exclude:
- Gemfile
- Gemfile.lock
- vendor

0 comments on commit 490729e

Please sign in to comment.