generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.py
90 lines (60 loc) · 1.89 KB
/
template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python
"""
Safely delete this script and commit edited files after use
"""
files = [
"package.json",
]
params = [
"PROJECT_NAME",
"PROJECT_DESCRIPTION",
]
descriptions = [
"(Ex. made.js, code.js, ...)",
"(Ex. 'COre DEfinitions')",
]
readme = """\
[![npm version](https://badge.fury.io/js/%40exabyte-io%2FPROJECT_NAME.svg)](https://badge.fury.io/js/%40exabyte-io%2FPROJECT_NAME)
[![License: Apache](https://img.shields.io/badge/License-Apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
# PROJECT_NAME
PROJECT_NAME houses entity definitions for use in the Mat3ra platform.
### Installation
For usage within a javascript project:
```bash
npm install @exabyte-io/PROJECT_NAME
```
For development:
```bash
git clone https://github.com/Exabyte-io/PROJECT_NAME.git
```
### Contribution
This repository is an [open-source](LICENSE.md) work-in-progress and we welcome contributions.
We regularly deploy the latest code containing all accepted contributions online as part of the
[Mat3ra.com](https://mat3ra.com) platform, so contributors will see their code in action there.
See [ESSE](https://github.com/Exabyte-io/esse) for additional context regarding the data schemas used here.
Useful commands for development:
```bash
# run linter without persistence
npm run lint
# run linter and save edits
npm run lint:fix
# compile the library
npm run transpile
# run tests
npm run test
```
"""
values = {}
for param, desc in zip(params, descriptions):
values[param] = input(f"Please provide a value for {param} {desc}: ")
def replace(content, values):
for key, val in values.items():
content = content.replace(key, val)
return content
for fl in files:
with open(fl, "r") as f:
content = f.read()
with open(fl, "w") as f:
f.write(replace(content, values))
with open("README.md", "w") as f:
f.write(replace(readme, values))