Compare commits
65 Commits
v0.0.1
...
328b2ba520
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
328b2ba520 | ||
|
|
4a76f61aa7 | ||
|
|
2c9396615e | ||
|
|
e7b6dc9059 | ||
|
|
bcdf441d77 | ||
|
|
884a28e63a | ||
|
|
1c3e2ca4d9 | ||
|
|
2081d25066 | ||
|
|
7ddc4011b3 | ||
|
|
379850fe3d | ||
|
|
8ab69e480e | ||
|
|
c5621212bc | ||
|
|
b9f74b7eca | ||
|
|
493adb4688 | ||
|
|
b6cc7a70b7 | ||
|
|
8868cfb63f | ||
|
|
ae3add9c81 | ||
|
|
98fa43575d | ||
|
|
5d3a6c4174 | ||
|
|
be467c8074 | ||
|
|
0da375c529 | ||
|
|
1b740b1f2f | ||
|
|
d94ecefab9 | ||
|
|
7501a018fd | ||
|
|
ce31397372 | ||
|
|
7e1e070e23 | ||
|
|
fa16a7dd39 | ||
|
|
59a91331cc | ||
|
|
d2ea6b6a0f | ||
|
|
fdff5a667b | ||
|
|
35cf675c87 | ||
|
|
3b63bbdfde | ||
|
|
24218f2979 | ||
|
|
6a086d57de | ||
|
|
93e0a2fe98 | ||
|
|
86d4e25aa0 | ||
|
|
cb5d131097 | ||
|
|
eb67327574 | ||
|
|
5228851c0e | ||
|
|
4fc08f4375 | ||
|
|
8905c9356b | ||
|
|
424a970014 | ||
|
|
138d694b27 | ||
|
|
397d4ea0bc | ||
|
|
818fca87f2 | ||
|
|
df339f20fa | ||
|
|
d5572c93cd | ||
|
|
322dbb8f4f | ||
|
|
904f834c86 | ||
|
|
48af194da0 | ||
|
|
bcb6b2d75f | ||
|
|
134444b2c3 | ||
|
|
4447f1ed4a | ||
|
|
457ff9e759 | ||
|
|
6f244a0a5f | ||
|
|
cb5838345e | ||
|
|
1107a653cf | ||
|
|
95d4ee7080 | ||
|
|
fa2dd96f78 | ||
|
|
7741e192f5 | ||
|
|
5dfd46852f | ||
|
|
88e10010d8 | ||
|
|
52c564d4fd | ||
|
|
f7874c1843 | ||
|
|
40120667f7 |
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
**/.git
|
||||
target/
|
||||
org_test_documents/
|
||||
222
.webhook_bridge/pipeline-build-hash.yaml
Normal file
222
.webhook_bridge/pipeline-build-hash.yaml
Normal file
@@ -0,0 +1,222 @@
|
||||
apiVersion: tekton.dev/v1
|
||||
kind: PipelineRun
|
||||
metadata:
|
||||
name: build
|
||||
spec:
|
||||
timeouts:
|
||||
pipeline: "2h0m0s"
|
||||
tasks: "1h0m0s"
|
||||
finally: "0h30m0s"
|
||||
taskRunTemplate:
|
||||
serviceAccountName: build-bot
|
||||
pipelineSpec:
|
||||
params:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
- name: path-to-dockerfile
|
||||
description: The path to the Dockerfile
|
||||
type: string
|
||||
tasks:
|
||||
- name: report-pending
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has started"
|
||||
- name: STATE
|
||||
value: pending
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: fetch-repository
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/git-clone/0.9/git-clone.yaml
|
||||
workspaces:
|
||||
- name: output
|
||||
workspace: git-source
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.REPO_URL)
|
||||
- name: revision
|
||||
value: $(params.PULL_BASE_SHA)
|
||||
- name: deleteExisting
|
||||
value: "true"
|
||||
- name: get-git-commit-time
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: "$(workspaces.repo.path)"
|
||||
results:
|
||||
- name: unix-time
|
||||
description: The time of the git commit in unix timestamp format.
|
||||
steps:
|
||||
- image: alpine/git:v2.34.2
|
||||
name: detect-tag-step
|
||||
script: |
|
||||
#!/usr/bin/env sh
|
||||
set -euo pipefail
|
||||
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||
workspaces:
|
||||
- name: repo
|
||||
workspace: git-source
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: build-image
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||
- name: revision
|
||||
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||
- name: pathInRepo
|
||||
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||
params:
|
||||
- name: OUTPUT
|
||||
value: >-
|
||||
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||
- name: CONTEXT
|
||||
value: $(params.path-to-image-context)
|
||||
- name: DOCKERFILE
|
||||
value: $(params.path-to-dockerfile)
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- --import-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache"
|
||||
- --export-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||
- --opt
|
||||
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||
- name: BUILDKITD_TOML
|
||||
value: |
|
||||
debug = true
|
||||
[registry."docker.io"]
|
||||
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||
http = true
|
||||
insecure = true
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
finally:
|
||||
- name: report-success
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Succeeded", "Completed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has succeeded"
|
||||
- name: STATE
|
||||
value: success
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: report-failure
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Failed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has failed"
|
||||
- name: STATE
|
||||
value: failure
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
workspaces:
|
||||
- name: git-source
|
||||
- name: docker-credentials
|
||||
workspaces:
|
||||
- name: git-source
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
subPath: rust-source
|
||||
- name: docker-credentials
|
||||
secret:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/natter"
|
||||
- name: target-name
|
||||
value: ""
|
||||
- name: path-to-image-context
|
||||
value: .
|
||||
- name: path-to-dockerfile
|
||||
value: docker/natter/
|
||||
367
.webhook_bridge/pipeline-format.yaml
Normal file
367
.webhook_bridge/pipeline-format.yaml
Normal file
@@ -0,0 +1,367 @@
|
||||
apiVersion: tekton.dev/v1
|
||||
kind: PipelineRun
|
||||
metadata:
|
||||
name: rust-format
|
||||
spec:
|
||||
timeouts:
|
||||
pipeline: "2h0m0s"
|
||||
tasks: "1h0m0s"
|
||||
finally: "0h30m0s"
|
||||
taskRunTemplate:
|
||||
serviceAccountName: build-bot
|
||||
pipelineSpec:
|
||||
params:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
- name: path-to-dockerfile
|
||||
description: The path to the Dockerfile
|
||||
type: string
|
||||
tasks:
|
||||
- name: report-pending
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has started"
|
||||
- name: STATE
|
||||
value: pending
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: fetch-repository
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/git-clone/0.9/git-clone.yaml
|
||||
workspaces:
|
||||
- name: output
|
||||
workspace: git-source
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.REPO_URL)
|
||||
- name: revision
|
||||
value: $(params.PULL_BASE_SHA)
|
||||
- name: deleteExisting
|
||||
value: "true"
|
||||
- name: get-git-commit-time
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: "$(workspaces.repo.path)"
|
||||
results:
|
||||
- name: unix-time
|
||||
description: The time of the git commit in unix timestamp format.
|
||||
steps:
|
||||
- image: alpine/git:v2.34.2
|
||||
name: detect-tag-step
|
||||
script: |
|
||||
#!/usr/bin/env sh
|
||||
set -euo pipefail
|
||||
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||
workspaces:
|
||||
- name: repo
|
||||
workspace: git-source
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: build-image
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||
- name: revision
|
||||
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||
- name: pathInRepo
|
||||
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||
params:
|
||||
- name: OUTPUT
|
||||
value: >-
|
||||
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||
- name: CONTEXT
|
||||
value: $(params.path-to-image-context)
|
||||
- name: DOCKERFILE
|
||||
value: $(params.path-to-dockerfile)
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- --import-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache"
|
||||
- --export-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||
- --opt
|
||||
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||
- name: BUILDKITD_TOML
|
||||
value: |
|
||||
debug = true
|
||||
[registry."docker.io"]
|
||||
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||
http = true
|
||||
insecure = true
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: run-cargo-fmt
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
params:
|
||||
- name: docker-image
|
||||
type: string
|
||||
description: Docker image to run.
|
||||
default: alpine:3.20
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: /workspace/source
|
||||
workspaces:
|
||||
- name: source
|
||||
mountPath: /source
|
||||
- name: cargo-cache
|
||||
mountPath: /usr/local/cargo/registry
|
||||
optional: true
|
||||
steps:
|
||||
- name: run
|
||||
image: $(params.docker-image)
|
||||
workingDir: "$(workspaces.source.path)"
|
||||
command: ["cargo", "fmt"]
|
||||
args: []
|
||||
env:
|
||||
- name: CARGO_TARGET_DIR
|
||||
value: /target
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: cargo-cache
|
||||
workspace: cargo-cache
|
||||
runAfter:
|
||||
- build-image
|
||||
params:
|
||||
- name: docker-image
|
||||
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||
- name: run-prettier
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
params:
|
||||
- name: docker-image
|
||||
type: string
|
||||
description: Docker image to run.
|
||||
default: alpine:3.20
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: /workspace/source
|
||||
workspaces:
|
||||
- name: source
|
||||
mountPath: /source
|
||||
steps:
|
||||
- name: run
|
||||
image: $(params.docker-image)
|
||||
workingDir: "$(workspaces.source.path)"
|
||||
command: ["sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
prettier --write --no-error-on-unmatched-pattern "default_environment/**/*.js" "default_environment/**/*.css"
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
runAfter:
|
||||
- build-image
|
||||
params:
|
||||
- name: docker-image
|
||||
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||
- name: commit-changes
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/git-cli/0.4/git-cli.yaml
|
||||
params:
|
||||
- name: GIT_USER_NAME
|
||||
value: fluxcdbot
|
||||
- name: GIT_USER_EMAIL
|
||||
value: "fluxcdbot@users.noreply.github.com"
|
||||
- name: GIT_SCRIPT
|
||||
value: |
|
||||
pwd
|
||||
git config --global --add safe.directory /workspace/source
|
||||
git_status=$(git status --porcelain)
|
||||
if [ -n "$git_status" ]; then
|
||||
git commit -a -m "CI: autofix rust code."
|
||||
git push origin HEAD:$(params.PULL_BASE_REF)
|
||||
else
|
||||
echo "No changes to commit."
|
||||
fi
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
runAfter:
|
||||
- run-cargo-fmt
|
||||
- run-prettier
|
||||
finally:
|
||||
- name: report-success
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Succeeded", "Completed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has succeeded"
|
||||
- name: STATE
|
||||
value: success
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: report-failure
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Failed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has failed"
|
||||
- name: STATE
|
||||
value: failure
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: cargo-cache-autoclean
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
params:
|
||||
- name: docker-image
|
||||
type: string
|
||||
description: Docker image to run.
|
||||
default: alpine:3.20
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: /workspace/source
|
||||
workspaces:
|
||||
- name: source
|
||||
mountPath: /source
|
||||
- name: cargo-cache
|
||||
mountPath: /usr/local/cargo/registry
|
||||
optional: true
|
||||
steps:
|
||||
- name: run
|
||||
image: $(params.docker-image)
|
||||
workingDir: "$(workspaces.source.path)"
|
||||
command: [cargo, cache, --autoclean]
|
||||
args: []
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: cargo-cache
|
||||
workspace: cargo-cache
|
||||
params:
|
||||
- name: docker-image
|
||||
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||
workspaces:
|
||||
- name: git-source
|
||||
- name: docker-credentials
|
||||
- name: cargo-cache
|
||||
workspaces:
|
||||
- name: git-source
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
subPath: rust-source
|
||||
- name: cargo-cache
|
||||
persistentVolumeClaim:
|
||||
claimName: natter-cargo-cache-fmt
|
||||
- name: docker-credentials
|
||||
secret:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/natter-development-format"
|
||||
- name: target-name
|
||||
value: ""
|
||||
- name: path-to-image-context
|
||||
value: docker/natter_development/
|
||||
- name: path-to-dockerfile
|
||||
value: docker/natter_development/
|
||||
311
.webhook_bridge/pipeline-rust-clippy.yaml
Normal file
311
.webhook_bridge/pipeline-rust-clippy.yaml
Normal file
@@ -0,0 +1,311 @@
|
||||
apiVersion: tekton.dev/v1
|
||||
kind: PipelineRun
|
||||
metadata:
|
||||
name: rust-clippy
|
||||
spec:
|
||||
taskRunTemplate:
|
||||
serviceAccountName: build-bot
|
||||
timeouts:
|
||||
pipeline: "2h0m0s"
|
||||
tasks: "1h0m40s"
|
||||
finally: "0h30m0s"
|
||||
pipelineSpec:
|
||||
params:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
- name: path-to-dockerfile
|
||||
description: The path to the Dockerfile
|
||||
type: string
|
||||
tasks:
|
||||
- name: report-pending
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has started"
|
||||
- name: STATE
|
||||
value: pending
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: fetch-repository
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/git-clone/0.9/git-clone.yaml
|
||||
workspaces:
|
||||
- name: output
|
||||
workspace: git-source
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.REPO_URL)
|
||||
- name: revision
|
||||
value: $(params.PULL_BASE_SHA)
|
||||
- name: deleteExisting
|
||||
value: "true"
|
||||
- name: get-git-commit-time
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: "$(workspaces.repo.path)"
|
||||
results:
|
||||
- name: unix-time
|
||||
description: The time of the git commit in unix timestamp format.
|
||||
steps:
|
||||
- image: alpine/git:v2.34.2
|
||||
name: detect-tag-step
|
||||
script: |
|
||||
#!/usr/bin/env sh
|
||||
set -euo pipefail
|
||||
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||
workspaces:
|
||||
- name: repo
|
||||
workspace: git-source
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: build-image
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||
- name: revision
|
||||
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||
- name: pathInRepo
|
||||
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||
params:
|
||||
- name: OUTPUT
|
||||
value: >-
|
||||
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||
- name: CONTEXT
|
||||
value: $(params.path-to-image-context)
|
||||
- name: DOCKERFILE
|
||||
value: $(params.path-to-dockerfile)
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- --import-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache"
|
||||
- --export-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||
- --opt
|
||||
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||
- name: BUILDKITD_TOML
|
||||
value: |
|
||||
debug = true
|
||||
[registry."docker.io"]
|
||||
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||
http = true
|
||||
insecure = true
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: run-cargo-clippy
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
params:
|
||||
- name: docker-image
|
||||
type: string
|
||||
description: Docker image to run.
|
||||
default: alpine:3.20
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: /workspace/source
|
||||
workspaces:
|
||||
- name: source
|
||||
mountPath: /source
|
||||
- name: cargo-cache
|
||||
mountPath: /usr/local/cargo/registry
|
||||
optional: true
|
||||
steps:
|
||||
- name: run
|
||||
image: $(params.docker-image)
|
||||
workingDir: "$(workspaces.source.path)"
|
||||
command:
|
||||
[
|
||||
"cargo",
|
||||
"clippy",
|
||||
"--no-deps",
|
||||
"--all-targets",
|
||||
"--all-features",
|
||||
"--",
|
||||
"-D",
|
||||
"warnings",
|
||||
]
|
||||
args: []
|
||||
env:
|
||||
- name: CARGO_TARGET_DIR
|
||||
value: /target
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: cargo-cache
|
||||
workspace: cargo-cache
|
||||
runAfter:
|
||||
- build-image
|
||||
params:
|
||||
- name: docker-image
|
||||
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||
finally:
|
||||
- name: report-success
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Succeeded", "Completed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has succeeded"
|
||||
- name: STATE
|
||||
value: success
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: report-failure
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Failed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has failed"
|
||||
- name: STATE
|
||||
value: failure
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: cargo-cache-autoclean
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
params:
|
||||
- name: docker-image
|
||||
type: string
|
||||
description: Docker image to run.
|
||||
default: alpine:3.20
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: /workspace/source
|
||||
workspaces:
|
||||
- name: source
|
||||
mountPath: /source
|
||||
- name: cargo-cache
|
||||
mountPath: /usr/local/cargo/registry
|
||||
optional: true
|
||||
steps:
|
||||
- name: run
|
||||
image: $(params.docker-image)
|
||||
workingDir: "$(workspaces.source.path)"
|
||||
command: [cargo, cache, --autoclean]
|
||||
args: []
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: cargo-cache
|
||||
workspace: cargo-cache
|
||||
params:
|
||||
- name: docker-image
|
||||
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||
workspaces:
|
||||
- name: git-source
|
||||
- name: docker-credentials
|
||||
- name: cargo-cache
|
||||
workspaces:
|
||||
- name: git-source
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
subPath: rust-source
|
||||
- name: cargo-cache
|
||||
persistentVolumeClaim:
|
||||
claimName: natter-cargo-cache-clippy
|
||||
- name: docker-credentials
|
||||
secret:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/natter-development-clippy"
|
||||
- name: target-name
|
||||
value: ""
|
||||
- name: path-to-image-context
|
||||
value: docker/natter_development/
|
||||
- name: path-to-dockerfile
|
||||
value: docker/natter_development/
|
||||
301
.webhook_bridge/pipeline-rust-test.yaml
Normal file
301
.webhook_bridge/pipeline-rust-test.yaml
Normal file
@@ -0,0 +1,301 @@
|
||||
apiVersion: tekton.dev/v1
|
||||
kind: PipelineRun
|
||||
metadata:
|
||||
name: rust-test
|
||||
spec:
|
||||
timeouts:
|
||||
pipeline: "2h0m0s"
|
||||
tasks: "1h0m40s"
|
||||
finally: "0h30m0s"
|
||||
taskRunTemplate:
|
||||
serviceAccountName: build-bot
|
||||
pipelineSpec:
|
||||
params:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
- name: path-to-dockerfile
|
||||
description: The path to the Dockerfile
|
||||
type: string
|
||||
tasks:
|
||||
- name: report-pending
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has started"
|
||||
- name: STATE
|
||||
value: pending
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: fetch-repository
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/git-clone/0.9/git-clone.yaml
|
||||
workspaces:
|
||||
- name: output
|
||||
workspace: git-source
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.REPO_URL)
|
||||
- name: revision
|
||||
value: $(params.PULL_BASE_SHA)
|
||||
- name: deleteExisting
|
||||
value: "true"
|
||||
- name: get-git-commit-time
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: "$(workspaces.repo.path)"
|
||||
results:
|
||||
- name: unix-time
|
||||
description: The time of the git commit in unix timestamp format.
|
||||
steps:
|
||||
- image: alpine/git:v2.34.2
|
||||
name: detect-tag-step
|
||||
script: |
|
||||
#!/usr/bin/env sh
|
||||
set -euo pipefail
|
||||
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
|
||||
workspaces:
|
||||
- name: repo
|
||||
workspace: git-source
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: build-image
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
|
||||
- name: revision
|
||||
value: 7ee31a185243ee6da13dcd26a592c585b64c80e5
|
||||
- name: pathInRepo
|
||||
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
|
||||
params:
|
||||
- name: OUTPUT
|
||||
value: >-
|
||||
type=image,"name=$(params.image-name):latest,$(params.image-name):$(tasks.fetch-repository.results.commit)",push=true,compression=zstd,compression-level=22,oci-mediatypes=true
|
||||
- name: CONTEXT
|
||||
value: $(params.path-to-image-context)
|
||||
- name: DOCKERFILE
|
||||
value: $(params.path-to-dockerfile)
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- --import-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache"
|
||||
- --export-cache
|
||||
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
|
||||
- --opt
|
||||
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
|
||||
- name: BUILDKITD_TOML
|
||||
value: |
|
||||
debug = true
|
||||
[registry."docker.io"]
|
||||
mirrors = ["dockerhub.dockerhub.svc.cluster.local"]
|
||||
[registry."dockerhub.dockerhub.svc.cluster.local"]
|
||||
http = true
|
||||
insecure = true
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: run-cargo-test
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
params:
|
||||
- name: docker-image
|
||||
type: string
|
||||
description: Docker image to run.
|
||||
default: alpine:3.20
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: /workspace/source
|
||||
workspaces:
|
||||
- name: source
|
||||
mountPath: /source
|
||||
- name: cargo-cache
|
||||
mountPath: /usr/local/cargo/registry
|
||||
optional: true
|
||||
steps:
|
||||
- name: run
|
||||
image: $(params.docker-image)
|
||||
workingDir: "$(workspaces.source.path)"
|
||||
command: [cargo, test, --no-fail-fast]
|
||||
args: []
|
||||
env:
|
||||
- name: CARGO_TARGET_DIR
|
||||
value: /target
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: cargo-cache
|
||||
workspace: cargo-cache
|
||||
runAfter:
|
||||
- build-image
|
||||
params:
|
||||
- name: docker-image
|
||||
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||
finally:
|
||||
- name: report-success
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Succeeded", "Completed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has succeeded"
|
||||
- name: STATE
|
||||
value: success
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: report-failure
|
||||
when:
|
||||
- input: "$(tasks.status)"
|
||||
operator: in
|
||||
values: ["Failed"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
- name: REPO_FULL_NAME
|
||||
value: "$(params.REPO_OWNER)/$(params.REPO_NAME)"
|
||||
- name: GITEA_HOST_URL
|
||||
value: code.fizz.buzz
|
||||
- name: SHA
|
||||
value: "$(tasks.fetch-repository.results.commit)"
|
||||
- name: DESCRIPTION
|
||||
value: "Build $(params.JOB_NAME) has failed"
|
||||
- name: STATE
|
||||
value: failure
|
||||
- name: TARGET_URL
|
||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||
- name: cargo-cache-autoclean
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
params:
|
||||
- name: docker-image
|
||||
type: string
|
||||
description: Docker image to run.
|
||||
default: alpine:3.20
|
||||
stepTemplate:
|
||||
image: alpine:3.20
|
||||
computeResources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 600Mi
|
||||
workingDir: /workspace/source
|
||||
workspaces:
|
||||
- name: source
|
||||
mountPath: /source
|
||||
- name: cargo-cache
|
||||
mountPath: /usr/local/cargo/registry
|
||||
optional: true
|
||||
steps:
|
||||
- name: run
|
||||
image: $(params.docker-image)
|
||||
workingDir: "$(workspaces.source.path)"
|
||||
command: [cargo, cache, --autoclean]
|
||||
args: []
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
- name: cargo-cache
|
||||
workspace: cargo-cache
|
||||
params:
|
||||
- name: docker-image
|
||||
value: "$(tasks.build-image.results.IMAGE_URL[1])"
|
||||
workspaces:
|
||||
- name: git-source
|
||||
- name: docker-credentials
|
||||
- name: cargo-cache
|
||||
workspaces:
|
||||
- name: git-source
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
subPath: rust-source
|
||||
- name: cargo-cache
|
||||
persistentVolumeClaim:
|
||||
claimName: natter-cargo-cache-test
|
||||
- name: docker-credentials
|
||||
secret:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/natter-development-test"
|
||||
- name: target-name
|
||||
value: ""
|
||||
- name: path-to-image-context
|
||||
value: docker/natter_development/
|
||||
- name: path-to-dockerfile
|
||||
value: docker/natter_development/
|
||||
25
.webhook_bridge/webhook_bridge.toml
Normal file
25
.webhook_bridge/webhook_bridge.toml
Normal file
@@ -0,0 +1,25 @@
|
||||
version = "0.0.1"
|
||||
|
||||
[[push]]
|
||||
name = "rust-test"
|
||||
source = "pipeline-rust-test.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/natter.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
|
||||
[[push]]
|
||||
name = "clippy"
|
||||
source = "pipeline-rust-clippy.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/natter.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
|
||||
[[push]]
|
||||
name = "format"
|
||||
source = "pipeline-format.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/natter.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
|
||||
[[push]]
|
||||
name = "build"
|
||||
source = "pipeline-build-hash.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/natter.git"
|
||||
branches = [ "^main$", "^master$" ]
|
||||
498
Cargo.lock
generated
498
Cargo.lock
generated
@@ -1,68 +1,69 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.21.0"
|
||||
version = "0.24.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
|
||||
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
name = "adler2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.4"
|
||||
version = "0.6.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
|
||||
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.4"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
||||
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.2"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
|
||||
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.0.0"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
|
||||
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.1"
|
||||
version = "3.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
|
||||
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -73,23 +74,23 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.69"
|
||||
version = "0.3.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
|
||||
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -111,19 +112,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.5.0"
|
||||
name = "bumpalo"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
name = "bytes"
|
||||
version = "1.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
@@ -133,9 +131,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.6"
|
||||
version = "4.5.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956"
|
||||
checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -143,9 +141,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.4.6"
|
||||
version = "4.5.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45"
|
||||
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -154,9 +152,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.4.2"
|
||||
version = "4.5.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
|
||||
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -166,15 +164,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.5.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
|
||||
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.0"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
|
||||
|
||||
[[package]]
|
||||
name = "duster"
|
||||
@@ -193,6 +191,15 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "1.1.0"
|
||||
@@ -201,9 +208,9 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335"
|
||||
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@@ -216,9 +223,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
|
||||
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@@ -226,15 +233,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
|
||||
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
|
||||
checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
@@ -243,15 +250,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa"
|
||||
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
|
||||
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -260,21 +267,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"
|
||||
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
|
||||
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.29"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
|
||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@@ -290,42 +297,59 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.28.0"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
||||
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
||||
|
||||
[[package]]
|
||||
name = "gloo-utils"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.1"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12"
|
||||
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.3"
|
||||
name = "idna"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
|
||||
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "include_dir"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e"
|
||||
checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd"
|
||||
dependencies = [
|
||||
"include_dir_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "include_dir_macros"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f"
|
||||
checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -333,19 +357,34 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.0.2"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
|
||||
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.9"
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-core"
|
||||
@@ -362,15 +401,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.149"
|
||||
version = "0.2.161"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
||||
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.4"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
@@ -380,11 +425,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"adler2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -400,7 +445,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"toml",
|
||||
"walkdir",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -426,40 +471,43 @@ dependencies = [
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.1"
|
||||
version = "0.36.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
|
||||
checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "organic"
|
||||
version = "0.1.13"
|
||||
name = "once_cell"
|
||||
version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c61b01691695303b42f9a2ff318bec83853fbeb65c96569f2fb391e7636801c6"
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "organic"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a21c93465150e58006a06060a7f0304ee03a90ad6108e6767b48f7237654699f"
|
||||
dependencies = [
|
||||
"gloo-utils",
|
||||
"nom 7.1.3",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
name = "percent-encoding"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
@@ -469,18 +517,18 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.69"
|
||||
version = "1.0.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
||||
checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.33"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -493,15 +541,15 @@ checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
@@ -514,18 +562,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.189"
|
||||
version = "1.0.210"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
|
||||
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.189"
|
||||
version = "1.0.210"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
|
||||
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -534,20 +582,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.107"
|
||||
version = "1.0.130"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
|
||||
checksum = "610f75ff4a8e3cb29b85da56eabdd1bff5b06739059a4b8e2967fef32e5d9944"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.3"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186"
|
||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -569,9 +618,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.38"
|
||||
version = "2.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
|
||||
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -585,22 +634,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.33.0"
|
||||
name = "tinyvec"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653"
|
||||
checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec_macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.40.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.2"
|
||||
version = "0.8.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
|
||||
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
@@ -610,18 +673,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.3"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
|
||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.20.2"
|
||||
version = "0.22.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
|
||||
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
@@ -631,82 +694,161 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.6"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
@@ -715,51 +857,57 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.17"
|
||||
version = "0.6.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c"
|
||||
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
10
Cargo.toml
10
Cargo.toml
@@ -26,9 +26,15 @@ futures = "0.3.29"
|
||||
include_dir = "0.7.3"
|
||||
# TODO: This is temporary to work on the latest organic code. Eventually switch back to using the published crate.
|
||||
# organic = { path = "../organic" }
|
||||
organic = "0.1.13"
|
||||
organic = "0.1.16"
|
||||
serde = { version = "1.0.189", default-features = false, features = ["std", "derive"] }
|
||||
serde_json = "1.0.107"
|
||||
tokio = { version = "1.30.0", default-features = false, features = ["rt", "rt-multi-thread", "fs", "io-util"] }
|
||||
toml = "0.8.2"
|
||||
walkdir = "2.4.0"
|
||||
url = "2.5.0"
|
||||
|
||||
# Optimized build for any sort of release.
|
||||
[profile.release-lto]
|
||||
inherits = "release"
|
||||
lto = true
|
||||
strip = "symbols"
|
||||
|
||||
39
Makefile
Normal file
39
Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
SHELL := bash
|
||||
.ONESHELL:
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
MAKEFLAGS += --warn-undefined-variables
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
OS:=$(shell uname -s)
|
||||
|
||||
ifeq ($(origin .RECIPEPREFIX), undefined)
|
||||
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
|
||||
endif
|
||||
.RECIPEPREFIX = >
|
||||
|
||||
IMAGE_NAME:=natter
|
||||
TARGET :=
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
|
||||
|
||||
.PHONY: docker_test
|
||||
docker_test: ## Run the rust tests
|
||||
> $(MAKE) -C docker/natter_development build
|
||||
> docker run --rm -i -t --mount type=tmpfs,destination=/tmp -v "$(shell readlink -f .):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "natter-cargo-registry:/usr/local/cargo/registry" natter-development cargo test
|
||||
|
||||
.PHONY: docker_clippy
|
||||
docker_clippy: ## Run static analysis of the code.
|
||||
> $(MAKE) -C docker/natter_development build
|
||||
> docker run --rm -i -t --mount type=tmpfs,destination=/tmp -v "$(shell readlink -f .):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "natter-cargo-registry:/usr/local/cargo/registry" natter-development cargo clippy --no-deps --all-targets --all-features -- -D warnings
|
||||
|
||||
.PHONY: docker_format
|
||||
docker_format: ## Auto-format source files.
|
||||
> $(MAKE) -C docker/natter_development build
|
||||
> docker run --rm -i -t --mount type=tmpfs,destination=/tmp -v "$(shell readlink -f .):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "natter-cargo-registry:/usr/local/cargo/registry" natter-development cargo fmt
|
||||
> docker run --rm -i -t --mount type=tmpfs,destination=/tmp -v "$(shell readlink -f .):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "natter-cargo-registry:/usr/local/cargo/registry" natter-development prettier --write --no-error-on-unmatched-pattern "default_environment/**/*.js" "default_environment/**/*.css"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
> $(MAKE) -C docker/natter_development clean
|
||||
@@ -1,187 +1,269 @@
|
||||
:root {
|
||||
--main-max-width: 800px;
|
||||
--site-background-color: #0a0a0a;
|
||||
--site-text-color: #fffffc;
|
||||
--header-divider-color: #6a687a;
|
||||
--main-max-width: 800px;
|
||||
--site-background-color: #0a0a0a;
|
||||
--site-text-color: #fffffc;
|
||||
--header-divider-color: #6a687a;
|
||||
|
||||
--stream-divider-color: #6ccff6;
|
||||
--stream-divider-color: #6ccff6;
|
||||
--stream-post-background-color: #1f1f1f;
|
||||
|
||||
--src-font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
|
||||
--src-font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo,
|
||||
Consolas, "DejaVu Sans Mono", monospace;
|
||||
|
||||
--src-block-background-color: #141414;
|
||||
--src-block-border-color: #84828f;
|
||||
--src-block-language-color: #0a0a0a;
|
||||
--src-block-language-background: #84828f;
|
||||
--src-block-background-color: #141414;
|
||||
--src-block-border-color: #84828f;
|
||||
--src-block-language-color: #0a0a0a;
|
||||
--src-block-language-background: #84828f;
|
||||
|
||||
--quote-block-border-color: #84828f;
|
||||
--quote-block-border-color: #84828f;
|
||||
|
||||
--table-border-color: #6a687a;
|
||||
--table-odd-background-color: #0a0a0a;
|
||||
--table-even-background-color: #141414;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
--site-background-color: #f5f5f5;
|
||||
--site-text-color: #000003;
|
||||
--header-divider-color: #959785;
|
||||
|
||||
--stream-divider-color: #933009;
|
||||
--stream-post-background-color: #e0e0e0;
|
||||
|
||||
--src-block-background-color: #ebebeb;
|
||||
--src-block-border-color: #7b7d70;
|
||||
--src-block-language-color: #f5f5f5;
|
||||
--src-block-language-background: #7b7d70;
|
||||
|
||||
--quote-block-border-color: #7b7d70;
|
||||
|
||||
--table-border-color: #959785;
|
||||
--table-odd-background-color: #f5f5f5;
|
||||
--table-even-background-color: #ebebeb;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
color: var(--site-text-color);
|
||||
background-color: var(--site-background-color);
|
||||
font-family: source-sans-pro, Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', sans-serif;
|
||||
color: var(--site-text-color);
|
||||
background-color: var(--site-background-color);
|
||||
font-family: source-sans-pro, Seravek, "Gill Sans Nova", Ubuntu, Calibri,
|
||||
"DejaVu Sans", sans-serif;
|
||||
|
||||
a:link, a:visited {
|
||||
/* TODO: Should I use a different color for links? */
|
||||
color: var(--site-text-color);
|
||||
}
|
||||
a:link,
|
||||
a:visited {
|
||||
/* TODO: Should I use a different color for links? */
|
||||
color: var(--site-text-color);
|
||||
}
|
||||
}
|
||||
|
||||
.page_centering {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page_header {
|
||||
width: 100%;
|
||||
max-width: var(--main-max-width);
|
||||
border-bottom: 0.1rem solid var(--header-divider-color);
|
||||
width: 100%;
|
||||
max-width: var(--main-max-width);
|
||||
border-bottom: 0.1rem solid var(--header-divider-color);
|
||||
|
||||
.home_link {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
.home_link {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
|
||||
&:link, &:visited {
|
||||
color: var(--site-text-color);
|
||||
}
|
||||
&:link,
|
||||
&:visited {
|
||||
color: var(--site-text-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main_content {
|
||||
width: 100%;
|
||||
max-width: var(--main-max-width);
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.2;
|
||||
width: 100%;
|
||||
max-width: var(--main-max-width);
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.2;
|
||||
padding-bottom: 8rem;
|
||||
|
||||
/* A stand-alone blog post (not in a blog stream). */
|
||||
.blog_post {
|
||||
padding: 1rem 0 3rem 0;
|
||||
/* A stand-alone blog post (not in a blog stream). */
|
||||
.blog_post {
|
||||
padding: 1rem 0 3rem 0;
|
||||
}
|
||||
|
||||
.blog_stream {
|
||||
.stream_divider {
|
||||
color: var(--stream-divider-color);
|
||||
}
|
||||
|
||||
.blog_stream {
|
||||
.stream_divider {
|
||||
color: var(--stream-divider-color);
|
||||
}
|
||||
}
|
||||
|
||||
/* A blog post in a blog stream (for example, the homepage). */
|
||||
.blog_stream_post {
|
||||
background: #1F1F1F;
|
||||
padding: 1rem 0.2rem;
|
||||
}
|
||||
|
||||
.blog_post_title {
|
||||
font-size: 2.5rem;
|
||||
.stream_nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
> a {
|
||||
display: inline-block;
|
||||
padding: 0.2rem 0.5rem;
|
||||
font-weight: 700;
|
||||
padding-bottom: 1rem;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
> .spacer {
|
||||
display: inline-block;
|
||||
flex: 1 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A blog post in a blog stream (for example, the homepage). */
|
||||
.blog_stream_post {
|
||||
background: var(--stream-post-background-color);
|
||||
padding: 1rem 0.2rem;
|
||||
}
|
||||
|
||||
.blog_post_title {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 700;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.src_block {
|
||||
background: var(--src-block-background-color);
|
||||
border-radius: 3px;
|
||||
border: 1px solid var(--src-block-border-color);
|
||||
font-size: 1rem;
|
||||
font-family: var(--src-font-family);
|
||||
margin: 1rem 0;
|
||||
|
||||
.src_language {
|
||||
display: inline-block;
|
||||
color: var(--src-block-language-color);
|
||||
background: var(--src-block-language-background);
|
||||
border-radius: 0 0 3px 0;
|
||||
padding: 0.1rem 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.src_body {
|
||||
margin: 0.5rem;
|
||||
|
||||
p {
|
||||
margin: 1rem 0;
|
||||
.src_line {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.inline_source_block {
|
||||
font-family: var(--src-font-family);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.code,
|
||||
.verbatim {
|
||||
font-family: var(--src-font-family);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.quote_block {
|
||||
border-left: 1px solid var(--quote-block-border-color);
|
||||
padding: 0 0 0 1rem;
|
||||
margin: 1rem 0 1rem 2rem;
|
||||
}
|
||||
|
||||
h2,
|
||||
h3 {
|
||||
margin: 1rem 0;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 2.3rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 2.1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.plain_list {
|
||||
&.unordered {
|
||||
list-style-type: disc;
|
||||
padding-left: 2.5rem;
|
||||
}
|
||||
|
||||
.src_block {
|
||||
background: var(--src-block-background-color);
|
||||
border-radius: 3px;
|
||||
border: 1px solid var(--src-block-border-color);
|
||||
font-size: 1rem;
|
||||
font-family: var(--src-font-family);
|
||||
margin: 1rem 0;
|
||||
|
||||
.src_language {
|
||||
display: inline-block;
|
||||
color: var(--src-block-language-color);
|
||||
background: var(--src-block-language-background);
|
||||
border-radius: 0 0 3px 0;
|
||||
padding: 0.1rem 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.src_body {
|
||||
margin: 0.5rem;
|
||||
|
||||
.src_line {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
&.ordered {
|
||||
list-style-type: decimal;
|
||||
padding-left: 2.5rem;
|
||||
}
|
||||
|
||||
.inline_source_block {
|
||||
font-family: var(--src-font-family);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.code, .verbatim {
|
||||
font-family: var(--src-font-family);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.quote_block {
|
||||
border-left: 1px solid var(--quote-block-border-color);
|
||||
padding: 0 0 0 1rem;
|
||||
margin: 1rem 0 1rem 2rem;
|
||||
}
|
||||
|
||||
h2, h3 {
|
||||
margin: 1rem 0;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 2.3rem;
|
||||
&.descriptive {
|
||||
font-size: 1rem;
|
||||
> dt {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
> dd {
|
||||
padding-left: 2.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 2.1rem;
|
||||
font-weight: 600;
|
||||
.footnote_reference {
|
||||
vertical-align: super;
|
||||
font-size: 80%;
|
||||
> a {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.plain_list {
|
||||
&.unordered {
|
||||
list-style-type: disc;
|
||||
padding-left: 2.5rem;
|
||||
}
|
||||
|
||||
&.ordered {
|
||||
list-style-type: decimal;
|
||||
padding-left: 2.5rem;
|
||||
}
|
||||
|
||||
&.descriptive {
|
||||
font-size: 1rem;
|
||||
> dt {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
> dd {
|
||||
padding-left: 2.5rem;
|
||||
}
|
||||
}
|
||||
.footnote_definition {
|
||||
.label {
|
||||
text-decoration: none;
|
||||
}
|
||||
.definition {
|
||||
display: inline;
|
||||
|
||||
.footnote_reference {
|
||||
vertical-align: super;
|
||||
font-size: 80%;
|
||||
> a {
|
||||
text-decoration: none;
|
||||
}
|
||||
> p {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footnote_definition {
|
||||
.label {
|
||||
text-decoration: none;
|
||||
}
|
||||
.definition {
|
||||
display: inline;
|
||||
|
||||
> p {
|
||||
display: inline;
|
||||
}
|
||||
.org_table {
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid var(--table-border-color);
|
||||
> tbody {
|
||||
border-width: 1px 0;
|
||||
border-style: solid;
|
||||
border-color: var(--table-border-color);
|
||||
> tr {
|
||||
> td {
|
||||
padding: 0.2rem;
|
||||
}
|
||||
}
|
||||
> tr:nth-child(odd) {
|
||||
background-color: var(--table-odd-background-color);
|
||||
}
|
||||
> tr:nth-child(even) {
|
||||
background-color: var(--table-even-background-color);
|
||||
}
|
||||
}
|
||||
> thead {
|
||||
border-width: 1px 0;
|
||||
border-style: solid;
|
||||
border-color: var(--table-border-color);
|
||||
> tr {
|
||||
> th {
|
||||
padding: 0.2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,46 +3,127 @@
|
||||
License: none (public domain)
|
||||
*/
|
||||
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
html,
|
||||
body,
|
||||
div,
|
||||
span,
|
||||
applet,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
a,
|
||||
abbr,
|
||||
acronym,
|
||||
address,
|
||||
big,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
em,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
s,
|
||||
samp,
|
||||
small,
|
||||
strike,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
tt,
|
||||
var,
|
||||
b,
|
||||
u,
|
||||
i,
|
||||
center,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td,
|
||||
article,
|
||||
aside,
|
||||
canvas,
|
||||
details,
|
||||
embed,
|
||||
figure,
|
||||
figcaption,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
output,
|
||||
ruby,
|
||||
section,
|
||||
summary,
|
||||
time,
|
||||
mark,
|
||||
audio,
|
||||
video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
line-height: 1;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
blockquote,
|
||||
q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
blockquote:before,
|
||||
blockquote:after,
|
||||
q:before,
|
||||
q:after {
|
||||
content: "";
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
</div>
|
||||
{/.children}
|
||||
{#.stream_pagination}
|
||||
<hr class="stream_divider" />
|
||||
<div class="stream_nav">
|
||||
{?.older_link}<a href="{.older_link}">Older</a>{/.older_link}
|
||||
<div class="spacer"></div>
|
||||
{?.newer_link}<a href="{.newer_link}">Newer</a>{/.newer_link}
|
||||
</div>
|
||||
{/.stream_pagination}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
{#.page_header}{>page_header/}{/.page_header}
|
||||
<main class="main_content">
|
||||
{@select key=.type}
|
||||
{@eq value="page"}{>page/}{/eq}
|
||||
{@eq value="blog_post_page"}{>blog_post_page/}{/eq}
|
||||
{@eq value="blog_stream"}{>blog_stream/}{/eq}
|
||||
{@none}{!TODO: make this panic!}ERROR: Unrecognized page content type{/none}
|
||||
|
||||
19
default_environment/templates/html/page.dust
Normal file
19
default_environment/templates/html/page.dust
Normal file
@@ -0,0 +1,19 @@
|
||||
<article class="page">
|
||||
{?.title}<h1 class="blog_post_title"><span>{.title}</span></h1>{/.title}
|
||||
{! TODO: date? !}
|
||||
|
||||
{! TODO: Table of contents? !}
|
||||
|
||||
<div class="blog_post_body">
|
||||
{#.children}
|
||||
{>document_element/}
|
||||
{/.children}
|
||||
|
||||
{?.footnotes}
|
||||
<h2>Footnotes:</h2>
|
||||
{#.footnotes}
|
||||
{>real_footnote_definition/}
|
||||
{/.footnotes}
|
||||
{/.footnotes}
|
||||
</div>
|
||||
</article>
|
||||
@@ -1 +1 @@
|
||||
!!!!!!!! plain_link
|
||||
<a href="{.raw_link}">{.raw_link}</a>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<a href="{.raw_link}">{#.children}{>object/}{/.children}</a>
|
||||
<a href="{.target}">{#.children}{>object/}{/.children}</a>
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
<table>{#.children}{>table_row/}{/.children}</table>
|
||||
<table class="org_table">{#.children}{@select key=.type}
|
||||
{@eq value="head"}{>table_head/}{/eq}
|
||||
{@eq value="body"}{>table_body/}{/eq}
|
||||
{@none}{!TODO: make this panic!}ERROR: Unrecognized type {.type}.{/none}
|
||||
{/select}{/.children}</table>
|
||||
|
||||
1
default_environment/templates/html/table_body.dust
Normal file
1
default_environment/templates/html/table_body.dust
Normal file
@@ -0,0 +1 @@
|
||||
<tbody>{#.children}{>table_row/}{/.children}</tbody>
|
||||
1
default_environment/templates/html/table_head.dust
Normal file
1
default_environment/templates/html/table_head.dust
Normal file
@@ -0,0 +1 @@
|
||||
<thead>{#.children}{>table_head_row/}{/.children}</thead>
|
||||
1
default_environment/templates/html/table_head_cell.dust
Normal file
1
default_environment/templates/html/table_head_cell.dust
Normal file
@@ -0,0 +1 @@
|
||||
<th scope="col">{#.children}{>object/}{/.children}</th>
|
||||
1
default_environment/templates/html/table_head_row.dust
Normal file
1
default_environment/templates/html/table_head_row.dust
Normal file
@@ -0,0 +1 @@
|
||||
<tr>{#.children}{>table_head_cell/}{/.children}</tr>
|
||||
15
docker/natter/Dockerfile
Normal file
15
docker/natter/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
ARG ALPINE_VERSION="3.20"
|
||||
|
||||
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder
|
||||
|
||||
RUN apk add --no-cache musl-dev
|
||||
|
||||
RUN mkdir /root/natter
|
||||
WORKDIR /root/natter
|
||||
COPY . .
|
||||
# TODO: Add static build, which currently errors due to proc_macro. RUSTFLAGS="-C target-feature=+crt-static"
|
||||
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked CARGO_TARGET_DIR=/target cargo build --profile release-lto
|
||||
|
||||
FROM alpine:$ALPINE_VERSION AS runner
|
||||
|
||||
COPY --from=builder /target/release-lto/natter /usr/bin/
|
||||
32
docker/natter/Makefile
Normal file
32
docker/natter/Makefile
Normal file
@@ -0,0 +1,32 @@
|
||||
SHELL := bash
|
||||
.ONESHELL:
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
MAKEFLAGS += --warn-undefined-variables
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
OS:=$(shell uname -s)
|
||||
|
||||
ifeq ($(origin .RECIPEPREFIX), undefined)
|
||||
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
|
||||
endif
|
||||
.RECIPEPREFIX = >
|
||||
|
||||
IMAGE_NAME:=natter
|
||||
TARGET :=
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
|
||||
|
||||
.PHONY: build
|
||||
build: ## Build the docker image.
|
||||
> docker build --tag $(IMAGE_NAME) --target=$(TARGET) --file Dockerfile ../../
|
||||
|
||||
.PHONY: shell
|
||||
shell: ## Launch an interactive shell inside the docker image.
|
||||
shell: build
|
||||
> docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp $(IMAGE_NAME)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
> docker rmi $(IMAGE_NAME)
|
||||
13
docker/natter_development/Dockerfile
Normal file
13
docker/natter_development/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
ARG ALPINE_VERSION="3.20"
|
||||
|
||||
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder
|
||||
|
||||
RUN apk add --no-cache musl-dev
|
||||
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked cargo install --locked --no-default-features --features ci-autoclean cargo-cache
|
||||
RUN rustup component add rustfmt
|
||||
RUN rustup component add clippy
|
||||
|
||||
FROM builder AS javascript
|
||||
|
||||
RUN apk add --no-cache npm
|
||||
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/npmcache,sharing=locked npm set cache /npmcache && npm install --global prettier@3.1.0
|
||||
33
docker/natter_development/Makefile
Normal file
33
docker/natter_development/Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
SHELL := bash
|
||||
.ONESHELL:
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
MAKEFLAGS += --warn-undefined-variables
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
ifeq ($(origin .RECIPEPREFIX), undefined)
|
||||
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
|
||||
endif
|
||||
.RECIPEPREFIX = >
|
||||
|
||||
IMAGE_NAME:=natter-development
|
||||
TARGET :=
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
|
||||
|
||||
.PHONY: build
|
||||
build: ## Build the docker image.
|
||||
> docker build --tag $(IMAGE_NAME) --target=$(TARGET) --file Dockerfile .
|
||||
> docker volume create natter-cargo-registry
|
||||
|
||||
.PHONY: shell
|
||||
shell: ## Launch an interactive shell inside the docker image with the source repository mounted at /source.
|
||||
shell: build
|
||||
> docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "natter-cargo-registry:/usr/local/cargo/registry" $(IMAGE_NAME)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
> docker rmi $(IMAGE_NAME)
|
||||
> docker volume rm natter-cargo-registry
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ use std::path::PathBuf;
|
||||
|
||||
use include_dir::include_dir;
|
||||
use include_dir::Dir;
|
||||
use tokio::fs::DirEntry;
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::context::RenderBlogPostPage;
|
||||
@@ -10,11 +12,16 @@ use crate::context::RenderBlogPostPageInput;
|
||||
use crate::context::RenderBlogStream;
|
||||
use crate::context::RenderBlogStreamInput;
|
||||
use crate::context::RenderContext;
|
||||
use crate::context::RenderPage;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::get_web_path;
|
||||
use crate::intermediate::BlogPost;
|
||||
use crate::intermediate::IPage;
|
||||
use crate::render::DusterRenderer;
|
||||
use crate::render::RendererIntegration;
|
||||
use crate::walk_fs::walk_fs;
|
||||
use crate::walk_fs::WalkAction;
|
||||
use crate::walk_fs::WalkFsFilterResult;
|
||||
|
||||
use super::stylesheet::Stylesheet;
|
||||
|
||||
@@ -24,6 +31,7 @@ pub(crate) struct SiteRenderer {
|
||||
output_directory: PathBuf,
|
||||
blog_posts: Vec<BlogPost>,
|
||||
stylesheets: Vec<Stylesheet>,
|
||||
pages: Vec<IPage>,
|
||||
}
|
||||
|
||||
impl SiteRenderer {
|
||||
@@ -31,11 +39,13 @@ impl SiteRenderer {
|
||||
output_directory: P,
|
||||
blog_posts: Vec<BlogPost>,
|
||||
stylesheets: Vec<Stylesheet>,
|
||||
pages: Vec<IPage>,
|
||||
) -> SiteRenderer {
|
||||
SiteRenderer {
|
||||
output_directory: output_directory.into(),
|
||||
blog_posts,
|
||||
stylesheets,
|
||||
pages,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +80,29 @@ impl SiteRenderer {
|
||||
Ok(renderer_integration)
|
||||
}
|
||||
|
||||
pub(crate) async fn render_pages(&self, config: &Config) -> Result<(), CustomError> {
|
||||
let renderer_integration = self.init_renderer_integration()?;
|
||||
|
||||
for page in &self.pages {
|
||||
let output_path = self.output_directory.join(page.get_output_path());
|
||||
let render_context = RenderContext::new(
|
||||
config,
|
||||
self.output_directory.as_path(),
|
||||
output_path.as_path(),
|
||||
None,
|
||||
)?;
|
||||
let render_context = RenderPage::new(render_context, page)?;
|
||||
let rendered_output = renderer_integration.render(render_context)?;
|
||||
let parent_directory = output_path
|
||||
.parent()
|
||||
.ok_or("Output file should have a containing directory.")?;
|
||||
tokio::fs::create_dir_all(parent_directory).await?;
|
||||
tokio::fs::write(output_path, rendered_output).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn render_blog_posts(&self, config: &Config) -> Result<(), CustomError> {
|
||||
let renderer_integration = self.init_renderer_integration()?;
|
||||
|
||||
@@ -196,6 +229,27 @@ impl SiteRenderer {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn copy_static_files(&self, config: &Config) -> Result<(), CustomError> {
|
||||
let static_files_directory = config
|
||||
.get_root_directory()
|
||||
.join(config.get_relative_path_to_static_files());
|
||||
if !static_files_directory.exists() {
|
||||
return Ok(());
|
||||
}
|
||||
let static_files = get_all_files(&static_files_directory).await?;
|
||||
for entry in static_files {
|
||||
let (path, contents) = entry.await??;
|
||||
let relative_path = path.strip_prefix(&static_files_directory)?;
|
||||
let output_path = self.output_directory.join(relative_path);
|
||||
let parent_directory = output_path
|
||||
.parent()
|
||||
.ok_or("Output file should have a containing directory.")?;
|
||||
tokio::fs::create_dir_all(parent_directory).await?;
|
||||
tokio::fs::write(output_path, contents).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn build_name_contents_pairs<'a>(
|
||||
@@ -210,3 +264,32 @@ fn build_name_contents_pairs<'a>(
|
||||
let contents = std::str::from_utf8(entry.contents())?;
|
||||
Ok((name, contents))
|
||||
}
|
||||
|
||||
type ReadFileResult = std::io::Result<(PathBuf, Vec<u8>)>;
|
||||
|
||||
async fn filter_to_files(entry: &DirEntry) -> WalkFsFilterResult {
|
||||
let file_type = entry.file_type().await?;
|
||||
if file_type.is_dir() {
|
||||
return Ok(WalkAction::Recurse);
|
||||
}
|
||||
if file_type.is_file() {
|
||||
return Ok(WalkAction::HaltAndCapture);
|
||||
}
|
||||
|
||||
unreachable!("Unhandled file type.");
|
||||
}
|
||||
|
||||
async fn get_all_files<P: Into<PathBuf>>(
|
||||
root_dir: P,
|
||||
) -> Result<impl Iterator<Item = JoinHandle<ReadFileResult>>, CustomError> {
|
||||
let files = walk_fs(root_dir, filter_to_files).await?;
|
||||
let files_and_content = files
|
||||
.into_iter()
|
||||
.map(|entry| tokio::spawn(read_file(entry.path())));
|
||||
Ok(files_and_content)
|
||||
}
|
||||
|
||||
async fn read_file(path: PathBuf) -> ReadFileResult {
|
||||
let contents = tokio::fs::read(&path).await?;
|
||||
Ok((path, contents))
|
||||
}
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
use std::ffi::OsStr;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use super::stylesheet::Stylesheet;
|
||||
use crate::cli::parameters::BuildArgs;
|
||||
use crate::command::build::render::SiteRenderer;
|
||||
use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::get_org_files;
|
||||
use crate::intermediate::BlogPost;
|
||||
use crate::intermediate::IPage;
|
||||
use crate::intermediate::IntermediateContext;
|
||||
use crate::intermediate::PageInput;
|
||||
use crate::intermediate::Registry;
|
||||
use crate::walk_fs::walk_fs;
|
||||
use crate::walk_fs::WalkAction;
|
||||
use crate::walk_fs::WalkFsFilterResult;
|
||||
use include_dir::include_dir;
|
||||
use include_dir::Dir;
|
||||
use tokio::fs::DirEntry;
|
||||
|
||||
static DEFAULT_STYLESHEETS: Dir =
|
||||
include_dir!("$CARGO_MANIFEST_DIR/default_environment/stylesheet");
|
||||
@@ -17,14 +28,18 @@ pub(crate) async fn build_site(args: BuildArgs) -> Result<(), CustomError> {
|
||||
let config = Config::load_from_file(args.config).await?;
|
||||
let blog_posts = load_blog_posts(&config).await?;
|
||||
let stylesheets = load_stylesheets().await?;
|
||||
let pages = load_pages(&config).await?;
|
||||
let renderer = SiteRenderer::new(
|
||||
get_output_directory(&config).await?,
|
||||
blog_posts,
|
||||
stylesheets,
|
||||
pages,
|
||||
);
|
||||
renderer.render_blog_posts(&config).await?;
|
||||
renderer.render_blog_stream(&config).await?;
|
||||
renderer.render_pages(&config).await?;
|
||||
renderer.render_stylesheets().await?;
|
||||
renderer.copy_static_files(&config).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -48,24 +63,54 @@ async fn get_output_directory(config: &Config) -> Result<PathBuf, CustomError> {
|
||||
Ok(output_directory)
|
||||
}
|
||||
|
||||
async fn get_post_directories(config: &Config) -> Result<Vec<PathBuf>, CustomError> {
|
||||
let mut ret = Vec::new();
|
||||
let mut entries = tokio::fs::read_dir(config.get_posts_directory()).await?;
|
||||
async fn filter_to_highest_folders_containing_org_files(entry: &DirEntry) -> WalkFsFilterResult {
|
||||
let file_type = entry.file_type().await?;
|
||||
if !file_type.is_dir() {
|
||||
return Ok(WalkAction::Halt);
|
||||
}
|
||||
let mut entries = tokio::fs::read_dir(entry.path()).await?;
|
||||
while let Some(entry) = entries.next_entry().await? {
|
||||
let file_type = entry.file_type().await?;
|
||||
if file_type.is_dir() {
|
||||
ret.push(entry.path());
|
||||
let entry_type = entry.file_type().await?;
|
||||
if !entry_type.is_file() {
|
||||
continue;
|
||||
}
|
||||
match entry.path().extension().and_then(OsStr::to_str) {
|
||||
Some(ext) if ext.eq_ignore_ascii_case("org") => {
|
||||
return Ok(WalkAction::HaltAndCapture);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
Ok(ret)
|
||||
Ok(WalkAction::Recurse)
|
||||
}
|
||||
|
||||
async fn get_post_directories(config: &Config) -> Result<Vec<PathBuf>, CustomError> {
|
||||
if !config.get_posts_directory().exists() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
|
||||
let top_level_org_folders = walk_fs(
|
||||
config.get_posts_directory(),
|
||||
filter_to_highest_folders_containing_org_files,
|
||||
)
|
||||
.await?;
|
||||
Ok(top_level_org_folders
|
||||
.into_iter()
|
||||
.map(|entry| entry.path())
|
||||
.collect())
|
||||
}
|
||||
|
||||
async fn load_blog_posts(config: &Config) -> Result<Vec<BlogPost>, CustomError> {
|
||||
let root_directory = config.get_root_directory().to_owned();
|
||||
let post_directories = get_post_directories(&config).await?;
|
||||
let load_jobs = post_directories
|
||||
.into_iter()
|
||||
.map(|path| tokio::spawn(BlogPost::load_blog_post(root_directory.clone(), path)));
|
||||
let posts_directory = config.get_posts_directory();
|
||||
let post_directories = get_post_directories(config).await?;
|
||||
let load_jobs = post_directories.into_iter().map(|path| {
|
||||
tokio::spawn(BlogPost::load_blog_post(
|
||||
root_directory.clone(),
|
||||
posts_directory.clone(),
|
||||
path,
|
||||
))
|
||||
});
|
||||
let mut blog_posts = Vec::new();
|
||||
for job in load_jobs {
|
||||
blog_posts.push(job.await??);
|
||||
@@ -73,6 +118,62 @@ async fn load_blog_posts(config: &Config) -> Result<Vec<BlogPost>, CustomError>
|
||||
Ok(blog_posts)
|
||||
}
|
||||
|
||||
async fn load_pages(config: &Config) -> Result<Vec<IPage>, CustomError> {
|
||||
let pages_source = config
|
||||
.get_root_directory()
|
||||
.join(config.get_relative_path_to_pages());
|
||||
if !pages_source.exists() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let page_files = get_org_files(&pages_source).await?;
|
||||
let org_files = {
|
||||
let mut ret = Vec::new();
|
||||
for page in page_files {
|
||||
ret.push(page.await??);
|
||||
}
|
||||
ret
|
||||
};
|
||||
let parsed_org_files = {
|
||||
let mut ret = Vec::new();
|
||||
for (path, contents) in org_files.iter() {
|
||||
let parsed = organic::parser::parse_file(contents.as_str(), Some(path))
|
||||
.map_err(|_| CustomError::Static("Failed to parse org-mode document."))?;
|
||||
ret.push((path, contents, parsed));
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
let pages = {
|
||||
let mut ret = Vec::new();
|
||||
for (real_path, _contents, parsed_document) in parsed_org_files.iter() {
|
||||
let mut registry = Registry::new();
|
||||
|
||||
// Assign IDs to the targets
|
||||
organic::types::AstNode::from(parsed_document)
|
||||
.iter_all_ast_nodes()
|
||||
.for_each(|node| {
|
||||
if let organic::types::AstNode::Target(target) = node {
|
||||
registry.get_target(target.value);
|
||||
}
|
||||
});
|
||||
|
||||
let registry = Arc::new(Mutex::new(registry));
|
||||
let intermediate_context = IntermediateContext::new(registry)?;
|
||||
let relative_to_pages_dir_path = real_path.strip_prefix(&pages_source)?;
|
||||
ret.push(
|
||||
IPage::new(
|
||||
intermediate_context,
|
||||
PageInput::new(relative_to_pages_dir_path, parsed_document),
|
||||
)
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(pages)
|
||||
}
|
||||
|
||||
async fn load_stylesheets() -> Result<Vec<Stylesheet>, CustomError> {
|
||||
let sources: Vec<_> = DEFAULT_STYLESHEETS
|
||||
.files()
|
||||
|
||||
@@ -13,7 +13,7 @@ pub(crate) async fn init_natter_folder(args: InitArgs) -> Result<(), CustomError
|
||||
|
||||
let mut existing_entries = tokio::fs::read_dir(&args.path).await?;
|
||||
let first_entry = existing_entries.next_entry().await?;
|
||||
if let Some(_) = first_entry {
|
||||
if first_entry.is_some() {
|
||||
return Err("The directory is not empty. Aborting.".into());
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ impl Config {
|
||||
}
|
||||
|
||||
pub(crate) fn get_root_directory(&self) -> &Path {
|
||||
&self
|
||||
.config_path
|
||||
self.config_path
|
||||
.parent()
|
||||
.expect("Config file must exist inside a directory.")
|
||||
}
|
||||
@@ -86,8 +85,15 @@ impl Config {
|
||||
self.raw
|
||||
.stream
|
||||
.as_ref()
|
||||
.map(|stream| stream.entries_per_page)
|
||||
.flatten()
|
||||
.and_then(|stream| stream.entries_per_page)
|
||||
.unwrap_or(5)
|
||||
}
|
||||
|
||||
pub(crate) fn get_relative_path_to_static_files(&self) -> PathBuf {
|
||||
Path::new("static").into()
|
||||
}
|
||||
|
||||
pub(crate) fn get_relative_path_to_pages(&self) -> PathBuf {
|
||||
Path::new("pages").into()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
/// This is the struct for the natter.toml config file that ends up in each site's root directory.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub(crate) struct RawConfig {
|
||||
pub(super) site_title: Option<String>,
|
||||
author: Option<String>,
|
||||
@@ -12,28 +12,7 @@ pub(crate) struct RawConfig {
|
||||
pub(super) stream: Option<RawConfigStream>,
|
||||
}
|
||||
|
||||
impl Default for RawConfig {
|
||||
fn default() -> Self {
|
||||
RawConfig {
|
||||
site_title: None,
|
||||
author: None,
|
||||
email: None,
|
||||
use_relative_paths: None,
|
||||
web_root: None,
|
||||
stream: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub(crate) struct RawConfigStream {
|
||||
pub(super) entries_per_page: Option<usize>,
|
||||
}
|
||||
|
||||
impl Default for RawConfigStream {
|
||||
fn default() -> Self {
|
||||
RawConfigStream {
|
||||
entries_per_page: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,14 +117,14 @@ pub(crate) enum RenderAstNode {
|
||||
}
|
||||
|
||||
pub(crate) trait IntoRenderAstNode {
|
||||
fn into_render_ast_node(
|
||||
fn as_render_ast_node(
|
||||
&self,
|
||||
render_context: RenderContext<'_>,
|
||||
) -> Result<RenderAstNode, CustomError>;
|
||||
}
|
||||
|
||||
impl IntoRenderAstNode for IAstNode {
|
||||
fn into_render_ast_node(
|
||||
fn as_render_ast_node(
|
||||
&self,
|
||||
render_context: RenderContext<'_>,
|
||||
) -> Result<RenderAstNode, CustomError> {
|
||||
|
||||
@@ -14,6 +14,7 @@ use super::RenderDocumentElement;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct RenderBlogPostPageInput<'a> {
|
||||
#[allow(dead_code)]
|
||||
post: &'a BlogPost,
|
||||
page: &'a BlogPostPage,
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ render!(
|
||||
|
||||
let children = original
|
||||
.original
|
||||
.into_iter()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, blog_post)| {
|
||||
RenderBlogStreamEntry::new(
|
||||
|
||||
@@ -39,7 +39,7 @@ render!(
|
||||
let contents = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.contents.iter() {
|
||||
ret.push(obj.into_render_ast_node(render_context.clone())?);
|
||||
ret.push(obj.as_render_ast_node(render_context.clone())?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
@@ -36,6 +36,7 @@ mod line_break;
|
||||
mod macros;
|
||||
mod object;
|
||||
mod org_macro;
|
||||
mod page;
|
||||
mod page_header;
|
||||
mod paragraph;
|
||||
mod plain_link;
|
||||
@@ -59,6 +60,7 @@ mod subscript;
|
||||
mod superscript;
|
||||
mod table;
|
||||
mod table_cell;
|
||||
mod table_group;
|
||||
mod table_row;
|
||||
mod target;
|
||||
mod timestamp;
|
||||
@@ -76,6 +78,7 @@ pub(crate) use footnote_definition::RenderRealFootnoteDefinition;
|
||||
pub(crate) use global_settings::GlobalSettings;
|
||||
pub(crate) use heading::RenderHeading;
|
||||
pub(crate) use object::RenderObject;
|
||||
pub(crate) use page::RenderPage;
|
||||
pub(crate) use page_header::PageHeader;
|
||||
pub(crate) use render_context::RenderContext;
|
||||
pub(crate) use section::RenderSection;
|
||||
|
||||
102
src/context/page.rs
Normal file
102
src/context/page.rs
Normal file
@@ -0,0 +1,102 @@
|
||||
use super::footnote_definition::RenderRealFootnoteDefinition;
|
||||
use super::macros::render;
|
||||
use super::render_context::RenderContext;
|
||||
use super::GlobalSettings;
|
||||
use super::PageHeader;
|
||||
use super::RenderDocumentElement;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::get_web_path;
|
||||
use crate::intermediate::IPage;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "page")]
|
||||
pub(crate) struct RenderPage {
|
||||
global_settings: GlobalSettings,
|
||||
|
||||
page_header: Option<PageHeader>,
|
||||
|
||||
/// The title that will be shown visibly on the page.
|
||||
title: Option<String>,
|
||||
|
||||
self_link: Option<String>,
|
||||
|
||||
children: Vec<RenderDocumentElement>,
|
||||
|
||||
footnotes: Vec<RenderRealFootnoteDefinition>,
|
||||
}
|
||||
|
||||
render!(RenderPage, IPage, original, render_context, {
|
||||
let css_files = vec![
|
||||
get_web_path(
|
||||
render_context.config,
|
||||
render_context.output_root_directory,
|
||||
render_context.output_file,
|
||||
"stylesheet/reset.css",
|
||||
)?,
|
||||
get_web_path(
|
||||
render_context.config,
|
||||
render_context.output_root_directory,
|
||||
render_context.output_file,
|
||||
"stylesheet/main.css",
|
||||
)?,
|
||||
];
|
||||
let js_files = vec![get_web_path(
|
||||
render_context.config,
|
||||
render_context.output_root_directory,
|
||||
render_context.output_file,
|
||||
"blog_post.js",
|
||||
)?];
|
||||
let global_settings = GlobalSettings::new(original.title.clone(), css_files, js_files);
|
||||
let page_header = PageHeader::new(
|
||||
render_context.config.get_site_title().map(str::to_string),
|
||||
Some(get_web_path(
|
||||
render_context.config,
|
||||
render_context.output_root_directory,
|
||||
render_context.output_file,
|
||||
"",
|
||||
)?),
|
||||
);
|
||||
let link_to_blog_post = get_web_path(
|
||||
render_context.config,
|
||||
render_context.output_root_directory,
|
||||
render_context.output_file,
|
||||
render_context
|
||||
.output_file
|
||||
.strip_prefix(render_context.output_root_directory)?,
|
||||
)?;
|
||||
|
||||
let children = {
|
||||
let mut children = Vec::new();
|
||||
|
||||
for child in original.children.iter() {
|
||||
children.push(RenderDocumentElement::new(render_context.clone(), child)?);
|
||||
}
|
||||
|
||||
children
|
||||
};
|
||||
|
||||
let footnotes = {
|
||||
let mut ret = Vec::new();
|
||||
|
||||
for footnote in original.footnotes.iter() {
|
||||
ret.push(RenderRealFootnoteDefinition::new(
|
||||
render_context.clone(),
|
||||
footnote,
|
||||
)?);
|
||||
}
|
||||
|
||||
ret
|
||||
};
|
||||
|
||||
let ret = RenderPage {
|
||||
global_settings,
|
||||
page_header: Some(page_header),
|
||||
title: original.title.clone(),
|
||||
self_link: Some(link_to_blog_post),
|
||||
children,
|
||||
footnotes,
|
||||
};
|
||||
Ok(ret)
|
||||
});
|
||||
@@ -1,16 +1,21 @@
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::render;
|
||||
use super::render_context::RenderContext;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IPlainLink;
|
||||
|
||||
use super::macros::rnoop;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "plain_link")]
|
||||
pub(crate) struct RenderPlainLink {
|
||||
raw_link: String,
|
||||
post_blank: organic::types::PostBlank,
|
||||
}
|
||||
|
||||
rnoop!(RenderPlainLink, IPlainLink);
|
||||
render!(RenderPlainLink, IPlainLink, original, _render_context, {
|
||||
Ok(RenderPlainLink {
|
||||
raw_link: original.raw_link.clone(),
|
||||
post_blank: original.post_blank,
|
||||
})
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ use super::RenderObject;
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "regular_link")]
|
||||
pub(crate) struct RenderRegularLink {
|
||||
target: String,
|
||||
raw_link: String,
|
||||
children: Vec<RenderObject>,
|
||||
post_blank: organic::types::PostBlank,
|
||||
@@ -25,7 +26,13 @@ render!(RenderRegularLink, IRegularLink, original, render_context, {
|
||||
ret
|
||||
};
|
||||
|
||||
let target = original
|
||||
.target
|
||||
.generate_final_target(render_context.clone())?
|
||||
.unwrap_or_else(|| "".to_owned());
|
||||
|
||||
Ok(RenderRegularLink {
|
||||
target,
|
||||
raw_link: original.raw_link.clone(),
|
||||
children,
|
||||
post_blank: original.post_blank,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
use serde::Serialize;
|
||||
|
||||
use super::render_context::RenderContext;
|
||||
use super::table_group::RenderTableGroup;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::ITable;
|
||||
use crate::intermediate::ITableGroup;
|
||||
|
||||
use super::macros::render;
|
||||
use super::table_row::RenderTableRow;
|
||||
@@ -11,15 +13,29 @@ use super::table_row::RenderTableRow;
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "table")]
|
||||
pub(crate) struct RenderTable {
|
||||
children: Vec<RenderTableRow>,
|
||||
children: Vec<RenderTableGroup>,
|
||||
post_blank: organic::types::PostBlank,
|
||||
}
|
||||
|
||||
render!(RenderTable, ITable, original, render_context, {
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderTableRow::new(render_context.clone(), obj)?);
|
||||
for group in original.children.iter() {
|
||||
let mut rows = Vec::new();
|
||||
match group {
|
||||
ITableGroup::Head(irows) => {
|
||||
for obj in irows {
|
||||
rows.push(RenderTableRow::new(render_context.clone(), obj)?);
|
||||
}
|
||||
ret.push(RenderTableGroup::Head { children: rows });
|
||||
}
|
||||
ITableGroup::Body(irows) => {
|
||||
for obj in irows {
|
||||
rows.push(RenderTableRow::new(render_context.clone(), obj)?);
|
||||
}
|
||||
ret.push(RenderTableGroup::Body { children: rows });
|
||||
}
|
||||
}
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
12
src/context/table_group.rs
Normal file
12
src/context/table_group.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use super::table_row::RenderTableRow;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub(crate) enum RenderTableGroup {
|
||||
#[serde(rename = "head")]
|
||||
Head { children: Vec<RenderTableRow> },
|
||||
|
||||
#[serde(rename = "body")]
|
||||
Body { children: Vec<RenderTableRow> },
|
||||
}
|
||||
@@ -14,9 +14,17 @@ pub(crate) struct RenderTarget {
|
||||
post_blank: organic::types::PostBlank,
|
||||
}
|
||||
|
||||
render!(RenderTarget, ITarget, original, _render_context, {
|
||||
render!(RenderTarget, ITarget, original, render_context, {
|
||||
let id = format!(
|
||||
"{}{}",
|
||||
render_context
|
||||
.id_addition
|
||||
.map(|id_addition| format!("sec{}.", id_addition))
|
||||
.unwrap_or_default(),
|
||||
original.id
|
||||
);
|
||||
Ok(RenderTarget {
|
||||
id: original.id.clone(),
|
||||
id,
|
||||
post_blank: original.post_blank,
|
||||
})
|
||||
});
|
||||
|
||||
@@ -3,19 +3,19 @@ use std::string::FromUtf8Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum CustomError {
|
||||
Static(&'static str),
|
||||
String(String),
|
||||
IO(std::io::Error),
|
||||
TomlSerialize(toml::ser::Error),
|
||||
TomlDeserialize(toml::de::Error),
|
||||
WalkDir(walkdir::Error),
|
||||
Tokio(tokio::task::JoinError),
|
||||
Serde(serde_json::Error),
|
||||
Utf8(Utf8Error),
|
||||
FromUtf8(FromUtf8Error),
|
||||
DusterCompile(duster::renderer::CompileError),
|
||||
DusterRender(duster::renderer::RenderError),
|
||||
PathStripPrefix(std::path::StripPrefixError),
|
||||
Static(#[allow(dead_code)] &'static str),
|
||||
String(#[allow(dead_code)] String),
|
||||
IO(#[allow(dead_code)] std::io::Error),
|
||||
TomlSerialize(#[allow(dead_code)] toml::ser::Error),
|
||||
TomlDeserialize(#[allow(dead_code)] toml::de::Error),
|
||||
Tokio(#[allow(dead_code)] tokio::task::JoinError),
|
||||
Serde(#[allow(dead_code)] serde_json::Error),
|
||||
Utf8(#[allow(dead_code)] Utf8Error),
|
||||
FromUtf8(#[allow(dead_code)] FromUtf8Error),
|
||||
DusterCompile(#[allow(dead_code)] duster::renderer::CompileError),
|
||||
DusterRender(#[allow(dead_code)] duster::renderer::RenderError),
|
||||
PathStripPrefix(#[allow(dead_code)] std::path::StripPrefixError),
|
||||
UrlParseError(#[allow(dead_code)] url::ParseError),
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for CustomError {
|
||||
@@ -48,12 +48,6 @@ impl From<toml::de::Error> for CustomError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<walkdir::Error> for CustomError {
|
||||
fn from(value: walkdir::Error) -> Self {
|
||||
CustomError::WalkDir(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<tokio::task::JoinError> for CustomError {
|
||||
fn from(value: tokio::task::JoinError) -> Self {
|
||||
CustomError::Tokio(value)
|
||||
@@ -95,3 +89,9 @@ impl From<std::path::StripPrefixError> for CustomError {
|
||||
CustomError::PathStripPrefix(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<url::ParseError> for CustomError {
|
||||
fn from(value: url::ParseError) -> Self {
|
||||
CustomError::UrlParseError(value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,14 +113,14 @@ pub(crate) enum IAstNode {
|
||||
}
|
||||
|
||||
pub(crate) trait IntoIAstNode<'parse> {
|
||||
fn into_ast_node<'orig>(
|
||||
fn as_ast_node<'orig>(
|
||||
&'orig self,
|
||||
intermediate_context: IntermediateContext<'orig, 'parse>,
|
||||
) -> BoxFuture<'orig, Result<IAstNode, CustomError>>;
|
||||
}
|
||||
|
||||
impl<'parse> IntoIAstNode<'parse> for organic::types::DocumentElement<'parse> {
|
||||
fn into_ast_node<'orig>(
|
||||
fn as_ast_node<'orig>(
|
||||
&'orig self,
|
||||
intermediate_context: IntermediateContext<'orig, 'parse>,
|
||||
) -> BoxFuture<'orig, Result<IAstNode, CustomError>> {
|
||||
@@ -139,7 +139,7 @@ impl<'parse> IntoIAstNode<'parse> for organic::types::DocumentElement<'parse> {
|
||||
}
|
||||
|
||||
impl<'parse> IntoIAstNode<'parse> for organic::types::Element<'parse> {
|
||||
fn into_ast_node<'orig>(
|
||||
fn as_ast_node<'orig>(
|
||||
&'orig self,
|
||||
intermediate_context: IntermediateContext<'orig, 'parse>,
|
||||
) -> BoxFuture<'orig, Result<IAstNode, CustomError>> {
|
||||
@@ -226,7 +226,7 @@ impl<'parse> IntoIAstNode<'parse> for organic::types::Element<'parse> {
|
||||
}
|
||||
|
||||
impl<'parse> IntoIAstNode<'parse> for organic::types::Object<'parse> {
|
||||
fn into_ast_node<'orig>(
|
||||
fn as_ast_node<'orig>(
|
||||
&'orig self,
|
||||
intermediate_context: IntermediateContext<'orig, 'parse>,
|
||||
) -> BoxFuture<'orig, Result<IAstNode, CustomError>> {
|
||||
|
||||
@@ -3,13 +3,16 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use tokio::fs::DirEntry;
|
||||
use tokio::task::JoinHandle;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::page::BlogPostPageInput;
|
||||
use crate::intermediate::blog_post_page::BlogPostPageInput;
|
||||
use crate::intermediate::registry::Registry;
|
||||
use crate::intermediate::IntermediateContext;
|
||||
use crate::walk_fs::walk_fs;
|
||||
use crate::walk_fs::WalkAction;
|
||||
use crate::walk_fs::WalkFsFilterResult;
|
||||
|
||||
use super::BlogPostPage;
|
||||
|
||||
@@ -20,18 +23,21 @@ pub(crate) struct BlogPost {
|
||||
}
|
||||
|
||||
impl BlogPost {
|
||||
pub(crate) async fn load_blog_post<P: AsRef<Path>, R: AsRef<Path>>(
|
||||
pub(crate) async fn load_blog_post<P: AsRef<Path>, R: AsRef<Path>, S: AsRef<Path>>(
|
||||
root_dir: R,
|
||||
posts_dir: S,
|
||||
post_dir: P,
|
||||
) -> Result<BlogPost, CustomError> {
|
||||
async fn inner(_root_dir: &Path, post_dir: &Path) -> Result<BlogPost, CustomError> {
|
||||
let post_id = post_dir
|
||||
.file_name()
|
||||
.expect("The post directory should have a name.");
|
||||
async fn inner(
|
||||
_root_dir: &Path,
|
||||
posts_dir: &Path,
|
||||
post_dir: &Path,
|
||||
) -> Result<BlogPost, CustomError> {
|
||||
let post_id = post_dir.strip_prefix(posts_dir)?.as_os_str();
|
||||
|
||||
let org_files = {
|
||||
let mut ret = Vec::new();
|
||||
let org_files_iter = get_org_files(post_dir)?;
|
||||
let org_files_iter = get_org_files(post_dir).await?;
|
||||
for entry in org_files_iter {
|
||||
ret.push(entry.await??);
|
||||
}
|
||||
@@ -55,11 +61,10 @@ impl BlogPost {
|
||||
// Assign IDs to the targets
|
||||
organic::types::AstNode::from(parsed_document)
|
||||
.iter_all_ast_nodes()
|
||||
.for_each(|node| match node {
|
||||
organic::types::AstNode::Target(target) => {
|
||||
.for_each(|node| {
|
||||
if let organic::types::AstNode::Target(target) = node {
|
||||
registry.get_target(target.value);
|
||||
}
|
||||
_ => {}
|
||||
});
|
||||
|
||||
let registry = Arc::new(Mutex::new(registry));
|
||||
@@ -81,7 +86,7 @@ impl BlogPost {
|
||||
pages,
|
||||
})
|
||||
}
|
||||
inner(root_dir.as_ref(), post_dir.as_ref()).await
|
||||
inner(root_dir.as_ref(), posts_dir.as_ref(), post_dir.as_ref()).await
|
||||
}
|
||||
|
||||
/// Get the date for a blog post.
|
||||
@@ -96,15 +101,14 @@ impl BlogPost {
|
||||
pub(crate) fn get_date(&self) -> Option<&str> {
|
||||
let index_page_date = self
|
||||
.get_index_page()
|
||||
.map(|index_page| index_page.date.as_ref().map(String::as_str))
|
||||
.flatten();
|
||||
.and_then(|index_page| index_page.date.as_deref());
|
||||
if index_page_date.is_some() {
|
||||
return index_page_date;
|
||||
}
|
||||
|
||||
self.pages
|
||||
.iter()
|
||||
.filter_map(|page| page.date.as_ref().map(String::as_str))
|
||||
.filter_map(|page| page.date.as_deref())
|
||||
.next()
|
||||
}
|
||||
|
||||
@@ -121,25 +125,33 @@ async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, String)> {
|
||||
Ok((path, contents))
|
||||
}
|
||||
|
||||
fn get_org_files<P: AsRef<Path>>(
|
||||
pub(crate) async fn get_org_files<P: Into<PathBuf>>(
|
||||
root_dir: P,
|
||||
) -> Result<impl Iterator<Item = JoinHandle<std::io::Result<(PathBuf, String)>>>, walkdir::Error> {
|
||||
let org_files = WalkDir::new(root_dir)
|
||||
.into_iter()
|
||||
.filter(|e| match e {
|
||||
Ok(dir_entry) => {
|
||||
dir_entry.file_type().is_file()
|
||||
&& Path::new(dir_entry.file_name())
|
||||
.extension()
|
||||
.map(|ext| ext.to_ascii_lowercase() == "org")
|
||||
.unwrap_or(false)
|
||||
}
|
||||
Err(_) => true,
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
) -> Result<impl Iterator<Item = JoinHandle<std::io::Result<(PathBuf, String)>>>, CustomError> {
|
||||
let org_files = walk_fs(root_dir, filter_to_org_files).await?;
|
||||
let org_files = org_files
|
||||
.into_iter()
|
||||
.map(walkdir::DirEntry::into_path)
|
||||
.map(|entry| entry.path())
|
||||
.map(|path| tokio::spawn(read_file(path)));
|
||||
Ok(org_files)
|
||||
}
|
||||
|
||||
async fn filter_to_org_files(entry: &DirEntry) -> WalkFsFilterResult {
|
||||
let file_type = entry.file_type().await?;
|
||||
if file_type.is_dir() {
|
||||
return Ok(WalkAction::Recurse);
|
||||
}
|
||||
if file_type.is_file() {
|
||||
if entry
|
||||
.path()
|
||||
.extension()
|
||||
.map(|ext| ext.eq_ignore_ascii_case("org"))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Ok(WalkAction::HaltAndCapture);
|
||||
}
|
||||
return Ok(WalkAction::Halt);
|
||||
}
|
||||
|
||||
unreachable!("Unhandled file type.");
|
||||
}
|
||||
|
||||
121
src/intermediate/blog_post_page.rs
Normal file
121
src/intermediate/blog_post_page.rs
Normal file
@@ -0,0 +1,121 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::footnote_definition::IRealFootnoteDefinition;
|
||||
|
||||
use super::macros::intermediate;
|
||||
use super::IDocumentElement;
|
||||
use super::IHeading;
|
||||
use super::ISection;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct BlogPostPageInput<'b, 'parse> {
|
||||
path: PathBuf,
|
||||
document: &'b organic::types::Document<'parse>,
|
||||
}
|
||||
|
||||
impl<'b, 'parse> BlogPostPageInput<'b, 'parse> {
|
||||
pub(crate) fn new<P: Into<PathBuf>>(
|
||||
path: P,
|
||||
document: &'b organic::types::Document<'parse>,
|
||||
) -> BlogPostPageInput<'b, 'parse> {
|
||||
BlogPostPageInput {
|
||||
path: path.into(),
|
||||
document,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct BlogPostPage {
|
||||
/// Relative path from the root of the blog post.
|
||||
pub(crate) path: PathBuf,
|
||||
|
||||
pub(crate) title: Option<String>,
|
||||
|
||||
pub(crate) date: Option<String>,
|
||||
|
||||
pub(crate) children: Vec<IDocumentElement>,
|
||||
|
||||
pub(crate) footnotes: Vec<IRealFootnoteDefinition>,
|
||||
}
|
||||
|
||||
intermediate!(
|
||||
BlogPostPage,
|
||||
BlogPostPageInput<'orig, 'parse>,
|
||||
original,
|
||||
intermediate_context,
|
||||
{
|
||||
let mut children = Vec::new();
|
||||
if let Some(section) = original.document.zeroth_section.as_ref() {
|
||||
children.push(IDocumentElement::Section(
|
||||
ISection::new(intermediate_context.clone(), section).await?,
|
||||
));
|
||||
}
|
||||
for heading in original.document.children.iter() {
|
||||
children.push(IDocumentElement::Heading(
|
||||
IHeading::new(intermediate_context.clone(), heading).await?,
|
||||
));
|
||||
}
|
||||
|
||||
let footnotes = {
|
||||
let footnote_definitions: Vec<_> = {
|
||||
let registry = intermediate_context.registry.lock().unwrap();
|
||||
let ret = registry
|
||||
.get_footnote_ids()
|
||||
.map(|(id, def)| (id, def.clone()))
|
||||
.collect();
|
||||
ret
|
||||
};
|
||||
let mut ret = Vec::new();
|
||||
for (id, def) in footnote_definitions.into_iter() {
|
||||
ret.push(
|
||||
IRealFootnoteDefinition::new(intermediate_context.clone(), id, def).await?,
|
||||
);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(BlogPostPage {
|
||||
path: original.path,
|
||||
title: get_title(original.document),
|
||||
date: get_date(original.document),
|
||||
children,
|
||||
footnotes,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
impl BlogPostPage {
|
||||
/// Get the output path relative to the post directory.
|
||||
pub(crate) fn get_output_path(&self) -> PathBuf {
|
||||
let mut ret = self.path.clone();
|
||||
ret.set_extension("html");
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_title(document: &organic::types::Document<'_>) -> Option<String> {
|
||||
organic::types::AstNode::from(document)
|
||||
.iter_all_ast_nodes()
|
||||
.filter_map(|node| match node {
|
||||
organic::types::AstNode::Keyword(kw) if kw.key.eq_ignore_ascii_case("title") => {
|
||||
Some(kw)
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.last()
|
||||
.map(|kw| kw.value.to_owned())
|
||||
}
|
||||
|
||||
pub(crate) fn get_date(document: &organic::types::Document<'_>) -> Option<String> {
|
||||
organic::types::AstNode::from(document)
|
||||
.iter_all_ast_nodes()
|
||||
.filter_map(|node| match node {
|
||||
organic::types::AstNode::Keyword(kw) if kw.key.eq_ignore_ascii_case("date") => Some(kw),
|
||||
_ => None,
|
||||
})
|
||||
.last()
|
||||
.map(|kw| kw.value.to_owned())
|
||||
}
|
||||
@@ -21,7 +21,7 @@ pub(crate) fn get_web_path<D: AsRef<Path>, F: AsRef<Path>, P: AsRef<Path>>(
|
||||
containing_file_relative_to_output_directory
|
||||
.parent()
|
||||
.ok_or("File should exist in a folder.")?,
|
||||
path_from_web_root.parent().unwrap_or(&Path::new("")),
|
||||
path_from_web_root.parent().unwrap_or(Path::new("")),
|
||||
)
|
||||
.collect::<PathBuf>();
|
||||
// Subtracting 1 from the depth to "remove" the file name.
|
||||
|
||||
@@ -53,7 +53,7 @@ impl IRealFootnoteDefinition {
|
||||
pub(crate) fn get_reference_id(&self, id_addition: Option<&str>) -> String {
|
||||
let id_addition = id_addition
|
||||
.map(|id_addition| format!("sec{}.", id_addition))
|
||||
.unwrap_or(String::default());
|
||||
.unwrap_or_default();
|
||||
|
||||
format!("{}fnr.{}", id_addition, self.get_display_label())
|
||||
}
|
||||
@@ -64,7 +64,7 @@ impl IRealFootnoteDefinition {
|
||||
pub(crate) fn get_definition_id(&self, id_addition: Option<&str>) -> String {
|
||||
let id_addition = id_addition
|
||||
.map(|id_addition| format!("sec{}.", id_addition))
|
||||
.unwrap_or(String::default());
|
||||
.unwrap_or_default();
|
||||
|
||||
format!("{}fn.{}", id_addition, self.get_display_label())
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ impl IFootnoteReference {
|
||||
pub(crate) fn get_reference_id(&self, id_addition: Option<&str>) -> String {
|
||||
let id_addition = id_addition
|
||||
.map(|id_addition| format!("sec{}.", id_addition))
|
||||
.unwrap_or(String::default());
|
||||
.unwrap_or_default();
|
||||
|
||||
if self.duplicate_offset == 0 {
|
||||
format!("{}fnr.{}", id_addition, self.get_display_label())
|
||||
@@ -55,7 +55,7 @@ impl IFootnoteReference {
|
||||
pub(crate) fn get_definition_id(&self, id_addition: Option<&str>) -> String {
|
||||
let id_addition = id_addition
|
||||
.map(|id_addition| format!("sec{}.", id_addition))
|
||||
.unwrap_or(String::default());
|
||||
.unwrap_or_default();
|
||||
|
||||
format!("{}fn.{}", id_addition, self.get_display_label())
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ intermediate!(
|
||||
{
|
||||
let value: String = if original.value.starts_with("$$") && original.value.ends_with("$$") {
|
||||
format!("\\[{}\\]", &original.value[2..(original.value.len() - 2)])
|
||||
} else if original.value.starts_with("$") && original.value.ends_with("$") {
|
||||
} else if original.value.starts_with('$') && original.value.ends_with('$') {
|
||||
format!("\\({}\\)", &original.value[1..(original.value.len() - 1)])
|
||||
} else {
|
||||
original.value.to_owned()
|
||||
|
||||
@@ -2,6 +2,7 @@ mod angle_link;
|
||||
mod ast_node;
|
||||
mod babel_call;
|
||||
mod blog_post;
|
||||
mod blog_post_page;
|
||||
mod bold;
|
||||
mod center_block;
|
||||
mod citation;
|
||||
@@ -59,6 +60,7 @@ mod subscript;
|
||||
mod superscript;
|
||||
mod table;
|
||||
mod table_cell;
|
||||
mod table_group;
|
||||
mod table_row;
|
||||
mod target;
|
||||
mod timestamp;
|
||||
@@ -69,7 +71,9 @@ mod verse_block;
|
||||
pub(crate) use angle_link::IAngleLink;
|
||||
pub(crate) use ast_node::IAstNode;
|
||||
pub(crate) use babel_call::IBabelCall;
|
||||
pub(crate) use blog_post::get_org_files;
|
||||
pub(crate) use blog_post::BlogPost;
|
||||
pub(crate) use blog_post_page::BlogPostPage;
|
||||
pub(crate) use bold::IBold;
|
||||
pub(crate) use center_block::ICenterBlock;
|
||||
pub(crate) use citation::ICitation;
|
||||
@@ -104,7 +108,8 @@ pub(crate) use latex_fragment::ILatexFragment;
|
||||
pub(crate) use line_break::ILineBreak;
|
||||
pub(crate) use object::IObject;
|
||||
pub(crate) use org_macro::IOrgMacro;
|
||||
pub(crate) use page::BlogPostPage;
|
||||
pub(crate) use page::IPage;
|
||||
pub(crate) use page::PageInput;
|
||||
pub(crate) use paragraph::IParagraph;
|
||||
pub(crate) use plain_link::IPlainLink;
|
||||
pub(crate) use plain_list::IPlainList;
|
||||
@@ -116,6 +121,7 @@ pub(crate) use property_drawer::IPropertyDrawer;
|
||||
pub(crate) use quote_block::IQuoteBlock;
|
||||
pub(crate) use radio_link::IRadioLink;
|
||||
pub(crate) use radio_target::IRadioTarget;
|
||||
pub(crate) use registry::Registry;
|
||||
pub(crate) use regular_link::IRegularLink;
|
||||
pub(crate) use section::ISection;
|
||||
pub(crate) use special_block::ISpecialBlock;
|
||||
@@ -126,6 +132,7 @@ pub(crate) use subscript::ISubscript;
|
||||
pub(crate) use superscript::ISuperscript;
|
||||
pub(crate) use table::ITable;
|
||||
pub(crate) use table_cell::ITableCell;
|
||||
pub(crate) use table_group::ITableGroup;
|
||||
pub(crate) use table_row::ITableRow;
|
||||
pub(crate) use target::ITarget;
|
||||
pub(crate) use timestamp::ITimestamp;
|
||||
|
||||
@@ -1,39 +1,21 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::blog_post_page::get_date;
|
||||
use super::blog_post_page::get_title;
|
||||
use super::footnote_definition::IRealFootnoteDefinition;
|
||||
|
||||
use super::macros::intermediate;
|
||||
use super::IDocumentElement;
|
||||
use super::IHeading;
|
||||
use super::ISection;
|
||||
use crate::error::CustomError;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct BlogPostPageInput<'b, 'parse> {
|
||||
path: PathBuf,
|
||||
document: &'b organic::types::Document<'parse>,
|
||||
}
|
||||
|
||||
impl<'b, 'parse> BlogPostPageInput<'b, 'parse> {
|
||||
pub(crate) fn new<P: Into<PathBuf>>(
|
||||
path: P,
|
||||
document: &'b organic::types::Document<'parse>,
|
||||
) -> BlogPostPageInput<'b, 'parse> {
|
||||
BlogPostPageInput {
|
||||
path: path.into(),
|
||||
document,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct BlogPostPage {
|
||||
/// Relative path from the root of the blog post.
|
||||
pub(crate) struct IPage {
|
||||
/// Relative path from the root of the pages directory.
|
||||
pub(crate) path: PathBuf,
|
||||
|
||||
pub(crate) title: Option<String>,
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) date: Option<String>,
|
||||
|
||||
pub(crate) children: Vec<IDocumentElement>,
|
||||
@@ -42,8 +24,8 @@ pub(crate) struct BlogPostPage {
|
||||
}
|
||||
|
||||
intermediate!(
|
||||
BlogPostPage,
|
||||
BlogPostPageInput<'orig, 'parse>,
|
||||
IPage,
|
||||
PageInput<'orig, 'parse>,
|
||||
original,
|
||||
intermediate_context,
|
||||
{
|
||||
@@ -77,7 +59,7 @@ intermediate!(
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(BlogPostPage {
|
||||
Ok(IPage {
|
||||
path: original.path,
|
||||
title: get_title(original.document),
|
||||
date: get_date(original.document),
|
||||
@@ -87,8 +69,8 @@ intermediate!(
|
||||
}
|
||||
);
|
||||
|
||||
impl BlogPostPage {
|
||||
/// Get the output path relative to the post directory.
|
||||
impl IPage {
|
||||
/// Get the output path relative to the pages directory.
|
||||
pub(crate) fn get_output_path(&self) -> PathBuf {
|
||||
let mut ret = self.path.clone();
|
||||
ret.set_extension("html");
|
||||
@@ -96,26 +78,20 @@ impl BlogPostPage {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_title(document: &organic::types::Document<'_>) -> Option<String> {
|
||||
organic::types::AstNode::from(document)
|
||||
.iter_all_ast_nodes()
|
||||
.filter_map(|node| match node {
|
||||
organic::types::AstNode::Keyword(kw) if kw.key.eq_ignore_ascii_case("title") => {
|
||||
Some(kw)
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.last()
|
||||
.map(|kw| kw.value.to_owned())
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct PageInput<'b, 'parse> {
|
||||
path: PathBuf,
|
||||
document: &'b organic::types::Document<'parse>,
|
||||
}
|
||||
|
||||
fn get_date(document: &organic::types::Document<'_>) -> Option<String> {
|
||||
organic::types::AstNode::from(document)
|
||||
.iter_all_ast_nodes()
|
||||
.filter_map(|node| match node {
|
||||
organic::types::AstNode::Keyword(kw) if kw.key.eq_ignore_ascii_case("date") => Some(kw),
|
||||
_ => None,
|
||||
})
|
||||
.last()
|
||||
.map(|kw| kw.value.to_owned())
|
||||
impl<'b, 'parse> PageInput<'b, 'parse> {
|
||||
pub(crate) fn new<P: Into<PathBuf>>(
|
||||
path: P,
|
||||
document: &'b organic::types::Document<'parse>,
|
||||
) -> PageInput<'b, 'parse> {
|
||||
PageInput {
|
||||
path: path.into(),
|
||||
document,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
use super::macros::inoop;
|
||||
use super::macros::intermediate;
|
||||
use crate::error::CustomError;
|
||||
use organic::types::StandardProperties;
|
||||
|
||||
inoop!(IPlainLink, PlainLink);
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct IPlainLink {
|
||||
pub(crate) raw_link: String,
|
||||
pub(crate) post_blank: organic::types::PostBlank,
|
||||
}
|
||||
|
||||
intermediate!(
|
||||
IPlainLink,
|
||||
&'orig organic::types::PlainLink<'parse>,
|
||||
original,
|
||||
_intermediate_context,
|
||||
{
|
||||
Ok(IPlainLink {
|
||||
raw_link: original.raw_link.to_owned(),
|
||||
post_blank: original.get_post_blank(),
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
@@ -29,11 +29,11 @@ intermediate!(
|
||||
let mut ret = Vec::new();
|
||||
|
||||
// Special case for list items with only paragraphs and sublists as their children. In those cases, the paragraph tags are omitted.
|
||||
let is_simple_list_item = original.children.iter().all(|child| match child {
|
||||
organic::types::Element::Paragraph(_) | organic::types::Element::PlainList(_) => {
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
let is_simple_list_item = original.children.iter().all(|child| {
|
||||
matches!(
|
||||
child,
|
||||
organic::types::Element::Paragraph(_) | organic::types::Element::PlainList(_)
|
||||
)
|
||||
});
|
||||
if is_simple_list_item {
|
||||
for elem in original.children.iter() {
|
||||
|
||||
@@ -14,7 +14,7 @@ type IdCounter = u16;
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Registry<'orig, 'parse> {
|
||||
id_counter: IdCounter,
|
||||
targets: HashMap<&'parse str, String>,
|
||||
targets: HashMap<String, String>,
|
||||
footnote_ids: Vec<(Option<&'parse str>, Vec<IAstNode>)>,
|
||||
footnote_reference_counts: HashMap<&'parse str, usize>,
|
||||
on_deck_footnote_ids: HashMap<&'parse str, &'orig Vec<Element<'parse>>>,
|
||||
@@ -31,8 +31,8 @@ impl<'orig, 'parse> Registry<'orig, 'parse> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_target<'reg>(&'reg mut self, body: &'parse str) -> &'reg String {
|
||||
self.targets.entry(body).or_insert_with(|| {
|
||||
pub(crate) fn get_target<S: Into<String>>(&mut self, body: S) -> &String {
|
||||
self.targets.entry(body.into()).or_insert_with(|| {
|
||||
self.id_counter += 1;
|
||||
format!("target_{}", self.id_counter)
|
||||
})
|
||||
@@ -52,9 +52,9 @@ impl<'orig, 'parse> Registry<'orig, 'parse> {
|
||||
pub(crate) async fn get_footnote_reference_id<'orig, 'parse>(
|
||||
intermediate_context: IntermediateContext<'orig, 'parse>,
|
||||
label: Option<&'parse str>,
|
||||
definition: &'orig Vec<Object<'parse>>,
|
||||
definition: &'orig [Object<'parse>],
|
||||
) -> Result<(usize, usize), CustomError> {
|
||||
if let None = label {
|
||||
if label.is_none() {
|
||||
// If it has no label then it must always get a new ID.
|
||||
let contents = convert_reference_contents(intermediate_context.clone(), definition).await?;
|
||||
let pos = {
|
||||
@@ -148,7 +148,7 @@ pub(crate) async fn register_footnote_definition<'orig, 'parse>(
|
||||
|
||||
async fn convert_reference_contents<'orig, 'parse>(
|
||||
intermediate_context: IntermediateContext<'orig, 'parse>,
|
||||
contents: &'orig Vec<Object<'parse>>,
|
||||
contents: &'orig [Object<'parse>],
|
||||
) -> Result<Vec<IAstNode>, CustomError> {
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
@@ -159,23 +159,19 @@ async fn convert_reference_contents<'orig, 'parse>(
|
||||
};
|
||||
let containing_paragraph =
|
||||
IParagraph::artificial(intermediate_context.clone(), children, 0).await?;
|
||||
let contents = {
|
||||
let mut ret = Vec::new();
|
||||
ret.push(IAstNode::Paragraph(containing_paragraph));
|
||||
ret
|
||||
};
|
||||
let contents = vec![IAstNode::Paragraph(containing_paragraph)];
|
||||
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
async fn convert_definition_contents<'orig, 'parse>(
|
||||
intermediate_context: IntermediateContext<'orig, 'parse>,
|
||||
contents: &'orig Vec<Element<'parse>>,
|
||||
contents: &'orig [Element<'parse>],
|
||||
) -> Result<Vec<IAstNode>, CustomError> {
|
||||
let contents = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in contents.iter() {
|
||||
ret.push(obj.into_ast_node(intermediate_context.clone()).await?);
|
||||
ret.push(obj.as_ast_node(intermediate_context.clone()).await?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
@@ -190,8 +186,7 @@ pub(crate) async fn promote_footnote_definition<'orig, 'parse>(
|
||||
) -> Result<(), CustomError> {
|
||||
let definition = {
|
||||
let mut registry = intermediate_context.registry.lock().unwrap();
|
||||
let definition = registry.on_deck_footnote_ids.remove(label);
|
||||
definition
|
||||
registry.on_deck_footnote_ids.remove(label)
|
||||
};
|
||||
if let Some(elements) = definition {
|
||||
let existing_id = {
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
use organic::types::StandardProperties;
|
||||
use url::Url;
|
||||
|
||||
use super::get_web_path;
|
||||
use super::macros::intermediate;
|
||||
use super::IntermediateContext;
|
||||
|
||||
use super::IObject;
|
||||
use crate::context::RenderContext;
|
||||
use crate::error::CustomError;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct IRegularLink {
|
||||
pub(crate) raw_link: String,
|
||||
pub(crate) children: Vec<IObject>,
|
||||
pub(crate) target: LinkTarget,
|
||||
pub(crate) post_blank: organic::types::PostBlank,
|
||||
}
|
||||
|
||||
@@ -25,10 +30,97 @@ intermediate!(
|
||||
}
|
||||
ret
|
||||
};
|
||||
let raw_link = original.get_raw_link();
|
||||
let target =
|
||||
LinkTarget::from_string(intermediate_context.clone(), raw_link.clone().into_owned())?;
|
||||
Ok(IRegularLink {
|
||||
raw_link: original.get_raw_link().into_owned(),
|
||||
raw_link: raw_link.into_owned(),
|
||||
children,
|
||||
target,
|
||||
post_blank: original.get_post_blank(),
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) enum LinkTarget {
|
||||
Raw(String),
|
||||
Post {
|
||||
post_id: Option<String>,
|
||||
subpath: String,
|
||||
},
|
||||
Target {
|
||||
target_id: String,
|
||||
},
|
||||
}
|
||||
|
||||
impl LinkTarget {
|
||||
pub(crate) fn from_string(
|
||||
intermediate_context: IntermediateContext<'_, '_>,
|
||||
input: String,
|
||||
) -> Result<LinkTarget, CustomError> {
|
||||
let parsed = Url::parse(&input);
|
||||
if let Err(url::ParseError::RelativeUrlWithoutBase) = parsed {
|
||||
let target_id = {
|
||||
let mut registry = intermediate_context.registry.lock().unwrap();
|
||||
let target_id = registry.get_target(input).to_owned();
|
||||
target_id
|
||||
};
|
||||
return Ok(LinkTarget::Target { target_id });
|
||||
}
|
||||
let parsed = parsed?;
|
||||
match parsed.scheme() {
|
||||
"post" => {
|
||||
let post_id = parsed.host_str().map(str::to_owned);
|
||||
let subpath = {
|
||||
let subpath = parsed.path();
|
||||
if let Some(subpath) = subpath.strip_prefix('/') {
|
||||
subpath
|
||||
} else {
|
||||
subpath
|
||||
}
|
||||
};
|
||||
Ok(LinkTarget::Post {
|
||||
post_id,
|
||||
subpath: subpath.to_owned(),
|
||||
})
|
||||
}
|
||||
_ => Ok(LinkTarget::Raw(input.to_owned())),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn generate_final_target(
|
||||
&self,
|
||||
render_context: RenderContext<'_>,
|
||||
) -> Result<Option<String>, CustomError> {
|
||||
match self {
|
||||
LinkTarget::Raw(raw_link) => Ok(Some(raw_link.clone())),
|
||||
LinkTarget::Post { post_id, subpath } => {
|
||||
let path = post_id
|
||||
.as_ref()
|
||||
.map(|post_id| {
|
||||
let path_to_post = render_context
|
||||
.config
|
||||
.get_relative_path_to_post(post_id)
|
||||
.join(subpath);
|
||||
get_web_path(
|
||||
render_context.config,
|
||||
render_context.output_root_directory,
|
||||
render_context.output_file,
|
||||
path_to_post,
|
||||
)
|
||||
})
|
||||
.map_or(Ok(None), |r| r.map(Some))?;
|
||||
Ok(path)
|
||||
}
|
||||
LinkTarget::Target { target_id } => Ok(Some(format!(
|
||||
"#{}{}",
|
||||
render_context
|
||||
.id_addition
|
||||
.map(|id_addition| format!("sec{}.", id_addition))
|
||||
.unwrap_or_default(),
|
||||
target_id
|
||||
))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
use super::macros::intermediate;
|
||||
use super::table_row::ITableRow;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::table_group::ITableGroup;
|
||||
use organic::types::StandardProperties;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ITable {
|
||||
pub(crate) children: Vec<ITableRow>,
|
||||
pub(crate) children: Vec<ITableGroup>,
|
||||
pub(crate) post_blank: organic::types::PostBlank,
|
||||
}
|
||||
|
||||
@@ -15,10 +16,40 @@ intermediate!(
|
||||
original,
|
||||
intermediate_context,
|
||||
{
|
||||
let children = {
|
||||
// Separate groups by lines, multiple contiguous lines are the same as one.
|
||||
// If there is only one group, it is a tbody.
|
||||
// If there are more than one group, the first is thead and the rest are tbody.
|
||||
|
||||
let sections = group_into_sections(&original.children);
|
||||
|
||||
let children = if sections.len() == 1 {
|
||||
// If there is only one section, then it is a body.
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(ITableRow::new(intermediate_context.clone(), obj).await?);
|
||||
for group in sections.into_iter() {
|
||||
let mut rows = Vec::new();
|
||||
for obj in group.into_iter() {
|
||||
rows.push(ITableRow::new(intermediate_context.clone(), obj).await?)
|
||||
}
|
||||
ret.push(ITableGroup::Body(rows));
|
||||
}
|
||||
ret
|
||||
} else {
|
||||
// If there are more than one section, the first is a head and the rest are body.
|
||||
let mut ret = Vec::new();
|
||||
let mut sections = sections.into_iter();
|
||||
if let Some(group) = sections.next() {
|
||||
let mut rows = Vec::new();
|
||||
for obj in group.into_iter() {
|
||||
rows.push(ITableRow::new(intermediate_context.clone(), obj).await?)
|
||||
}
|
||||
ret.push(ITableGroup::Head(rows));
|
||||
}
|
||||
for group in sections {
|
||||
let mut rows = Vec::new();
|
||||
for obj in group.into_iter() {
|
||||
rows.push(ITableRow::new(intermediate_context.clone(), obj).await?)
|
||||
}
|
||||
ret.push(ITableGroup::Body(rows));
|
||||
}
|
||||
ret
|
||||
};
|
||||
@@ -29,3 +60,41 @@ intermediate!(
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
enum GroupIntoSectionsState<'orig, 'parse> {
|
||||
NonSection,
|
||||
Section(Vec<&'orig organic::types::TableRow<'parse>>),
|
||||
}
|
||||
|
||||
fn group_into_sections<'orig, 'parse>(
|
||||
rows: &'orig [organic::types::TableRow<'parse>],
|
||||
) -> Vec<Vec<&'orig organic::types::TableRow<'parse>>> {
|
||||
let mut sections = Vec::new();
|
||||
let mut rows = rows.iter();
|
||||
let mut state = GroupIntoSectionsState::NonSection;
|
||||
loop {
|
||||
state = match (state, rows.next()) {
|
||||
(GroupIntoSectionsState::NonSection, None) => break,
|
||||
(GroupIntoSectionsState::NonSection, Some(row)) if row.children.is_empty() => {
|
||||
GroupIntoSectionsState::NonSection
|
||||
}
|
||||
(GroupIntoSectionsState::NonSection, Some(row)) => {
|
||||
GroupIntoSectionsState::Section(vec![row])
|
||||
}
|
||||
(GroupIntoSectionsState::Section(section), None) => {
|
||||
sections.push(section);
|
||||
break;
|
||||
}
|
||||
(GroupIntoSectionsState::Section(section), Some(row)) if row.children.is_empty() => {
|
||||
sections.push(section);
|
||||
GroupIntoSectionsState::NonSection
|
||||
}
|
||||
(GroupIntoSectionsState::Section(mut section), Some(row)) => {
|
||||
section.push(row);
|
||||
GroupIntoSectionsState::Section(section)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sections
|
||||
}
|
||||
|
||||
7
src/intermediate/table_group.rs
Normal file
7
src/intermediate/table_group.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
use super::ITableRow;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) enum ITableGroup {
|
||||
Head(Vec<ITableRow>),
|
||||
Body(Vec<ITableRow>),
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use organic::types::StandardProperties;
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ITarget {
|
||||
pub(crate) id: String,
|
||||
#[allow(dead_code)]
|
||||
value: String,
|
||||
pub(crate) post_blank: organic::types::PostBlank,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#![feature(let_chains)]
|
||||
#![feature(async_closure)]
|
||||
use std::process::ExitCode;
|
||||
|
||||
use clap::Parser;
|
||||
@@ -15,13 +16,11 @@ mod context;
|
||||
mod error;
|
||||
mod intermediate;
|
||||
mod render;
|
||||
mod walk_fs;
|
||||
|
||||
fn main() -> Result<ExitCode, CustomError> {
|
||||
let rt = tokio::runtime::Runtime::new()?;
|
||||
rt.block_on(async {
|
||||
let main_body_result = main_body().await;
|
||||
main_body_result
|
||||
})
|
||||
rt.block_on(async { main_body().await })
|
||||
}
|
||||
|
||||
async fn main_body() -> Result<ExitCode, CustomError> {
|
||||
|
||||
@@ -19,7 +19,7 @@ impl<'a> DusterRenderer<'a> {
|
||||
|
||||
impl<'a> RendererIntegration<'a> for DusterRenderer<'a> {
|
||||
fn load_template(&mut self, name: &'a str, contents: &'a str) -> Result<(), CustomError> {
|
||||
let compiled_template = duster::renderer::compile_template(contents.as_ref())?;
|
||||
let compiled_template = duster::renderer::compile_template(contents)?;
|
||||
self.templates.insert(name, compiled_template);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
53
src/walk_fs.rs
Normal file
53
src/walk_fs.rs
Normal file
@@ -0,0 +1,53 @@
|
||||
use std::collections::VecDeque;
|
||||
use std::ops::AsyncFn;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tokio::fs::DirEntry;
|
||||
|
||||
use crate::error::CustomError;
|
||||
|
||||
pub(crate) type WalkFsFilterResult = Result<WalkAction, CustomError>;
|
||||
|
||||
pub(crate) async fn walk_fs<P: Into<PathBuf>, F: AsyncFn(&DirEntry) -> WalkFsFilterResult>(
|
||||
root: P,
|
||||
filter: F,
|
||||
) -> Result<Vec<DirEntry>, CustomError> {
|
||||
let mut ret = Vec::new();
|
||||
let mut backlog = VecDeque::new();
|
||||
backlog.push_back(root.into());
|
||||
while let Some(p) = backlog.pop_front() {
|
||||
let mut entries = tokio::fs::read_dir(p).await?;
|
||||
while let Some(entry) = entries.next_entry().await? {
|
||||
let action = filter(&entry).await?;
|
||||
match action {
|
||||
WalkAction::HaltAndCapture => {
|
||||
ret.push(entry);
|
||||
}
|
||||
WalkAction::Halt => {}
|
||||
WalkAction::RecurseAndCapture => {
|
||||
backlog.push_back(entry.path());
|
||||
ret.push(entry);
|
||||
}
|
||||
WalkAction::Recurse => {
|
||||
backlog.push_back(entry.path());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
pub(crate) enum WalkAction {
|
||||
/// Do not walk down this path but add it to the return list.
|
||||
HaltAndCapture,
|
||||
|
||||
/// Do not walk down this path and do not add it to the return list.
|
||||
Halt,
|
||||
|
||||
/// Walk down this path and add it to the return list.
|
||||
#[allow(dead_code)]
|
||||
RecurseAndCapture,
|
||||
|
||||
/// Walk down this path but do not add it to the return list.
|
||||
Recurse,
|
||||
}
|
||||
Reference in New Issue
Block a user