Update README.md with latest json schema (automated)
This commit is contained in:
parent
34f3c93aaa
commit
968f9d92f2
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
BUILD="_build/default/lib/gmhive_client"
|
||||||
|
SCHEMA_OUT=$(BUILD)/priv/gmhc_schema.json
|
||||||
|
|
||||||
|
schema:
|
||||||
|
ERL_LIBS=_build/default/lib \
|
||||||
|
erl -run gmhc_config_schema export $(SCHEMA_OUT) -run init stop
|
||||||
|
scripts/update_readme_json.sh README.md $(SCHEMA_OUT)
|
||||||
|
|
||||||
|
|
||||||
12
README.md
12
README.md
@ -155,6 +155,16 @@ server. (For `"testnet"` this will be `"test.gajumining.com"`.)
|
|||||||
"pattern": "^ak_[1-9A-HJ-NP-Za-km-z]*$",
|
"pattern": "^ak_[1-9A-HJ-NP-Za-km-z]*$",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"report": {
|
||||||
|
"default": "silent",
|
||||||
|
"description": "Progress reporting",
|
||||||
|
"enum": [
|
||||||
|
"debug",
|
||||||
|
"progress",
|
||||||
|
"silent"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"default": "worker",
|
"default": "worker",
|
||||||
"description": "monitor mode can be used to see if a pool is alive",
|
"description": "monitor mode can be used to see if a pool is alive",
|
||||||
@ -174,7 +184,7 @@ server. (For `"testnet"` this will be `"test.gajumining.com"`.)
|
|||||||
"properties": {
|
"properties": {
|
||||||
"executable": {
|
"executable": {
|
||||||
"default": "mean29-generic",
|
"default": "mean29-generic",
|
||||||
"description": "Executable binary of the worker. Can be a fully qualified path, but the software may apply default logic to locate a plain basename.",
|
"description": "Executable binary of the worker. Can be a fully qualified path, \nbut the software may apply default logic to locate a plain basename.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"extra_args": {
|
"extra_args": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{application,gmhive_client,
|
{application,gmhive_client,
|
||||||
[{description,"Gajumaru Hive Client"},
|
[{description,"Gajumaru Hive Client"},
|
||||||
{vsn,"0.6.2"},
|
{vsn,"0.6.3"},
|
||||||
{registered,[]},
|
{registered,[]},
|
||||||
{applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise,
|
{applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise,
|
||||||
gmconfig,gmhive_protocol,gmhive_worker]},
|
gmconfig,gmhive_protocol,gmhive_worker]},
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
{plugins, [rebar3_hex]}.
|
{plugins, [rebar3_hex]}.
|
||||||
|
|
||||||
|
{post_hooks, [{compile, "make schema"}]}.
|
||||||
|
|
||||||
{deps, [
|
{deps, [
|
||||||
{enoise, {git, "https://git.qpq.swiss/QPQ-AG/enoise.git", {ref, "029292817e"}}},
|
{enoise, {git, "https://git.qpq.swiss/QPQ-AG/enoise.git", {ref, "029292817e"}}},
|
||||||
{gmhive_protocol,
|
{gmhive_protocol,
|
||||||
|
|||||||
51
scripts/update_readme_json.sh
Executable file
51
scripts/update_readme_json.sh
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
README="$1"
|
||||||
|
SCHEMA="$2"
|
||||||
|
|
||||||
|
if [[ ! -f "$README" || ! -f "$SCHEMA" ]]; then
|
||||||
|
echo "Usage: $0 README.md schema.json"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmpfile=$(mktemp)
|
||||||
|
|
||||||
|
awk -v schema_file="$SCHEMA" '
|
||||||
|
BEGIN {
|
||||||
|
in_json_block = 0
|
||||||
|
in_schema_section = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/^##[[:space:]]+JSON[[:space:]]+Schema/ {
|
||||||
|
in_schema_section = 1
|
||||||
|
print
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
/^##[[:space:]]+/ && in_schema_section {
|
||||||
|
# Another section starts, end the schema section
|
||||||
|
in_schema_section = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
in_schema_section && /^```json/ {
|
||||||
|
print "```json"
|
||||||
|
while ((getline line < schema_file) > 0) print line
|
||||||
|
close(schema_file)
|
||||||
|
in_json_block = 1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
in_json_block && /^```$/ {
|
||||||
|
print "```"
|
||||||
|
in_json_block = 0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
!(in_schema_section && in_json_block) {
|
||||||
|
print
|
||||||
|
}
|
||||||
|
' "$README" > "$tmpfile"
|
||||||
|
|
||||||
|
mv "$tmpfile" "$README"
|
||||||
|
echo "✅ Updated JSON schema block in $README"
|
||||||
@ -2,7 +2,8 @@
|
|||||||
-vsn("0.6.1").
|
-vsn("0.6.1").
|
||||||
|
|
||||||
-export([ schema/0
|
-export([ schema/0
|
||||||
, to_json/0 ]).
|
, to_json/0
|
||||||
|
, export/1 ]).
|
||||||
|
|
||||||
-import(gmconfig_schema_helpers,
|
-import(gmconfig_schema_helpers,
|
||||||
[ str/1
|
[ str/1
|
||||||
@ -22,6 +23,17 @@
|
|||||||
to_json() ->
|
to_json() ->
|
||||||
json:encode(schema()).
|
json:encode(schema()).
|
||||||
|
|
||||||
|
export(ToFile) ->
|
||||||
|
case file:open(ToFile, [write]) of
|
||||||
|
{ok, Fd} ->
|
||||||
|
try ok = io:put_chars(Fd, json:format(schema(), #{indent => 4}))
|
||||||
|
after
|
||||||
|
file:close(Fd)
|
||||||
|
end;
|
||||||
|
{error, _} = Error ->
|
||||||
|
Error
|
||||||
|
end.
|
||||||
|
|
||||||
schema() ->
|
schema() ->
|
||||||
obj(schema_init(),
|
obj(schema_init(),
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
{name,"gmhive_client"}.
|
{name,"gmhive_client"}.
|
||||||
{type,app}.
|
{type,app}.
|
||||||
{modules,[]}.
|
{modules,[]}.
|
||||||
{author,"Ulf Wiger, QPQ AG"}.
|
|
||||||
{prefix,"gmhc"}.
|
{prefix,"gmhc"}.
|
||||||
{desc,"Gajumaru Hive Client"}.
|
{desc,"Gajumaru Hive Client"}.
|
||||||
{package_id,{"uwiger","gmhive_client",{0,6,2}}}.
|
{author,"Ulf Wiger, QPQ AG"}.
|
||||||
|
{package_id,{"uwiger","gmhive_client",{0,6,3}}}.
|
||||||
{deps,[{"uwiger","gmhive_worker",{0,5,1}},
|
{deps,[{"uwiger","gmhive_worker",{0,5,1}},
|
||||||
{"uwiger","gmcuckoo",{1,2,4}},
|
{"uwiger","gmcuckoo",{1,2,4}},
|
||||||
{"otpr","eblake2",{1,0,1}},
|
{"otpr","eblake2",{1,0,1}},
|
||||||
|
|||||||
@ -38,5 +38,12 @@ rm "$IGNORE_TEMP"
|
|||||||
cp "$PWD/zomp.meta" "$DST/"
|
cp "$PWD/zomp.meta" "$DST/"
|
||||||
cp "$PWD/Emakefile" "$DST/"
|
cp "$PWD/Emakefile" "$DST/"
|
||||||
|
|
||||||
|
# copy generated schema
|
||||||
|
SCHEMA="$SRC/priv/gmhc_schema.json"
|
||||||
|
if [ -e "$SCHEMA" ]; then
|
||||||
|
mkdir -p "$DST/priv"
|
||||||
|
cp -a "$SCHEMA" "$DST/priv/$(basename "$SCHEMA")"
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean up beam files just in case
|
# Clean up beam files just in case
|
||||||
[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true
|
[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user