5 Commits

Author SHA1 Message Date
Ulf Wiger 44c5631943 Add gmconfig:pur_update_config/3 2026-04-28 10:22:33 +02:00
uwiger b78d0a5b80 Merge pull request 'Zompify' (#3) from uw-zompify into master
Reviewed-on: #3
2026-04-20 03:55:51 +09:00
Ulf Wiger 38620ff9e2 remove post_hook 2025-05-14 22:55:22 +02:00
Ulf Wiger 18daaaa0d7 Merge branch 'uw-zompify' of https://git.qpq.swiss/QPQ-AG/gmconfig into uw-zompify 2025-05-12 23:28:04 +02:00
Ulf Wiger 4ee669ebba process plain args, update zompify.sh 2025-05-12 23:26:35 +02:00
4 changed files with 44 additions and 9 deletions
-2
View File
@@ -6,8 +6,6 @@
{setup, "2.2.1"} {setup, "2.2.1"}
]}. ]}.
{post_hooks, [{compile, "./zompify.sh"}]}.
{profiles, [ {profiles, [
{test, [{deps, [{meck, "0.9.2"}]}]} {test, [{deps, [{meck, "0.9.2"}]}]}
]}. ]}.
+7
View File
@@ -38,6 +38,7 @@
-export([update_config/1, -export([update_config/1,
update_config/2, update_config/2,
update_config/3, update_config/3,
pure_update_config/3,
silent_update_config/1, silent_update_config/1,
delete_config_value/1, delete_config_value/1,
suggest_config/2, suggest_config/2,
@@ -878,6 +879,12 @@ update_config(Map, ConfigMap, Mode) ->
pt_set_config(ConfigMap1), pt_set_config(ConfigMap1),
ok. ok.
pure_update_config(Map, ConfigMap, Schema) ->
NewCfg = gmconfig_schema_utils:merge(Map, ConfigMap, Schema),
check_validation([validate_(NewCfg, Schema)],
[NewCfg], pure_update_config, silent),
NewCfg.
export_config() -> export_config() ->
Config = pt_get_config(), Config = pt_get_config(),
JSON = json:format(Config, #{indent => 2}), JSON = json:format(Config, #{indent => 2}),
+3 -3
View File
@@ -2,10 +2,10 @@
{type,app}. {type,app}.
{modules,[]}. {modules,[]}.
{prefix,"gmconfig"}. {prefix,"gmconfig"}.
{desc,"Configuration management support"}.
{author,"Ulf Wiger"}. {author,"Ulf Wiger"}.
{package_id,{"uwiger","gmconfig",{0,1,0}}}. {desc,"Configuration management support"}.
{deps,[{"uwiger","setup",{2,2,3}}]}. {package_id,{"uwiger","gmconfig",{0,1,2}}}.
{deps,[{"uwiger","setup",{2,2,4}}]}.
{key_name,none}. {key_name,none}.
{a_email,"ulf@wiger.net"}. {a_email,"ulf@wiger.net"}.
{c_email,"ulf@wiger.net"}. {c_email,"ulf@wiger.net"}.
+34 -4
View File
@@ -2,11 +2,41 @@
set -e set -e
APP=$(basename "$PWD") APP=$(basename "$PWD")
SRC="_build/default/lib/$APP" SRC="_build/default/lib/$APP"
DST="$PWD/_build/zomp/lib/$APP" DST="$PWD/_build/zomp/lib/$APP"
IGNORE_FILE="zomp.ignore"
mkdir -p "$DST" mkdir -p "$DST"
find "$SRC" -type l ! -exec test -e {} \; -delete
cp -aR -L "$SRC/." "$DST/" # Remove broken symlinks
find "$SRC" -type l ! -exec test -e {} \; -delete || true
# Build ignore matcher
IGNORE_TEMP=$(mktemp)
trap "rm -f $IGNORE_TEMP" EXIT
# Expand globs in zomp.ignore to patterns suitable for grep
if [ -e "$IGNORE_FILE" ]; then
grep -v '^\s*#' "$IGNORE_FILE" | sed 's#/#\\/#g' | sed 's/\./\\./g' | sed 's/\*/.*/g' > "$IGNORE_TEMP"
fi
# Copy Git-tracked and Zomp-allowed files
git ls-files -z | while IFS= read -r -d '' file; do
# Skip if ignored
echo "$file" | grep -Eq -f "$IGNORE_TEMP" && continue
# Only copy if file exists in the build dir
if [ -e "$SRC/$file" ]; then
mkdir -p "$DST/$(dirname "$file")"
cp -a "$SRC/$file" "$DST/$file"
fi
done
rm "$IGNORE_TEMP"
# Copy metadata
cp "$PWD/zomp.meta" "$DST/" cp "$PWD/zomp.meta" "$DST/"
cp "$PWD/Emakefile" "$DST" cp "$PWD/Emakefile" "$DST/"
rm "$DST"/ebin/*.beam
# Clean up beam files just in case
[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true