Skip to content

Commit 041b328

Browse files
DOC-5963 enabled Lettuce sync examples
1 parent cc4324c commit 041b328

File tree

6 files changed

+52
-18
lines changed

6 files changed

+52
-18
lines changed

build/local_examples.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ def get_client_name_from_language_and_path(language: str, path: str) -> str:
5757
"""Get client name from language with path-based overrides.
5858
5959
For Java (.java) files, override based on path substrings:
60+
- If 'lettuce-sync' in path -> Lettuce-Sync
6061
- If 'lettuce-async' in path -> Java-Async
6162
- If 'lettuce-reactive' in path -> Java-Reactive
6263
6364
Substring checks are case-sensitive and can appear anywhere in the path.
6465
"""
6566
if language == 'java':
67+
if 'lettuce-sync' in path:
68+
return 'Lettuce-Sync'
6669
if 'lettuce-async' in path:
6770
return 'Java-Async'
6871
if 'lettuce-reactive' in path:

build/tcedocs/README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ There are two sections that need to updated when new languages are added.
88
1. In the `[params]` section:
99

1010
```toml
11-
clientsExamples = ["Python", "Node.js", "Java-Sync", "Java-Async", "Java-Reactive", "Go", "C#", "RedisVL", "PHP"]
11+
clientsExamples = ["Python", "Node.js", "Java-Sync", "Lettuce-Sync", "Java-Async", "Java-Reactive", "Go", "C#-Sync", "C#-Async", "RedisVL", "PHP", "Rust-Sync", "Rust-Async"]
1212
```
1313

