From 9ad89e46a4e7106c25f3926c436b6137e7473f46 Mon Sep 17 00:00:00 2001 From: DAC Date: Sun, 9 May 2021 11:45:59 -0400 Subject: [PATCH] TAG --- bin/evalxtnode | 5 +++-- bin/xtnode.js | 12 +++++++++++- bin/xtnodegit | 6 ++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 bin/xtnodegit diff --git a/bin/evalxtnode b/bin/evalxtnode index b8251f6..31a5b13 100644 --- a/bin/evalxtnode +++ b/bin/evalxtnode @@ -2,10 +2,11 @@ xtnodecmd () { RUN_EP=$1; shift; RUN_NAME=${RUN_NAME:-"XTNODE_`date +%s`"}; RUN_TYPE=${RUN_TYPE:-'--rm'}; + MAPAPP=${MAPAPP:-$PWD}; HOST=${HOST:-'127.0.0.1'}; PORT=${PORT:-'80'}; LOGLEVEL=${LOGLEVEL:-'debug'}; - docker run -it --init $RUN_TYPE --name $RUN_NAME -v $PWD:/app --env LOGLEVEL=$LOGLEVEL --env HOST=0.0.0.0 --env PORT=9 -p $HOST:$PORT:9 --entrypoint $RUN_EP cogsmith/xtnode $@; + docker run -it --init $RUN_TYPE --name $RUN_NAME -v $MAPAPP:/app --env LOGLEVEL=$LOGLEVEL --env HOST=0.0.0.0 --env PORT=9 -p $HOST:$PORT:9 --entrypoint $RUN_EP cogsmith/xtnode $@; unset RUN_EP RUN_NAME; }; @@ -23,4 +24,4 @@ alias xtnodeuninstall='docker update --restart no'; alias xtnodedebug='echo ; echo XTNODE=`xtnode version` ; echo HOST=$HOST ; echo PORT=$PORT ; echo ; LOGLEVEL=debug ; xtnode'; alias xtnodetrace='echo ; echo XTNODE=`xtnode version` ; echo HOST=$HOST ; echo PORT=$PORT ; echo ; LOGLEVEL=trace ; xtnode'; alias xtnodeversion='docker run --rm cogsmith/xtnode version'; -alias xtnodegit='xtnodecmd xtnodegit'; \ No newline at end of file +alias xtnodegit='mkdir /tmp/null 2>/dev/null ; MAPAPP=/tmp/null ; xtnodecmd xtnodegit'; \ No newline at end of file diff --git a/bin/xtnode.js b/bin/xtnode.js index 0c21957..c9531c4 100644 --- a/bin/xtnode.js +++ b/bin/xtnode.js @@ -10,12 +10,22 @@ console.log({ NODEBIN: nodebin, NODEAPP: nodeapp, ARGS: args }); if (false) { } else if (args[0] == 'version' || args[1] == 'version') { console.log(XT.Meta.Version); + return; } else if (args[0] == 'evalxtnode' || args[1] == 'evalxtnode') { let evalxtnode = fs.readFileSync('/bin/evalxtnode').toString(); console.log(evalxtnode); + return; } -else if (fs.existsSync('/app/app.js')) { +else if (args[0] == 'xtnodegit' || args[1] == 'xtnodegit') { + let gitrepo = args[1]; if (args[1] == 'xtnodegit') { gitrepo = args[2]; } + let cmd = 'cd / ; git clone ' + gitrepo + ' /app'; + let cmdout = XT.EXECA.commandSync(cmd, { shell: true }).stdout; + console.log(cmd); + console.log(cmdout); +} + +if (fs.existsSync('/app/app.js')) { let cmd = 'node /app/app.js ' + args.join(' '); XT.EXECA.command(cmd).stdout.pipe(process.stdout); } diff --git a/bin/xtnodegit b/bin/xtnodegit new file mode 100644 index 0000000..4d810fc --- /dev/null +++ b/bin/xtnodegit @@ -0,0 +1,6 @@ +#!/bin/sh +cd /app +echo "$@" +echo $0 +echo $1 +git clone "$@" .