File tree Expand file tree Collapse file tree 3 files changed +25
-16
lines changed
main/resources/templates/cli
test/resources/com/box/l10n/mojito/service/cli Expand file tree Collapse file tree 3 files changed +25
-16
lines changed Original file line number Diff line number Diff line change 1919mkdir -p {{installDirectory}}
2020
2121# Create the bash wrapper for the CLI
22- cat << ' EOF ' | envsubst '$PWD' > {{installDirectory}}/mojito
22+ cat > {{installDirectory}}/mojito-tmp << ' EOF '
2323#!/usr/bin/env bash
2424{{#hasHeaders}}
2525{{#headers}}
2626if [ -z "{{{envVarPresenceCheck}}}" ]; then
2727 echo "Environment variable {{envVar}} must be set before running this command."
28- exit 1
2928fi
3029{{/headers}}
3130{{#authenticationMode}}
@@ -39,6 +38,10 @@ java -Dl10n.resttemplate.host={{host}} \
3938 -jar {{installDirectory}}/mojito-cli.jar "$@" ;
4039EOF
4140
41+ _ESC=" $( printf ' %s' " ${PWD} " | sed ' s/[\/&]/\\&/g' ) "
42+ sed " s|\$ {PWD}|$_ESC |g" {{installDirectory}}/mojito-tmp > {{installDirectory}}/mojito
43+ rm {{installDirectory}}/mojito-tmp
44+
4245# Make the wrapper executable
4346chmod +x {{installDirectory}}/mojito
4447
Original file line number Diff line number Diff line change 1919mkdir -p ${PWD} /.mojito
2020
2121# Create the bash wrapper for the CLI
22- cat > ${PWD} /.mojito/mojito << 'EOF '
22+ cat > ${PWD} /.mojito/mojito-tmp << 'EOF '
2323#!/usr/bin/env bash
24- java -Dl10n.resttemplate.host=localhost \\
25- -Dl10n.resttemplate.scheme=http \\
26- -Dl10n.resttemplate.port=8080 \\
27- -Dlogging.file.path=${PWD}/.mojito \\
28- -jar ${PWD}/.mojito/mojito-cli.jar "\ $@" ;
24+ java -Dl10n.resttemplate.host=localhost \
25+ -Dl10n.resttemplate.scheme=http \
26+ -Dl10n.resttemplate.port=8080 \
27+ -Dlogging.file.path=${PWD}/.mojito \
28+ -jar ${PWD}/.mojito/mojito-cli.jar "$@" ;
2929EOF
3030
31+ _ESC=" $( printf ' %s' " ${PWD} " | sed ' s/[\/&]/\\&/g' ) "
32+ sed " s|\$ {PWD}|$_ESC |g" ${PWD} /.mojito/mojito-tmp > ${PWD} /.mojito/mojito
33+ rm ${PWD} /.mojito/mojito-tmp
34+
3135# Make the wrapper executable
3236chmod +x ${PWD} /.mojito/mojito
3337
Original file line number Diff line number Diff line change 1919mkdir -p ${PWD} /.mojito
2020
2121# Create the bash wrapper for the CLI
22- cat > ${PWD} /.mojito/mojito << 'EOF '
22+ cat > ${PWD} /.mojito/mojito-tmp << 'EOF '
2323#!/usr/bin/env bash
2424if [ -z "${L10N_RESTTEMPLATE_HEADER_HEADERS_CF_ACCESS_CLIENT_ID:-}" ]; then
2525 echo "Environment variable L10N_RESTTEMPLATE_HEADER_HEADERS_CF_ACCESS_CLIENT_ID must be set before running this command."
26- exit 1
2726fi
2827if [ -z "${L10N_RESTTEMPLATE_HEADER_HEADERS_CF_ACCESS_CLIENT_SECRET:-}" ]; then
2928 echo "Environment variable L10N_RESTTEMPLATE_HEADER_HEADERS_CF_ACCESS_CLIENT_SECRET must be set before running this command."
30- exit 1
3129fi
3230export L10N_RESTTEMPLATE_AUTHENTICATION_MODE=HEADER
33- java -Dl10n.resttemplate.host=localhost \\
34- -Dl10n.resttemplate.scheme=http \\
35- -Dl10n.resttemplate.port=8080 \\
36- -Dlogging.file.path=${PWD}/.mojito \\
37- -jar ${PWD}/.mojito/mojito-cli.jar "\ $@" ;
31+ java -Dl10n.resttemplate.host=localhost \
32+ -Dl10n.resttemplate.scheme=http \
33+ -Dl10n.resttemplate.port=8080 \
34+ -Dlogging.file.path=${PWD}/.mojito \
35+ -jar ${PWD}/.mojito/mojito-cli.jar "$@" ;
3836EOF
3937
38+ _ESC=" $( printf ' %s' " ${PWD} " | sed ' s/[\/&]/\\&/g' ) "
39+ sed " s|\$ {PWD}|$_ESC |g" ${PWD} /.mojito/mojito-tmp > ${PWD} /.mojito/mojito
40+ rm ${PWD} /.mojito/mojito-tmp
41+
4042# Make the wrapper executable
4143chmod +x ${PWD} /.mojito/mojito
4244
You can’t perform that action at this time.
0 commit comments