From 710c44dceaf5f1a746c3f5f41eb415facc98c799 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 00:26:53 -0300 Subject: Add bundix Jekyll setup --- scripts/bundix-gen.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 scripts/bundix-gen.sh (limited to 'scripts') diff --git a/scripts/bundix-gen.sh b/scripts/bundix-gen.sh new file mode 100755 index 0000000..1dd303e --- /dev/null +++ b/scripts/bundix-gen.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +bundler package --no-install --path vendor +bundix -- cgit v1.2.3 From a6ae95d8bd0e9a933160fed6381b215d19d817ee Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 22:05:04 -0300 Subject: DIY Atom feed --- 404.html | 24 ------ Gemfile | 3 +- Gemfile.lock | 3 - TODOs.org | 3 +- _config.yml | 15 ++-- _includes/feed.atom | 97 ++++------------------ _layouts/default.html | 2 +- .../2018-08-01-verifying-npm-ci-reproducibility.md | 3 + ...g-youtube-dl-to-manage-youtube-subscriptions.md | 2 + _posts/2019-06-02-stateless-os.md | 2 + feed.en.atom | 3 + feed.pt.atom | 3 + gemset.nix | 11 --- pastebins.md | 2 + scripts/assert-content.sh | 85 +++++++++++++++++++ site.json | 26 ++++++ sitemap.xml | 29 +++++++ 17 files changed, 183 insertions(+), 130 deletions(-) delete mode 100644 404.html create mode 100644 feed.en.atom create mode 100644 feed.pt.atom create mode 100755 scripts/assert-content.sh create mode 100644 site.json create mode 100644 sitemap.xml (limited to 'scripts') diff --git a/404.html b/404.html deleted file mode 100644 index 1edf1a0..0000000 --- a/404.html +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: default ---- - - - -
-

404

- -

Page not found

-

Página não encontrada

