diff --git a/exporters/11ty.yaml b/exporters/11ty.yaml index a14ae84..42badfc 100644 --- a/exporters/11ty.yaml +++ b/exporters/11ty.yaml @@ -6,5 +6,5 @@ data: in: projects/ work: - - log: [Exporting, cyan, '{{if .Verbose}}{{.Work.ID}} for 11ty to [bold]{{ index .Data "in" }}/{{.Work.ID}}.11tydata.json[reset]{{end}}'] - - run: echo {{ .Work | json | escape }} > {{ index .Data "in" }}/{{.Work.ID}}.11tydata.json + - log: [Exporting, cyan, '{{if .Verbose}}{{.Work.ID}} for 11ty to [bold]{{ .Data.in }}/{{.Work.ID}}.11tydata.json[reset]{{end}}'] + - run: echo {{ .Work | json | escape }} > {{ .Data.in }}/{{.Work.ID}}.11tydata.json diff --git a/exporters/cloud.yaml b/exporters/cloud.yaml index dd3fe44..547b539 100644 --- a/exporters/cloud.yaml +++ b/exporters/cloud.yaml @@ -16,12 +16,12 @@ data: remotes: after: - - log: [Uploading, blue, '{{ .Ctx.OutputDatabaseFile }} to{{ range $remote := (index .Data "remotes") }} {{$remote}}:{{ index $.Data "path" }}/{{ index $.Data "name" }}, {{ end }}[dim]with rclone'] + - log: [Uploading, blue, '{{ .Ctx.OutputDatabaseFile }} to{{ range $remote := .Data.remotes }} {{$remote}}:{{ $.Data.path }}/{{ $.Data.name }}, {{ end }}[dim]with rclone'] - run: mkdir -p .ortfo-cloud-exporter-tmp - - run: cp {{ $.Ctx.OutputDatabaseFile }} .ortfo-cloud-exporter-tmp/{{ index $.Data "name" }} + - run: cp {{ $.Ctx.OutputDatabaseFile }} .ortfo-cloud-exporter-tmp/{{ $.Data.name }} - run: >- - {{ range $remote := (index .Data "remotes") }} - rclone copy --progress .ortfo-cloud-exporter-tmp/{{ index $.Data "name" }} {{$remote}}:{{ index $.Data "path" }} + {{ range $remote := .Data.remotes }} + rclone copy --progress .ortfo-cloud-exporter-tmp/{{ $.Data.name }} {{$remote}}:{{ $.Data.path }} {{ end }} - - run: rm .ortfo-cloud-exporter-tmp/{{ index $.Data "name" }} + - run: rm .ortfo-cloud-exporter-tmp/{{ $.Data.name }} - run: rmdir .ortfo-cloud-exporter-tmp diff --git a/exporters/copy.yaml b/exporters/copy.yaml index 2194cda..3dc1982 100644 --- a/exporters/copy.yaml +++ b/exporters/copy.yaml @@ -5,8 +5,8 @@ data: paths: [] after: - - log: [Copying, cyan, 'database to [bold]{{ index .Data "paths" | join ", " }}[reset]'] + - log: [Copying, cyan, 'database to [bold]{{ .Data.paths | join ", " }}[reset]'] - run: >- - {{ range $path := index .Data "paths" }} + {{ range $path := .Data.paths }} cp {{ if $.Verbose}}-v{{end}} {{ $.Ctx.OutputDatabaseFile }} {{$path}} {{ end }} diff --git a/exporters/ftp.yaml b/exporters/ftp.yaml index 12d0ea7..2b18fc4 100644 --- a/exporters/ftp.yaml +++ b/exporters/ftp.yaml @@ -14,8 +14,8 @@ data: dry run: false after: - - log: [Uploading, blue, '{{ .Ctx.OutputDatabaseFile }} to {{if (index .Data "secure")}}s{{end}}ftp://{{ index .Data "host" }}/{{ index .Data "path" }}'] + - log: [Uploading, blue, '{{ .Ctx.OutputDatabaseFile }} to {{if .Data.secure}}s{{end}}ftp://{{ .Data.host }}/{{ .Data.path }}'] - run: >- {{if .DryRun}} echo {{end}} curl -T {{ .Ctx.OutputDatabaseFile }} - {{if (index .Data "secure")}}sftp://{{else}}ftp://{{end}}{{index .Data "username"}}:{{index .Data "password"}}@{{ index .Data "host" }}/{{ index .Data "path" }} + {{if .Data.secure}}sftp://{{else}}ftp://{{end}}{{.Data.username}}:{{.Data.password}}@{{ .Data.host }}/{{ .Data.path }} diff --git a/exporters/git.yaml b/exporters/git.yaml index 63752f9..9c403f4 100644 --- a/exporters/git.yaml +++ b/exporters/git.yaml @@ -29,12 +29,12 @@ data: after: # - run: test ! -d .ortfodb-tmp || echo .ortfodb-tmp exists, please remove it >&2; exit 1 - - log: [Cloning, blue, 'repository {{ index .Data "url" }}'] - - run: git clone {{ index .Data "git_clone_flags" }} {{ index .Data "url" }} .ortfodb-tmp + - log: [Cloning, blue, 'repository {{ .Data.url }}'] + - run: git clone {{ .Data.git_clone_flags }} {{ .Data.url }} .ortfodb-tmp - log: [Comitting, blue, "{{ .Ctx.OutputDatabaseFile }} to the repository"] - - run: cp {{ .Ctx.OutputDatabaseFile }} .ortfodb-tmp/{{ index .Data "path" }} - - run: cd .ortfodb-tmp && git add {{ index .Data "git_add_flags" }} {{ index .Data "path" }} && git commit {{ index .Data "git_commit_flags" }} -m '{{ index .Data "commit" }}' + - run: cp {{ .Ctx.OutputDatabaseFile }} .ortfodb-tmp/{{ .Data.path }} + - run: cd .ortfodb-tmp && git add {{ .Data.git_add_flags }} {{ .Data.path }} && git commit {{ .Data.git_commit_flags }} -m '{{ .Data.commit }}' - log: [Pushing, blue, "changes to the repository"] - - run: cd .ortfodb-tmp && git push {{ index .Data "git_push_flags" }} + - run: cd .ortfodb-tmp && git push {{ .Data.git_push_flags }} - log: [Cleaning up, dim, ".ortfodb-tmp directory"] - run: rm -rf .ortfodb-tmp diff --git a/exporters/hugo.yaml b/exporters/hugo.yaml index 592f40f..3191627 100644 --- a/exporters/hugo.yaml +++ b/exporters/hugo.yaml @@ -9,12 +9,12 @@ data: index: index.json before: - - run: mkdir -p {{ index .Data "in" }} + - run: mkdir -p {{ .Data.in }} work: - - log: [Exporting, cyan, '{{if .Verbose}}{{.Work.ID}} for Hugo to [bold]{{ index .Data "in" }}/{{.Work.ID}}.json[reset]{{end}}'] - - run: echo {{ .Work | json | escape }} > {{ index .Data "in" }}/{{.Work.ID}}.json + - log: [Exporting, cyan, '{{if .Verbose}}{{.Work.ID}} for Hugo to [bold]{{ .Data.in }}/{{.Work.ID}}.json[reset]{{end}}'] + - run: echo {{ .Work | json | escape }} > {{ .Data.in }}/{{.Work.ID}}.json after: - - log: [Exporting, cyan, '{{ if .Verbose}}Index database to {{ index .Data "in" | splitList "/" | first }}/{{ index .Data "index" }}{{ end }}'] - - run: echo {{ .Database.AsSlice | json | escape }} > {{ index .Data "in" | splitList "/" | first }}/{{ index .Data "index" }} + - log: [Exporting, cyan, '{{ if .Verbose}}Index database to {{ .Data.in | splitList "/" | first }}/{{ .Data.index }}{{ end }}'] + - run: echo {{ .Database.AsSlice | json | escape }} > {{ .Data.in | splitList "/" | first }}/{{ .Data.index }} diff --git a/exporters/ssh.yaml b/exporters/ssh.yaml index 43de36b..5f1cc12 100644 --- a/exporters/ssh.yaml +++ b/exporters/ssh.yaml @@ -18,12 +18,12 @@ after: - log: - Uploading - blue - - '{{ .Ctx.OutputDatabaseFile }} to [bold]{{ index .Data "ssh" }} [dim]using{{ if (index .Data "rsync") }} rsync {{ else }} scp {{ end }} [reset]' + - '{{ .Ctx.OutputDatabaseFile }} to [bold]{{ .Data.ssh }} [dim]using{{ if .Data.rsync }} rsync {{ else }} scp {{ end }} [reset]' - run: >- {{ $from := .Ctx.OutputDatabaseFile }} - {{ $to := index .Data "ssh" }} + {{ $to := .Data.ssh }} {{ if .DryRun }} echo {{end}} - {{ if (index .Data "rsync") }} + {{ if .Data.rsync }} rsync -r --info=progress {{$from}} {{$to}} {{ else }} scp {{$from}} {{$to}} diff --git a/exporters/webhook.yaml b/exporters/webhook.yaml index 7e8b55a..6b66f3d 100644 --- a/exporters/webhook.yaml +++ b/exporters/webhook.yaml @@ -16,7 +16,7 @@ after: - Triggering - cyan - 'webhook [bold]{{ - index .Data "url" + .Data.url | trimPrefix "http://" | trimPrefix "https://" }}[reset]' @@ -25,7 +25,7 @@ after: curl -X POST {{if not .Verbose }} -sS {{ end }} -d @{{ .Ctx.OutputDatabaseFile }} - {{ range $name, $value := (index .Data "headers") }} + {{ range $name, $value := .Data.headers }} -H "{{ $name }}: {{ $value }}" {{ end }} - {{ index .Data "url" }} + {{ .Data.url }}