From 893c22eea27b94010de3a2ec275858b00099eb5e Mon Sep 17 00:00:00 2001 From: Bryn Rhodes Date: Mon, 29 Jun 2020 19:08:35 -0600 Subject: [PATCH 1/3] Added anchor for cql-content in the liquid library template. --- templates/liquid/Library.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/liquid/Library.liquid b/templates/liquid/Library.liquid index 70aa2c9..0514403 100644 --- a/templates/liquid/Library.liquid +++ b/templates/liquid/Library.liquid @@ -307,7 +307,7 @@ {% if c.contentType = 'text/cql' %} - +
Content: {{c.contentType}}
Content: {{c.contentType}}
{{c.data.decode('base64').escape('html')}}
From 52e1448ba52880456f9a5246416bb3a898ed0e63 Mon Sep 17 00:00:00 2001 From: Carl Anderson Date: Wed, 1 Jul 2020 16:26:59 -0500 Subject: [PATCH 2/3] Follow 302 redirects with curl I noticed that, after running this script, the jar file was only 144 bytes. Running the commented-out `wget` command worked for me, so I re-ran the `curl` command with `-v`. I noticed that the first response was a 302 redirect. It seemed that `curl` needs an extra nudge to follow redirects. Looking in the man page I found `-L`, which worked for me. --- _updatePublisher.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_updatePublisher.sh b/_updatePublisher.sh index effde2e..babd762 100755 --- a/_updatePublisher.sh +++ b/_updatePublisher.sh @@ -58,7 +58,7 @@ fi if [[ "$FORCE" == true ]] || [[ "$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 + curl -L $dlurl -o "$jarlocation" --create-dirs else echo cancel... fi From ace44c2dfa72e62c6bac6cb82f8bf2a3bc5ca4d4 Mon Sep 17 00:00:00 2001 From: David Pyke <44613570+DavidPyke@users.noreply.github.com> Date: Fri, 24 Jul 2020 08:21:56 -0400 Subject: [PATCH 3/3] Update _updatePublisher linux/mac script Update the linux/mac script to emulate what the windows batch file does (but better and more logically because it's not windows) --- _updatePublisher.sh | 109 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 20 deletions(-) diff --git a/_updatePublisher.sh b/_updatePublisher.sh index 739b61a..a8d4489 100755 --- a/_updatePublisher.sh +++ b/_updatePublisher.sh @@ -1,30 +1,64 @@ -#!/bin/bash -dlurl=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar +#/bin/bash +pubsource=https://github.com/HL7/fhir-ig-publisher/releases/latest/download/ publisher_jar=publisher.jar -input_cache_path=./input-cache/ +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 -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 +while [ "$#" -gt 0 ]; do case $1 in - -f|--force) FORCE=true ;; - --) - shift - break - ;; - *) break + -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 + +if test -f "$publisher" ; then echo "IG Publisher FOUND in input-cache" jarlocation="$publisher" jarlocationname="Input Cache" @@ -38,27 +72,62 @@ else jarlocationname="Parent Folder" upgrade=true 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_path$publisher_jar jarlocationname="Input Cache" upgrade=false fi fi -if [[ "$FORCE" != true ]]; then - if "$upgrade"; then +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 -if [[ "$FORCE" == true ]] || [[ "$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 -L $dlurl -o "$jarlocation" --create-dirs else - echo cancel... + 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