Skip to content

Commit 5c2346a

Browse files
author
Pablo Panero
committed
development: how to add extensions
1 parent c2dbc19 commit 5c2346a

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

docs/develop/customize.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ Go to the browser [*https://localhost:5000/*](https://localhost:5000) or refresh
2323

2424
!!! warning "That evil cache"
2525
If you do not see it changing, check in an incognito window, the browser might have cached the logo.
26+
27+
Need further customizations? Have you thought of creating your own extensions? How to add them to your InvenioRDM instance is explained in the next section - [here](../extensions/custom.md).

docs/extensions/custom.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Extensions
2+
3+
If you need to add custom functionalaty to your RDM instance you need to develop your own module. You can start it by using the [cookiecutter-invenio-module](https://github.com/inveniosoftware/cookiecutter-invenio-module) template. It will get you started in no time.
4+
5+
## Create your module
6+
Lets assume you have already done so:
7+
8+
``` console
9+
$ cookiecutter https://github.com/inveniosoftware/cookiecutter-invenio-module
10+
11+
[...]
12+
```
13+
14+
## Add your functionality
15+
16+
And you have added a simple view to the blue print in the `<your_custom_module>/views.py`, which looks like:
17+
18+
``` python
19+
[...]
20+
blueprint = Blueprint(
21+
'invenio_rdm_extension_demo',
22+
__name__
23+
)
24+
25+
26+
@blueprint.route("/rdm-ext-demo")
27+
def index():
28+
"""RDM Extension Demo view."""
29+
return 'RDM Extension Demo!'
30+
```
31+
32+
## Integrate it in your InvenioRDM instance
33+
34+
Once you have your functionality ready, in order to add it to your instance you just have to install the module via pipenv:
35+
36+
``` console
37+
$ cd path/to/your/instance
38+
$ pipenv install [--pre] -e path/to/your/extension
39+
```
40+
41+
As you can see, `--pre` is optional, it is only needed when the package is in a pre-release state. In addition, note that you do not need to specify a local path, if the package is available e.g. via PyPi you can just install it by its name.
42+
43+
## Sanity check and run!
44+
45+
Check that the Pipfile got a new line with your extension. For example:
46+
47+
``` console
48+
...
49+
50+
[packages]
51+
...
52+
invenio-rdm-extension-demo = {editable = true, path="../invenio-rdm-ext-demo"}
53+
...
54+
```
55+
56+
It's all set, run your instance with the cli and you will have your new features available!
57+
58+
``` console
59+
$ invenio-cli run
60+
```

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ nav:
3636
- Customization: 'develop/customize.md'
3737
- Troubleshooting: 'develop/troubleshoot.md'
3838
- Cleanup: 'develop/cleanup.md'
39+
- Extensions:
40+
- Add your extensions: 'extensions/custom.md'
3941
- Deploy:
4042
- Kubernetes: 'deployment/kubernetes.md'
4143
- OpenShift: 'deployment/openshift.md'

0 commit comments

Comments
 (0)