-
diff --git a/Gemfile b/Gemfile index 5b81e13..3ed43f3 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,5 @@ source "https://rubygems.org" gem "jekyll" group :jekyll_plugins do - gem "jekyll-feed" - gem "jekyll-seo-tag" + gem "jekyll-seo-tag" # FIXME end diff --git a/Gemfile.lock b/Gemfile.lock index 3516df2..65a43b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,8 +27,6 @@ GEM pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-feed (0.13.0) - jekyll (>= 3.7, < 5.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) jekyll-seo-tag (2.6.1) @@ -60,7 +58,6 @@ PLATFORMS DEPENDENCIES jekyll - jekyll-feed jekyll-seo-tag BUNDLED WITH diff --git a/TODOs.org b/TODOs.org index 3b94187..8bcfd2c 100644 --- a/TODOs.org +++ b/TODOs.org @@ -1,6 +1,5 @@ * Tasks ** Spelling -** i18n Feed title ** config.yml ** kramdown -> commonmark ** https://github.com/planetjekyll/awesome-jekyll-plugins/ @@ -9,3 +8,5 @@ use subfolders? ** Fix date formatting ** add sitemap https://www.sylvaindurand.org/making-jekyll-multilingual/ +** Indent XML and HTML +** Drafts in feed diff --git a/_config.yml b/_config.yml index 2462bfd..382eec0 100644 --- a/_config.yml +++ b/_config.yml @@ -1,17 +1,14 @@ --- -title: Your awesome title -email: your-email@example.com -description: >- - Write an awesome description for your new site here. You can edit this - line in _config.yml. It will appear in your document head meta (for - Google search results) and in your feed.xml site description. -baseurl: "" -url: "url.com" +title: EuAndreh::blog +url: "https://euandre.org" +author: + name: EuAndreh + email: eu@euandre.org markdown: kramdown plugins: - - jekyll-feed - jekyll-seo-tag +# FIXME: remove plugins exclude: - Gemfile diff --git a/_includes/feed.atom b/_includes/feed.atom index 4d4fd16..f4243ea 100644 --- a/_includes/feed.atom +++ b/_includes/feed.atom @@ -1,96 +1,35 @@ - -{% if page.xsl %} - -{% endif %} - - Jekyll + + - + {{ site.time | date_to_xmlschema }} {{ page.url | absolute_url | xml_escape }} - {% assign title = site.title | default: site.name %} - {% if page.collection != "posts" %} - {% assign collection = page.collection | capitalize %} - {% assign title = title | append: " | " | append: collection %} - {% endif %} - {% if page.category %} - {% assign category = page.category | capitalize %} - {% assign title = title | append: " | " | append: category %} - {% endif %} + {{ site.title | smartify | xml_escape }} + {{ site.t.feed_title[include.lang] | smartify | xml_escape }} - {% if title %} - {{ title | smartify | xml_escape }} - {% endif %} + + {{ site.author.name | xml_escape }} + {{ site.author.email | xml_escape }} + - {% if site.description %} - {{ site.description | xml_escape }} - {% endif %} - - {% if site.author %} - - {{ site.author.name | default: site.author | xml_escape }} - {% if site.author.email %} - {{ site.author.email | xml_escape }} - {% endif %} - {% if site.author.uri %} - {{ site.author.uri | xml_escape }} - {% endif %} - - {% endif %} - - {% assign posts = site[page.collection] | where_exp: "post", "post.draft != true" | sort: "date" | reverse %} - {% if page.category %} - {% assign posts = posts | where: "category",page.category %} - {% endif %} - {% for post in posts limit: 10 %} - + {% assign posts = site.posts | where:"lang", include.lang | sort: "date" | reverse %} + {% for post in posts %} + {{ post.title | smartify | strip_html | normalize_whitespace | xml_escape }} {{ post.date | date_to_xmlschema }} - {{ post.last_modified_at | default: post.date | date_to_xmlschema }} - {{ post.id | absolute_url | xml_escape }} - {% assign excerpt_only = post.feed.excerpt_only | default: site.feed.excerpt_only %} - {% unless excerpt_only %} - {{ post.content | strip | xml_escape }} - {% endunless %} + {{ post.updated_at | default: post.date | date_to_xmlschema }} + {{ post.url | absolute_url | xml_escape }} - {% assign post_author = post.author | default: post.authors[0] | default: site.author %} - {% assign post_author = site.data.authors[post_author] | default: post_author %} - {% assign post_author_email = post_author.email | default: nil %} - {% assign post_author_uri = post_author.uri | default: nil %} - {% assign post_author_name = post_author.name | default: post_author %} + {{ post.content | strip | xml_escape }} - {{ post_author_name | default: "" | xml_escape }} - {% if post_author_email %} - {{ post_author_email | xml_escape }} - {% endif %} - {% if post_author_uri %} - {{ post_author_uri | xml_escape }} - {% endif %} + {{ site.author.name | xml_escape }} + {{ site.author.email | xml_escape }} - {% if post.category %} - - {% endif %} - - {% for tag in post.tags %} - - {% endfor %} - - {% if post.excerpt and post.excerpt != empty %} - {{ post.excerpt | strip_html | normalize_whitespace | xml_escape }} - {% endif %} - - {% assign post_image = post.image.path | default: post.image %} - {% if post_image %} - {% unless post_image contains "://" %} - {% assign post_image = post_image | absolute_url %} - {% endunless %} - - - {% endif %} + {{ post.excerpt | strip_html | normalize_whitespace | xml_escape }} {% endfor %} diff --git a/_layouts/default.html b/_layouts/default.html index 53b9830..bd253c8 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -6,7 +6,7 @@ - {%- seo -%} +
diff --git a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md index efb5fea..dcfdd75 100644 --- a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md +++ b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md @@ -2,6 +2,9 @@ title: Verifying "npm ci" reproducibility date: 2018-08-01 layout: post +lang: en +ref: veryfing-npm-ci-reproducibility +updated_at: 2019-05-22 --- When [npm\@5](https://blog.npmjs.org/post/161081169345/v500) came bringing diff --git a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md index 21b6686..b58aee9 100644 --- a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md +++ b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md @@ -2,6 +2,8 @@ title: Using "youtube-dl" to manage YouTube subscriptions date: 2018-12-21 layout: post +lang: en +ref: using-youtube-dl-to-manage-youtube-subscriptions --- I\'ve recently read the [announcement](https://www.reddit.com/r/DataHoarder/comments/9sg8q5/i_built_a_selfhosted_youtube_subscription_manager/) diff --git a/_posts/2019-06-02-stateless-os.md b/_posts/2019-06-02-stateless-os.md index 64e74f7..486a0c2 100644 --- a/_posts/2019-06-02-stateless-os.md +++ b/_posts/2019-06-02-stateless-os.md @@ -2,6 +2,8 @@ title: Using NixOS as an stateless workstation date: 2019-06-02 layout: post +lang: en +ref: stateless-os --- Last week[^1] I changed back to an old[^2] Samsung laptop, and installed [NixOS](https://nixos.org/) on it. diff --git a/feed.en.atom b/feed.en.atom new file mode 100644 index 0000000..643f557 --- /dev/null +++ b/feed.en.atom @@ -0,0 +1,3 @@ +--- +--- +{% include feed.atom lang="en" %} \ No newline at end of file diff --git a/feed.pt.atom b/feed.pt.atom new file mode 100644 index 0000000..39a9248 --- /dev/null +++ b/feed.pt.atom @@ -0,0 +1,3 @@ +--- +--- +{% include feed.atom lang="pt" %} diff --git a/gemset.nix b/gemset.nix index 23e26a2..4c38b33 100644 --- a/gemset.nix +++ b/gemset.nix @@ -103,17 +103,6 @@ }; version = "3.8.5"; }; - jekyll-feed = { - dependencies = ["jekyll"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1lx8nvkhd8l1wm3b6s506rycwbmpbzbsbjl65p21asjz6vbwf1ir"; - type = "gem"; - }; - version = "0.13.0"; - }; jekyll-sass-converter = { dependencies = ["sass"]; groups = ["default"]; diff --git a/pastebins.md b/pastebins.md index e2d95c6..24083f9 100644 --- a/pastebins.md +++ b/pastebins.md @@ -1,3 +1,5 @@ --- layout: pastebins-listing +lang: en +ref: pastebins --- diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh new file mode 100755 index 0000000..a55e9b0 --- /dev/null +++ b/scripts/assert-content.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +JSON="${1:-}" +[[ -z "${JSON}" ]] && { + echo 'Missing input JSON file.' + exit 2 +} + +contains-element() { + local e match="$1" + shift + for e; do [[ "$e" == "$match" ]] && return 0; done + return 1 +} + +fail-attr() { + ATTRIBUTE="${1}" + URL="${2}" + red "Undefined '${ATTRIBUTE}' for ${URL}." >&2 + exit 1 +} + +LANGS=(en pt) +assert-frontmatter() { + F="${1}" + LANG="$(echo "$F" | base64 --decode | jq -r .lang)" + REF="$(echo "$F" | base64 --decode | jq -r .ref)" + URL="$(echo "$F" | base64 --decode | jq -r .url)" + [[ -z "${LANG}" ]] && fail-attr 'lang' "${URL}" + [[ -z "${REF}" ]] && fail-attr 'ref' "${URL}" + set +e + contains-element "${LANG}" "${LANGS[@]}" + [[ $? != 0 ]] && { + red "Invalid lang '${LANG}' in ${URL}." >&2 + exit 1 + } + set -e + : +} + +echo Linting posts... >&2 +for post in $(jq -r '.posts[] | @base64' "${JSON}"); do + assert-frontmatter "${post}" +done + +echo Linting pages... >&2 +IGNORED_PAGES=(/site.json /sitemap.xml) +for page in $(jq -r '.pages[] | @base64' "${JSON}"); do + URL="$(echo "$page" | base64 --decode | jq -r .url)" + set +e + contains-element "${URL}" "${IGNORED_PAGES[@]}" + if [[ $? != 0 ]]; then + set -e + assert-frontmatter "${page}" + fi + set -e +done + +echo Asserting unique refs... >&2 +KNOWN_IDS=() +for page in $(jq -r '.pages[] | @base64' "${JSON}"); do + URL="$(echo "$page" | base64 --decode | jq -r .url)" + set +e + contains-element "${URL}" "${IGNORED_PAGES[@]}" + if [[ $? != 0 ]]; then + set -e + LANG="$(echo "$page" | base64 --decode | jq -r .lang)" + REF="$(echo "$page" | base64 --decode | jq -r .ref)" + ID="${LANG}:${REF}" + + set +e + contains-element "${ID}" "${KNOWN_IDS[@]}" + [[ $? == 0 ]] && { + red "Duplicated lang:ref match: '${ID}'." >&2 + exit 1 + } + set -e + + KNOWN_IDS+=("${ID}") # printf '%s\n' "${KNOWN_IDS[@]}" + fi + set -e +done + +echo Done. >&2 diff --git a/site.json b/site.json new file mode 100644 index 0000000..0920bf8 --- /dev/null +++ b/site.json @@ -0,0 +1,26 @@ +--- +--- +{ + "posts": [ + {% for post in site.posts %} + { + "title": "{{ post.title | smartify }}", + "url": "{{ post.url }}", + "lang": "{{ post.lang }}", + "ref": "{{ post.ref }}", + "content": {{ post.content | strip_html | jsonify }} + }{% unless forloop.last %},{% endunless %} + {% endfor %} + ], + "pages": [ + {% for page in site.pages %} + { + "title": "{{ page.title | smartify }}", + "url": "{{ page.url }}", + "lang": "{{ page.lang }}", + "ref": "{{ page.ref }}", + "content": {{ page.content | strip_html | jsonify }} + }{% unless forloop.last %},{% endunless %} + {% endfor %} + ] +} diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..1c17a14 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,29 @@ +--- +--- + + + {% for post in site.posts %} + + {{ site.url }}{{ post.url }} + {% assign versions=site.posts | where:"ref", post.ref %} + {% for version in versions %} + + {% endfor %} + {{ post.date | date_to_xmlschema }} + weekly + + {% endfor %} + + {% for page in site.pages %} + + {{ site.base }}{{ page.url }} + {% if page.ref != nil %} + {% assign versions=site.pages | where:"ref", page.ref %} + {% for version in versions %} + + {% endfor %} + {% endif %} + weekly + + {% endfor %} + -- cgit v1.2.3 From 97b809d4c0fe6e4b36c96ac4530266c40f0e0777 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Feb 2020 23:37:38 -0300 Subject: Test: assert date in filename matches date in frontmatter --- TODOs.org | 2 +- scripts/assert-content.sh | 42 +++++++++++++++++++++++++++++++++--------- site.json | 1 + 3 files changed, 35 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/TODOs.org b/TODOs.org index 9d354e6..67e6cd8 100644 --- a/TODOs.org +++ b/TODOs.org @@ -1,7 +1,6 @@ * Tasks ** Spelling ** config.yml -** https://github.com/planetjekyll/awesome-jekyll-plugins/ ** change file naming strategy use subfolders? ** Fix date formatting @@ -9,3 +8,4 @@ use subfolders? https://www.sylvaindurand.org/making-jekyll-multilingual/ ** Indent XML and HTML ** Drafts in feed +** Fix markdown of posts and pastebins diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index a55e9b0..3c3f0ba 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -21,12 +21,28 @@ fail-attr() { exit 1 } +get-lang() { + echo "${1}" | base64 --decode | jq -r .lang +} + +get-ref() { + echo "${1}" | base64 --decode | jq -r .ref +} + +get-url() { + echo "${1}" | base64 --decode | jq -r .url +} + +get-date() { + echo "${1}" | base64 --decode | jq -r .date +} + LANGS=(en pt) assert-frontmatter() { F="${1}" - LANG="$(echo "$F" | base64 --decode | jq -r .lang)" - REF="$(echo "$F" | base64 --decode | jq -r .ref)" - URL="$(echo "$F" | base64 --decode | jq -r .url)" + LANG="$(get-lang "$F")" + REF="$(get-ref "$F")" + URL="$(get-url "$F")" [[ -z "${LANG}" ]] && fail-attr 'lang' "${URL}" [[ -z "${REF}" ]] && fail-attr 'ref' "${URL}" set +e @@ -41,13 +57,21 @@ assert-frontmatter() { echo Linting posts... >&2 for post in $(jq -r '.posts[] | @base64' "${JSON}"); do - assert-frontmatter "${post}" + assert-frontmatter "$post" + DATE="$(get-date "$post" | awk '{print $1}')" + URL="$(basename $(get-url "$post"))" + FILE="_posts/${DATE}-${URL%.html}.md" + + [[ -f "${FILE}" ]] || { + red "date/filename mismatch: '${FILE}' does not exist." + exit 1 + } done echo Linting pages... >&2 -IGNORED_PAGES=(/site.json /sitemap.xml) +IGNORED_PAGES=(/site.json /sitemap.xml /feed.en.atom /feed.pt.atom) for page in $(jq -r '.pages[] | @base64' "${JSON}"); do - URL="$(echo "$page" | base64 --decode | jq -r .url)" + URL="$(get-url "$page")" set +e contains-element "${URL}" "${IGNORED_PAGES[@]}" if [[ $? != 0 ]]; then @@ -60,13 +84,13 @@ done echo Asserting unique refs... >&2 KNOWN_IDS=() for page in $(jq -r '.pages[] | @base64' "${JSON}"); do - URL="$(echo "$page" | base64 --decode | jq -r .url)" + URL="$(get-url "$page")" set +e contains-element "${URL}" "${IGNORED_PAGES[@]}" if [[ $? != 0 ]]; then set -e - LANG="$(echo "$page" | base64 --decode | jq -r .lang)" - REF="$(echo "$page" | base64 --decode | jq -r .ref)" + LANG="$(get-lang "$page")" + REF="$(get-ref "$page")" ID="${LANG}:${REF}" set +e diff --git a/site.json b/site.json index 0920bf8..30a7260 100644 --- a/site.json +++ b/site.json @@ -5,6 +5,7 @@ {% for post in site.posts %} { "title": "{{ post.title | smartify }}", + "date": "{{ post.date }}", "url": "{{ post.url }}", "lang": "{{ post.lang }}", "ref": "{{ post.ref }}", -- cgit v1.2.3 From 02943c8e2d96ec0534b243386f4048df3cddd24d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 6 Feb 2020 02:06:34 -0300 Subject: Assert pastebins have lang frontmatter --- scripts/assert-content.sh | 5 +++++ site.json | 12 ++++++++++++ 2 files changed, 17 insertions(+) (limited to 'scripts') diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index 3c3f0ba..94bf1b3 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -81,6 +81,11 @@ for page in $(jq -r '.pages[] | @base64' "${JSON}"); do set -e done +echo Linting pastebins... >&2 +for pastebin in $(jq -r '.pastebins[] | @base64' "${JSON}"); do + assert-frontmatter "$pastebin" +done + echo Asserting unique refs... >&2 KNOWN_IDS=() for page in $(jq -r '.pages[] | @base64' "${JSON}"); do diff --git a/site.json b/site.json index 30a7260..411a02b 100644 --- a/site.json +++ b/site.json @@ -23,5 +23,17 @@ "content": {{ page.content | strip_html | jsonify }} }{% unless forloop.last %},{% endunless %} {% endfor %} + ], + "pastebins": [ + {% for pastebin in site.pastebins %} + { + "title": "{{ pastebin.title | smartify }}", + "date": "{{ post.date }}", + "url": "{{ pastebin.url }}", + "lang": "{{ pastebin.lang }}", + "ref": "placeholder-ref", + "content": {{ pastebin.content | strip_html | jsonify }} + }{% unless forloop.last %},{% endunless %} + {% endfor %} ] } -- cgit v1.2.3 From 5e5d4ede6356f2ffce245bd17104f86709f829c3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 6 Feb 2020 02:54:48 -0300 Subject: Add feed.all.atom to IGNORED_PAGES --- TODOs.org | 1 - scripts/assert-content.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'scripts') diff --git a/TODOs.org b/TODOs.org index 9fede74..9f488db 100644 --- a/TODOs.org +++ b/TODOs.org @@ -1,6 +1,5 @@ * Tasks ** Spelling -** Assert line length ** Line number ** Feed symlinks rss.xml -> feed.en.atom diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index 94bf1b3..14fa688 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -69,7 +69,7 @@ for post in $(jq -r '.posts[] | @base64' "${JSON}"); do done echo Linting pages... >&2 -IGNORED_PAGES=(/site.json /sitemap.xml /feed.en.atom /feed.pt.atom) +IGNORED_PAGES=(/site.json /sitemap.xml /feed.all.atom /feed.en.atom /feed.pt.atom) for page in $(jq -r '.pages[] | @base64' "${JSON}"); do URL="$(get-url "$page")" set +e -- cgit v1.2.3 From 9451be4df72415352bcc7bf7eb43ec1d8011a871 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 6 Feb 2020 03:46:19 -0300 Subject: Fix shellcheck offenses --- scripts/assert-content.sh | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'scripts') diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index 14fa688..f9ea345 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -45,21 +45,17 @@ assert-frontmatter() { URL="$(get-url "$F")" [[ -z "${LANG}" ]] && fail-attr 'lang' "${URL}" [[ -z "${REF}" ]] && fail-attr 'ref' "${URL}" - set +e - contains-element "${LANG}" "${LANGS[@]}" - [[ $? != 0 ]] && { + if ! contains-element "${LANG}" "${LANGS[@]}"; then red "Invalid lang '${LANG}' in ${URL}." >&2 exit 1 - } - set -e - : + fi } echo Linting posts... >&2 for post in $(jq -r '.posts[] | @base64' "${JSON}"); do assert-frontmatter "$post" DATE="$(get-date "$post" | awk '{print $1}')" - URL="$(basename $(get-url "$post"))" + URL="$(basename "$(get-url "$post")")" FILE="_posts/${DATE}-${URL%.html}.md" [[ -f "${FILE}" ]] || { @@ -69,16 +65,12 @@ for post in $(jq -r '.posts[] | @base64' "${JSON}"); do done echo Linting pages... >&2 -IGNORED_PAGES=(/site.json /sitemap.xml /feed.all.atom /feed.en.atom /feed.pt.atom) +IGNORED_PAGES=(/site.json /sitemap.xml /rss.xml /atom.xml /feed.atom /feed.xml /feed.all.atom /feed.en.atom /feed.pt.atom) for page in $(jq -r '.pages[] | @base64' "${JSON}"); do URL="$(get-url "$page")" - set +e - contains-element "${URL}" "${IGNORED_PAGES[@]}" - if [[ $? != 0 ]]; then - set -e + if ! contains-element "${URL}" "${IGNORED_PAGES[@]}"; then assert-frontmatter "${page}" fi - set -e done echo Linting pastebins... >&2 @@ -90,25 +82,18 @@ echo Asserting unique refs... >&2 KNOWN_IDS=() for page in $(jq -r '.pages[] | @base64' "${JSON}"); do URL="$(get-url "$page")" - set +e - contains-element "${URL}" "${IGNORED_PAGES[@]}" - if [[ $? != 0 ]]; then - set -e + if ! contains-element "${URL}" "${IGNORED_PAGES[@]}"; then LANG="$(get-lang "$page")" REF="$(get-ref "$page")" ID="${LANG}:${REF}" - set +e - contains-element "${ID}" "${KNOWN_IDS[@]}" - [[ $? == 0 ]] && { + if contains-element "${ID}" "${KNOWN_IDS[@]}"; then red "Duplicated lang:ref match: '${ID}'." >&2 exit 1 - } - set -e + fi KNOWN_IDS+=("${ID}") # printf '%s\n' "${KNOWN_IDS[@]}" fi - set -e done echo Done. >&2 -- cgit v1.2.3 From 1aba532d4311d1ea819af071cc44ceb95759a51f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 6 Feb 2020 03:51:43 -0300 Subject: Setup publish environment variables --- .build.yml | 2 +- scripts/publish-env.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 scripts/publish-env.sh (limited to 'scripts') diff --git a/.build.yml b/.build.yml index 29f67a6..5e3c5bf 100644 --- a/.build.yml +++ b/.build.yml @@ -16,5 +16,5 @@ tasks: - docs: | cd website/ nix-build -A publishScript - source ./docs/env.sh + source ./scripts/publish-env.sh ./result/bin/publish.sh diff --git a/scripts/publish-env.sh b/scripts/publish-env.sh new file mode 100644 index 0000000..d5e8be2 --- /dev/null +++ b/scripts/publish-env.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +export SERVER_URL=root@euandre.org +export DOCS_SERVER_PATH="/home/user-data/www/default/" -- cgit v1.2.3