mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 11:41:02 +00:00
rust docs: add simple analytics (#1377)
* inject simple analytics * comments * fix chown * comments * doc features
This commit is contained in:
@@ -114,11 +114,30 @@ build-rustdoc:
|
|||||||
script:
|
script:
|
||||||
# FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features`
|
# FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features`
|
||||||
# FIXME: return to stable when https://github.com/rust-lang/rust/issues/96937 gets into stable
|
# FIXME: return to stable when https://github.com/rust-lang/rust/issues/96937 gets into stable
|
||||||
- time cargo doc --workspace --no-deps
|
- time cargo doc --features try-runtime,experimental --workspace --no-deps
|
||||||
- rm -f ./target/doc/.lock
|
- rm -f ./target/doc/.lock
|
||||||
- mv ./target/doc ./crate-docs
|
- mv ./target/doc ./crate-docs
|
||||||
# FIXME: remove me after CI image gets nonroot
|
# FIXME: remove me after CI image gets nonroot
|
||||||
- chown -R nonroot:nonroot ./crate-docs
|
- chown -R nonroot:nonroot ./crate-docs
|
||||||
|
# Inject Simple Analytics (https://www.simpleanalytics.com/) privacy preserving tracker into
|
||||||
|
# all .html files
|
||||||
|
- |
|
||||||
|
inject_simple_analytics() {
|
||||||
|
local path="$1"
|
||||||
|
local script_content="<script async defer src=\"https://apisa.parity.io/latest.js\"></script><noscript><img src=\"https://apisa.parity.io/latest.js\" alt=\"\" referrerpolicy=\"no-referrer-when-downgrade\" /></noscript>"
|
||||||
|
|
||||||
|
# Function that inject script into the head of an html file using sed.
|
||||||
|
process_file() {
|
||||||
|
local file="$1"
|
||||||
|
echo "Adding Simple Analytics script to $file"
|
||||||
|
sed -i "s|</head>|$script_content</head>|" "$file"
|
||||||
|
}
|
||||||
|
export -f process_file
|
||||||
|
|
||||||
|
# Modify .html files in parallel using xargs, otherwise it can take a long time.
|
||||||
|
find "$path" -name '*.html' | xargs -I {} -P "$(nproc)" bash -c 'process_file "$@"' _ {}
|
||||||
|
}
|
||||||
|
inject_simple_analytics "./crate-docs"
|
||||||
- echo "<meta http-equiv=refresh content=0;url=polkadot_service/index.html>" > ./crate-docs/index.html
|
- echo "<meta http-equiv=refresh content=0;url=polkadot_service/index.html>" > ./crate-docs/index.html
|
||||||
|
|
||||||
build-implementers-guide:
|
build-implementers-guide:
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
# This script manages the deployment of Substrate rustdocs to https://paritytech.github.io/substrate/.
|
# This script used to manage the deployment of Substrate rustdocs to https://paritytech.github.io/substrate/.
|
||||||
|
# It is no longer used anywhere, and only here for historical/demonstration purposes.
|
||||||
# - With `deploy` sub-command, it will checkout the passed-in branch/tag ref, build the rustdocs
|
# - With `deploy` sub-command, it will checkout the passed-in branch/tag ref, build the rustdocs
|
||||||
# locally (this takes some time), update the `index.html` index page, and push it to remote
|
# locally (this takes some time), update the `index.html` index page, and push it to remote
|
||||||
# `gh-pages` branch. So users running this command need to have write access to the remote
|
# `gh-pages` branch. So users running this command need to have write access to the remote
|
||||||
|
|||||||
Reference in New Issue
Block a user