From 4ee1aab8223fdcf243fc4e50b9c8bb24853433b1 Mon Sep 17 00:00:00 2001 From: Chris Moesel Date: Wed, 8 Apr 2026 20:30:59 -0400 Subject: [PATCH] Use _build script instead of _updatePublisher and _genonce --- content/docs/SUSHI/project/_index.md | 6 +- content/docs/SUSHI/running/_index.md | 12 +- content/docs/SUSHI/tutorial/_index.md | 12 +- content/docs/SUSHI/tutorial/fsh-tutorial.zip | Bin 42818 -> 47803 bytes fsh-tutorial/FishExample/_build.bat | 386 ++++++++++++++++++ fsh-tutorial/FishExample/_build.sh | 176 ++++++++ fsh-tutorial/FishExample/_genonce.bat | 27 -- fsh-tutorial/FishExample/_genonce.sh | 28 -- fsh-tutorial/FishExample/_updatePublisher.bat | 218 ---------- fsh-tutorial/FishExample/_updatePublisher.sh | 133 ------ fsh-tutorial/FishExampleComplete/_build.bat | 386 ++++++++++++++++++ fsh-tutorial/FishExampleComplete/_build.sh | 176 ++++++++ fsh-tutorial/FishExampleComplete/_genonce.bat | 27 -- fsh-tutorial/FishExampleComplete/_genonce.sh | 28 -- .../FishExampleComplete/_updatePublisher.bat | 218 ---------- .../FishExampleComplete/_updatePublisher.sh | 133 ------ 16 files changed, 1138 insertions(+), 828 deletions(-) create mode 100644 fsh-tutorial/FishExample/_build.bat create mode 100755 fsh-tutorial/FishExample/_build.sh delete mode 100644 fsh-tutorial/FishExample/_genonce.bat delete mode 100644 fsh-tutorial/FishExample/_genonce.sh delete mode 100644 fsh-tutorial/FishExample/_updatePublisher.bat delete mode 100644 fsh-tutorial/FishExample/_updatePublisher.sh create mode 100644 fsh-tutorial/FishExampleComplete/_build.bat create mode 100755 fsh-tutorial/FishExampleComplete/_build.sh delete mode 100644 fsh-tutorial/FishExampleComplete/_genonce.bat delete mode 100644 fsh-tutorial/FishExampleComplete/_genonce.sh delete mode 100644 fsh-tutorial/FishExampleComplete/_updatePublisher.bat delete mode 100644 fsh-tutorial/FishExampleComplete/_updatePublisher.sh diff --git a/content/docs/SUSHI/project/_index.md b/content/docs/SUSHI/project/_index.md index e835007..cb50262 100644 --- a/content/docs/SUSHI/project/_index.md +++ b/content/docs/SUSHI/project/_index.md @@ -44,10 +44,8 @@ These values are then used to generate a project structure compatible with the F ```text my-project ├── .gitignore -├── _genonce.bat -├── _genonce.sh -├── _updatePublisher.bat -├── _updatePublisher.sh +├── _build_.bat +├── _build_.sh ├── ig.ini ├── input | ├── ignoreWarnings.txt diff --git a/content/docs/SUSHI/running/_index.md b/content/docs/SUSHI/running/_index.md index fbdff33..ff76358 100644 --- a/content/docs/SUSHI/running/_index.md +++ b/content/docs/SUSHI/running/_index.md @@ -244,7 +244,7 @@ SUSHI creates only the **fsh-generated** folder, but some of the files shown abo ### Downloading the IG Publisher Scripts -To run the IG Publisher, we recommend downloading the **\_updatePublisher.bat|sh** and **\_genonce.bat|sh** scripts provided by the sample-ig project. To get these scripts, [download the sample-ig project](https://github.com/FHIR/sample-ig/archive/master.zip), unzip it, and copy _all_ of the **.bat** and **.sh** files to the directory above the **fsh-generated** directory (**my-project** in the example above). +To run the IG Publisher, we recommend downloading the **\_build.bat|sh** scripts. To get these scripts, [download the ig-publisher-scripts project](https://github.com/HL7/ig-publisher-scripts/archive/refs/heads/main.zip), unzip it, and copy the **_build.bat** and **_build.sh** files to the directory above the **fsh-generated** directory (**my-project** in the example above). If you used `sushi init` then these scripts were already downloaded and added to your project. @@ -253,17 +253,17 @@ If you used `sushi init` then these scripts were already downloaded and added to After copying these, change directories in the command prompt to the directory above the **fsh-generated** directory. At the command prompt, enter: ```shell -{{< windows >}} {{< terminal >}} _updatePublisher +{{< windows >}} {{< terminal >}} _build update ``` ```shell -{{< apple >}} {{< terminal >}} ./_updatePublisher.sh +{{< apple >}} {{< terminal >}} ./_build.sh update ``` This will download the latest version of the HL7 FHIR IG Publisher tool into the **/input-cache** directory. _This step can be skipped if you already have the latest version of the IG Publisher tool in **input-cache**._ {{% alert title="Tip" color="success" %}} -If you are blocked by a firewall, or if for any reason `_updatePublisher` fails to execute, download the current IG Publisher jar file [here](https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar). When the file has downloaded, move it into the **input-cache** directory (which you may need to create as a _sibling_ to the **input** directory). +If you are blocked by a firewall, or if for any reason `_build` fails to execute, download the current IG Publisher jar file [here](https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar). When the file has downloaded, move it into the **input-cache** directory (which you may need to create as a _sibling_ to the **input** directory). {{% /alert %}} ### Running the IG Publisher @@ -275,11 +275,11 @@ If you have never run the IG Publisher, you may need to install Jekyll first. Se After the IG Publisher has been successfully downloaded, execute the following command to run it: ```shell -{{< windows >}} {{< terminal >}} _genonce +{{< windows >}} {{< terminal >}} _build build ``` ```shell -{{< apple >}} {{< terminal >}} ./_genonce.sh +{{< apple >}} {{< terminal >}} ./_build.sh build ``` This will run the HL7 IG Publisher, which may take several minutes to complete. After the publisher is finished, open the file **/output/index.html** in a browser to see the resulting IG. diff --git a/content/docs/SUSHI/tutorial/_index.md b/content/docs/SUSHI/tutorial/_index.md index 44d0721..523eead 100644 --- a/content/docs/SUSHI/tutorial/_index.md +++ b/content/docs/SUSHI/tutorial/_index.md @@ -81,14 +81,14 @@ The files generated by SUSHI are located in the **FishExample/fsh-generated** di At the command prompt, enter: ```shell -{{< windows >}} {{< terminal >}} _updatePublisher -{{< apple >}} {{< terminal >}} ./_updatePublisher.sh +{{< windows >}} {{< terminal >}} _build +{{< apple >}} {{< terminal >}} ./_build.sh ``` This will download the latest version of the HL7 FHIR IG Publisher tool into **./input-cache**. _This step can be skipped if you already have run the command recently, and have the latest version of the IG Publisher tool._ {{% alert title="Tip" color="success" %}} -If you are blocked by a firewall, or if for any reason `_updatePublisher` fails to execute, download the current IG Publisher jar file [here](https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar). When the file has downloaded, move it into the directory **/FishExample/input-cache** (creating the directory if necessary). +If you are blocked by a firewall, or if for any reason `_build` fails to execute, download the current IG Publisher jar file [here](https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar). When the file has downloaded, move it into the directory **/FishExample/input-cache** (creating the directory if necessary). {{% /alert %}} {{% alert title="Warning" color="warning" %}} @@ -98,8 +98,8 @@ Before proceeding to the next command: If you have never run the IG Publisher, y Now run: ```shell -{{< windows >}} {{< terminal >}} _genonce -{{< apple >}} {{< terminal >}} ./_genonce.sh +{{< windows >}} {{< terminal >}} _build build +{{< apple >}} {{< terminal >}} ./_build.sh build ``` This will run the HL7 FHIR IG generator, which may take several minutes to complete. @@ -175,7 +175,7 @@ Description: "Codes describing various species of fish, taken from SNOMED-CT." The rule in the value set definition above selects all codes from SNOMED-CT that are children of the concept "Fish (organism)". {{% /alert %}} -Run SUSHI again. The count of ValueSets should now be 1. Try generating the IG by running `_genonce` again. Open the file **/FishExample/output/index.html** to see the resulting IG. +Run SUSHI again. The count of ValueSets should now be 1. Try generating the IG by running the `_build` command again. Open the file **/FishExample/output/index.html** to see the resulting IG. * Do you see where the FishPatient profile is in the IG? * Does the differential reflect your changes? diff --git a/content/docs/SUSHI/tutorial/fsh-tutorial.zip b/content/docs/SUSHI/tutorial/fsh-tutorial.zip index ef84384623db1e87506a6c8e68e0b8ef37ea2afe..f39ce926b88ba173772a35561602eebd844b6063 100644 GIT binary patch delta 18779 zcmeHv1yodP_x=z=OE*XfNH@}@bP0%b4c#FjB}0QW3?MBn-O{OubSm8;ASn$Z{s#44 z<$m|O`h9Et*S|b#9cB(|-e>l^_kQ=;d!P527yYmehp^X`M{`BZch!8js*CP1A^ z>}9Id#!Gb{4ia~y@_QsfNTfo%6Xl>d5bm$@C?`fY3*Zg7F4?KyFI-!&sDr(YkC*MyxU`X-!x*Ec(+qg0H3IMKlaF_Xcwip zmM2vMU?7Uo^fgZL^~LTKPf(*_dGcm)IkVR{ruSU1jEY7In5P&J6V{F$&}$eV9uU** zs~T|5Ro3P%%cP@);`X>MA0^P;T}wyjFSgtw>dQ%h3XA|XHRl(hxxNd0skFb?@qUC5 zs-GyP_{WcUFXOP$hjU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iSxof7l%aQu6+j4#zxI!XS~y9g@l zykp;f75^>*-JB>ly^9G6^O~nC!qP!rE@u=1)g{+v{Y#qvCC&fIq#0kFg%Vltnd=%e zgNn19b2nS@$tiy9U)KD;&zhkv`Nf(Womjve_n&*?y70~h-WzD_U)uaHZT^2to58?c ztkphV@$`ZSBq#7s?Y-UWl#dp=g9nQ_z_v05)UVE+h>1Ra_OId+AwlK>1pnp6J^2zhC^vbO69F{v83TRkDJ!2-FXZA1$=sg6ss8U>Vjx9wOI4C}0qR z4jE>xL$*SYN+esuAp^ZgP~gondeo+l$`&lbY!L(K ztz)5~`^jy;u-5e3)MMF#wLTfXi2!@nAMs~EO?cf{DA2xy5>}F+pR&bJgbCtqfY9n# zkqtmlTjhu430o~&05{gMHDSrt&O@IV3`ikF4+Cv1Y;VEYSb-(Pp~u2F?ZQ8C2&%B4 zaUDCjTuO~hk%WImjUfkjmAN73rPm*+LBo1FaHz~2Nh1djeUPUIRsBdn+j38&h}!xP zBe+toFYpf@&kd30wGZCl-?X4PJ7JXwYGPaTA#{2HK#jmIBiaxE?|O+0A36w1WLUUF z_PYr118eP6a_B->La;CdMXGgS{yv0kJU%3PcmQI&r^6@&MW`(*Z7f5X5va5Pqrf#O zyg~#usVyKIYZ2xIAlr;!UGRkoJP1KyVhaeNyUPKl1RyOYForaXKL5TTQA z1ab<1f$&M=IuK#f2zj|M@@o)yu#p$ct_wsuhpc}k19j_tkV#?iBgSt#F_MttcZLW0JG&hK3KH;7{{yX(-z@+D diff --git a/fsh-tutorial/FishExample/_build.bat b/fsh-tutorial/FishExample/_build.bat new file mode 100644 index 0000000..99d0e1f --- /dev/null +++ b/fsh-tutorial/FishExample/_build.bat @@ -0,0 +1,386 @@ +@ECHO OFF +setlocal enabledelayedexpansion + +SET "dlurl=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar" +SET "publisher_jar=publisher.jar" +SET "input_cache_path=%CD%\input-cache\" +SET "skipPrompts=false" +SET "upper_path=..\" +SET "scriptdlroot=https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main" +SET "build_bat_url=%scriptdlroot%/_build.bat" +SET "build_sh_url=%scriptdlroot%/_build.sh" + + + +:: Debugging statements to check jar file location +ECHO Checking for publisher.jar in %input_cache_path% +IF EXIST "%input_cache_path%%publisher_jar%" ( + SET "jar_location=%input_cache_path%%publisher_jar%" + ECHO Found publisher.jar in input-cache +) ELSE ( + ECHO Checking for publisher.jar in %upper_path% + IF EXIST "%upper_path%%publisher_jar%" ( + SET "jar_location=%upper_path%%publisher_jar%" + ECHO Found publisher.jar in parent folder + ) ELSE ( + SET "jar_location=not_found" + SET "default_choice=1" + ECHO publisher.jar not found in input-cache or parent folder + ) +) + + +:: Handle command-line argument to bypass the menu +IF NOT "%~1"=="" ( + IF /I "%~1"=="update" SET "userChoice=1" + IF /I "%~1"=="build" SET "userChoice=2" + IF /I "%~1"=="nosushi" SET "userChoice=3" + IF /I "%~1"=="notx" SET "userChoice=4" + IF /I "%~1"=="jekyll" SET "userChoice=5" + IF /I "%~1"=="clean" SET "userChoice=6" + IF /I "%~1"=="exit" SET "userChoice=0" + GOTO executeChoice +) + +echo --------------------------------------------------------------- +ECHO Checking internet connection... +PING tx.fhir.org -4 -n 1 -w 4000 >nul 2>&1 && SET "online_status=true" || SET "online_status=false" + +IF "%online_status%"=="true" ( + ECHO We're online and tx.fhir.org is available. + FOR /F "tokens=2 delims=:" %%a IN ('curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest ^| findstr "tag_name"') DO SET "latest_version=%%a" + SET "latest_version=!latest_version:"=!" + SET "latest_version=!latest_version: =!" + SET "latest_version=!latest_version:~0,-1!" +) ELSE ( + ECHO We're offline or tx.fhir.org is not available, can only run the publisher without TX... + SET "txoption=-tx n/a" + SET "latest_version=unknown" + SET "default_choice=4" +) + +echo --------------------------------------------------------------- + + +IF NOT "%jar_location%"=="not_found" ( + FOR /F "tokens=*" %%i IN ('java "-Dfile.encoding=UTF-8" -jar "%jar_location%" -v 2^>^&1') DO SET "publisher_version=%%i" + SET "publisher_version=!publisher_version:"=!" + ECHO Detected publisher version: !publisher_version! +) ELSE ( + SET "publisher_version=unknown" + ECHO publisher.jar location is not found +) + +ECHO Publisher version: !publisher_version!; Latest is !latest_version! + +IF NOT "%online_status%"=="true" ( + ECHO We're offline. +) ELSE ( + IF NOT "!publisher_version!"=="!latest_version!" ( + ECHO An update is recommended. + SET "default_choice=1" + ) ELSE ( + ECHO Publisher is up to date. + SET "default_choice=2" + ) +) + +echo --------------------------------------------------------------- +echo. + +echo Please select an option: +echo 1. Download or update publisher +echo 2. Build IG +echo 3. Build IG - no sushi +echo 4. Build IG - force no TX server +echo 5. Jekyll build +echo 6. Clean up temp directories +echo 0. Exit +:: echo [Press Enter for default (%default_choice%) or type an option number:] +echo. + +:: Using CHOICE to handle input with timeout +:: ECHO [Enter=Continue, 1-7=Option, 0=Exit] +choice /C 12345670 /N /CS /D %default_choice% /T 5 /M "Choose an option number or wait 5 seconds for default (%default_choice%):" +SET "userChoice=%ERRORLEVEL%" + + +:executeChoice +echo You selected: %userChoice% + +IF "%userChoice%"=="1" GOTO downloadpublisher +IF "%userChoice%"=="2" GOTO publish_once +IF "%userChoice%"=="3" GOTO publish_nosushi +IF "%userChoice%"=="4" GOTO publish_notx +IF "%userChoice%"=="5" GOTO debugjekyll +IF "%userChoice%"=="6" GOTO clean +IF "%userChoice%"=="0" EXIT /B + +:end + + + +:debugjekyll + echo Running Jekyll build... + jekyll build -s temp/pages -d output +GOTO end + + +:clean + echo Cleaning up directories... + if exist ".\input-cache\publisher.jar" ( + echo Preserving publisher.jar and removing other files in .\input-cache... + move ".\input-cache\publisher.jar" ".\" + rmdir /s /q ".\input-cache" + mkdir ".\input-cache" + move ".\publisher.jar" ".\input-cache" + ) else ( + if exist ".\input-cache\" ( + rmdir /s /q ".\input-cache" + ) + ) + if exist ".\temp\" ( + rmdir /s /q ".\temp" + echo Removed: .\temp + ) + if exist ".\output\" ( + rmdir /s /q ".\output" + echo Removed: .\output + ) + if exist ".\template\" ( + rmdir /s /q ".\template" + echo Removed: .\template + ) + +GOTO end + + + + + +:downloadpublisher +ECHO Downloading Publisher... +:processflags +SET ARG=%1 +IF DEFINED ARG ( + IF "%ARG%"=="-f" SET FORCE=true + IF "%ARG%"=="--force" SET FORCE=true + SHIFT + GOTO processflags +) + +FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx + +ECHO. +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 +IF DEFINED FORCE ( + MKDIR "%input_cache_path%" 2> NUL + GOTO download +) + +IF "%skipPrompts%"=="y" ( + SET create=Y +) ELSE ( + SET /p create="Download? (Y/N) " +) +IF /I "%create%"=="Y" ( + ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% + MKDIR "%input_cache_path%" 2> NUL + GOTO download +) +GOTO done + +:upgrade +IF "%skipPrompts%"=="y" ( + SET overwrite=Y +) ELSE ( + 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 ~200 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 +rem this may be triggering the antivirus - bitsadmin.exe is a known threat +rem CALL bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%" + +rem this didn't work in win 10 +rem CALL Start-BitsTransfer /priority normal "%dlurl%" "%jarlocation%" + +rem this should work - untested +call (New-Object Net.WebClient).DownloadFile('%dlurl%', '%jarlocation%') +GOTO done + +:win8.1 +:win8 +:vista +GOTO done + + + +:done + + + + +ECHO. +ECHO Updating scripts +IF "%skipPrompts%"=="y" ( + SET updateScripts=Y +) ELSE ( + SET /p updateScripts="Update scripts? (Y/N) " +) +IF /I "%updateScripts%"=="Y" ( + GOTO scripts +) +GOTO end + + +:scripts + +REM Download all batch files (and this one with a new name) + +SETLOCAL DisableDelayedExpansion + + + +:dl_script_1 +ECHO Updating _build.sh +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_sh_url%\",\"_build.new.sh\") } else { Invoke-WebRequest -Uri "%build_sh_url%" -Outfile "_build.new.sh" } +if %ERRORLEVEL% == 0 goto upd_script_1 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_2 +:upd_script_1 +start copy /y "_build.new.sh" "_build.sh" ^&^& del "_build.new.sh" ^&^& exit + + +:dl_script_2 +ECHO Updating _build.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_bat_url%\",\"_build.new.bat\") } else { Invoke-WebRequest -Uri "%build_bat_url%" -Outfile "_build.new.bat" } +if %ERRORLEVEL% == 0 goto upd_script_2 +echo "Errors encountered during download: %errorlevel%" +goto end +:upd_script_2 +start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit + + +GOTO end + + +:publish_once + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 1jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + +:publish_nosushi + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 3jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% -no-sushi %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + +:publish_notx +SET txoption=-tx n/a + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 2jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + + +:publish_continuous + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO Checking %input_cache_path% for publisher.jar +IF EXIST "%input_cache_path%\%publisher_jar%" ( + java %JAVA_OPTS% -jar "%input_cache_path%\%publisher_jar%" -ig . %txoption% -watch %* +) ELSE ( + ECHO Checking %upper_path% for publisher.jar + IF EXIST "..\%publisher_jar%" ( + java %JAVA_OPTS% -jar "..\%publisher_jar%" -ig . %txoption% -watch %* + ) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... + ) +) + +GOTO end + + +:end + +:: Pausing at the end + + +IF NOT "%skipPrompts%"=="true" ( + PAUSE +) diff --git a/fsh-tutorial/FishExample/_build.sh b/fsh-tutorial/FishExample/_build.sh new file mode 100755 index 0000000..f11edff --- /dev/null +++ b/fsh-tutorial/FishExample/_build.sh @@ -0,0 +1,176 @@ +#!/bin/bash + +set -e + +# Variables +dlurl="https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar" +publisher_jar="publisher.jar" +input_cache_path="$(pwd)/input-cache/" +skipPrompts=false +upper_path="../" +scriptdlroot="https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main" +build_bat_url="${scriptdlroot}/_build.bat" +build_sh_url="${scriptdlroot}/_build.sh" + +function check_jar_location() { + if [ -f "${input_cache_path}${publisher_jar}" ]; then + jar_location="${input_cache_path}${publisher_jar}" + echo "Found publisher.jar in input-cache" + elif [ -f "${upper_path}${publisher_jar}" ]; then + jar_location="${upper_path}${publisher_jar}" + echo "Found publisher.jar in parent folder" + else + jar_location="not_found" + echo "publisher.jar not found in input-cache or parent folder" + fi +} + +function check_internet_connection() { + if ping -c 1 tx.fhir.org &>/dev/null; then + online=true + echo "We're online and tx.fhir.org is available." + latest_version=$(curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest | grep tag_name | cut -d'"' -f4) + else + online=false + echo "We're offline or tx.fhir.org is unavailable." + fi +} + + +function update_publisher() { + echo "Publisher jar location: ${input_cache_path}${publisher_jar}" + read -p "Download or update publisher.jar? (Y/N): " confirm + if [[ "$confirm" =~ ^[Yy]$ ]]; then + echo "Downloading latest publisher.jar (~200 MB)..." + mkdir -p "$input_cache_path" + curl -L "$dlurl" -o "${input_cache_path}${publisher_jar}" + else + echo "Skipped downloading publisher.jar" + fi + + update_scripts_prompt +} + + +function update_scripts_prompt() { + read -p "Update scripts (_build.bat and _build.sh)? (Y/N): " update_confirm + if [[ "$update_confirm" =~ ^[Yy]$ ]]; then + echo "Updating scripts..." + curl -L "$build_bat_url" -o "_build.new.bat" && mv "_build.new.bat" "_build.bat" + curl -L "$build_sh_url" -o "_build.new.sh" && mv "_build.new.sh" "_build.sh" + chmod +x _build.sh + echo "Scripts updated." + else + echo "Skipped updating scripts." + fi +} + + +function build_ig() { + if [ "$jar_location" != "not_found" ]; then + args=() + if [ "$online" = "false" ]; then + args+=("-tx" "n/a") + fi + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . "${args[@]}" "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + + +function build_nosushi() { + if [ "$jar_location" != "not_found" ]; then + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . -no-sushi "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + +function build_notx() { + if [ "$jar_location" != "not_found" ]; then + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . -tx n/a "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + +function jekyll_build() { + echo "Running Jekyll build..." + jekyll build -s temp/pages -d output +} + +function cleanup() { + echo "Cleaning up temp directories..." + if [ -f "${input_cache_path}${publisher_jar}" ]; then + mv "${input_cache_path}${publisher_jar}" ./ + rm -rf "${input_cache_path}"* + mkdir -p "$input_cache_path" + mv "$publisher_jar" "$input_cache_path" + fi + rm -rf ./output ./template ./temp + echo "Cleanup complete." +} + +check_jar_location +check_internet_connection + +# Handle command-line argument or menu +case "$1" in + update) update_publisher ;; + build) build_ig ;; + nosushi) build_nosushi ;; + notx) build_notx ;; + jekyll) jekyll_build ;; + clean) cleanup ;; + exit) exit 0 ;; + *) + # Compute default choice + default_choice=2 # Build by default + + if [ "$jar_location" = "not_found" ]; then + default_choice=1 # Download if jar is missing + elif [ "$online" = "false" ]; then + default_choice=4 # Offline build + elif [ -n "$latest_version" ]; then + current_version=$(java -jar "$jar_location" -v 2>/dev/null | tr -d '\r') + if [ "$current_version" != "$latest_version" ]; then + default_choice=1 # Offer update if newer version exists + fi + fi + + echo "---------------------------------------------" + echo "Publisher: ${current_version:-unknown}; Latest: ${latest_version:-unknown}" + echo "Publisher location: $jar_location" + echo "Online: $online" + echo "---------------------------------------------" + echo + echo "Please select an option:" + echo "1) Download or update publisher" + echo "2) Build IG" + echo "3) Build IG without Sushi" + echo "4) Build IG without TX server" + echo "5) Jekyll build" + echo "6) Cleanup temp directories" + echo "0) Exit" + echo + + # Read with timeout, but default if nothing entered + echo -n "Choose an option [default: $default_choice]: " + read -t 5 choice || choice="$default_choice" + choice="${choice:-$default_choice}" + echo "You selected: $choice" + + case "$choice" in + 1) update_publisher ;; + 2) build_ig ;; + 3) build_nosushi ;; + 4) build_notx ;; + 5) jekyll_build ;; + 6) cleanup ;; + 0) exit 0 ;; + *) echo "Invalid option." ;; + esac + ;; + +esac diff --git a/fsh-tutorial/FishExample/_genonce.bat b/fsh-tutorial/FishExample/_genonce.bat deleted file mode 100644 index a9864ef..0000000 --- a/fsh-tutorial/FishExample/_genonce.bat +++ /dev/null @@ -1,27 +0,0 @@ -@ECHO OFF -SET publisher_jar=publisher.jar -SET input_cache_path=%CD%\input-cache - -ECHO Checking internet connection... -PING tx.fhir.org -4 -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 . %txoption% %* -) ELSE If exist "..\%publisher_jar%" ( - JAVA -jar "..\%publisher_jar%" -ig . %txoption% %* -) ELSE ( - ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... -) - -PAUSE diff --git a/fsh-tutorial/FishExample/_genonce.sh b/fsh-tutorial/FishExample/_genonce.sh deleted file mode 100644 index 38efcb4..0000000 --- a/fsh-tutorial/FishExample/_genonce.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -publisher_jar=publisher.jar -input_cache_path=./input-cache/ -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 . $txoption $* - -else - publisher=../$publisher_jar - if test -f "$publisher"; then - java -jar $publisher -ig . $txoption $* - else - echo IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... - fi -fi diff --git a/fsh-tutorial/FishExample/_updatePublisher.bat b/fsh-tutorial/FishExample/_updatePublisher.bat deleted file mode 100644 index a8bf6ee..0000000 --- a/fsh-tutorial/FishExample/_updatePublisher.bat +++ /dev/null @@ -1,218 +0,0 @@ -@ECHO OFF - -SETLOCAL - -SET dlurl=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar -SET publisher_jar=publisher.jar -SET input_cache_path=%CD%\input-cache\ -SET skipPrompts=false - -set update_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.bat -set gen_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.bat -set gencont_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.bat -set gencont_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.sh -set gen_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.sh -set update_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.sh - -IF "%~1"=="/f" SET skipPrompts=true - - -ECHO. -ECHO Checking internet connection... -PING tx.fhir.org -4 -n 1 -w 1000 | FINDSTR TTL && GOTO isonline -ECHO We're offline, nothing to do... -GOTO end - -:isonline -ECHO We're online - - -:processflags -SET ARG=%1 -IF DEFINED ARG ( - IF "%ARG%"=="-f" SET FORCE=true - IF "%ARG%"=="--force" SET FORCE=true - SHIFT - GOTO processflags -) - -FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx - -ECHO. -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 -IF DEFINED FORCE ( - MKDIR "%input_cache_path%" 2> NUL - GOTO download -) - -IF "%skipPrompts%"=="true" ( - SET create="Y" -) ELSE ( - SET /p create="Ok? (Y/N) " -) -IF /I "%create%"=="Y" ( - ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% - MKDIR "%input_cache_path%" 2> NUL - GOTO download -) -GOTO done - -:upgrade -IF "%skipPrompts%"=="true" ( - SET overwrite="Y" -) ELSE ( - 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 -rem this may be triggering the antivirus - bitsadmin.exe is a known threat -rem CALL bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%" - -rem this didn't work in win 10 -rem CALL Start-BitsTransfer /priority normal "%dlurl%" "%jarlocation%" - -rem this should work - untested -call (New-Object Net.WebClient).DownloadFile('%dlurl%', '%jarlocation%') -GOTO done - -:win8.1 -:win8 -:vista -GOTO done - - - -:done - - - - -ECHO. -ECHO Updating scripts -IF "%skipPrompts%"=="true" ( - SET updateScripts="Y" -) ELSE ( - SET /p updateScripts="Update scripts? (Y/N) " -) -IF /I "%updateScripts%"=="Y" ( - GOTO scripts -) -GOTO end - - -:scripts - -REM Download all batch files (and this one with a new name) - -SETLOCAL DisableDelayedExpansion - - - -:dl_script_1 -ECHO Updating _updatePublisher.sh -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_sh_url%\",\"_updatePublisher.new.sh\") } else { Invoke-WebRequest -Uri "%update_sh_url%" -Outfile "_updatePublisher.new.sh" } -if %ERRORLEVEL% == 0 goto upd_script_1 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_2 -:upd_script_1 -start copy /y "_updatePublisher.new.sh" "_updatePublisher.sh" ^&^& del "_updatePublisher.new.sh" ^&^& exit - - -:dl_script_2 -ECHO Updating _genonce.bat -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_bat_url%\",\"_genonce.new.bat\") } else { Invoke-WebRequest -Uri "%gen_bat_url%" -Outfile "_genonce.bat" } -if %ERRORLEVEL% == 0 goto upd_script_2 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_3 -:upd_script_2 -start copy /y "_genonce.new.bat" "_genonce.bat" ^&^& del "_genonce.new.bat" ^&^& exit - -:dl_script_3 -ECHO Updating _gencontinuous.bat -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_bat_url%\",\"_gencontinuous.new.bat\") } else { Invoke-WebRequest -Uri "%gencont_bat_url%" -Outfile "_gencontinuous.bat" } -if %ERRORLEVEL% == 0 goto upd_script_3 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_4 -:upd_script_3 -start copy /y "_gencontinuous.new.bat" "_gencontinuous.bat" ^&^& del "_gencontinuous.new.bat" ^&^& exit - - -:dl_script_4 -ECHO Updating _genonce.sh -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_sh_url%\",\"_genonce.new.sh\") } else { Invoke-WebRequest -Uri "%gen_sh_url%" -Outfile "_genonce.sh" } -if %ERRORLEVEL% == 0 goto upd_script_4 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_5 -:upd_script_4 -start copy /y "_genonce.new.sh" "_genonce.sh" ^&^& del "_genonce.new.sh" ^&^& exit - -:dl_script_5 -ECHO Updating _gencontinuous.sh -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_sh_url%\",\"_gencontinuous.new.sh\") } else { Invoke-WebRequest -Uri "%gencont_sh_url%" -Outfile "_gencontinuous.sh" } -if %ERRORLEVEL% == 0 goto upd_script_5 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_6 -:upd_script_5 -start copy /y "_gencontinuous.new.sh" "_gencontinuous.sh" ^&^& del "_gencontinuous.new.sh" ^&^& exit - - - -:dl_script_6 -ECHO Updating _updatePublisher.bat -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_bat_url%\",\"_updatePublisher.new.bat\") } else { Invoke-WebRequest -Uri "%update_bat_url%" -Outfile "_updatePublisher.new.bat" } -if %ERRORLEVEL% == 0 goto upd_script_6 -echo "Errors encountered during download: %errorlevel%" -goto end -:upd_script_6 -start copy /y "_updatePublisher.new.bat" "_updatePublisher.bat" ^&^& del "_updatePublisher.new.bat" ^&^& exit - - -:end - - -IF "%skipPrompts%"=="true" ( - PAUSE -} diff --git a/fsh-tutorial/FishExample/_updatePublisher.sh b/fsh-tutorial/FishExample/_updatePublisher.sh deleted file mode 100644 index 1a3484b..0000000 --- a/fsh-tutorial/FishExample/_updatePublisher.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -pubsource=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/ -publisher_jar=publisher.jar -dlurl=$pubsource$publisher_jar - -input_cache_path=$PWD/input-cache/ - -scriptdlroot=https://raw.githubusercontent.com/FHIR/sample-ig/master -update_bat_url=$scriptdlroot/_updatePublisher.bat -gen_bat_url=$scriptdlroot/_genonce.bat -gencont_bat_url=$scriptdlroot/_gencontinuous.bat -gencont_sh_url=$scriptdlroot/_gencontinuous.sh -gen_sh_url=$scriptdlroot/_genonce.sh -update_sh_url=$scriptdlroot/_updatePublisher.sh - -skipPrompts=false -FORCE=false - -if ! type "curl" > /dev/null; then - echo "ERROR: Script needs curl to download latest IG Publisher. Please install curl." - exit 1 -fi - -while [ "$#" -gt 0 ]; do - case $1 in - -f|--force) FORCE=true ;; - -y|--yes) skipPrompts=true ; FORCE=true ;; - *) echo "Unknown parameter passed: $1. Exiting"; exit 1 ;; - esac - shift -done - -echo "Checking internet connection" -case "$OSTYPE" in - linux-gnu* ) ping tx.fhir.org -4 -c 1 -w 1000 >/dev/null ;; - darwin* ) ping tx.fhir.org -c 1 >/dev/null ;; - *) echo "unknown: $OSTYPE"; exit 1 ;; -esac - -if [ $? -ne 0 ] ; then - echo "Offline (or the terminology server is down), unable to update. Exiting" - exit 1 -fi - -if [ ! -d "$input_cache_path" ] ; then - if [ $FORCE != true ]; then - echo "$input_cache_path does not exist" - message="create it?" - read -r -p "$message" response - else - response=y - fi -fi - -if [[ $response =~ ^[yY].*$ ]] ; then - mkdir ./input-cache -fi - -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 [[ $skipPrompts == false ]]; then - - if [[ $upgrade == true ]]; 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 -else - response=y -fi -if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then - - echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit" - curl -L $dlurl -o "$jarlocation" --create-dirs -else - echo cancelled publisher update -fi - -if [[ $skipPrompts != true ]]; then - message="Update scripts? (enter 'y' or 'Y' to continue, any other key to cancel)?" - read -r -p "$message" response - fi - -if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then - echo "Downloading most recent scripts " - - curl -L $update_bat_url -o /tmp/_updatePublisher.new - cp /tmp/_updatePublisher.new _updatePublisher.bat - rm /tmp/_updatePublisher.new - - curl -L $gen_bat_url -o /tmp/_genonce.new - cp /tmp/_genonce.new _genonce.bat - rm /tmp/_genonce.new - - curl -L $gencont_bat_url -o /tmp/_gencontinuous.new - cp /tmp/_gencontinuous.new _gencontinuous.bat - rm /tmp/_gencontinuous.new - - curl -L $gencont_sh_url -o /tmp/_gencontinuous.new - cp /tmp/_gencontinuous.new _gencontinuous.sh - rm /tmp/_gencontinuous.new - - curl -L $gen_sh_url -o /tmp/_genonce.new - cp /tmp/_genonce.new _genonce.sh - rm /tmp/_genonce.new - - curl -L $update_sh_url -o /tmp/_updatePublisher.new - cp /tmp/_updatePublisher.new _updatePublisher.sh - rm /tmp/_updatePublisher.new -fi diff --git a/fsh-tutorial/FishExampleComplete/_build.bat b/fsh-tutorial/FishExampleComplete/_build.bat new file mode 100644 index 0000000..99d0e1f --- /dev/null +++ b/fsh-tutorial/FishExampleComplete/_build.bat @@ -0,0 +1,386 @@ +@ECHO OFF +setlocal enabledelayedexpansion + +SET "dlurl=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar" +SET "publisher_jar=publisher.jar" +SET "input_cache_path=%CD%\input-cache\" +SET "skipPrompts=false" +SET "upper_path=..\" +SET "scriptdlroot=https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main" +SET "build_bat_url=%scriptdlroot%/_build.bat" +SET "build_sh_url=%scriptdlroot%/_build.sh" + + + +:: Debugging statements to check jar file location +ECHO Checking for publisher.jar in %input_cache_path% +IF EXIST "%input_cache_path%%publisher_jar%" ( + SET "jar_location=%input_cache_path%%publisher_jar%" + ECHO Found publisher.jar in input-cache +) ELSE ( + ECHO Checking for publisher.jar in %upper_path% + IF EXIST "%upper_path%%publisher_jar%" ( + SET "jar_location=%upper_path%%publisher_jar%" + ECHO Found publisher.jar in parent folder + ) ELSE ( + SET "jar_location=not_found" + SET "default_choice=1" + ECHO publisher.jar not found in input-cache or parent folder + ) +) + + +:: Handle command-line argument to bypass the menu +IF NOT "%~1"=="" ( + IF /I "%~1"=="update" SET "userChoice=1" + IF /I "%~1"=="build" SET "userChoice=2" + IF /I "%~1"=="nosushi" SET "userChoice=3" + IF /I "%~1"=="notx" SET "userChoice=4" + IF /I "%~1"=="jekyll" SET "userChoice=5" + IF /I "%~1"=="clean" SET "userChoice=6" + IF /I "%~1"=="exit" SET "userChoice=0" + GOTO executeChoice +) + +echo --------------------------------------------------------------- +ECHO Checking internet connection... +PING tx.fhir.org -4 -n 1 -w 4000 >nul 2>&1 && SET "online_status=true" || SET "online_status=false" + +IF "%online_status%"=="true" ( + ECHO We're online and tx.fhir.org is available. + FOR /F "tokens=2 delims=:" %%a IN ('curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest ^| findstr "tag_name"') DO SET "latest_version=%%a" + SET "latest_version=!latest_version:"=!" + SET "latest_version=!latest_version: =!" + SET "latest_version=!latest_version:~0,-1!" +) ELSE ( + ECHO We're offline or tx.fhir.org is not available, can only run the publisher without TX... + SET "txoption=-tx n/a" + SET "latest_version=unknown" + SET "default_choice=4" +) + +echo --------------------------------------------------------------- + + +IF NOT "%jar_location%"=="not_found" ( + FOR /F "tokens=*" %%i IN ('java "-Dfile.encoding=UTF-8" -jar "%jar_location%" -v 2^>^&1') DO SET "publisher_version=%%i" + SET "publisher_version=!publisher_version:"=!" + ECHO Detected publisher version: !publisher_version! +) ELSE ( + SET "publisher_version=unknown" + ECHO publisher.jar location is not found +) + +ECHO Publisher version: !publisher_version!; Latest is !latest_version! + +IF NOT "%online_status%"=="true" ( + ECHO We're offline. +) ELSE ( + IF NOT "!publisher_version!"=="!latest_version!" ( + ECHO An update is recommended. + SET "default_choice=1" + ) ELSE ( + ECHO Publisher is up to date. + SET "default_choice=2" + ) +) + +echo --------------------------------------------------------------- +echo. + +echo Please select an option: +echo 1. Download or update publisher +echo 2. Build IG +echo 3. Build IG - no sushi +echo 4. Build IG - force no TX server +echo 5. Jekyll build +echo 6. Clean up temp directories +echo 0. Exit +:: echo [Press Enter for default (%default_choice%) or type an option number:] +echo. + +:: Using CHOICE to handle input with timeout +:: ECHO [Enter=Continue, 1-7=Option, 0=Exit] +choice /C 12345670 /N /CS /D %default_choice% /T 5 /M "Choose an option number or wait 5 seconds for default (%default_choice%):" +SET "userChoice=%ERRORLEVEL%" + + +:executeChoice +echo You selected: %userChoice% + +IF "%userChoice%"=="1" GOTO downloadpublisher +IF "%userChoice%"=="2" GOTO publish_once +IF "%userChoice%"=="3" GOTO publish_nosushi +IF "%userChoice%"=="4" GOTO publish_notx +IF "%userChoice%"=="5" GOTO debugjekyll +IF "%userChoice%"=="6" GOTO clean +IF "%userChoice%"=="0" EXIT /B + +:end + + + +:debugjekyll + echo Running Jekyll build... + jekyll build -s temp/pages -d output +GOTO end + + +:clean + echo Cleaning up directories... + if exist ".\input-cache\publisher.jar" ( + echo Preserving publisher.jar and removing other files in .\input-cache... + move ".\input-cache\publisher.jar" ".\" + rmdir /s /q ".\input-cache" + mkdir ".\input-cache" + move ".\publisher.jar" ".\input-cache" + ) else ( + if exist ".\input-cache\" ( + rmdir /s /q ".\input-cache" + ) + ) + if exist ".\temp\" ( + rmdir /s /q ".\temp" + echo Removed: .\temp + ) + if exist ".\output\" ( + rmdir /s /q ".\output" + echo Removed: .\output + ) + if exist ".\template\" ( + rmdir /s /q ".\template" + echo Removed: .\template + ) + +GOTO end + + + + + +:downloadpublisher +ECHO Downloading Publisher... +:processflags +SET ARG=%1 +IF DEFINED ARG ( + IF "%ARG%"=="-f" SET FORCE=true + IF "%ARG%"=="--force" SET FORCE=true + SHIFT + GOTO processflags +) + +FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx + +ECHO. +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 +IF DEFINED FORCE ( + MKDIR "%input_cache_path%" 2> NUL + GOTO download +) + +IF "%skipPrompts%"=="y" ( + SET create=Y +) ELSE ( + SET /p create="Download? (Y/N) " +) +IF /I "%create%"=="Y" ( + ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% + MKDIR "%input_cache_path%" 2> NUL + GOTO download +) +GOTO done + +:upgrade +IF "%skipPrompts%"=="y" ( + SET overwrite=Y +) ELSE ( + 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 ~200 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 +rem this may be triggering the antivirus - bitsadmin.exe is a known threat +rem CALL bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%" + +rem this didn't work in win 10 +rem CALL Start-BitsTransfer /priority normal "%dlurl%" "%jarlocation%" + +rem this should work - untested +call (New-Object Net.WebClient).DownloadFile('%dlurl%', '%jarlocation%') +GOTO done + +:win8.1 +:win8 +:vista +GOTO done + + + +:done + + + + +ECHO. +ECHO Updating scripts +IF "%skipPrompts%"=="y" ( + SET updateScripts=Y +) ELSE ( + SET /p updateScripts="Update scripts? (Y/N) " +) +IF /I "%updateScripts%"=="Y" ( + GOTO scripts +) +GOTO end + + +:scripts + +REM Download all batch files (and this one with a new name) + +SETLOCAL DisableDelayedExpansion + + + +:dl_script_1 +ECHO Updating _build.sh +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_sh_url%\",\"_build.new.sh\") } else { Invoke-WebRequest -Uri "%build_sh_url%" -Outfile "_build.new.sh" } +if %ERRORLEVEL% == 0 goto upd_script_1 +echo "Errors encountered during download: %errorlevel%" +goto dl_script_2 +:upd_script_1 +start copy /y "_build.new.sh" "_build.sh" ^&^& del "_build.new.sh" ^&^& exit + + +:dl_script_2 +ECHO Updating _build.bat +call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%build_bat_url%\",\"_build.new.bat\") } else { Invoke-WebRequest -Uri "%build_bat_url%" -Outfile "_build.new.bat" } +if %ERRORLEVEL% == 0 goto upd_script_2 +echo "Errors encountered during download: %errorlevel%" +goto end +:upd_script_2 +start copy /y "_build.new.bat" "_build.bat" ^&^& del "_build.new.bat" ^&^& exit + + +GOTO end + + +:publish_once + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 1jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + +:publish_nosushi + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 3jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% -no-sushi %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + +:publish_notx +SET txoption=-tx n/a + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO 2jar_location is: %jar_location% +IF NOT "%jar_location%"=="not_found" ( + java %JAVA_OPTS% -jar "%jar_location%" -ig . %txoption% %* +) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... +) + +GOTO end + + + + +:publish_continuous + +SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 + +:: Debugging statements before running publisher +ECHO Checking %input_cache_path% for publisher.jar +IF EXIST "%input_cache_path%\%publisher_jar%" ( + java %JAVA_OPTS% -jar "%input_cache_path%\%publisher_jar%" -ig . %txoption% -watch %* +) ELSE ( + ECHO Checking %upper_path% for publisher.jar + IF EXIST "..\%publisher_jar%" ( + java %JAVA_OPTS% -jar "..\%publisher_jar%" -ig . %txoption% -watch %* + ) ELSE ( + ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... + ) +) + +GOTO end + + +:end + +:: Pausing at the end + + +IF NOT "%skipPrompts%"=="true" ( + PAUSE +) diff --git a/fsh-tutorial/FishExampleComplete/_build.sh b/fsh-tutorial/FishExampleComplete/_build.sh new file mode 100755 index 0000000..f11edff --- /dev/null +++ b/fsh-tutorial/FishExampleComplete/_build.sh @@ -0,0 +1,176 @@ +#!/bin/bash + +set -e + +# Variables +dlurl="https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar" +publisher_jar="publisher.jar" +input_cache_path="$(pwd)/input-cache/" +skipPrompts=false +upper_path="../" +scriptdlroot="https://raw.githubusercontent.com/HL7/ig-publisher-scripts/main" +build_bat_url="${scriptdlroot}/_build.bat" +build_sh_url="${scriptdlroot}/_build.sh" + +function check_jar_location() { + if [ -f "${input_cache_path}${publisher_jar}" ]; then + jar_location="${input_cache_path}${publisher_jar}" + echo "Found publisher.jar in input-cache" + elif [ -f "${upper_path}${publisher_jar}" ]; then + jar_location="${upper_path}${publisher_jar}" + echo "Found publisher.jar in parent folder" + else + jar_location="not_found" + echo "publisher.jar not found in input-cache or parent folder" + fi +} + +function check_internet_connection() { + if ping -c 1 tx.fhir.org &>/dev/null; then + online=true + echo "We're online and tx.fhir.org is available." + latest_version=$(curl -s https://api.github.com/repos/HL7/fhir-ig-publisher/releases/latest | grep tag_name | cut -d'"' -f4) + else + online=false + echo "We're offline or tx.fhir.org is unavailable." + fi +} + + +function update_publisher() { + echo "Publisher jar location: ${input_cache_path}${publisher_jar}" + read -p "Download or update publisher.jar? (Y/N): " confirm + if [[ "$confirm" =~ ^[Yy]$ ]]; then + echo "Downloading latest publisher.jar (~200 MB)..." + mkdir -p "$input_cache_path" + curl -L "$dlurl" -o "${input_cache_path}${publisher_jar}" + else + echo "Skipped downloading publisher.jar" + fi + + update_scripts_prompt +} + + +function update_scripts_prompt() { + read -p "Update scripts (_build.bat and _build.sh)? (Y/N): " update_confirm + if [[ "$update_confirm" =~ ^[Yy]$ ]]; then + echo "Updating scripts..." + curl -L "$build_bat_url" -o "_build.new.bat" && mv "_build.new.bat" "_build.bat" + curl -L "$build_sh_url" -o "_build.new.sh" && mv "_build.new.sh" "_build.sh" + chmod +x _build.sh + echo "Scripts updated." + else + echo "Skipped updating scripts." + fi +} + + +function build_ig() { + if [ "$jar_location" != "not_found" ]; then + args=() + if [ "$online" = "false" ]; then + args+=("-tx" "n/a") + fi + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . "${args[@]}" "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + + +function build_nosushi() { + if [ "$jar_location" != "not_found" ]; then + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . -no-sushi "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + +function build_notx() { + if [ "$jar_location" != "not_found" ]; then + java -Dfile.encoding=UTF-8 -jar "$jar_location" -ig . -tx n/a "$@" + else + echo "publisher.jar not found. Please run update." + fi +} + +function jekyll_build() { + echo "Running Jekyll build..." + jekyll build -s temp/pages -d output +} + +function cleanup() { + echo "Cleaning up temp directories..." + if [ -f "${input_cache_path}${publisher_jar}" ]; then + mv "${input_cache_path}${publisher_jar}" ./ + rm -rf "${input_cache_path}"* + mkdir -p "$input_cache_path" + mv "$publisher_jar" "$input_cache_path" + fi + rm -rf ./output ./template ./temp + echo "Cleanup complete." +} + +check_jar_location +check_internet_connection + +# Handle command-line argument or menu +case "$1" in + update) update_publisher ;; + build) build_ig ;; + nosushi) build_nosushi ;; + notx) build_notx ;; + jekyll) jekyll_build ;; + clean) cleanup ;; + exit) exit 0 ;; + *) + # Compute default choice + default_choice=2 # Build by default + + if [ "$jar_location" = "not_found" ]; then + default_choice=1 # Download if jar is missing + elif [ "$online" = "false" ]; then + default_choice=4 # Offline build + elif [ -n "$latest_version" ]; then + current_version=$(java -jar "$jar_location" -v 2>/dev/null | tr -d '\r') + if [ "$current_version" != "$latest_version" ]; then + default_choice=1 # Offer update if newer version exists + fi + fi + + echo "---------------------------------------------" + echo "Publisher: ${current_version:-unknown}; Latest: ${latest_version:-unknown}" + echo "Publisher location: $jar_location" + echo "Online: $online" + echo "---------------------------------------------" + echo + echo "Please select an option:" + echo "1) Download or update publisher" + echo "2) Build IG" + echo "3) Build IG without Sushi" + echo "4) Build IG without TX server" + echo "5) Jekyll build" + echo "6) Cleanup temp directories" + echo "0) Exit" + echo + + # Read with timeout, but default if nothing entered + echo -n "Choose an option [default: $default_choice]: " + read -t 5 choice || choice="$default_choice" + choice="${choice:-$default_choice}" + echo "You selected: $choice" + + case "$choice" in + 1) update_publisher ;; + 2) build_ig ;; + 3) build_nosushi ;; + 4) build_notx ;; + 5) jekyll_build ;; + 6) cleanup ;; + 0) exit 0 ;; + *) echo "Invalid option." ;; + esac + ;; + +esac diff --git a/fsh-tutorial/FishExampleComplete/_genonce.bat b/fsh-tutorial/FishExampleComplete/_genonce.bat deleted file mode 100644 index a9864ef..0000000 --- a/fsh-tutorial/FishExampleComplete/_genonce.bat +++ /dev/null @@ -1,27 +0,0 @@ -@ECHO OFF -SET publisher_jar=publisher.jar -SET input_cache_path=%CD%\input-cache - -ECHO Checking internet connection... -PING tx.fhir.org -4 -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 . %txoption% %* -) ELSE If exist "..\%publisher_jar%" ( - JAVA -jar "..\%publisher_jar%" -ig . %txoption% %* -) ELSE ( - ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... -) - -PAUSE diff --git a/fsh-tutorial/FishExampleComplete/_genonce.sh b/fsh-tutorial/FishExampleComplete/_genonce.sh deleted file mode 100644 index 38efcb4..0000000 --- a/fsh-tutorial/FishExampleComplete/_genonce.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -publisher_jar=publisher.jar -input_cache_path=./input-cache/ -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 . $txoption $* - -else - publisher=../$publisher_jar - if test -f "$publisher"; then - java -jar $publisher -ig . $txoption $* - else - echo IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting... - fi -fi diff --git a/fsh-tutorial/FishExampleComplete/_updatePublisher.bat b/fsh-tutorial/FishExampleComplete/_updatePublisher.bat deleted file mode 100644 index a8bf6ee..0000000 --- a/fsh-tutorial/FishExampleComplete/_updatePublisher.bat +++ /dev/null @@ -1,218 +0,0 @@ -@ECHO OFF - -SETLOCAL - -SET dlurl=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar -SET publisher_jar=publisher.jar -SET input_cache_path=%CD%\input-cache\ -SET skipPrompts=false - -set update_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.bat -set gen_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.bat -set gencont_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.bat -set gencont_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.sh -set gen_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.sh -set update_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.sh - -IF "%~1"=="/f" SET skipPrompts=true - - -ECHO. -ECHO Checking internet connection... -PING tx.fhir.org -4 -n 1 -w 1000 | FINDSTR TTL && GOTO isonline -ECHO We're offline, nothing to do... -GOTO end - -:isonline -ECHO We're online - - -:processflags -SET ARG=%1 -IF DEFINED ARG ( - IF "%ARG%"=="-f" SET FORCE=true - IF "%ARG%"=="--force" SET FORCE=true - SHIFT - GOTO processflags -) - -FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx - -ECHO. -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 -IF DEFINED FORCE ( - MKDIR "%input_cache_path%" 2> NUL - GOTO download -) - -IF "%skipPrompts%"=="true" ( - SET create="Y" -) ELSE ( - SET /p create="Ok? (Y/N) " -) -IF /I "%create%"=="Y" ( - ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% - MKDIR "%input_cache_path%" 2> NUL - GOTO download -) -GOTO done - -:upgrade -IF "%skipPrompts%"=="true" ( - SET overwrite="Y" -) ELSE ( - 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 -rem this may be triggering the antivirus - bitsadmin.exe is a known threat -rem CALL bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%" - -rem this didn't work in win 10 -rem CALL Start-BitsTransfer /priority normal "%dlurl%" "%jarlocation%" - -rem this should work - untested -call (New-Object Net.WebClient).DownloadFile('%dlurl%', '%jarlocation%') -GOTO done - -:win8.1 -:win8 -:vista -GOTO done - - - -:done - - - - -ECHO. -ECHO Updating scripts -IF "%skipPrompts%"=="true" ( - SET updateScripts="Y" -) ELSE ( - SET /p updateScripts="Update scripts? (Y/N) " -) -IF /I "%updateScripts%"=="Y" ( - GOTO scripts -) -GOTO end - - -:scripts - -REM Download all batch files (and this one with a new name) - -SETLOCAL DisableDelayedExpansion - - - -:dl_script_1 -ECHO Updating _updatePublisher.sh -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_sh_url%\",\"_updatePublisher.new.sh\") } else { Invoke-WebRequest -Uri "%update_sh_url%" -Outfile "_updatePublisher.new.sh" } -if %ERRORLEVEL% == 0 goto upd_script_1 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_2 -:upd_script_1 -start copy /y "_updatePublisher.new.sh" "_updatePublisher.sh" ^&^& del "_updatePublisher.new.sh" ^&^& exit - - -:dl_script_2 -ECHO Updating _genonce.bat -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_bat_url%\",\"_genonce.new.bat\") } else { Invoke-WebRequest -Uri "%gen_bat_url%" -Outfile "_genonce.bat" } -if %ERRORLEVEL% == 0 goto upd_script_2 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_3 -:upd_script_2 -start copy /y "_genonce.new.bat" "_genonce.bat" ^&^& del "_genonce.new.bat" ^&^& exit - -:dl_script_3 -ECHO Updating _gencontinuous.bat -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_bat_url%\",\"_gencontinuous.new.bat\") } else { Invoke-WebRequest -Uri "%gencont_bat_url%" -Outfile "_gencontinuous.bat" } -if %ERRORLEVEL% == 0 goto upd_script_3 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_4 -:upd_script_3 -start copy /y "_gencontinuous.new.bat" "_gencontinuous.bat" ^&^& del "_gencontinuous.new.bat" ^&^& exit - - -:dl_script_4 -ECHO Updating _genonce.sh -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_sh_url%\",\"_genonce.new.sh\") } else { Invoke-WebRequest -Uri "%gen_sh_url%" -Outfile "_genonce.sh" } -if %ERRORLEVEL% == 0 goto upd_script_4 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_5 -:upd_script_4 -start copy /y "_genonce.new.sh" "_genonce.sh" ^&^& del "_genonce.new.sh" ^&^& exit - -:dl_script_5 -ECHO Updating _gencontinuous.sh -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_sh_url%\",\"_gencontinuous.new.sh\") } else { Invoke-WebRequest -Uri "%gencont_sh_url%" -Outfile "_gencontinuous.sh" } -if %ERRORLEVEL% == 0 goto upd_script_5 -echo "Errors encountered during download: %errorlevel%" -goto dl_script_6 -:upd_script_5 -start copy /y "_gencontinuous.new.sh" "_gencontinuous.sh" ^&^& del "_gencontinuous.new.sh" ^&^& exit - - - -:dl_script_6 -ECHO Updating _updatePublisher.bat -call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_bat_url%\",\"_updatePublisher.new.bat\") } else { Invoke-WebRequest -Uri "%update_bat_url%" -Outfile "_updatePublisher.new.bat" } -if %ERRORLEVEL% == 0 goto upd_script_6 -echo "Errors encountered during download: %errorlevel%" -goto end -:upd_script_6 -start copy /y "_updatePublisher.new.bat" "_updatePublisher.bat" ^&^& del "_updatePublisher.new.bat" ^&^& exit - - -:end - - -IF "%skipPrompts%"=="true" ( - PAUSE -} diff --git a/fsh-tutorial/FishExampleComplete/_updatePublisher.sh b/fsh-tutorial/FishExampleComplete/_updatePublisher.sh deleted file mode 100644 index 1a3484b..0000000 --- a/fsh-tutorial/FishExampleComplete/_updatePublisher.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -pubsource=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/ -publisher_jar=publisher.jar -dlurl=$pubsource$publisher_jar - -input_cache_path=$PWD/input-cache/ - -scriptdlroot=https://raw.githubusercontent.com/FHIR/sample-ig/master -update_bat_url=$scriptdlroot/_updatePublisher.bat -gen_bat_url=$scriptdlroot/_genonce.bat -gencont_bat_url=$scriptdlroot/_gencontinuous.bat -gencont_sh_url=$scriptdlroot/_gencontinuous.sh -gen_sh_url=$scriptdlroot/_genonce.sh -update_sh_url=$scriptdlroot/_updatePublisher.sh - -skipPrompts=false -FORCE=false - -if ! type "curl" > /dev/null; then - echo "ERROR: Script needs curl to download latest IG Publisher. Please install curl." - exit 1 -fi - -while [ "$#" -gt 0 ]; do - case $1 in - -f|--force) FORCE=true ;; - -y|--yes) skipPrompts=true ; FORCE=true ;; - *) echo "Unknown parameter passed: $1. Exiting"; exit 1 ;; - esac - shift -done - -echo "Checking internet connection" -case "$OSTYPE" in - linux-gnu* ) ping tx.fhir.org -4 -c 1 -w 1000 >/dev/null ;; - darwin* ) ping tx.fhir.org -c 1 >/dev/null ;; - *) echo "unknown: $OSTYPE"; exit 1 ;; -esac - -if [ $? -ne 0 ] ; then - echo "Offline (or the terminology server is down), unable to update. Exiting" - exit 1 -fi - -if [ ! -d "$input_cache_path" ] ; then - if [ $FORCE != true ]; then - echo "$input_cache_path does not exist" - message="create it?" - read -r -p "$message" response - else - response=y - fi -fi - -if [[ $response =~ ^[yY].*$ ]] ; then - mkdir ./input-cache -fi - -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 [[ $skipPrompts == false ]]; then - - if [[ $upgrade == true ]]; 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 -else - response=y -fi -if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then - - echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit" - curl -L $dlurl -o "$jarlocation" --create-dirs -else - echo cancelled publisher update -fi - -if [[ $skipPrompts != true ]]; then - message="Update scripts? (enter 'y' or 'Y' to continue, any other key to cancel)?" - read -r -p "$message" response - fi - -if [[ $skipPrompts == true ]] || [[ $response =~ ^[yY].*$ ]]; then - echo "Downloading most recent scripts " - - curl -L $update_bat_url -o /tmp/_updatePublisher.new - cp /tmp/_updatePublisher.new _updatePublisher.bat - rm /tmp/_updatePublisher.new - - curl -L $gen_bat_url -o /tmp/_genonce.new - cp /tmp/_genonce.new _genonce.bat - rm /tmp/_genonce.new - - curl -L $gencont_bat_url -o /tmp/_gencontinuous.new - cp /tmp/_gencontinuous.new _gencontinuous.bat - rm /tmp/_gencontinuous.new - - curl -L $gencont_sh_url -o /tmp/_gencontinuous.new - cp /tmp/_gencontinuous.new _gencontinuous.sh - rm /tmp/_gencontinuous.new - - curl -L $gen_sh_url -o /tmp/_genonce.new - cp /tmp/_genonce.new _genonce.sh - rm /tmp/_genonce.new - - curl -L $update_sh_url -o /tmp/_updatePublisher.new - cp /tmp/_updatePublisher.new _updatePublisher.sh - rm /tmp/_updatePublisher.new -fi