1414
The order of the `clientsExamples` list matters: it's the order in which the language tabs are presented for each code example.
@@ -18,13 +18,17 @@ There are two sections that need to updated when new languages are added.
1818
[params.clientsConfig]
1919
"Python"={quickstartSlug="redis-py"}
2020
"Node.js"={quickstartSlug="nodejs"}
21-
"Java-sync"={quickstartSlug="jedis"}
22-
"Java-async"={quickstartSlug="lettuce"}
23-
"Java-reactive"={quickstartSlug="lettuce"}
21+
"Java-Sync"={quickstartSlug="jedis"}
22+
"Lettuce-Sync"={quickstartSlug="lettuce"}
23+
"Java-Async"={quickstartSlug="lettuce"}
24+
"Java-Reactive"={quickstartSlug="lettuce"}
2425
"Go"={quickstartSlug="go"}
25-
"C#"={quickstartSlug="dotnet"}
26+
"C#-Sync"={quickstartSlug="dotnet"}
27+
"C#-Async"={quickstartSlug="dotnet"}
2628
"RedisVL"={quickstartSlug="redis-vl"}
2729
"PHP"={quickstartSlug="php"}
30+
"Rust-Sync"={quickstartSlug="rust"}
31+
"Rust-Async"={quickstartSlug="rust"}
2832
```
2933

3034
This configuration, along with the configuration steps below, is used to control the behavior of the Hugo shortcode that was developed to show tabbed code examples.
@@ -36,7 +40,7 @@ A shortcode is a simple snippet inside a content file that Hugo will render usin
3640

3741
The folder `data/components` contains one component configuration file for each supported language. These files contain information about the GitHub repos that house the code examples.
3842

39-
Here is the configuration file for Python, `redis_py.json`:
43+
Here is the configuration file for Python, `redis_py.json`:
4044

4145
```json
4246
{
@@ -65,15 +69,19 @@ Register your component file by adding it to the `clients` array in the `index.j
6569
Here is an example:
6670
```json
6771
"clients": [
68-
"nredisstack",
72+
"nredisstack_sync",
73+
"nredisstack_async",
6974
"go_redis",
7075
"node_redis",
7176
"php",
7277
"redis_py",
7378
"jedis",
79+
"lettuce_sync",
7480
"lettuce_async",
7581
"lettuce_reactive",
76-
"redis_vl"
82+
"redis_vl",
83+
"redis_rs_sync",
84+
"redis_rs_async"
7785
]
7886
```
7987

@@ -133,7 +141,8 @@ Add a source code file to an appropriate client repo. Consult the /data/componen
133141
| C# | [NRedisStack](https://github.com/redis/NRedisStack) | `tests/Doc` |
134142
| Go | [go-redis](https://github.com/redis/go-redis) | `doctests` |
135143
| Java | [jedis](https://github.com/redis/jedis) | `src/test/java/io/redis/examples` |
136-
| | [Lettuce](https://github.com/redis/lettuce) | `src/test/java/io/redis/examples/async` or |
144+
| | [Lettuce](https://github.com/redis/lettuce) | `src/test/java/io/redis/examples/sync`, |
145+
| | | `src/test/java/io/redis/examples/async`, or |
137146
| | | `src/test/java/io/redis/examples/reactive` |
138147
| Node.js | [node-redis](https://github.com/redis/node-redis) | `doctests` |
139148
| PHP | [Predis](https://github.com/predis/predis) | Examples, for now, are stored in `local_examples` |
@@ -151,6 +160,9 @@ local_examples
151160
│   │   ...
152161
│   ├── jedis
153162
│   │   ...
163+
│ ├── lettuce-sync
164+
│ │ ...
165+
154166
│   ├── lettuce-async
155167
│   │   ...
156168
│   ├── lettuce-reactive

build/tcedocs/SPECIFICATION.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,16 @@ The system operates in three distinct phases:
245245

246246
Some languages have multiple client implementations (sync/async, different libraries). The system uses directory path to determine which variant:
247247

248-
- Java files in `lettuce-async/``Java-Async` (Lettuce async client)
248+
- Java files in `lettuce-sync/``Lettuce-Sync` (Lettuce synchronous client)
249+
- Java files in `lettuce-async/``Java-Async` (Lettuce asynchronous client)
249250
- Java files in `lettuce-reactive/``Java-Reactive` (Lettuce reactive client)
250251
- Java files elsewhere → `Java-Sync` (Jedis synchronous client)
251252
- Rust files in `rust-async/``Rust-Async`
252253
- Rust files in `rust-sync/``Rust-Sync`
253254
- C# files in `async/``C#-Async`
254255
- C# files in `sync/``C#-Sync`
255256

256-
This allows the same language to appear multiple times in the tab interface with different implementations.
257+
This allows the same language to appear multiple times in the tab interface with different implementations. The order of checks matters: more specific paths (e.g., `lettuce-sync`) should be checked before generic ones (e.g., `Java-Sync`).
257258

258259
**Outputs**:
259260
- Copies files to `examples/{example_id}/local_{filename}`
@@ -1126,7 +1127,7 @@ def main():
11261127
**Client Examples Order**:
11271128
```toml
11281129
[params]
1129-
clientsExamples = ["Python", "Node.js", "Java-Sync", "Java-Async", "Java-Reactive", "Go", "C#-Sync", "C#-Async", "RedisVL", "PHP", "Rust-Sync", "Rust-Async"]
1130+
clientsExamples = ["Python", "Node.js", "Java-Sync", "Lettuce-Sync", "Java-Async", "Java-Reactive", "Go", "C#-Sync", "C#-Async", "RedisVL", "PHP", "Rust-Sync", "Rust-Async"]
11301131
```
11311132

11321133
This controls:

config.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ tagManagerId = "GTM-TKZ6J9R"
4545
gitHubRepo = "https://github.com/redis/docs"
4646

4747
# Display and sort order for client examples
48-
clientsExamples = ["Python", "Node.js", "Java-Sync", "Java-Async", "Java-Reactive", "Go", "C#-Sync", "C#-Async", "RedisVL", "PHP", "Rust-Sync", "Rust-Async"]
48+
clientsExamples = ["Python", "Node.js", "Java-Sync", "Lettuce-Sync", "Java-Async", "Java-Reactive", "Go", "C#-Sync", "C#-Async", "RedisVL", "PHP", "Rust-Sync", "Rust-Async"]
4949
searchService = "/convai/api/search-service"
5050
ratingsService = "/docusight/api/rate/docs"
5151

@@ -60,16 +60,17 @@ rdi_current_version = "1.15.0"
6060
[params.clientsConfig]
6161
"Python"={quickstartSlug="redis-py"}
6262
"Node.js"={quickstartSlug="nodejs"}
63-
"Java-sync"={quickstartSlug="jedis"}
64-
"Java-async"={quickstartSlug="lettuce"}
65-
"Java-reactive"={quickstartSlug="lettuce"}
63+
"Java-Sync"={quickstartSlug="jedis"}
64+
"Lettuce-Sync"={quickstartSlug="lettuce"}
65+
"Java-Async"={quickstartSlug="lettuce"}
66+
"Java-Reactive"={quickstartSlug="lettuce"}
6667
"Go"={quickstartSlug="go"}
6768
"C#-Sync"={quickstartSlug="dotnet"}
6869
"C#-Async"={quickstartSlug="dotnet"}
6970
"RedisVL"={quickstartSlug="redis-vl"}
7071
"PHP"={quickstartSlug="php"}
71-
"Rust-sync"={quickstartSlug="rust"}
72-
"Rust-async"={quickstartSlug="rust"}
72+
"Rust-Sync"={quickstartSlug="rust"}
73+
"Rust-Async"={quickstartSlug="rust"}
7374

7475
# Mount directories for duplicate content
7576
[module]

data/components/index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"php",
1515
"redis_py",
1616
"jedis",
17+
"lettuce_sync",
1718
"lettuce_async",
1819
"lettuce_reactive",
1920
"redis_vl",

data/components/lettuce_sync.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "lettuce_sync",
3+
"type": "client",
4+
"name": "lettuce_sync",
5+
"language": "Lettuce-Sync",
6+
"label": "Lettuce-Sync",
7+
"repository": {
8+
"git_uri": "https://github.com/redis/lettuce"
9+
},
10+
"examples": {
11+
"git_uri": "https://github.com/redis/lettuce",
12+
"path": "src/test/java/io/redis/examples/sync",
13+
"pattern": "*.java"
14+
}
15+
}
16+

0 commit comments

Comments
 (0)