-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
105 additions
and
4 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
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,9 @@ | ||
require 'fileutils' | ||
require 'html-proofer' | ||
require 'yaml' | ||
|
||
SITE_DIR = './_site' | ||
CONFIG = YAML.load_file './_config.yml' | ||
SITE_ID = ENV['SITE_ID'] || CONFIG.fetch('site_id', 'root') | ||
|
||
module Iiifc ; end |
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,33 @@ | ||
require 'iiifc' | ||
|
||
namespace :build do | ||
def build(dest=nil, baseurl=nil) | ||
sh "bundle exec jekyll clean" | ||
cmd = "bundle exec jekyll build" | ||
cmd += " -d '#{dest}'" unless dest.nil? | ||
cmd += " --baseurl '#{baseurl}'" unless baseurl.nil? | ||
sh cmd | ||
end | ||
|
||
desc 'Clean and build with branch preview URL overrides' | ||
task :preview do | ||
branch = `git rev-parse --abbrev-ref HEAD`.strip | ||
baseurl = "/#{SITE_ID}/#{branch}" | ||
dest = SITE_DIR + baseurl | ||
|
||
build dest=dest, baseurl=baseurl | ||
end | ||
|
||
desc 'Clean and build with CI test overrides' | ||
task :ci do | ||
baseurl = '/test/extra-test' | ||
dest = SITE_DIR + baseurl | ||
|
||
build dest=dest, baseurl=baseurl | ||
end | ||
|
||
desc 'Clean and build with no overrrides' | ||
task :default do | ||
build | ||
end | ||
end |
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,59 @@ | ||
require 'iiifc' | ||
|
||
namespace :test do | ||
desc 'Check html' | ||
task :html do | ||
opts = { | ||
check_html: true, | ||
assume_extension: true, | ||
validation: { | ||
report_mismatched_tags: true, | ||
report_invalid_tags: true | ||
}, | ||
checks_to_ignore: ['LinkCheck'] | ||
} | ||
HTMLProofer.check_directory(SITE_DIR, opts).run | ||
end | ||
|
||
namespace :links do | ||
desc 'Check for internal link errors' | ||
task :internal do | ||
puts 'Checking for internal link errors' | ||
opts = { | ||
checks_to_ignore: ['ImageCheck', 'HtmlCheck', 'ScriptCheck'], | ||
disable_external: true, | ||
internal_domains: ['localhost:4000'] | ||
} | ||
HTMLProofer.check_directory(SITE_DIR, opts).run | ||
end | ||
|
||
desc 'Check for *iiif.io* link errors' | ||
task :iiif do | ||
puts 'Checking for link errors in *iiif.io* sites' | ||
opts = { | ||
checks_to_ignore: ['ImageCheck', 'HtmlCheck', 'ScriptCheck'], | ||
url_ignore: [/^((?!iiif\.io).)*$/, 'github'] # temporarily ignore iiif.io github repo errors | ||
} | ||
HTMLProofer.check_directory(SITE_DIR, opts).run | ||
end | ||
|
||
desc 'Check for external link rot' | ||
task :external do | ||
puts 'Checking for external link errors' | ||
opts = { | ||
external_only: true, | ||
http_status_ignore: [429], | ||
enforce_https: true, | ||
only_4xx: true, | ||
checks_to_ignore: ['ImageCheck', 'HtmlCheck', 'ScriptCheck'], | ||
url_ignore: [/.*iiif\.io.*/] | ||
} | ||
HTMLProofer.check_directory(SITE_DIR, opts).run | ||
end | ||
|
||
desc 'Run rspec tests (if they exist)' | ||
task :spec do | ||
|
||
end | ||
end | ||
end |