...
This commit is contained in:
@@ -19,7 +19,7 @@ pub fn generate(args_ GenerateArgs) ! {
|
||||
mut args := args_
|
||||
|
||||
console.print_header('Generate code for path: ${args.path} (reset:${args.reset}, force:${args.force})')
|
||||
console.print_debug(args)
|
||||
|
||||
if args.path == '' {
|
||||
return error('no path provided')
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ pub mut:
|
||||
hasconfig bool = true
|
||||
play_name string // e.g. docusaurus is what we look for
|
||||
module_path string // e.g.incubaid.herolib.web.docusaurus
|
||||
active bool = true // if false then we skip generation
|
||||
}
|
||||
|
||||
pub enum Cat {
|
||||
@@ -29,8 +30,6 @@ pub enum Cat {
|
||||
}
|
||||
|
||||
fn args_get(path string) !ModuleMeta {
|
||||
console.print_debug('generate code for path: ${path}')
|
||||
|
||||
mut config_path := pathlib.get_file(path: '${path}/.heroscript', create: false)!
|
||||
|
||||
if !config_path.exists() {
|
||||
@@ -74,6 +73,7 @@ fn args_get(path string) !ModuleMeta {
|
||||
startupmanager: p.get_default_true('startupmanager')
|
||||
hasconfig: p.get_default_true('hasconfig')
|
||||
build: p.get_default_false('build')
|
||||
active: p.get_default_true('active')
|
||||
cat: .installer
|
||||
path: path
|
||||
}
|
||||
@@ -93,6 +93,7 @@ fn args_get(path string) !ModuleMeta {
|
||||
title: p.get_default('title', '')!
|
||||
default: p.get_default_true('default')
|
||||
singleton: p.get_default_false('singleton')
|
||||
active: p.get_default_true('active')
|
||||
cat: .client
|
||||
path: path
|
||||
play_name: p.get_default('play_name', name)!
|
||||
|
||||
@@ -19,8 +19,10 @@ pub fn scan(args_ ScannerArgs) ! {
|
||||
args.path = os.getwd()
|
||||
}
|
||||
|
||||
mut generateall := false
|
||||
if args.path == '' {
|
||||
args.path = '${os.home_dir()}/code/github/incubaid/herolib/lib'
|
||||
generateall = true
|
||||
}
|
||||
|
||||
// now walk over all directories, find .heroscript
|
||||
@@ -32,9 +34,6 @@ pub fn scan(args_ ScannerArgs) ! {
|
||||
)!
|
||||
|
||||
console.print_debug('Found ${plist.paths.len} directories with .heroscript file.')
|
||||
if args.generate && args.path != '' {
|
||||
return error('when scanning without generation then we always need to start from the root path, so no . or path provided.')
|
||||
}
|
||||
if args.generate {
|
||||
console.print_debug('Now generating code for all found .heroscript files.')
|
||||
for mut p in plist.paths {
|
||||
@@ -45,8 +44,15 @@ pub fn scan(args_ ScannerArgs) ! {
|
||||
mut res := []ModuleMeta{}
|
||||
for mut p in plist.paths {
|
||||
pparent := p.parent()!
|
||||
res << args_get(pparent.path)!
|
||||
mut t := args_get(pparent.path)!
|
||||
if t.active {
|
||||
res << t
|
||||
} else {
|
||||
console.print_debug('Skipping generation for ${t.name} as active is false.')
|
||||
}
|
||||
}
|
||||
if generateall {
|
||||
console.print_debug('Found ${res.len} generator args.')
|
||||
generate_play_all(res)!
|
||||
}
|
||||
console.print_debug('Found ${res.len} generator args.')
|
||||
generate_play_all(res)!
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
module playcmds
|
||||
|
||||
import incubaid.herolib.core.playbook
|
||||
|
||||
@for item in meta_items
|
||||
import @{item.module_path}
|
||||
@end
|
||||
|
||||
@@ -32,6 +32,7 @@ pub fn cmd_generator(mut cmdroot Command) {
|
||||
flag: .bool
|
||||
required: false
|
||||
name: 'generate'
|
||||
abbrev: 'g'
|
||||
description: 'generate the code only relevant for scanning.'
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module playcmds
|
||||
|
||||
import incubaid.herolib.core.playbook
|
||||
import incubaid.herolib.clients.giteaclient
|
||||
import incubaid.herolib.clients.ipapi
|
||||
import incubaid.herolib.clients.jina
|
||||
@@ -18,12 +19,7 @@ import incubaid.herolib.clients.wireguard
|
||||
import incubaid.herolib.clients.zerodb_client
|
||||
import incubaid.herolib.clients.zinit
|
||||
import incubaid.herolib.develop.heroprompt
|
||||
import incubaid.herolib.installers.db.cometbft
|
||||
import incubaid.herolib.installers.db.meilisearch_installer
|
||||
import incubaid.herolib.installers.db.postgresql
|
||||
import incubaid.herolib.installers.db.qdrant_installer
|
||||
import incubaid.herolib.installers.db.zerodb
|
||||
import incubaid.herolib.installers.db.zerofs
|
||||
import incubaid.herolib.installers.infra.coredns
|
||||
import incubaid.herolib.installers.infra.gitea
|
||||
import incubaid.herolib.installers.infra.livekit
|
||||
@@ -34,15 +30,8 @@ import incubaid.herolib.installers.lang.python
|
||||
import incubaid.herolib.installers.lang.rust
|
||||
import incubaid.herolib.installers.net.mycelium_installer
|
||||
import incubaid.herolib.installers.net.wireguard_installer
|
||||
import incubaid.herolib.installers.net.yggdrasil
|
||||
import incubaid.herolib.installers.sysadmintools.actrunner
|
||||
import incubaid.herolib.installers.sysadmintools.b2
|
||||
import incubaid.herolib.installers.sysadmintools.fungistor
|
||||
import incubaid.herolib.installers.sysadmintools.garage_s3
|
||||
import incubaid.herolib.installers.sysadmintools.grafana
|
||||
import incubaid.herolib.installers.sysadmintools.prometheus
|
||||
import incubaid.herolib.installers.sysadmintools.rclone
|
||||
import incubaid.herolib.installers.sysadmintools.restic
|
||||
import incubaid.herolib.installers.threefold.griddriver
|
||||
import incubaid.herolib.installers.virt.cloudhypervisor
|
||||
import incubaid.herolib.installers.virt.docker
|
||||
@@ -52,13 +41,10 @@ import incubaid.herolib.installers.virt.pacman
|
||||
import incubaid.herolib.installers.virt.podman
|
||||
import incubaid.herolib.installers.virt.youki
|
||||
import incubaid.herolib.installers.web.bun
|
||||
import incubaid.herolib.installers.web.imagemagick
|
||||
import incubaid.herolib.installers.web.lighttpd
|
||||
import incubaid.herolib.installers.web.tailwind
|
||||
import incubaid.herolib.installers.web.tailwind4
|
||||
import incubaid.herolib.installers.web.traefik
|
||||
import incubaid.herolib.installers.web.zola
|
||||
import incubaid.herolib.threefold.grid3.deployer
|
||||
import incubaid.herolib.virt.hetznermanager
|
||||
|
||||
pub fn run_all(args_ PlayArgs) ! {
|
||||
@@ -86,12 +72,7 @@ pub fn run_all(args_ PlayArgs) ! {
|
||||
zerodb_client.play(mut plbook)!
|
||||
zinit.play(mut plbook)!
|
||||
heroprompt.play(mut plbook)!
|
||||
cometbft.play(mut plbook)!
|
||||
meilisearch_installer.play(mut plbook)!
|
||||
postgresql.play(mut plbook)!
|
||||
qdrant_installer.play(mut plbook)!
|
||||
zerodb.play(mut plbook)!
|
||||
zerofs.play(mut plbook)!
|
||||
coredns.play(mut plbook)!
|
||||
gitea.play(mut plbook)!
|
||||
livekit.play(mut plbook)!
|
||||
@@ -102,15 +83,8 @@ pub fn run_all(args_ PlayArgs) ! {
|
||||
rust.play(mut plbook)!
|
||||
mycelium_installer.play(mut plbook)!
|
||||
wireguard_installer.play(mut plbook)!
|
||||
yggdrasil.play(mut plbook)!
|
||||
actrunner.play(mut plbook)!
|
||||
b2.play(mut plbook)!
|
||||
fungistor.play(mut plbook)!
|
||||
garage_s3.play(mut plbook)!
|
||||
grafana.play(mut plbook)!
|
||||
prometheus.play(mut plbook)!
|
||||
rclone.play(mut plbook)!
|
||||
restic.play(mut plbook)!
|
||||
griddriver.play(mut plbook)!
|
||||
cloudhypervisor.play(mut plbook)!
|
||||
docker.play(mut plbook)!
|
||||
@@ -120,12 +94,9 @@ pub fn run_all(args_ PlayArgs) ! {
|
||||
podman.play(mut plbook)!
|
||||
youki.play(mut plbook)!
|
||||
bun.play(mut plbook)!
|
||||
imagemagick.play(mut plbook)!
|
||||
lighttpd.play(mut plbook)!
|
||||
tailwind.play(mut plbook)!
|
||||
tailwind4.play(mut plbook)!
|
||||
traefik.play(mut plbook)!
|
||||
zola.play(mut plbook)!
|
||||
deployer.play(mut plbook)!
|
||||
hetznermanager.play(mut plbook)!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user