diff --git a/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java b/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java
index bf4692489..00a908919 100644
--- a/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java
+++ b/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java
@@ -1032,10 +1032,10 @@ private String makeTemplateIndexPage() {
}
private String makeTemplateJekyllIndexPage() {
- String page = "---"+
- "layout: page"+
- "title: {{npm}}"+
- "---"+
+ String page = "---\r\n"+
+ "layout: page\r\n"+
+ "title: {{npm}}\r\n"+
+ "---\r\n"+
"
Template {{npm}}
\r\n"+
" You can download the template, though you should not need to; just refer to the template as {{npm}} in your IG configuration.
\r\n"+
" A full version history is published
\r\n";
diff --git a/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/utils/TemplateReleaser.java b/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/utils/TemplateReleaser.java
index 4264ece15..224449256 100644
--- a/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/utils/TemplateReleaser.java
+++ b/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/utils/TemplateReleaser.java
@@ -123,6 +123,8 @@ public String summary() {
private File xml;
+ private Boolean assumeValidDependencies;
+
// 3 parameters: source of package, package dest folder, and release note
public static void main(String[] args) throws Exception {
@@ -138,6 +140,7 @@ public static void main(String[] args) throws Exception {
private void release(String source, String dest) throws Exception {
SimpleDateFormat df = new SimpleDateFormat(RSS_DATE, new Locale("en", "US"));
+ assumeValidDependencies = ("YES".equals(System.getenv("PUB_ASSUME_VALID_DEPENDENCIES")));
checkDest(dest);
Map currentPublishedVersions = scanForCurrentVersions(dest);
System.out.println("Current Published Versions");
@@ -215,13 +218,21 @@ private void buildIndexPage(Map currentVersions, String path) th
for (String id : Utilities.sorted(currentVersions.keySet())) {
tr = tbl.tr();
PackageList pl = new PackageList(JsonParser.parseObject(new File(Utilities.path(path, id, "package-list.json"))));
- tr.td().ah("http://fhir.org/templates/"+id).tx(pl.pid());
+ tr.td().ah(pl.canonical()).tx(pl.pid());
tr.td().tx(pl.title());
- tr.td().ah("http://fhir.org/templates/"+id+"/"+pl.current().version()+"/package.tgz").tx(pl.current().version());
+ tr.td().ah(pl.canonical() + "/" + pl.current().version() + "/package.tgz").tx(pl.current().version());
tr.td().tx(pl.current().date());
}
- String s = INDEX_TEMPLATE.replace("{{index}}", new XhtmlComposer(false, false).compose(tbl));
- TextFile.stringToFile(s, Utilities.path(path, "index.html"), false);
+
+ String templateName = System.getenv("PUB_INDEX_TEMPLATE_FILE");
+ if (templateName != null) {
+ String s = TextFile.fileToString(templateName).replace("{{index}}", new XhtmlComposer(false, false).compose(tbl));
+ TextFile.stringToFile(s, Utilities.path(path, "index.html"), false);
+ }
+ else {
+ String s = INDEX_TEMPLATE.replace("{{index}}", new XhtmlComposer(false, false).compose(tbl));
+ TextFile.stringToFile(s, Utilities.path(path, "index.html"), false);
+ }
}
private void build(String source, VersionDecision vd, List versions) throws Exception {
@@ -242,12 +253,23 @@ private void updateVersions(String source, VersionDecision vd, List deps = new ArrayList<>();
- for (JsonProperty e : d.getProperties()) {
- deps.add(e.getName());
+ if (assumeValidDependencies) {
+ for (JsonProperty e : d.getProperties()) {
+ if (assumeValidDependencies && "current".equals(e.getValue().asJsonString().getValue())) {
+ throw new Error("When skipping dependency checks, cannot use \"current\" for "+e.getName()+" in "+vd.getId()+".");
+ }
+ }
}
- for (String s : deps) {
- d.remove(s);
- d.add(s, findVersion(versionsList, s).newVersion);
+ else {
+ for (JsonProperty e : d.getProperties()) {
+ deps.add(e.getName());
+ }
+ if (!assumeValidDependencies) {
+ for (String s : deps) {
+ d.remove(s);
+ d.add(s, findVersion(versionsList, s).newVersion);
+ }
+ }
}
}
String jcnt = JsonParser.compose(npm, true);
@@ -255,6 +277,9 @@ private void updateVersions(String source, VersionDecision vd, List versionsList) throws FileNotFoundException, IOException {
+ if (assumeValidDependencies) {
+ return;
+ }
JsonObject npm = JsonParser.parseObject(new FileInputStream(Utilities.path(source, vd.getId(), "package", "package.json")));
if (npm.has("dependencies")) {
JsonObject d = npm.getJsonObject("dependencies");
@@ -282,7 +307,7 @@ private void updateDate(String source, VersionDecision vd, String dateFmt) throw
}
}
if (!ok) {
- throw new Error("unable to find version "+vd.getNewVersion()+" in pacjage list");
+ throw new Error("unable to find version "+vd.getNewVersion()+" in package list");
}
TextFile.stringToFile(pl.toJson(), Utilities.path(source, vd.getId(), "package-list.json"));
}
@@ -356,8 +381,8 @@ private String getNewVersion(VersionChangeType t, String v) {
private void checkDependencies(String source, VersionDecision vd, List versions) throws Exception {
vd.checked = false;
- List dependendencies = listDependencies(source, vd.getId());
- for (String s : dependendencies) {
+ List dependencies = listDependencies(source, vd.getId());
+ for (String s : dependencies) {
VersionDecision v = findVersion(versions, s);
if (v.checked == null) {
checkDependencies(source, v, versions);
@@ -395,7 +420,7 @@ private VersionDecision findVersion(List versions, String s) {
private List listDependencies(String source, String id) throws Exception {
JsonObject npm = JsonParser.parseObject(TextFile.fileToString(Utilities.path(source, id, "package", "package.json")));
List res = new ArrayList();
- if (npm.has("dependencies")) {
+ if (!assumeValidDependencies && npm.has("dependencies")) {
for (JsonProperty s : npm.getJsonObject("dependencies").getProperties()) {
// if (!"current".equals(s.getValue().getAsString())) {
// throw new Exception("Dependency is not 'current'");