Skip to content

Commit

Permalink
Sample-content-ig to test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
brynrhodes committed Apr 6, 2020
0 parents commit 3c0547f
Show file tree
Hide file tree
Showing 39 changed files with 97,290 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Temporary folders #
#####################
temp
template
output

# Don't commit this because it's so large #
###########################################
/input-cache/org.hl7.fhir.publisher.jar

# Windows generated files #
###########################
Thumbs.db

# OS generated files #
######################
.DS_Store
.DS_Store?

# backup files #
################
*.bak
6 changes: 6 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Copyright (c) 2017, HL7

This document is licensed under the terms of HL7's FHIR license.
http://hl7.org/fhir/license.html

Creative Commons "No Rights Reserved" (CC0)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sample-ig
A sample, template-driven implementation guide that provides a starting environment to use a base for defining new IGs
2 changes: 2 additions & 0 deletions _gencontinuous.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@ECHO OFF
CALL ./_genonce.bat -watch
2 changes: 2 additions & 0 deletions _gencontinuous.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./_genonce.sh -watch
27 changes: 27 additions & 0 deletions _genonce.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@ECHO OFF
SET publisher_jar=org.hl7.fhir.publisher.jar
SET input_cache_path=%CD%\input-cache

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

IF EXIST "%input_cache_path%\%publisher_jar%" (
JAVA -jar "%input_cache_path%\%publisher_jar%" -ig ig.ini %txoption% %*
) ELSE If exist "..\%publisher_jar%" (
JAVA -jar "..\%publisher_jar%" -ig ig.ini %txoption% %*
) ELSE (
ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
)

PAUSE
29 changes: 29 additions & 0 deletions _genonce.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
publisher_jar=org.hl7.fhir.publisher.jar
input_cache_path=./input-cache/
set -e
echo Checking internet connection...
curl -sSf tx.fhir.org > /dev/null

if [ $? -eq 0 ]; then
echo "Online"
txoption=""
else
echo "Offline"
txoption="-tx n/a"
fi

echo "$txoption"

publisher=$input_cache_path/$publisher_jar
if test -f "$publisher"; then
JAVA -jar $publisher -ig ig.ini $txoption $*

else
publisher=../$publisher_jar
if test -f "$publisher"; then
JAVA -jar $publisher -ig ig.ini $txoption $*
else
echo IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
fi
fi
73 changes: 73 additions & 0 deletions _updatePublisher.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@ECHO OFF
SET dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar
SET publisher_jar=org.hl7.fhir.publisher.jar
SET input_cache_path=%CD%\input-cache\

FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx

IF NOT EXIST "%input_cache_path%%publisher_jar%" (
IF NOT EXIST "%upper_path%%publisher_jar%" (
SET jarlocation="%input_cache_path%%publisher_jar%"
SET jarlocationname=Input Cache
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
GOTO create
) ELSE (
ECHO IG Publisher FOUND in parent folder
SET jarlocation="%upper_path%%publisher_jar%"
SET jarlocationname=Parent folder
GOTO:upgrade
)
) ELSE (
ECHO IG Publisher FOUND in input-cache
SET jarlocation="%input_cache_path%%publisher_jar%"
SET jarlocationname=Input Cache
GOTO:upgrade
)

:create
ECHO Will place publisher jar here: %input_cache_path%%publisher_jar%
SET /p create="Ok? (Y/N) "
IF /I "%create%"=="Y" (
MKDIR "%input_cache_path%" 2> NUL
GOTO:download
)
GOTO:done

:upgrade
SET /p overwrite="Overwrite %jarlocation%? (Y/N) "
IF /I "%overwrite%"=="Y" (
GOTO:download
)
GOTO:done

:download
ECHO Downloading most recent publisher to %jarlocationname% - it's ~100 MB, so this may take a bit

FOR /f "tokens=4-5 delims=. " %%i IN ('ver') DO SET VERSION=%%i.%%j
IF "%version%" == "10.0" GOTO win10
IF "%version%" == "6.3" GOTO win8.1
IF "%version%" == "6.2" GOTO win8
IF "%version%" == "6.1" GOTO win7
IF "%version%" == "6.0" GOTO vista

ECHO Unrecognized version: %version%
GOTO done

:win10
CALL POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%dlurl%\",\"%jarlocation%\") } else { Invoke-WebRequest -Uri "%dlurl%" -Outfile "%jarlocation%" }

GOTO done

:win7
CALL bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%"
GOTO done

:win8.1
:win8
:vista
ECHO This script does not yet support Windows %winver%. Please ask for help on http://chat.fhir.org
GOTO done

:done
PAUSE
64 changes: 64 additions & 0 deletions _updatePublisher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar
publisher_jar=org.hl7.fhir.publisher.jar
input_cache_path=./input-cache/

set -e
if ! type "curl" > /dev/null; then
echo "ERROR: Script needs curl to download latest IG Publisher. Please install curl."
exit 1
fi

FORCE=false

while :; do
case $1 in
-f|--force) FORCE=true ;;
--)
shift
break
;;
*) break
esac
shift
done

publisher="$input_cache_path$publisher_jar"
if test -f "$publisher"; then
echo "IG Publisher FOUND in input-cache"
jarlocation="$publisher"
jarlocationname="Input Cache"
upgrade=true
else
publisher="../$publisher_jar"
upgrade=true
if test -f "$publisher"; then
echo "IG Publisher FOUND in parent folder"
jarlocation="$publisher"
jarlocationname="Parent Folder"
upgrade=true
else
echo IG Publisher NOT FOUND in input-cache or parent folder...
jarlocation=$input_cache_path$publisher_jar
jarlocationname="Input Cache"
upgrade=false
fi
fi

if [[ "$FORCE" != true ]]; then
if "$upgrade"; then
message="Overwrite $jarlocation? (Y/N) "
else
echo Will place publisher jar here: "$jarlocation"
message="Ok (enter 'y' or 'Y' to continue, any other key to cancel)?"
fi
read -r -p "$message" response
fi

if [[ "$FORCE" ]] || [[ "$response" =~ ^([yY])$ ]]; then
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"
curl $dlurl -o "$jarlocation" --create-dirs
else
echo cancel...
fi
4 changes: 4 additions & 0 deletions ig.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[IG]
ig = input/mycontentig.xml
template = fhir.base.template
usage-stats-opt-out = false
Loading

0 comments on commit 3c0547f

Please sign in to comment.