diff --git a/documentation/Makefile b/documentation/Makefile index b9fa304050..72616084fa 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -1,70 +1,74 @@ # Generate the FreeBSD documentation # # Copyright (c) 2020-2021, The FreeBSD Documentation Project # Copyright (c) 2020-2021, Sergio Carlavilla # # Targets intended for use on the command line # # all (default) - generate the books TOC and compile all the documentation # run - serves the built documentation site for local browsing # # The run target uses hugo's built-in webserver to make the documentation site # available for local browsing. The documentation should have been built prior # to attempting to use the `run` target. By default, hugo will start its # webserver on port 1313. MAINTAINER=carlavilla@FreeBSD.org LOCALBASE?= /usr/local PYTHON_CMD = ${LOCALBASE}/bin/python3 +RUBY_CMD = ${LOCALBASE}/bin/ruby HUGO_CMD = ${LOCALBASE}/bin/hugo LANGUAGES = en,es,pt-br,de,ja,zh-cn,zh-tw,ru,el,hu,it,mn,nl,pl,fr RUBYLIB = ../shared/lib .export RUBYLIB RUN_DEPENDS= ${PYTHON_CMD} \ ${HUGO_CMD} \ ${LOCALBASE}/bin/asciidoctor \ ${LOCALBASE}/bin/rougify .ifndef HOSTNAME .HOST+=localhost .else .HOST+=$(HOSTNAME) .endif .ORDER: all run .ORDER: requirements .ORDER: starting-message generate-books-toc .ORDER: starting-message build .ORDER: generate-books-toc build -all: requirements starting-message generate-books-toc build -run: requirements starting-message generate-books-toc run-local +all: requirements starting-message generate-books-toc generate-pgpkeys-txt build +run: requirements starting-message generate-books-toc generate-pgpkeys-txt run-local requirements: .for dep in ${RUN_DEPENDS} .if !exists(${dep}) @(echo ${dep} not found, please run 'pkg install docproj'; exit 1) .endif .endfor starting-message: .PHONY @echo --------------------------------------------------------------- @echo Building the documentation @echo --------------------------------------------------------------- generate-books-toc: .PHONY ${PYTHON_CMD} ./tools/books-toc-parts-creator.py -l ${LANGUAGES} ${PYTHON_CMD} ./tools/books-toc-creator.py -l ${LANGUAGES} ${PYTHON_CMD} ./tools/books-toc-figures-creator.py -l ${LANGUAGES} ${PYTHON_CMD} ./tools/books-toc-tables-creator.py -l ${LANGUAGES} ${PYTHON_CMD} ./tools/books-toc-examples-creator.py -l ${LANGUAGES} +generate-pgpkeys-txt: .PHONY + ${RUBY_CMD} ./tools/global-pgpkeys-creator.rb + run-local: .PHONY ${HUGO_CMD} server -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313" build: .PHONY ${HUGO_CMD} --minify diff --git a/documentation/tools/global-pgpkeys-creator.rb b/documentation/tools/global-pgpkeys-creator.rb new file mode 100644 index 0000000000..37eb94fe32 --- /dev/null +++ b/documentation/tools/global-pgpkeys-creator.rb @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby + +=begin + +BSD 2-Clause License +Copyright (c) 2020-2021, The FreeBSD Project +Copyright (c) 2020-2021, Sergio Carlavilla + +This script will merge all the pgpkeys into one single file + +=end + +def getAllPGPKeys() + return Dir.glob('./static/pgpkeys/*.key').sort +end + +def processAllPGPKeys(keysFiles, pgpKeysFile) + keysFiles.each{ |keyFile| + processPGPKey(keyFile, pgpKeysFile) + } +end + +def processPGPKey(keyFile, pgpKeysFile) + File.readlines(keyFile).each do |line| + pgpKeysFile.puts(line) + end +end + +# Main method +keysFiles = getAllPGPKeys() + +pgpKeysFile = File.new("./static/pgpkeys/pgpkeys.txt", "w") + +processAllPGPKeys(keysFiles, pgpKeysFile)