Skip to content

Commit

Permalink
Very stubby implementation of "deposit to file" plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
led02 committed Sep 28, 2023
1 parent 4d4c7c3 commit 82d72e1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,35 @@ git_add_branch = "hermes.commands.process.git:add_branch"

[tool.poetry.plugins."hermes.deposit.prepare"]
invenio = "hermes.commands.deposit.invenio:prepare"
file = "hermes.commands.deposit.file:prepare"

[tool.poetry.plugins."hermes.deposit.map"]
invenio = "hermes.commands.deposit.invenio:map_metadata"
file = "hermes.commands.deposit.file:map_metadata"

[tool.poetry.plugins."hermes.deposit.create_initial_version"]
invenio = "hermes.commands.deposit.invenio:create_initial_version"
file = "hermes.commands.deposit.file:create_initial_version"

[tool.poetry.plugins."hermes.deposit.create_new_version"]
invenio = "hermes.commands.deposit.invenio:create_new_version"
file = "hermes.commands.deposit.file:create_new_version"

[tool.poetry.plugins."hermes.deposit.update_metadata"]
invenio = "hermes.commands.deposit.invenio:update_metadata"
file = "hermes.commands.deposit.file:update_metadata"

[tool.poetry.plugins."hermes.deposit.delete_artifacts"]
invenio = "hermes.commands.deposit.invenio:delete_artifacts"
file = "hermes.commands.deposit.file:delete_artifacts"

[tool.poetry.plugins."hermes.deposit.upload_artifacts"]
invenio = "hermes.commands.deposit.invenio:upload_artifacts"
file = "hermes.commands.deposit.file:upload_artifacts"

[tool.poetry.plugins."hermes.deposit.publish"]
invenio = "hermes.commands.deposit.invenio:publish"
file = "hermes.commands.deposit.file:publish"

[tool.poetry.plugins."hermes.postprocess"]
config_record_id = "hermes.commands.postprocess.invenio:config_record_id"
Expand Down
43 changes: 43 additions & 0 deletions src/hermes/commands/deposit/file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import json

import click

from hermes import config
from hermes.model.context import CodeMetaContext
from hermes.model.path import ContextPath


def prepare(click_ctx: click.Context, ctx: CodeMetaContext):
pass


def prepare_metadata(click_ctx: click.Context, ctx: CodeMetaContext):
ctx.update(ContextPath.parse('deposit.file'), ctx['codemeta'])


def create_initial_version(click_ctx: click.Context, ctx: CodeMetaContext):
pass


def create_new_version(click_ctx: click.Context, ctx: CodeMetaContext):
pass


def update_metadata(click_ctx: click.Context, ctx: CodeMetaContext):
pass


def delete_artifacts(click_ctx: click.Context, ctx: CodeMetaContext):
pass


def upload_artifacts(click_ctx: click.Context, ctx: CodeMetaContext):
pass


def publish(click_ctx: click.Context, ctx: CodeMetaContext):
file_config = config.get("deposit").get("file", {})
output_data = ctx['deposit.file']

with open(file_config.get('filename', 'hermes.json'), 'w') as deposition_file:
json.dump(output_data, deposition_file)

0 comments on commit 82d72e1

Please sign in to comment.