Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 12 additions & 4 deletions odk/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,9 @@ def update(templatedir):
@click.option('-g', '--skipgit', default=False, is_flag=True)
@click.option('-n', '--gitname', default=None)
@click.option('-e', '--gitemail', default=None)
@click.option('-r', '--commit-artefacts', default=False, is_flag=True)
@click.argument('repo', nargs=-1)
def seed(config, clean, outdir, templatedir, dependencies, title, user, source, verbose, repo, skipgit, gitname, gitemail):
def seed(config, clean, outdir, templatedir, dependencies, title, user, source, verbose, repo, skipgit, gitname, gitemail, commit_artefacts):
"""
Seeds an ontology project
"""
Expand Down Expand Up @@ -1213,10 +1214,18 @@ 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}".
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 all_assets && cp $(make show_release_assets) ../../"
.format(dir=outdir))
if commit_artefacts:
runcmd("cd {dir}/src/ontology "
"&& for asset in $(make show_release_assets) ; do git add -f ../../$asset ; done"
.format(dir=outdir))
runcmd("cd {dir} && if [ -n \"$(git status -s)\" ]; then git commit -a -m 'initial build' ; fi"
.format(dir=outdir))
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 @@ -1227,7 +1236,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
10 changes: 10 additions & 0 deletions template/.gitignore.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ bin/

.github/token.txt

/{{ 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.*

src/ontology/mirror
src/ontology/mirror/*
src/ontology/reports/*
Expand Down
12 changes: 4 additions & 8 deletions template/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ show_assets:
echo $(ASSETS)
du -sh $(ASSETS)

.PHONY: show_release_assets
show_release_assets:
@echo $(RELEASE_ASSETS)

check_rdfxml_%: %
@check-rdfxml {% if project.extra_rdfxml_checks %}--jena --rdflib{% endif %} $<

Expand Down Expand Up @@ -427,14 +431,6 @@ prepare_release: all_odk
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"

.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)

.PHONY: prepare_release_fast
prepare_release_fast:
$(MAKE) prepare_release IMP=false PAT=false MIR=false COMP=false
Expand Down