Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions odk/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ class OntologyProject(JsonSchemaMixin):
release_artefacts : List[str] = field(default_factory=lambda: ['full', 'base'])
"""A list of release artefacts you wish to be exported. Supported: base, full, baselite, simple, non-classified,
simple-non-classified, basic."""

commit_release_artefacts : bool = False
"""If true, release artefacts are committed to the repository."""

release_use_reasoner : bool = True
"""If set to True, the reasoner will be used during the release process. The reasoner is used for three operations:
Expand Down Expand Up @@ -1094,10 +1097,16 @@ def seed(config, clean, outdir, templatedir, dependencies, title, user, source,
if gitemail is not None:
os.environ['GIT_AUTHOR_EMAIL'] = gitemail
os.environ['GIT_COMMITTER_EMAIL'] = gitemail
runcmd("cd {dir} && git init && git add {files}".
initial_release_target = 'prepare_release'
if project.commit_release_artefacts:
initial_release_target = 'prepare_initial_release'
runcmd("cd {dir} && git init -b {branch} && git add {files} && git commit -m 'initial commit'".
format(dir=outdir,
branch=project.git_main_branch,
files=" ".join([t.replace(outdir, ".", 1) for t in tgts])))
runcmd("cd {dir}/src/ontology && make && git commit -m 'initial commit' -a && git branch -M {branch} && make prepare_initial_release && git commit -m 'first release'".format(dir=outdir, branch=project.git_main_branch))
runcmd("cd {dir}/src/ontology && make {target} && if [ -n \"$(git status -s)\" ]; then git commit -a -m 'first release' ; fi"
.format(dir=outdir,
target=initial_release_target))
print("\n\n####\nNEXT STEPS:")
print(" 0. Examine {} and check it meets your expectations. If not blow it away and start again".format(outdir))
print(" 1. Go to: https://github.com/new")
Expand All @@ -1108,7 +1117,6 @@ def seed(config, clean, outdir, templatedir, dependencies, title, user, source,
print(" E.g.:")
print("cd {}".format(outdir))
print("git remote add origin git@github.com:{org}/{repo}.git".format(org=project.github_org, repo=project.repo))
print("git branch -M {branch}\n".format(branch=project.git_main_branch))
print("git push -u origin {branch}\n".format(branch=project.git_main_branch))
print("BE BOLD: you can always delete your repo and start again\n")
print("")
Expand Down
12 changes: 12 additions & 0 deletions template/.gitignore.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ bin/
.template.db

.github/token.txt
{%- if not project.commit_release_artefacts %}

/{{ project.id }}.owl
/{{ project.id }}.obo
/{{ project.id }}.json
/{{ project.id }}.db
/{{ project.id }}-base.*
/{{ project.id }}-basic.*
/{{ project.id }}-full.*
/{{ project.id }}-simple.*
/{{ project.id }}-simple-non-classified.*
{%- endif %}

src/ontology/mirror
src/ontology/mirror/*
Expand Down
10 changes: 4 additions & 6 deletions template/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,12 @@ prepare_release: all_odk
rm -f $(CLEANFILES) &&\
echo "Release files are now in $(RELEASEDIR) - now you should commit, push and make a release \
on your git hosting site such as GitHub or GitLab"
{%- if project.commit_release_artefacts %}

.PHONY: prepare_initial_release
prepare_initial_release: all_assets
rsync -R $(RELEASE_ASSETS) $(RELEASEDIR) &&\{% if project.sssom_mappingset_group is defined %}{% if project.sssom_mappingset_group.released_products is defined %}
mkdir -p $(RELEASEDIR)/mappings && cp -rf $(RELEASED_MAPPING_FILES) $(RELEASEDIR)/mappings &&\{% endif %}{% endif %}{% if project.use_dosdps %}
mkdir -p $(RELEASEDIR)/patterns && cp -rf $(PATTERN_RELEASE_FILES) $(RELEASEDIR)/patterns &&\{% endif %}
rm -f $(patsubst %, ./%, $(CLEANFILES)) &&\
cd $(RELEASEDIR) && git add $(RELEASE_ASSETS)
prepare_initial_release: prepare_release
git add $(foreach asset,$(RELEASE_ASSETS),$(RELEASEDIR)/$(asset))
{%- endif %}

.PHONY: prepare_release_fast
prepare_release_fast:
Expand Down