mirror of
https://github.com/EvernodeXRPL/hp-devkit.git
synced 2026-04-29 15:37:58 +00:00
Added new contract templates (#31)
This commit is contained in:
@@ -8,6 +8,7 @@ network=$NETWORK
|
||||
container_prefix=$CONTAINER_PREFIX
|
||||
volume_mount=$VOLUME_MOUNT
|
||||
bundle_mount=$BUNDLE_MOUNT
|
||||
disparate_dir=$DISPARATE_DIR
|
||||
hotpocket_image=$HOTPOCKET_IMAGE
|
||||
config_overrides_file=$CONFIG_OVERRIDES_FILE
|
||||
user_port_begin=$HP_USER_PORT_BEGIN
|
||||
@@ -274,9 +275,13 @@ function attach_logs {
|
||||
function sync_instance {
|
||||
local node=$1
|
||||
local contract_dir=$(contract_dir_mount_path $node)
|
||||
rm -rf $contract_dir/ledger_fs/* $contract_dir/contract_fs/*
|
||||
rm -rf $contract_dir/ledger_fs/* $contract_dir/contract_fs/*
|
||||
mkdir -p $contract_dir/contract_fs/seed
|
||||
cp -r $bundle_mount $contract_dir/contract_fs/seed/state
|
||||
[ -d $contract_dir/contract_fs/seed/state/$disparate_dir ] && rm -r $contract_dir/contract_fs/seed/state/$disparate_dir
|
||||
|
||||
# Copy non-syncable files if exist.
|
||||
[ -d "$bundle_mount/$disparate_dir/$i" ] && cp -r "$bundle_mount/$disparate_dir/$i/." "$contract_dir/contract_fs/seed/"
|
||||
|
||||
# Merge contract config overrides.
|
||||
local cfg_file=$contract_dir/cfg/hp.cfg
|
||||
|
||||
@@ -18,8 +18,8 @@ fi
|
||||
|
||||
[ ! -d $templates_dir/$platform ] && echo "Invalid platform '$platform' specified." && exit 1
|
||||
[ ! -d $templates_dir/$platform/$apptype ] && echo "Invalid application type '$apptype' specified." && exit 1
|
||||
if ! [[ "$projname" =~ ^[a-z][a-z0-9_-]*$ ]]; then
|
||||
echo "Invalid project name. Must be lowercase. Must start with a letter. Can only contain letters, numbers, dash and underscore."
|
||||
if ! [[ "$projname" =~ ^[a-z][a-z0-9_]*$ ]]; then
|
||||
echo "Invalid project name. Must be lowercase. Must start with a letter. Can only contain letters, numbers, and underscore."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
26
docker/scripts/templates.sh
Normal file
26
docker/scripts/templates.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
cmd=$1
|
||||
|
||||
templates_dir="/code-templates"
|
||||
usage="Usage:
|
||||
\nlist <platform>"
|
||||
|
||||
if [ "$cmd" = "list" ]; then
|
||||
platform=$2
|
||||
|
||||
if [ ! -z $platform ]; then
|
||||
platforms=("$templates_dir/$platform")
|
||||
else
|
||||
platforms="$templates_dir/*"
|
||||
fi
|
||||
|
||||
for p in $platforms; do
|
||||
[ ! -d "$p" ] && echo "There are no templates for platform: ${p##*/}." && exit 0
|
||||
echo "$(tput bold)PLATFORM: ${p##*/}$(tput sgr0)"
|
||||
for t in $(ls -1 "$p"); do
|
||||
echo " $t"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user