adds the 'cbpi create' command to vscode.

also initilizes plugin names with dashes instead of underscores.
everything now runs as root inside the dev container
(otherwise the permissions for cbpi create wouldnt be sufficient).
This commit is contained in:
prash3r 2022-09-16 10:25:31 +02:00
parent ac9b599619
commit 1fa3f88997
5 changed files with 15 additions and 3 deletions

View file

@ -47,5 +47,5 @@
//"postCreateCommand": "pip3 install -r ./requirements.txt",
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// "remoteUser": "vscode"
}

4
.gitignore vendored
View file

@ -18,4 +18,6 @@ node_modules
config/*
logs/
.coverage
.devcontainer/cbpi-dev-config/*
.devcontainer/cbpi-dev-config/*
cbpi4-*
temp*

8
.vscode/launch.json vendored
View file

@ -14,6 +14,14 @@
"preLaunchTask": "copy default cbpi config files if dev config files dont exist"
},
{
"name": "create CraftBeerPi4 plugin",
"type": "python",
"request": "launch",
"module": "run",
"args": ["--config-folder-path=./.devcontainer/cbpi-dev-config", "create"]
},
{
"name": "setup CraftBeerPi4: create config folder structure",
"type": "python",

View file

@ -87,7 +87,7 @@ class CraftBeerPiCli():
answers = prompt(questions)
name = "cbpi4_" + answers["name"]
name = "cbpi4-" + str(answers["name"]).replace('_', '-').replace(' ', '-')
if os.path.exists(os.path.join(".", name)) is True:
print("Cant create Plugin. Folder {} already exists ".format(name))
return

View file

@ -97,6 +97,7 @@ class ConfigFolder:
['dashboard/widgets', 'folder'],
['dashboard', 'folder'],
['fermenterrecipes', 'folder'],
[self.logsFolderPath, 'folder'],
['recipes', 'folder'],
['upload', 'folder']
]
@ -172,6 +173,7 @@ class ConfigFolder:
def create_folders(self):
pathlib.Path(self.configFolderPath).mkdir(parents=True, exist_ok=True)
pathlib.Path(self.logsFolderPath).mkdir(parents=True, exist_ok=True)
pathlib.Path(os.path.join(self.configFolderPath, 'dashboard', 'widgets')).mkdir(parents=True, exist_ok=True)
pathlib.Path(os.path.join(self.configFolderPath, 'recipes')).mkdir(parents=True, exist_ok=True)
pathlib.Path(os.path.join(self.configFolderPath, 'fermenterrecipes')).mkdir(parents=True, exist_ok=True)