58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
"""Create a starter HiveStore repo index.
|
|
|
|
Usage:
|
|
py tools/create_hivestore_repo.py ./my-hivestore "My HiveStore Repo"
|
|
|
|
Then commit the generated hivestore_index.json to GitHub.
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def create_repo(path: Path, name: str) -> None:
|
|
path.mkdir(parents=True, exist_ok=True)
|
|
index = {
|
|
"schema": 1,
|
|
"source_name": name,
|
|
"source_url": "https://github.com/example/my-hivestore",
|
|
"packages": [
|
|
{
|
|
"id": "example.app.hello",
|
|
"name": "Hello Bee",
|
|
"type": "app",
|
|
"category": "Apps",
|
|
"version": "0.1.0",
|
|
"author": "Example Developer",
|
|
"description": "A simple starter BeeOS app listing.",
|
|
"repository": "https://github.com/example/hello-bee",
|
|
"entry": "app.py",
|
|
"permissions": ["display", "storage"],
|
|
"rating": "0.0",
|
|
"color": "#ffcc00",
|
|
"icon": "▣",
|
|
"curated": True
|
|
}
|
|
]
|
|
}
|
|
(path / "hivestore_index.json").write_text(json.dumps(index, indent=2), encoding="utf-8")
|
|
(path / "README.md").write_text(
|
|
f"# {name}\\n\\nThis is a BeeOS HiveStore repo.\\n\\nThe package index lives at `hivestore_index.json`.\\n",
|
|
encoding="utf-8",
|
|
)
|
|
print(f"Created HiveStore repo starter at: {path}")
|
|
|
|
|
|
def main() -> None:
|
|
if len(sys.argv) < 3:
|
|
print('Usage: py tools/create_hivestore_repo.py <folder> "Repo Name"')
|
|
raise SystemExit(1)
|
|
create_repo(Path(sys.argv[1]), " ".join(sys.argv[2:]))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|