From 39c53b13f43ba096be5d34df2a0ed0dbe3d24b36 Mon Sep 17 00:00:00 2001 From: John Moehrke Date: Tue, 10 May 2022 14:27:32 -0500 Subject: [PATCH] publication 3.7.0 potential --- .gitignore | 1 - _updatePublisher.sh | 129 ++++++++++++++++++++++++++++++++++++++++++++ package-list.json | 2 +- sushi-config.yaml | 2 +- 4 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 _updatePublisher.sh diff --git a/.gitignore b/.gitignore index ee700d4a..a395f6a2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ www # macos .DS_Store /_genonce.sh -/_updatePublisher.sh /_gencontinuous.bat /_gencontinuous.sh /_genonce.bat diff --git a/_updatePublisher.sh b/_updatePublisher.sh new file mode 100644 index 00000000..f127f661 --- /dev/null +++ b/_updatePublisher.sh @@ -0,0 +1,129 @@ +#!/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/HL7/ig-publisher-scripts/main +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" +curl -sSf tx.fhir.org > /dev/null + +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/package-list.json b/package-list.json index 98a8ef84..d0f52e80 100644 --- a/package-list.json +++ b/package-list.json @@ -13,7 +13,7 @@ }, { "version" : "3.7.0", - "date" : "2022-04-06", + "date" : "2022-04-13", "desc" : "Public-Comment: comment resolution", "path" : "https://profiles.ihe.net/ITI/mCSD/3.7.0", "status" : "ballot", diff --git a/sushi-config.yaml b/sushi-config.yaml index 7b25aecb..efd88c23 100644 --- a/sushi-config.yaml +++ b/sushi-config.yaml @@ -6,7 +6,7 @@ title: "Mobile Care Services Discovery (mCSD)" #releaseLabel: ci-build #releaseLabel: Trial-Implementation releaseLabel: ballot -date: 2022-04-06 +date: 2022-04-13 status: active publisher: - name: IHE IT Infrastructure Technical Committee