-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
132 lines (115 loc) · 4.29 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# frozen_string_literal: true
# gem install rake
# https://ruby.github.io/rake/doc/rakefile_rdoc.html
# rubocop:disable RubocopIsRacistAndIcanProveIt/AsciiComments
# @see https://github.com/rubocop/ruby-style-guide/issues/301
# @see https://github.com/rubocop/ruby-style-guide/issues/137
# rake
task default: %i[download_hxl_datum]
# rake completum
task completum: %i[download_hxl_datum openapi_exportandum]
# @see https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=1181688279
task :download_hxl_datum do
puts 'download_hxl_datum'
puts 'Sincroliza dados HXL de _data/ do Google Planilhas' if l('pt')
puts 'Syncronize HXL data from _data/ from Google Planilhas' if l('en')
sh '_systema/programma/download-hxl-datum.sh'
end
task :openapi_exportandum do
puts 'download_hxl_datum'
puts 'openapi-generator-cli: gera arquivos baseado nos OpenAPI' if l('pt')
puts 'openapi-generator-cli: generate files base on OpenAPI' if l('en')
sh '_systema/programma/openapi-exportandum.sh'
end
task :purgatorium do
puts 'purgatorium'
# JEKYLL_ENV=development bundle exec jekyll clean
cached_list = [
'_data/expandendum/api.json',
'_data/expandendum/schemam.json',
'_data/l10n/api.l10n.json',
'_data/l10n/api.l10n.json',
'_data/l10n/apineo.l10n.json',
'_data/l10n/mappam-situm.l10n.json',
'_data/l10n/navigationem.l10n.json',
'_data/l10n/referens.l10n.json',
'_data/l10n/schema.l10n.json',
'_data/l10n/schemam.l10n.json',
'_data/tm/commune.tm.hxl.csv',
'_data/tm/hapi-api.tm.hxl.csv',
'_data/tm/hapi-miniman.tm.hxl.csv',
'_data/tm/schemam-un-htcds.tm.hxl.csv',
'_data/tm/schemam.tm.hxl.csv',
'do-not-exit-skip'
]
cached_list.each do |archivum|
if File.exist?(archivum)
puts archivum
File.delete(archivum)
end
end
end
# @see https://github.com/gjtorikian/html-proofer#using-with-jekyll
require 'html-proofer'
task :test do
sh 'bundle exec jekyll build --trace'
options = {
assume_extension: true,
# If true, does not run the external link checker, which can take a lot of time.
disable_external: true,
# If true, ignores the href="#".
allow_hash_href: true,
# Enables HTML validation errors from Nokogumbo
check_html: true,
# An array of Strings or RegExps containing file paths that are safe to ignore.
# Note; the graphql-doc generate malformated HTML, so we put exception here.
# TODO: discover what regex html-proofer use. Copy all files is bizarre.
file_ignore: [
'./_site/schema/iso/iso639-3/eng/graphql-doc/comment.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/i_id.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/i_status.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/id.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/m_id.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/part1.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/part2b.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/part2t.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/ref_name.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/scope.doc.html',
'./_site/schema/iso/iso639-3/eng/graphql-doc/type.doc.html'
]
}
HTMLProofer.check_directory('./_site', options).run
end
# _[por] Messages on user language [por]_
# _[por] Mensagem no idioma do usuário [por]_
# @exemplum
# ENV['LANG'] contains 'pt_BR.UTF-8'
# ---
# l('pt')
# @resultatum
# true
def l(iso6391, fallback: false)
ENV['LANG']&.start_with?(iso6391) || fallback
end
# @see https://stackoverflow.com/questions/33582197/how-do-i-build-a-jekyll-site-from-rake-task-without-using-the-command-line
# # https://www.devdungeon.com/content/ruby-rake-tutorial
# task default: %i[clean build install]
#
# task :clean do
# puts 'Cleaning packages'
# # `rm *.deb`
# end
# task :build do
# puts 'Building mypackage-0.0.0'
# # `dpkg -b ./mypackage-0.0.0 ./mypackage-0.0.0.deb`
# puts 'Try `rake install` now.'
# end
# task :uninstall do
# puts 'Uninstalling mypackage'
# # `sudo apt-get remove -y mypackage`
# end
# task install: [:uninstall] do
# puts 'Installing mypackage-0.0.0'
# # `sudo apt-get install -y ./mypackage-0.0.0.deb`
# end
# rubocop:enable RubocopIsRacistAndIcanProveIt/AsciiComments