Use git for versioning not folder names
This commit is contained in:
parent
177921fd5f
commit
9a276526ef
|
@ -38,4 +38,4 @@ client.connect('localhost', 8303, detach: false)
|
||||||
|
|
||||||
## Documentation
|
## 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.
|
||||||
|
|
|
@ -150,15 +150,8 @@ function check_file() {
|
||||||
local ruby_file="$2"
|
local ruby_file="$2"
|
||||||
local hooks
|
local hooks
|
||||||
local hook
|
local hook
|
||||||
local version
|
|
||||||
local got_err=0
|
local got_err=0
|
||||||
version="$(grep TEEWORLDS_NETWORK_VERSION lib/version.rb | cut -d"'" -f2)"
|
|
||||||
hooks="$(get_hooks "$ruby_file")"
|
hooks="$(get_hooks "$ruby_file")"
|
||||||
if [ "$version" == "" ]
|
|
||||||
then
|
|
||||||
echo "Error: failed to get library version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# self testing the test
|
# self testing the test
|
||||||
# if the test finds no hooks the test is wrong not the code
|
# 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"
|
echo -n "[*] checking hook: $hook"
|
||||||
# check documentation
|
# check documentation
|
||||||
local mdfile
|
local mdfile
|
||||||
mdfile="docs/$version/classes/$ruby_class.md"
|
mdfile="docs/classes/$ruby_class.md"
|
||||||
if [ ! -f "$mdfile" ]
|
if [ ! -f "$mdfile" ]
|
||||||
then
|
then
|
||||||
echo "ERROR: documentation not found $mdfile"
|
echo "ERROR: documentation not found $mdfile"
|
||||||
|
|
|
@ -19,7 +19,6 @@ done
|
||||||
|
|
||||||
function missing_doc() {
|
function missing_doc() {
|
||||||
local rb_file="$1"
|
local rb_file="$1"
|
||||||
local version="$2"
|
|
||||||
local line
|
local line
|
||||||
local ifs="$IFS"
|
local ifs="$IFS"
|
||||||
local dir=''
|
local dir=''
|
||||||
|
@ -65,7 +64,7 @@ function missing_doc() {
|
||||||
fi
|
fi
|
||||||
done < "$rb_file"
|
done < "$rb_file"
|
||||||
IFS="$ifs"
|
IFS="$ifs"
|
||||||
dst_file="docs/$version/classes/messages/$class_name.md"
|
dst_file="docs/classes/messages/$class_name.md"
|
||||||
if [ -f "$dst_file" ]
|
if [ -f "$dst_file" ]
|
||||||
then
|
then
|
||||||
return 1
|
return 1
|
||||||
|
@ -85,18 +84,11 @@ function missing_doc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_msg_docs() {
|
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
|
local rb_file
|
||||||
for rb_file in ./lib/messages/*.rb
|
for rb_file in ./lib/messages/*.rb
|
||||||
do
|
do
|
||||||
echo -n "[*] $(basename "$rb_file") .. "
|
echo -n "[*] $(basename "$rb_file") .. "
|
||||||
if missing_doc "$rb_file" "$version"
|
if missing_doc "$rb_file"
|
||||||
then
|
then
|
||||||
echo "ERROR: missing doc try --fix"
|
echo "ERROR: missing doc try --fix"
|
||||||
else
|
else
|
||||||
|
|
|
@ -41,16 +41,16 @@ function print_instance_methods() {
|
||||||
hook_slug="${hook_slug%%\?*}"
|
hook_slug="${hook_slug%%\?*}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "[#$hook](classes/$class.md#$hook_slug)"
|
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() {
|
function list_classes() {
|
||||||
local class_path
|
local class_path
|
||||||
local class_name
|
local class_name
|
||||||
for class_path in ./docs/"$version"/classes/*.md
|
for class_path in ./docs/classes/*.md
|
||||||
do
|
do
|
||||||
class_name="$(basename "$class_path" .md)"
|
class_name="$(basename "$class_path" .md)"
|
||||||
class_path="$(echo "$class_path" | cut -d'/' -f4-)"
|
class_path="$(echo "$class_path" | cut -d'/' -f3-)"
|
||||||
{
|
{
|
||||||
echo ""
|
echo ""
|
||||||
echo "### [$class_name]($class_path)"
|
echo "### [$class_name]($class_path)"
|
||||||
|
@ -60,7 +60,7 @@ function list_classes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_diff_or_fix() {
|
function check_diff_or_fix() {
|
||||||
local index_file="docs/$version/README.md"
|
local index_file="docs/README.md"
|
||||||
if [ ! -f "$index_file" ]
|
if [ ! -f "$index_file" ]
|
||||||
then
|
then
|
||||||
echo "Error: missing index file $index_file"
|
echo "Error: missing index file $index_file"
|
||||||
|
|
|
@ -11,13 +11,6 @@ tmpdir=scripts/tmp
|
||||||
mkdir -p scripts/tmp
|
mkdir -p scripts/tmp
|
||||||
tmpfile="$tmpdir/README.md"
|
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
|
arg_generate_docs=0
|
||||||
|
|
||||||
for arg in "$@"
|
for arg in "$@"
|
||||||
|
@ -138,7 +131,7 @@ function check_diff_or_fix() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
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
|
main
|
||||||
|
|
Loading…
Reference in a new issue