Use git for versioning not folder names

This commit is contained in:
ChillerDragon 2023-09-17 17:31:10 +02:00
parent 177921fd5f
commit 9a276526ef
25 changed files with 9 additions and 31 deletions

View file

@ -38,4 +38,4 @@ client.connect('localhost', 8303, detach: false)
## Documentation
Checkout [docs/v0.0.1/READE.md](docs/v0.0.1/README.md) for a full library documentation.
Checkout [docs/READE.md](docs/README.md) for a full library documentation.

View file

@ -150,15 +150,8 @@ function check_file() {
local ruby_file="$2"
local hooks
local hook
local version
local got_err=0
version="$(grep TEEWORLDS_NETWORK_VERSION lib/version.rb | cut -d"'" -f2)"
hooks="$(get_hooks "$ruby_file")"
if [ "$version" == "" ]
then
echo "Error: failed to get library version"
exit 1
fi
# self testing the test
# if the test finds no hooks the test is wrong not the code
@ -175,7 +168,7 @@ function check_file() {
echo -n "[*] checking hook: $hook"
# check documentation
local mdfile
mdfile="docs/$version/classes/$ruby_class.md"
mdfile="docs/classes/$ruby_class.md"
if [ ! -f "$mdfile" ]
then
echo "ERROR: documentation not found $mdfile"

View file

@ -19,7 +19,6 @@ done
function missing_doc() {
local rb_file="$1"
local version="$2"
local line
local ifs="$IFS"
local dir=''
@ -65,7 +64,7 @@ function missing_doc() {
fi
done < "$rb_file"
IFS="$ifs"
dst_file="docs/$version/classes/messages/$class_name.md"
dst_file="docs/classes/messages/$class_name.md"
if [ -f "$dst_file" ]
then
return 1
@ -85,18 +84,11 @@ function missing_doc() {
}
function generate_msg_docs() {
local version
version="$(grep TEEWORLDS_NETWORK_VERSION lib/version.rb | cut -d"'" -f2)"
if [ "$version" == "" ]
then
echo "Error: failed to get library version"
exit 1
fi
local rb_file
for rb_file in ./lib/messages/*.rb
do
echo -n "[*] $(basename "$rb_file") .. "
if missing_doc "$rb_file" "$version"
if missing_doc "$rb_file"
then
echo "ERROR: missing doc try --fix"
else

View file

@ -41,16 +41,16 @@ function print_instance_methods() {
hook_slug="${hook_slug%%\?*}"
echo ""
echo "[#$hook](classes/$class.md#$hook_slug)"
done < <(grep '### <a name="' "docs/$version/classes/$class.md" | cut -d'#' -f5)
done < <(grep '### <a name="' "docs/classes/$class.md" | cut -d'#' -f5)
}
function list_classes() {
local class_path
local class_name
for class_path in ./docs/"$version"/classes/*.md
for class_path in ./docs/classes/*.md
do
class_name="$(basename "$class_path" .md)"
class_path="$(echo "$class_path" | cut -d'/' -f4-)"
class_path="$(echo "$class_path" | cut -d'/' -f3-)"
{
echo ""
echo "### [$class_name]($class_path)"
@ -60,7 +60,7 @@ function list_classes() {
}
function check_diff_or_fix() {
local index_file="docs/$version/README.md"
local index_file="docs/README.md"
if [ ! -f "$index_file" ]
then
echo "Error: missing index file $index_file"

View file

@ -11,13 +11,6 @@ tmpdir=scripts/tmp
mkdir -p scripts/tmp
tmpfile="$tmpdir/README.md"
version="$(grep TEEWORLDS_NETWORK_VERSION lib/version.rb | cut -d"'" -f2)"
if [ "$version" == "" ]
then
echo "Error: failed to get library version"
exit 1
fi
arg_generate_docs=0
for arg in "$@"
@ -138,7 +131,7 @@ function check_diff_or_fix() {
}
function main() {
gen_class_methods TeeworldsClient ./lib/teeworlds_client.rb ./docs/"$version"/classes/TeeworldsClient.md
gen_class_methods TeeworldsClient ./lib/teeworlds_client.rb ./docs/classes/TeeworldsClient.md
}
main