diff --git a/build/components/component.py b/build/components/component.py index 3047f8377..97c2b91c7 100644 --- a/build/components/component.py +++ b/build/components/component.py @@ -1,6 +1,8 @@ import logging import glob import os +import shutil + import semver import uuid from typing import Tuple @@ -514,13 +516,20 @@ def _copy_examples(self): if not example_id: continue - example_metadata = {'source': f} + example_metadata = { + 'source': f, + 'language': self.get('language').lower() + } + + base_path = os.path.join(dst, example_id) + mkdir_p(base_path) + rsync(example_metadata['source'], base_path) - mkdir_p(f'{dst}/{example_id}') - rsync(example_metadata['source'], f'{dst}/{example_id}/') + target_path = os.path.join(base_path, f'{self.get("id")}_{os.path.basename(f)}') + shutil.move(os.path.join(base_path, os.path.basename(f)), target_path) - example_metadata['target'] = f'{dst}/{example_id}/{os.path.basename(f)}' - e = Example(self.get('language'), example_metadata['target']) + example_metadata['target'] = target_path + e = Example(self.get('language'), target_path) example_metadata['highlight'] = e.highlight example_metadata['hidden'] = e.hidden example_metadata['named_steps'] = e.named_steps @@ -532,7 +541,7 @@ def _copy_examples(self): examples[example_id] = {} logging.info(f'Example {example_id} processed successfully.') - examples[example_id][self.get('language')] = example_metadata + examples[example_id][self.get('label')] = example_metadata def apply(self) -> None: logging.info(f'Applying client {self._id}') diff --git a/config.toml b/config.toml index 9d0f703d1..3a7915a03 100644 --- a/config.toml +++ b/config.toml @@ -45,7 +45,7 @@ tagManagerId = "GTM-TKZ6J9R" gitHubRepo = "https://github.com/redis/docs" # Display and sort order for client examples -clientsExamples = ["Python", "Node.js", "Java", "Go", "C#", "RedisVL"] +clientsExamples = ["Python", "Node.js", "Java Sync", "Java Async", "Java Reactive", "Go", "C#", "RedisVL"] searchService = "/convai/api/search-service" ratingsService = "/docusight/api/rate" @@ -57,12 +57,14 @@ rdi_db_types = "cassandra|mysql|oracle|postgresql|sqlserver" rdi_cli_latest = "latest" [params.clientsConfig] -"Python"={lang="python", quickstartSlug="python/redis-py"} -"Node.js"={lang="javascript", quickstartSlug="nodejs"} -"Java"={lang="java", quickstartSlug="java/jedis"} -"Go"={lang="go", quickstartSlug="go"} -"C#"={lang="C#", quickstartSlug="dotnet"} -"RedisVL"={lang="python", quickstartSlug="python/redis-vl"} +"Python"={quickstartSlug="redis-py"} +"Node.js"={quickstartSlug="nodejs"} +"Java sync"={quickstartSlug="jedis"} +"Java async"={quickstartSlug="lettuce"} +"Java reactive"={quickstartSlug="lettuce"} +"Go"={quickstartSlug="go"} +"C#"={quickstartSlug="dotnet"} +"RedisVL"={quickstartSlug="redis-vl"} # Markup [markup] diff --git a/data/components/go_redis.json b/data/components/go_redis.json index ce46beca1..80fb21a60 100644 --- a/data/components/go_redis.json +++ b/data/components/go_redis.json @@ -3,6 +3,7 @@ "type": "client", "name": "go-redis", "language": "Go", + "label": "Go", "repository": { "git_uri": "https://github.com/redis/go-redis" }, diff --git a/data/components/index.json b/data/components/index.json index cd2dd4433..ff8b8f451 100644 --- a/data/components/index.json +++ b/data/components/index.json @@ -12,6 +12,8 @@ "node_redis", "redis_py", "jedis", + "lettuce_async", + "lettuce_reactive", "redis_vl" ], "assets": [], diff --git a/data/components/jedis.json b/data/components/jedis.json index 058ddc08a..4aa154ab5 100644 --- a/data/components/jedis.json +++ b/data/components/jedis.json @@ -3,6 +3,7 @@ "type": "client", "name": "jedis", "language": "Java", + "label": "Java Sync", "repository": { "git_uri": "https://github.com/redis/jedis" }, diff --git a/data/components/lettuce_async.json b/data/components/lettuce_async.json new file mode 100644 index 000000000..cc860f75c --- /dev/null +++ b/data/components/lettuce_async.json @@ -0,0 +1,16 @@ +{ + "id": "lettuce_async", + "type": "client", + "name": "lettuce_async", + "language": "Java", + "label": "Java Async", + "repository": { + "git_uri": "https://github.com/redis/lettuce" + }, + "examples": { + "git_uri": "https://github.com/redis/lettuce", + "dev_branch": "doctests", + "path": "src/test/java/io/redis/examples/async", + "pattern": "*.java" + } +} \ No newline at end of file diff --git a/data/components/lettuce_reactive.json b/data/components/lettuce_reactive.json new file mode 100644 index 000000000..b79aa9880 --- /dev/null +++ b/data/components/lettuce_reactive.json @@ -0,0 +1,16 @@ +{ + "id": "lettuce_reactive", + "type": "client", + "name": "lettuce_reactive", + "language": "Java", + "label": "Java Reactive", + "repository": { + "git_uri": "https://github.com/redis/lettuce" + }, + "examples": { + "git_uri": "https://github.com/redis/lettuce", + "dev_branch": "doctests", + "path": "src/test/java/io/redis/examples/reactive", + "pattern": "*.java" + } +} \ No newline at end of file diff --git a/data/components/node_redis.json b/data/components/node_redis.json index 79742c786..b1a5c4d1b 100644 --- a/data/components/node_redis.json +++ b/data/components/node_redis.json @@ -3,6 +3,7 @@ "type": "client", "name": "node-redis", "language": "Node.js", + "label": "Node.js", "repository": { "git_uri": "https://github.com/redis/node-redis" }, diff --git a/data/components/nredisstack.json b/data/components/nredisstack.json index 7e5271934..4283fdd49 100644 --- a/data/components/nredisstack.json +++ b/data/components/nredisstack.json @@ -3,6 +3,7 @@ "type": "client", "name": "NRedisStack", "language": "C#", + "label": "C#", "repository": { "git_uri": "https://github.com/redis/NRedisStack" }, diff --git a/data/components/redis_py.json b/data/components/redis_py.json index 801a09c66..dd93419c5 100644 --- a/data/components/redis_py.json +++ b/data/components/redis_py.json @@ -3,6 +3,7 @@ "type": "client", "name": "redis-py", "language": "Python", + "label": "Python", "repository": { "git_uri": "https://github.com/redis/redis-py" }, diff --git a/data/components/redis_vl.json b/data/components/redis_vl.json index befe6f452..bd0566723 100644 --- a/data/components/redis_vl.json +++ b/data/components/redis_vl.json @@ -2,7 +2,8 @@ "id": "redisvl", "type": "client", "name": "RedisVL", - "language": "RedisVL", + "language": "Python", + "label": "RedisVL", "repository": { "git_uri": "https://github.com/redis/redis-vl-python" }, diff --git a/layouts/partials/tabbed-clients-example.html b/layouts/partials/tabbed-clients-example.html index 42b127775..4d7fb5fa6 100644 --- a/layouts/partials/tabbed-clients-example.html +++ b/layouts/partials/tabbed-clients-example.html @@ -19,7 +19,7 @@ {{ range $client := $.Site.Params.clientsexamples }} {{ $example := index $clientExamples $client }} {{ $clientConfig := index $.Site.Params.clientsconfig $client }} - {{ $language := index $clientConfig "lang" }} + {{ $language := index $example "language" }} {{ $quickstartSlug := index $clientConfig "quickstartSlug" }} {{ if and ($example) (or (eq $lang "") (eq $lang $client)) }}