Files
herolib/lib/core/generator/generic
kristof de spiegeleer 2c5986295e Merge branch 'development_bizmodel' into development_generator_docusaurus
* development_bizmodel: (93 commits)
  s
  Revert "test: add cmdline parser tests"
  test: add cmdline parser tests
  markdown code
  ...
  revert
  ...
  ..deployments
  ...
  bump version to 1.0.21
  ...
  bump version to 1.0.20
  ...
  fix tests and example
  bump version to 1.0.19
  bump version to 1.0.18
  bump version to 1.0.17
  ...
  ...
  bump version to 1.0.16
  ...

# Conflicts:
#	lib/web/docusaurus/config.v
2025-03-08 10:55:58 +01:00
..
2025-02-11 09:37:03 +03:00
...
2025-01-31 15:39:44 +03:00
2025-01-02 19:01:37 +02:00

generation framework

#will ask questions if .heroscript is not there yet
hero generate -p thepath_is_optional
# to generate without questions
hero generate -p thepath_is_optional -t client
#if installer, default is a client
hero generate -p thepath_is_optional -t installer

#when you want to scan over multiple directories
hero generate -p thepath_is_optional -t installer -s 

there will be a .heroscript in the director you want to generate for, the format is as follows:

//for a server
!!hero_code.generate_installer
    name:'daguserver'
    classname:'DaguServer'
    singleton:1            //there can only be 1 object in the globals, is called 'default'
    templates:1            //are there templates for the installer
    default:1              //can we create a default when the factory is used
    title:''
    supported_platforms:'' //osx, ... (empty means all)
    reset:0                 // regenerate all, dangerous !!!
    startupmanager:1      //managed by a startup manager, default true
    build:1                 //will we also build the component

//or for a client

!!hero_code.generate_client
  name:'mail'
  classname:'MailClient'
  singleton:0            //default is 0
  default:1              //can we create a default when the factory is used
  reset:0                 // regenerate all, dangerous !!!

//or for a play 

!!hero_code.generate_play
  path:'' //if not used then is path where this action is found
  reset:0 //if set will overwrite the play_$actor_$action_.v
  actor:'mail'
  action:''
  model:"""
    
    """             


needs to be put as .heroscript in the directories which we want to generate

templates remarks

in templates:

  • ^^ or @@ > gets replaced to @
  • ?? > gets replaced to $

this is to make distinction between processing at compile time (pre-compile) or at runtime.

call by code

to call in code

#!/usr/bin/env -S v -gc none  -cc tcc -d use_openssl -enable-globals run

import freeflowuniverse.herolib.core.generator.generic

generic.scan(path:"~/code/github/freeflowuniverse/herolib/herolib/installers",force:true)!


to run from bash

~/code/github/freeflowuniverse/herolib/scripts/fix_installers.vsh