diff --git a/src/incatools/odk/model.py b/src/incatools/odk/model.py index f209c3a..8a8f83b 100644 --- a/src/incatools/odk/model.py +++ b/src/incatools/odk/model.py @@ -967,7 +967,7 @@ class OntologyProject(JsonSchemaMixin): annotation in the seeded ontology. """ - description: str = "None" + description: Optional[str] = None """A short description of the ontology.""" use_dosdps: bool = False diff --git a/src/incatools/odk/templates/_dynamic_files.jinja2 b/src/incatools/odk/templates/_dynamic_files.jinja2 index 1fc451f..19d4e87 100644 --- a/src/incatools/odk/templates/_dynamic_files.jinja2 +++ b/src/incatools/odk/templates/_dynamic_files.jinja2 @@ -316,42 +316,72 @@ For more background see: --- layout: ontology_detail id: {{ project.id }} -title: {{ project.title }} -jobs: - - id: https://travis-ci.org/{{ project.github_org }}/{{ project.repo }} - type: travis-ci +title: "{{ project.title }}" build: +{%- if project.github_org %} checkout: git clone https://github.com/{{ project.github_org }}/{{ project.repo }}.git +{%- elif project.repo_url %} +{#- The repo_url is primarily intended to point to a browsable version of + of the repo, but most Git hosting services also serve a repository + compatible with the use of `git clone` at the main repo URL. #} + checkout: git clone {{ project.repo_url }} +{%- else %} + checkout: git clone +{%- endif %} system: git path: "." contact: - email: {{ project.contact.email }} - label: {{ project.contact.name }} - github: {{ project.contact.github }} -description: {{ project.title }} is an ontology... -domain: stuff + email: + label: +{%- if project.github_org %} + github: +{%- endif %} +{%- if project.description %} +description: "{{ project.description }}" +{%- else %} +description: +{%- endif %} +domain: +{%- if project.github_org %} homepage: https://github.com/{{ project.github_org }}/{{ project.repo }} +{%- elif project.repo_url %} +homepage: {{ project.repo_url }} +{%- endif %} products: - id: {{ project.id }}.owl name: "{{ project.title }} main release in OWL format" - - id: {{ project.id }}.obo - name: "{{ project.title }} additional release in OBO format" - - id: {{ project.id }}.json - name: "{{ project.title }} additional release in OBOJSon format" - - id: {{ project.id }}/{{ project.id }}-base.owl - name: "{{ project.title }} main release in OWL format" - - id: {{ project.id }}/{{ project.id }}-base.obo - name: "{{ project.title }} additional release in OBO format" - - id: {{ project.id }}/{{ project.id }}-base.json - name: "{{ project.title }} additional release in OBOJSon format" +{%- for format in project.export_formats %} +{%- if format != "owl" %} + - id: {{ project.id }}.{{ format }} + name: "{{ project.title }} main release in {{ format|upper }} format" +{%- endif %} +{%- endfor %} +{%- for artefact in project.release_artefacts %} +{%- if artefact != project.primary_release %} + - id: {{ project.id }}/{{ project.id }}-{{ artefact }}.owl + name: "{{ project.title }} {{ artefact|upper }} release in OWL format" +{%- for format in project.export_formats %} +{%- if format != "owl" %} + - id: {{ project.id }}/{{ project.id }}-{{ artefact }}.{{ format }} + name: "{{ project.title }} {{ artefact|upper }} release in {{ format|upper}} format" +{%- endif %} +{%- endfor %} +{%- endif %} +{%- endfor %} +{%- if project.import_group is not none %} dependencies: -{% for imp in project.import_group.products -%} +{%- for imp in project.import_group.products %} - id: {{ imp.id }} -{% endfor -%} +{%- endfor %} +{%- endif %} +{%- if project.github_org %} tracker: https://github.com/{{ project.github_org }}/{{ project.repo }}/issues +{%- else %} +tracker: +{%- endif %} license: - url: http://creativecommons.org/licenses/by/3.0/ - label: CC-BY + url: {{ project.license }} + label: activity_status: active --- @@ -365,8 +395,16 @@ idspace: {{ project.id|upper }} base_url: /obo/{{ project.id }} products: -- {{ project.id }}.owl: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/{{ project.git_main_branch }}/{{ project.id }}.owl -- {{ project.id }}.obo: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/{{ project.git_main_branch }}/{{ project.id }}.obo +{%- if project.github_org %} +- {{ project.id }}.owl: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/latest/download/{{ project.id }}.owl +{%- for format in project.export_formats %} +{%- if format != "owl" %} +- {{ project.id }}.{{ format }}: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/latest/download/{{ project.id }}.{{ format }} +{%- endif %} +{%- endfor %} +{%- else %} +- {{ project.id }}.owl: +{%- endif %} term_browser: ontobee example_terms: @@ -375,17 +413,67 @@ example_terms: entries: - prefix: /releases/ - replacement: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/v +{%- if project.github_org %} + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/download/v +{%- else %} + replacement: +{%- endif %} - prefix: /tracker/ +{%- if project.github_org %} replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/issues +{%- else %} + replacement: +{%- endif %} - prefix: /about/ replacement: http://www.ontobee.org/ontology/{{ project.id|upper }}?iri=http://purl.obolibrary.org/obo/ -## generic fall-through, serve direct from github by default +{%- if project.import_group is not none or project.components is not none or project.use_dosdps %} + +# For files that are imported from the -edit file, we cannot point to +# the latest release download folder as we do below in the "generic" +# fall-through, because those files are _not_ release artefacts and are +# absent from that folder. Instead, we point to the current {{ project.git_main_branch }} branch. +{%- if project.import_group is not none %} + +- prefix: /imports/ +{%- if project.github_org %} + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/imports/ +{%- else %} + replacement: +{%- endif %} + +{%- endif %} +{%- if project.components is not none %} + +- prefix: /components/ +{%- if project.github_org %} + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/components/ +{%- else %} + replacement: +{%- endif %} + +{%- endif %} +{%- if project.use_dosdps %} + +- prefix: /patterns/ +{%- if project.github_org %} + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/patterns/ +{%- else %} + replacement: +{%- endif %} + +{%- endif %} +{%- endif %} + +# Generic fall-through, serve from the latest release artefacts - prefix: / - replacement: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/{{ project.git_main_branch }}/ +{%- if project.github_org %} + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/latest/download/ +{%- else %} + replacement: +{%- endif %} {% endif %}{# ! project.create_obo_metadata -#} {% if project.use_templates -%} ^^^ src/templates/README.md