Skip to content

Commit

Permalink
Merge pull request #3 from oarepo/save-only-when-needed
Browse files Browse the repository at this point in the history
Saving oarepo.yaml only when needed
  • Loading branch information
mesemus authored Jan 29, 2024
2 parents ff1bce8 + 3c128f4 commit c514435
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nrp-devtools"
version = "0.1.13"
version = "0.1.14"
description = "NRP repository development tools"
readme = "README.md"
authors = [
Expand Down
4 changes: 3 additions & 1 deletion src/nrp_devtools/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def command_sequence(
continue_on_errors: Union[
bool, Callable[[OARepoConfig, Dict[str, Any]], bool]
] = False,
save: bool = False
):
def wrapper(command):
command = click.option(
Expand Down Expand Up @@ -90,7 +91,8 @@ def proxied(*args, **kwargs):
run_steps(
config, steps, step_commands, continue_on_errors=_continue_on_errors
)
config.save()
if save:
config.save()

return proxied

Expand Down
2 changes: 1 addition & 1 deletion src/nrp_devtools/cli/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
help="Do not ask for input, use the initial config only",
is_flag=True,
)
@command_sequence(repository_dir_as_argument=True, repository_dir_must_exist=False)
@command_sequence(repository_dir_as_argument=True, repository_dir_must_exist=False, save=True)
def initialize_command(
*, repository_dir, config: OARepoConfig, verbose, initial_config, no_input
):
Expand Down
2 changes: 1 addition & 1 deletion src/nrp_devtools/cli/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def model_group():

@model_group.command(name="create", help="Create a new model")
@click.argument("model_name")
@command_sequence()
@command_sequence(save=True)
def create_model_command(*, config: OARepoConfig, model_name, **kwargs):
for model in config.models:
if model.model_name == model_name:
Expand Down
4 changes: 2 additions & 2 deletions src/nrp_devtools/cli/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def pages_group():
"ui-endpoint",
required=False,
)
@command_sequence()
@command_sequence(save=True)
def create_pages(config: OARepoConfig, ui_name, ui_endpoint, **kwargs):
"""
Create a new UI pages collection.
Expand Down Expand Up @@ -101,7 +101,7 @@ def model_group():
"ui-endpoint",
required=False,
)
@command_sequence()
@command_sequence(save=True)
def create_model(config: OARepoConfig, model_name, ui_name, ui_endpoint, **kwargs):
"""
Create a new UI model.
Expand Down
1 change: 1 addition & 0 deletions src/nrp_devtools/templates/repository/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"repository_name": "",
"repository_package": "",
"repository_human_name": "",
"repository_description": "",
"shared_package": "",
"use_oarepo_vocabularies": true,
"site_package": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ THEME_FRONTPAGE_TEMPLATE = "frontpage.html"
THEME_FRONTPAGE_LOGO = "images/repo_logo_eng_rgb.png"


REPOSITORY_NAME = "{{ cookiecutter.repository_human_name }}"
REPOSITORY_DESCRIPTION = "{{ cookiecutter.repository_description }}"


# We set this to avoid bug: https://github.com/inveniosoftware/invenio-administration/issues/180
THEME_HEADER_LOGIN_TEMPLATE = "header_login.html"

Expand Down

0 comments on commit c514435

Please sign in to comment.