git: 5a9f8ba840 - main - Add new tool to generate the pgpkeys.txt file

Sergio Carlavilla Delgado <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by carlavilla:

URL: https://cgit.FreeBSD.org/doc/commit/?id=5a9f8ba84024192b35746faa2a665f2e79571ed0

commit 5a9f8ba84024192b35746faa2a665f2e79571ed0
Author:     Sergio Carlavilla Delgado <[email protected]>
AuthorDate: 2021-05-16 20:41:00 +0000
Commit:     Sergio Carlavilla Delgado <[email protected]>
CommitDate: 2021-05-16 20:41:00 +0000

    Add new tool to generate the pgpkeys.txt file
---
 documentation/Makefile                        |  8 +++++--
 documentation/tools/global-pgpkeys-creator.rb | 34 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/documentation/Makefile b/documentation/Makefile
index b9fa304050..72616084fa 100644
--- a/documentation/Makefile
+++ b/documentation/Makefile
@@ -18,6 +18,7 @@ [email protected]
 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
@@ -41,8 +42,8 @@ RUN_DEPENDS=	${PYTHON_CMD} \
 .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}
@@ -63,6 +64,9 @@ generate-books-toc: .PHONY
 	${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"
 
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 <[email protected]>
+
+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)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.