This commit is contained in:
2024-12-25 19:17:23 +01:00
parent 49286ffcd0
commit 7bbeee570e
22 changed files with 42 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
module zdb module zdb
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
pub struct ZDB { pub struct ZDB {

View File

@@ -34,15 +34,16 @@ pub enum Cat {
pub fn gen_model_set(args GenerateArgs) ! { pub fn gen_model_set(args GenerateArgs) ! {
model := args.model model := args.model
heroscript_templ := $tmpl('templates/heroscript') mut heroscript_templ := match model.cat {
.client { heroscript_templ := $tmpl('templates/heroscript_client' )}
//TODO: look in lib/code/generator/installer_client/templates/heroscript, don't use the if in template, use 2 templates, depending type use other template, and the args used should be set here in code .installer { heroscript_templ := $tmpl('templates/heroscript_installer' )}
else { return error('Invalid category: ${model.cat}') }
}
pathlib.template_write(heroscript_templ, '${args.path}/.heroscript', true)! pathlib.template_write(heroscript_templ, '${args.path}/.heroscript', true)!
} }
pub fn gen_model_get(path string, create: bool) !GenModel { pub fn gen_model_get(path string, create bool) !GenModel {
console.print_debug('play installer code for path: ${path}') console.print_debug('play installer code for path: ${path}')
mut config_path := pathlib.get_file(path: '${path}/.heroscript', create: create)! mut config_path := pathlib.get_file(path: '${path}/.heroscript', create: create)!

View File

@@ -1,12 +0,0 @@
!!hero_code.generate_${if model.cat == .installer { "installer" } else { "client" }}
name:"${model.name}"
classname:"${model.classname}"
config:${if model.hasconfig { "1" } else { "0" }}
singleton:${if model.singleton { "1" } else { "0" }}
default:${if model.default { "1" } else { "0" }}
title:\"${model.title}\"
${if model.cat == .installer {
templates:${if model.templates { "1" } else { "0" }}
build:${if model.build { "1" } else { "0" }}
startupmanager:${if model.startupmanager { "1" } else { "0" }}
}

View File

@@ -0,0 +1,7 @@
!!hero_code.generate_client
name: "${model.name}"
classname: "${model.classname}"
config: ${model.hasconfig}
singleton: ${model.singleton}
default: ${model.default}
title: "${model.title}|

View File

@@ -0,0 +1,11 @@
!!hero_code.generate_installer
name: "${model.name}"
classname: "${model.classname}"
config: ${model.hasconfig}
singleton: ${model.singleton}
default: ${model.default}
title: "${model.title}"
templates: ${model.templates}
build: ${model.build}
startupmanager: ${model.startupmanager}

View File

@@ -1,7 +1,7 @@
module base module base
import freeflowuniverse.herolib.data.paramsparser import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import freeflowuniverse.herolib.data.dbfs import freeflowuniverse.herolib.data.dbfs
// import freeflowuniverse.herolib.crypt.secp256k1 // import freeflowuniverse.herolib.crypt.secp256k1
import freeflowuniverse.herolib.crypt.aes_symmetric import freeflowuniverse.herolib.crypt.aes_symmetric

View File

@@ -1,7 +1,7 @@
module httpconnection module httpconnection
import net.http { Header } import net.http { Header }
import freeflowuniverse.herolib.clients.redisclient { Redis } import freeflowuniverse.herolib.core.redisclient { Redis }
@[heap] @[heap]
pub struct HTTPConnection { pub struct HTTPConnection {

View File

@@ -1,7 +1,7 @@
module httpconnection module httpconnection
import net.http import net.http
import freeflowuniverse.herolib.clients.redisclient { RedisURL } import freeflowuniverse.herolib.core.redisclient { RedisURL }
@[params] @[params]
pub struct HTTPConnectionArgs { pub struct HTTPConnectionArgs {

View File

@@ -4,7 +4,7 @@
```v ```v
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
mut redis := redisclient.core_get()! mut redis := redisclient.core_get()!
redis.set('test', 'some data') or { panic('set' + err.str() + '\n' + c.str()) } redis.set('test', 'some data') or { panic('set' + err.str() + '\n' + c.str()) }

View File

@@ -1,4 +1,4 @@
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
fn setup() !&redisclient.Redis { fn setup() !&redisclient.Redis {
mut redis := redisclient.core_get()! mut redis := redisclient.core_get()!

View File

@@ -1,4 +1,4 @@
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import time import time
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
// original code see https://github.com/patrickpissurno/vredis/blob/master/vredis_test.v // original code see https://github.com/patrickpissurno/vredis/blob/master/vredis_test.v

View File

@@ -1,4 +1,4 @@
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
fn setup() !&redisclient.Redis { fn setup() !&redisclient.Redis {

View File

@@ -1,6 +1,6 @@
module smartid module smartid
// import freeflowuniverse.herolib.clients.redisclient // import freeflowuniverse.herolib.core.redisclient
import math import math
// import freeflowuniverse.herolib.core.texttools.regext // import freeflowuniverse.herolib.core.texttools.regext
// import rand // import rand

View File

@@ -2,7 +2,7 @@ module dbfs
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.core.texttools import freeflowuniverse.herolib.core.texttools
// import freeflowuniverse.herolib.clients.redisclient // import freeflowuniverse.herolib.core.redisclient
import os import os
import json import json
// import freeflowuniverse.herolib.ui.console // import freeflowuniverse.herolib.ui.console

View File

@@ -1,7 +1,7 @@
module dbfs module dbfs
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
// import freeflowuniverse.herolib.clients.redisclient // import freeflowuniverse.herolib.core.redisclient
import os import os
@[params] @[params]

View File

@@ -2,7 +2,7 @@ module gittools
import crypto.md5 import crypto.md5
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import os import os
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console

View File

@@ -4,7 +4,7 @@ import freeflowuniverse.herolib.ui as gui
import freeflowuniverse.herolib.core.pathlib import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.ui.generic import freeflowuniverse.herolib.ui.generic
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import os import os
pub const gitcmds = 'clone,commit,pull,push,delete,reload,list,edit,sourcetree,cd' pub const gitcmds = 'clone,commit,pull,push,delete,reload,list,edit,sourcetree,cd'

View File

@@ -1,6 +1,6 @@
module gittools module gittools
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import time import time
// ReposGetArgs defines arguments to retrieve repositories from the git structure. // ReposGetArgs defines arguments to retrieve repositories from the git structure.

View File

@@ -1,7 +1,7 @@
module gittools module gittools
import json import json
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
fn redis_get() redisclient.Redis { fn redis_get() redisclient.Redis {
mut redis_client := redisclient.core_get() or { panic(err) } mut redis_client := redisclient.core_get() or { panic(err) }

View File

@@ -44,7 +44,7 @@ Display the recorded timeline:
## Dependencies ## Dependencies
• Redis: Requires a Redis server for data storage. • Redis: Requires a Redis server for data storage.
• Redis Client: Uses freeflowuniverse.herolib.clients.redisclient. • Redis Client: Uses freeflowuniverse.herolib.core.redisclient.
## Example ## Example
``` ```

View File

@@ -4,7 +4,7 @@ import arrays
import time import time
import sync import sync
import term // For color coding import term // For color coding
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
// Struct to represent a timer for measuring process performance // Struct to represent a timer for measuring process performance
@[noinit] @[noinit]

View File

@@ -1,7 +1,7 @@
module client module client
import freeflowuniverse.herolib.baobab.client import freeflowuniverse.herolib.baobab.client
import freeflowuniverse.herolib.clients.redisclient import freeflowuniverse.herolib.core.redisclient
import dariotarantini.vgram import dariotarantini.vgram
import json import json