Merge pull request #8 from costateixeira/master

Fix some issues in _updatePublisher.sh
This commit is contained in:
Lloyd McKenzie 2020-01-17 09:07:27 -07:00 committed by GitHub
commit 9305ceb124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View File

@ -1,6 +1,6 @@
@ECHO OFF @ECHO OFF
SET publisher_jar=org.hl7.fhir.publisher.jar SET publisher_jar=org.hl7.fhir.publisher.jar
SET input_cache_path=%CD%\input-cache\ SET input_cache_path=%CD%\input-cache
ECHO Checking internet connection... ECHO Checking internet connection...
PING tx.fhir.org -n 1 -w 1000 | FINDSTR TTL && GOTO isonline PING tx.fhir.org -n 1 -w 1000 | FINDSTR TTL && GOTO isonline
@ -17,9 +17,9 @@ SET txoption=
SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
IF EXIST "%input_cache_path%\%publisher_jar%" ( IF EXIST "%input_cache_path%\%publisher_jar%" (
JAVA -jar %input_cache_path%\%publisher_jar% -ig ig.ini %txoption% %* JAVA -jar "%input_cache_path%\%publisher_jar%" -ig ig.ini %txoption% %*
) ELSE If exist "..\%publisher_jar%" ( ) ELSE If exist "..\%publisher_jar%" (
JAVA -jar ..\%publisher_jar% -ig ig.ini %txoption% %* JAVA -jar "..\%publisher_jar%" -ig ig.ini %txoption% %*
) ELSE ( ) ELSE (
ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
) )

View File

@ -7,20 +7,20 @@ FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx
IF NOT EXIST "%input_cache_path%%publisher_jar%" ( IF NOT EXIST "%input_cache_path%%publisher_jar%" (
IF NOT EXIST "%upper_path%%publisher_jar%" ( IF NOT EXIST "%upper_path%%publisher_jar%" (
SET jarlocation=%input_cache_path%%publisher_jar% SET jarlocation="%input_cache_path%%publisher_jar%"
SET jarlocationname=Input Cache SET jarlocationname=Input Cache
ECHO IG Publisher is not yet in input-cache or parent folder. ECHO IG Publisher is not yet in input-cache or parent folder.
REM we don't use jarlocation below because it will be empty because we're in a bracketed if statement REM we don't use jarlocation below because it will be empty because we're in a bracketed if statement
GOTO create GOTO create
) ELSE ( ) ELSE (
ECHO IG Publisher FOUND in parent folder ECHO IG Publisher FOUND in parent folder
SET jarlocation=%upper_path%%publisher_jar% SET jarlocation="%upper_path%%publisher_jar%"
SET jarlocationname=Parent folder SET jarlocationname=Parent folder
GOTO:upgrade GOTO:upgrade
) )
) ELSE ( ) ELSE (
ECHO IG Publisher FOUND in input-cache ECHO IG Publisher FOUND in input-cache
SET jarlocation=%input_cache_path%%publisher_jar% SET jarlocation="%input_cache_path%%publisher_jar%"
SET jarlocationname=Input Cache SET jarlocationname=Input Cache
GOTO:upgrade GOTO:upgrade
) )

View File

@ -9,7 +9,7 @@ if ! type "curl" > /dev/null; then
exit 1 exit 1
fi fi
publisher="$input_cache_dir$publisher_jar" publisher="$input_cache_path$publisher_jar"
if test -f "$publisher"; then if test -f "$publisher"; then
echo "IG Publisher FOUND in input-cache" echo "IG Publisher FOUND in input-cache"
jarlocation="$publisher" jarlocation="$publisher"
@ -25,21 +25,21 @@ else
upgrade=true upgrade=true
else else
echo IG Publisher NOT FOUND in input-cache or parent folder... echo IG Publisher NOT FOUND in input-cache or parent folder...
jarlocation="$input_cache_dir$publisher_jar" jarlocation=$input_cache_path$publisher_jar
jarlocationname="Input Cache" jarlocationname="Input Cache"
upgrade=false upgrade=false
fi fi
fi fi
if $upgrade ; then if "$upgrade"; then
message="Overwrite $jarlocation? [Y/N] " message="Overwrite $jarlocation?"
else else
echo Will place publisher jar here: $input_cache_path$publisher_jar echo Will place publisher jar here: "$jarlocation"
message="Ok? [Y/N] " message="Ok?"
fi fi
read -r -p $message response read -r -p "$message" response
if [[ "$response" =~ ^([yY])$ ]] then if [[ "$response" =~ ^([yY])$ ]]; then
echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit" echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit"
# wget "https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar" -O "$jarlocation" # wget "https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar" -O "$jarlocation"
curl $dlurl -o "$jarlocation" --create-dirs curl $dlurl -o "$jarlocation" --create-dirs