generated from Business-Wizard/dev-workspace-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
27 lines (20 loc) · 828 Bytes
/
tasks.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
import pathlib
import yaml
from invoke import tasks
from invoke.context import Context
SECRETS = pathlib.Path('secrets.yaml')
# create task to update vscode
@tasks.task
def update_vscode(context: Context):
password: str = _read_secrets()['password']
cmd_clone_repo = (
"git clone https://aur.archlinux.org/visual-studio-code-insiders-bin.git"
)
context.run(command=cmd_clone_repo)
repo_path = pathlib.Path("visual-studio-code-insiders-bin")
with context.cd(path=repo_path):
context.run(command="echo 'Y' | makepkg -si")
context.sudo(command="pacman -U", password=password)
context.sudo(command="rm -rf ./visual-studio-code-insiders-bin", password=password)
def _read_secrets() -> dict[str, str]:
return yaml.load(stream=SECRETS.read_text(), Loader=yaml.SafeLoader)