From 6e05d0fcb1d9803bb98dead4eb511744f3586d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= Date: Tue, 30 Apr 2024 18:24:18 +0200 Subject: [PATCH] Update script to generate Valkey Module API docs (#406) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The output of this script becomes the contents of `topics/module-api-ref.md` in the `valkey-doc` repo. (Updating it is a manual process.) The script uses git tags to find the version that first added an API function. To preserve the history from old Redis OSS versions, for which we don't keep git tags, a mapping is stored in a file. Signed-off-by: Viktor Söderqvist --- utils/generate-module-api-doc.rb | 36 ++-- utils/module-api-since.rb | 354 +++++++++++++++++++++++++++++++ 2 files changed, 371 insertions(+), 19 deletions(-) create mode 100644 utils/module-api-since.rb diff --git a/utils/generate-module-api-doc.rb b/utils/generate-module-api-doc.rb index 8829434bc..1e3f76ecc 100755 --- a/utils/generate-module-api-doc.rb +++ b/utils/generate-module-api-doc.rb @@ -13,13 +13,13 @@ def markdown(s) newlines = [] # Fix some markdown lines.each{|l| - # Rewrite RM_Xyz() to RedisModule_Xyz(). - l = l.gsub(/(?\n\n" puts "### `#{name}`\n\n" puts " #{proto}\n" - puts "**Available since:** #{$since[name] or "unreleased"}\n\n" + puts "**Available since:** #{$since[shortname] or "unreleased"}\n\n" comment = "" while true i = i-1 @@ -132,7 +132,7 @@ end def is_func_line(src, i) line = src[i] - return line =~ /RM_/ && + return line =~ /VM_/ && line[0] != ' ' && line[0] != '#' && line[0] != '/' && src[i-1] =~ /\*\// end @@ -142,9 +142,7 @@ puts "title: \"Modules API reference\"\n" puts "linkTitle: \"API reference\"\n" puts "weight: 1\n" puts "description: >\n" -puts " Reference for the Redis Modules API\n" -puts "aliases:\n" -puts " - /topics/modules-api-ref\n" +puts " Reference for the Valkey Modules API\n" puts "---\n" puts "\n" puts "