Skip to content

Commit 2611df3

Browse files
authored
Update for Hurl 6.0.0 (#99)
1 parent b09ca17 commit 2611df3

23 files changed

Lines changed: 6083 additions & 251 deletions

sites/generate/build_jekyll_md.py

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
Examples:
1313
$ python3 sites/generate/build_jekyll_md.py
1414
"""
15+
16+
import argparse
1517
import re
1618
import gzip
1719
import shutil
20+
import sys
21+
import tomllib
1822
from pathlib import Path
1923
from typing import Optional
2024

@@ -204,7 +208,15 @@ def convert(self):
204208
self.file_dst.write_text(md)
205209

206210

207-
def build():
211+
def build(standalone: bool):
212+
"""Build a jekyll project for documentation from original repo"""
213+
# Identify version
214+
with open("../hurl/packages/hurl/Cargo.toml", "rb") as f:
215+
data = tomllib.load(f)
216+
version = data["package"]["version"]
217+
version = version.replace("-SNAPSHOT", "")
218+
sys.stderr.write(f"version:{version}\n")
219+
208220
docs = [
209221
(
210222
Path("../hurl/docs/home.md"),
@@ -391,19 +403,23 @@ def build():
391403
FrontMatter(layout="doc", section="Resources"),
392404
False,
393405
),
394-
(
395-
Path("../hurl/docs/standalone/hurl-5.0.1.md"),
396-
Path("sites/hurl.dev/_docs/standalone/hurl-5.0.1.md"),
397-
FrontMatter(
398-
layout="standalone",
399-
section="Standalone",
400-
title="Hurl 5.0.1",
401-
indexed=False,
402-
),
403-
False,
404-
),
405406
]
406407

408+
if standalone:
409+
docs.append(
410+
(
411+
Path(f"../hurl/docs/standalone/hurl-{version}.md"),
412+
Path(f"sites/hurl.dev/_docs/standalone/hurl-{version}.md"),
413+
FrontMatter(
414+
layout="standalone",
415+
section="Standalone",
416+
title=f"Hurl {version}",
417+
indexed=False,
418+
),
419+
False,
420+
),
421+
)
422+
407423
for src, dst, front_matter, force_list_numbering in docs:
408424
task = ConvertTask(
409425
file_src=src,
@@ -453,21 +469,22 @@ def build():
453469
"../hurl/docs/assets/img/quiz-light.png",
454470
"sites/hurl.dev/assets/img/quiz-light.png",
455471
)
456-
compress(src=Path("../hurl/docs/standalone/hurl-5.0.1.md"))
457-
shutil.move(
458-
"../hurl/docs/standalone/hurl-5.0.1.md.gz",
459-
"sites/hurl.dev/assets/docs/hurl-5.0.1.md.gz",
460-
)
461-
compress(src=Path("../hurl/docs/standalone/hurl-5.0.1.html"))
462-
shutil.move(
463-
"../hurl/docs/standalone/hurl-5.0.1.html.gz",
464-
"sites/hurl.dev/assets/docs/hurl-5.0.1.html.gz",
465-
)
466-
compress(src=Path("../hurl/docs/standalone/hurl-5.0.1.pdf"))
467-
shutil.move(
468-
"../hurl/docs/standalone/hurl-5.0.1.pdf.gz",
469-
"sites/hurl.dev/assets/docs/hurl-5.0.1.pdf.gz",
470-
)
472+
if standalone:
473+
compress(src=Path(f"../hurl/docs/standalone/hurl-{version}.md"))
474+
shutil.move(
475+
f"../hurl/docs/standalone/hurl-{version}.md.gz",
476+
f"sites/hurl.dev/assets/docs/hurl-{version}.md.gz",
477+
)
478+
compress(src=Path(f"../hurl/docs/standalone/hurl-{version}.html"))
479+
shutil.move(
480+
f"../hurl/docs/standalone/hurl-{version}.html.gz",
481+
f"sites/hurl.dev/assets/docs/hurl-{version}.html.gz",
482+
)
483+
compress(src=Path(f"../hurl/docs/standalone/hurl-{version}.pdf"))
484+
shutil.move(
485+
f"../hurl/docs/standalone/hurl-{version}.pdf.gz",
486+
f"sites/hurl.dev/assets/docs/hurl-{version}.pdf.gz",
487+
)
471488

472489

473490
def compress(src: Path):
@@ -476,9 +493,19 @@ def compress(src: Path):
476493
shutil.copyfileobj(f_in, f_out)
477494

478495

479-
def main():
480-
build()
496+
def main(standalone: bool):
497+
build(standalone=standalone)
481498

482499

483500
if __name__ == "__main__":
484-
main()
501+
parser = argparse.ArgumentParser(
502+
description="Build jekyll source from https://github.com/Orange-OpenSource/hurl"
503+
)
504+
parser.add_argument(
505+
"--standalone",
506+
action="store_true",
507+
default=False,
508+
help="Generate standalone docs",
509+
)
510+
args = parser.parse_args()
511+
main(standalone=args.standalone)

sites/hurl.dev/_data/docs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
- title: Templating a JSON Body
7070
- title: Templating a XML Body
7171
- title: Using GraphQL Query
72+
- title: Using Dynamic Datas
7273
- title: Testing Response
7374
items:
7475
- title: Testing Response Headers
@@ -161,6 +162,7 @@
161162
- title: Method
162163
- title: URL
163164
- title: Headers
165+
- title: Options
164166
- title: Query parameters
165167
- title: Form parameters
166168
- title: Multipart Form Data
@@ -176,7 +178,6 @@
176178
- title: Base64 body
177179
- title: Hex body
178180
- title: File body
179-
- title: Options
180181
- title: Response
181182
path: /docs/response.html
182183
items:
@@ -266,6 +267,7 @@
266267
path: /docs/templates.html
267268
items:
268269
- title: Variables
270+
- title: Functions
269271
- title: Types
270272
- title: Injecting Variables
271273
items:
@@ -321,6 +323,7 @@
321323
- title: Get Response Body
322324
- title: Interactive Mode
323325
- title: Include Headers Like curl
326+
- title: Export curl Commands
324327
- title: Using a Proxy
325328
- title: Captures
326329
path: /docs/tutorial/captures.html

sites/hurl.dev/_docs/asserting-response.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ after this delimiter, you'll find the implicit asserts, then an `[Asserts]` sect
1414

1515

1616
```hurl
17-
GET https://api/example.org/cats
17+
GET https://example.org/api/cats
1818
HTTP 200
1919
Content-Type: application/json; charset=utf-8 # Implicit assert on Content-Type Header
2020
[Asserts] # Explicit asserts section
@@ -567,7 +567,7 @@ Alternatively, `matches` predicate support [JavaScript-like Regular expression s
567567
the readability:
568568

569569
```hurl
570-
GET https://sample.org/hello
570+
GET https://example.org/hello
571571
HTTP 200
572572
[Asserts]
573573
@@ -585,7 +585,7 @@ jsonpath "$.name" matches /Hello [a-zA-Z]+!/
585585
Check that the HTTP received body, decoded as text, matches a regex pattern.
586586

587587
```hurl
588-
GET https://sample.org/hello
588+
GET https://example.org/hello
589589
HTTP 200
590590
[Asserts]
591591
regex "^(\\d{4}-\\d{2}-\\d{2})$" == "2018-12-31"
@@ -639,7 +639,7 @@ variable "pets" count == 200
639639
Check the total duration (sending plus receiving time) of the HTTP transaction.
640640

641641
```hurl
642-
GET https://sample.org/helloworld
642+
GET https://example.org/helloworld
643643
HTTP 200
644644
[Asserts]
645645
duration < 1000 # Check that response time is less than one second

sites/hurl.dev/_docs/filters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Decode bytes to string using encoding.
105105
```hurl
106106
# The 'Content-Type' HTTP response header does not precise the charset 'gb2312'
107107
# so body must be decoded explicitly by Hurl before processing any text based assert
108-
GET https://exapple.org/hello_china
108+
GET https://example.org/hello_china
109109
HTTP 200
110110
[Asserts]
111111
header "Content-Type" == "text/html"

0 commit comments

Comments
 (0)