-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
67 lines (53 loc) · 1.6 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# frozen_string_literal: true
# Copyright © 2015-2024 Matt Robinson
#
# SPDX-License-Identifier: GPL-3.0-or-later
require 'rubocop/rake_task'
require 'rake/extensiontask'
require 'rake/clean'
require 'rspec/core/rake_task'
require 'html-proofer'
require 'jekyll'
RuboCop::RakeTask.new
desc 'Run JShint'
task :jshint do
sh 'npm run --silent jshint'
end
desc 'Run all lint tasks'
task lint: %w[rubocop jshint cppcheck]
Rake::ExtensionTask.new do |ext|
ext.name = 'bbc_native'
ext.ext_dir = '_ext/BBC'
ext.tmp_dir = File.join(Dir.tmpdir, '8bs_online_conversion')
ext.lib_dir = File.join(__dir__, '/_plugins/BBC')
end
desc 'Build site and run HTMLProofer against the output'
task :proof do
builddir = File.join(Dir.tmpdir, '8bs_online_conversion', 'html')
ENV['JEKYLL_ENV'] = 'production'
Jekyll::Commands::Build.process(destination: builddir)
HTMLProofer.check_directory(
builddir,
checks: %w[Images Links Scripts Favicon],
allow_hash_href: false,
disable_external: true,
ignore_urls: [
%r{^/assets/convimages/},
%r{^http://8bs[.]com/},
]
).run
end
desc 'Run Cppcheck'
task :cppcheck do
puts 'Running Cppcheck...'
sh 'cppcheck --quiet --error-exitcode=2 --enable=all --std=c99 \
--check-level=exhaustive --suppress=missingIncludeSystem \
--suppress=checkersReport --inline-suppr _ext/BBC/*.c',
verbose: false
puts 'No errors found'
end
RSpec::Core::RakeTask.new(rspec: :compile) do |rake|
rake.pattern = '_spec/**/*_spec.rb'
end
CLEAN.include('_plugins/**/*.so')
CLEAN.include(File.join(Dir.tmpdir, '8bs_online_conversion'))