Merge pull request #7 from costateixeira/master
Support jar in input-cache OR parent folder; offline publishing option;
This commit is contained in:
commit
d9a3c6a76b
24
_genonce.bat
24
_genonce.bat
@ -1,3 +1,25 @@
|
||||
@echo off
|
||||
|
||||
echo Checking internet connection...
|
||||
Ping tx.fhir.org -n 1 -w 1000 | findstr TTL && goto isonline
|
||||
echo We're offline...
|
||||
set txoption=-tx n/a
|
||||
goto igpublish
|
||||
:isonline
|
||||
echo We're online
|
||||
set txoption=
|
||||
|
||||
:igpublish
|
||||
|
||||
|
||||
@SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
|
||||
JAVA -jar input-cache/org.hl7.fhir.publisher.jar -ig ig.ini
|
||||
|
||||
If exist "input-cache\org.hl7.fhir.publisher.jar" (
|
||||
JAVA -jar input-cache/org.hl7.fhir.publisher.jar -ig ig.ini %txoption%
|
||||
) ELSE If exist "..\org.hl7.fhir.publisher.jar" (
|
||||
JAVA -jar ../org.hl7.fhir.publisher.jar -ig ig.ini %txoption%
|
||||
) Else (
|
||||
@ECHO IG Publisher NOT FOUND in input-cache or parent folder... aborting
|
||||
)
|
||||
|
||||
@PAUSE
|
||||
26
_genonce.sh
26
_genonce.sh
@ -1,3 +1,27 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
java -jar input-cache/org.hl7.fhir.publisher.jar -ig ig.ini
|
||||
echo Checking internet connection...
|
||||
wget -q --spider tx.fhir.org
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Online"
|
||||
txoption=""
|
||||
else
|
||||
echo "Offline"
|
||||
txoption="-tx n/a"
|
||||
fi
|
||||
|
||||
echo "$txoption"
|
||||
|
||||
publisher=./input-cache/org.hl7.fhir.publisher.jar
|
||||
if test -f "$publisher"; then
|
||||
JAVA -jar ./input-cache/org.hl7.fhir.publisher.jar -ig ig.ini $txoption
|
||||
|
||||
else
|
||||
publisher=../org.hl7.fhir.publisher.jar
|
||||
if test -f "$publisher"; then
|
||||
JAVA -jar ../org.hl7.fhir.publisher.jar -ig ig.ini $txoption
|
||||
else
|
||||
echo IG Publisher NOT FOUND in input-cache or parent folder... aborting
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,5 +1,69 @@
|
||||
@MKDIR input-cache
|
||||
@ECHO "Downloading most recent publisher - it's ~100 MB, so this may take a bit
|
||||
@POWERSHELL -command (new-object System.Net.WebClient).DownloadFile(\"https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar\",\"input-cache\org.hl7.fhir.publisher.jar\")
|
||||
@echo off
|
||||
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "10.0" set winver=10
|
||||
if "%version%" == "6.3" set winver=8.1
|
||||
if "%version%" == "6.2" set winver=8
|
||||
if "%version%" == "6.1" set winver=7
|
||||
if "%version%" == "6.0" set winver=vista
|
||||
|
||||
for %%x in ("%CD%") do set upper_path=%%~dpx
|
||||
set current_path=%cd%
|
||||
|
||||
@Set location=
|
||||
rem echo inputcachepath
|
||||
rem echo "%current_path%\input-cache\org.hl7.fhir.publisher.jar"
|
||||
|
||||
If not exist "%current_path%\input-cache\org.hl7.fhir.publisher.jar" (
|
||||
If not exist "%upper_path%org.hl7.fhir.publisher.jar" (
|
||||
@ECHO IG Publisher is not in input-cache or parent folder...
|
||||
@Set filelocation="%current_path%\input-cache\org.hl7.fhir.publisher.jar"
|
||||
echo %filelocation%
|
||||
@goto:download
|
||||
|
||||
) else (
|
||||
@ECHO IG Publisher FOUND in parent folder
|
||||
@Set location=parent
|
||||
@Set filelocation="%upper_path%org.hl7.fhir.publisher.jar"
|
||||
@set filelocationname=Parent folder
|
||||
echo %filelocation%
|
||||
@goto:upgrade
|
||||
|
||||
)
|
||||
|
||||
) else (
|
||||
@ECHO IG Publisher FOUND in input-cache
|
||||
@Set location=cache
|
||||
@Set filelocation="%current_path%\input-cache\org.hl7.fhir.publisher.jar"
|
||||
@set filelocationname=Input Cache
|
||||
echo %filelocation%
|
||||
@goto:upgrade
|
||||
|
||||
)
|
||||
|
||||
echo Done
|
||||
goto:eof
|
||||
|
||||
:upgrade
|
||||
set /p overwrite="Overwrite? "
|
||||
if /I "%overwrite%"=="Y" (
|
||||
goto:download
|
||||
)
|
||||
|
||||
goto:eof
|
||||
|
||||
:download
|
||||
set dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar
|
||||
@ECHO Downloading most recent publisher to %filelocationname% - it's ~100 MB, so this may take a bit
|
||||
|
||||
if /I "%winver%"=="10" (
|
||||
@POWERSHELL -command Invoke-WebRequest -Uri %dlurl% -Outfile %filelocation%
|
||||
)
|
||||
|
||||
if /I "%winver%"=="7" (
|
||||
bitsadmin /transfer GetPublisher /download /priority normal %dlurl% %filelocation%
|
||||
)
|
||||
|
||||
@ECHO "Done"
|
||||
@PAUSE
|
||||
pause
|
||||
:eof
|
||||
|
||||
@ -3,7 +3,33 @@ set -e
|
||||
if ! type "curl" > /dev/null; then
|
||||
echo "ERROR: Script needs curl to download latest IG Publisher. Please install curl."
|
||||
exit 1
|
||||
|
||||
publisher=./input-cache/org.hl7.fhir.publisher.jar
|
||||
if test -f "$publisher"; then
|
||||
jarlocation="./input-cache/org.hl7.fhir.publisher.jar"
|
||||
echo "IG Publisher FOUND in input-cache"
|
||||
else
|
||||
publisher=../org.hl7.fhir.publisher.jar
|
||||
upgrade=true
|
||||
if test -f "$publisher"; then
|
||||
echo "IG Publisher FOUND in parent folder"
|
||||
jarlocation="../org.hl7.fhir.publisher.jar"
|
||||
upgrade=true
|
||||
else
|
||||
echo IG Publisher NOT FOUND in input-cache or parent folder...
|
||||
jarlocation="./input-cache/org.hl7.fhir.publisher.jar"
|
||||
upgrade=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if $upgrade ; then
|
||||
read -r -p "Download? [y/N] " response
|
||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||
then
|
||||
echo "Downloading most recent publisher to $jarlocation - 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"
|
||||
curl https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar -o "$jarlocation" --create-dirs
|
||||
else
|
||||
echo cancel...
|
||||
fi
|
||||
fi
|
||||
echo "Downloading most recent publisher - it's ~100 MB, so this may take a bit"
|
||||
curl https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar -o input-cache/org.hl7.fhir.publisher.jar --create-dirs
|
||||
echo "Done"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user