Yzena
/
Yc
2
1
Fork 0
Browse Source

Move the doc scripts into Yc

Once again, it was a small repo that didn't make sense with a monorepo.

Signed-off-by: Gavin Howard <gavin@yzena.com>
afl_persistent_mode
Gavin Howard 4 months ago
parent
commit
5aedff65b3
Signed by: gavin
GPG Key ID: C08038BDF280D33E
  1. 3
      .gitmodules
  2. 1
      docs/scripts
  3. 88
      docs/tools/compress.sh
  4. 51
      docs/tools/copy_static.sh
  5. 37
      docs/tools/server.sh

3
.gitmodules vendored

@ -2,6 +2,3 @@
path = cmake
url = https://git.yzena.com/Yzena/YCMake.git
branch = master
[submodule "docs/scripts"]
path = docs/scripts
url = https://git.yzena.com/Yzena/doc_scripts.git

1
docs/scripts

@ -1 +0,0 @@
Subproject commit a20f00e7842aa2003a898075845d27f7ced1095a

88
docs/tools/compress.sh

@ -0,0 +1,88 @@
#! /bin/bash
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright 2017-2022 Yzena Tech
#
# Licensed under the Yzena Network License, Version 0.1 (the "Yzena Network
# License" or "YNL"). You may not use this file except in compliance with the
# Yzena Network License.
#
# You may obtain a copy of the Yzena Network License at
#
# https://yzena.com/yzena-network-license/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Yzena Network License is distributed under the
# following disclaimer:
#
# As far as the law allows, this software comes as is, without any
# warranty or condition, and no contributor will be liable to anyone for
# any damages related to this software or this license, under any kind of
# legal claim.
#
# ****** END LICENSE BLOCK ******
#
usage() {
printf 'usage: %s <build_directory> <docs_directory>\n' "$0"
exit 1
}
compress() {
f="$1"
zopfli "$f" --stdout > "$f.gz"
}
export -f compress
set -e
script="$0"
scriptdir=$(dirname "$script")
if [ "$#" -ge 1 ]; then
build_dir="$1"
shift
else
usage
fi
if [ "$#" -ge 1 ]; then
docs_dir="$1"
shift
else
usage
fi
if [ -f "$scriptdir/../purgecss.config.js" ]; then
printf '\nPurging CSS...'
cp "$scriptdir/../purgecss.config.js" "$docs_dir"
npx purgecss -c "purgecss.config.js" -o "$build_dir/_static"
printf 'Done\n'
fi
exts="html
css
js
ttf
woff2
atom
stl
xml
svg
eot
ico
gaml
json"
s=""
for t in $exts; do
temp=$(find $build_dir -type f -name "*.$t")
if [ "$temp" != "" ]; then
s=$(printf '%s\n%s' "$temp" "$s")
fi
done
printf '%s\n' "$s" | parallel --progress --eta -j$CORES compress

51
docs/tools/copy_static.sh

@ -0,0 +1,51 @@
#! /bin/bash
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright 2017-2022 Yzena Tech
#
# Licensed under the Yzena Network License, Version 0.1 (the "Yzena Network
# License" or "YNL"). You may not use this file except in compliance with the
# Yzena Network License.
#
# You may obtain a copy of the Yzena Network License at
#
# https://yzena.com/yzena-network-license/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Yzena Network License is distributed under the
# following disclaimer:
#
# As far as the law allows, this software comes as is, without any
# warranty or condition, and no contributor will be liable to anyone for
# any damages related to this software or this license, under any kind of
# legal claim.
#
# ****** END LICENSE BLOCK ******
#
usage() {
printf 'usage: %s <source_directory> <build_directory\n' "$0"
exit 1
}
set -e
script="$0"
scriptdir=$(dirname "$script")
if [ "$#" -ge 1 ]; then
source_dir="$1"
shift
else
usage
fi
if [ "$#" -ge 1 ]; then
build_dir="$1"
shift
else
usage
fi
cp -r "$source_dir"/_static/* "$build_dir/_static"

37
docs/tools/server.sh

@ -0,0 +1,37 @@
#! /bin/sh
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright 2017-2022 Yzena Tech
#
# Licensed under the Yzena Network License, Version 0.1 (the "Yzena Network
# License" or "YNL"). You may not use this file except in compliance with the
# Yzena Network License.
#
# You may obtain a copy of the Yzena Network License at
#
# https://yzena.com/yzena-network-license/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Yzena Network License is distributed under the
# following disclaimer:
#
# As far as the law allows, this software comes as is, without any
# warranty or condition, and no contributor will be liable to anyone for
# any damages related to this software or this license, under any kind of
# legal claim.
#
# ****** END LICENSE BLOCK ******
#
script="$0"
scriptdir=$(dirname "$script")
if [ "$#" -gt 0 ]; then
builddir="$1"
shift
else
builddir="$scriptdir/../../../build"
fi
python -m http.server --directory "$builddir/docs/sphinx/"
Loading…
Cancel
Save