Compare commits

..

8 Commits

Author SHA1 Message Date
35dace9155 bump version to 1.0.20 2025-02-26 18:08:29 -07:00
69e7c1cce9 Merge branch 'development_bizmodel' of github.com:freeflowuniverse/herolib into development_bizmodel 2025-02-26 18:07:25 -07:00
d21e71e615 ... 2025-02-26 18:07:24 -07:00
timurgordon
f38d4249ef fix tests and example 2025-02-26 02:31:04 +03:00
293dc3f1ac bump version to 1.0.18 2025-02-25 13:18:39 -07:00
6492e42358 bump version to 1.0.17 2025-02-25 11:41:01 -07:00
4aaf1bd6db ... 2025-02-25 11:36:01 -07:00
a56a251d7f ... 2025-02-25 11:17:11 -07:00
15 changed files with 199 additions and 27 deletions

View File

@@ -51,7 +51,7 @@ fn do() ! {
mut cmd := Command{
name: 'hero'
description: 'Your HERO toolset.'
version: '1.0.16'
version: '1.0.20'
}
// herocmds.cmd_run_add_flags(mut cmd)

View File

@@ -4,7 +4,7 @@ set -e
os_name="$(uname -s)"
arch_name="$(uname -m)"
version='1.0.16'
version='1.0.20'
# Base URL for GitHub releases

View File

@@ -0,0 +1,143 @@
module herocmds
import freeflowuniverse.herolib.web.starlight
import os
import cli { Command, Flag }
pub fn cmd_starlight(mut cmdroot Command) {
mut cmd_run := Command{
name: 'starlight'
description: 'Generate, build, run starlight sites.'
required_args: 0
execute: cmd_starlight_execute
}
// cmd_run.add_flag(Flag{
// flag: .bool
// required: false
// name: 'reset'
// abbrev: 'r'
// description: 'will reset.'
// })
cmd_run.add_flag(Flag{
flag: .string
required: false
name: 'url'
abbrev: 'u'
// default: ''
description: 'Url where starlight source is.'
})
cmd_run.add_flag(Flag{
flag: .string
required: false
name: 'path'
abbrev: 'p'
// default: ''
description: 'Path where starlight source is.'
})
cmd_run.add_flag(Flag{
flag: .string
required: false
name: 'deploykey'
abbrev: 'dk'
// default: ''
description: 'Path of SSH Key used to deploy.'
})
cmd_run.add_flag(Flag{
flag: .string
required: false
name: 'publish'
// default: ''
description: 'Path where to publish.'
})
cmd_run.add_flag(Flag{
flag: .bool
required: false
name: 'buildpublish'
abbrev: 'bp'
description: 'build and publish.'
})
cmd_run.add_flag(Flag{
flag: .bool
required: false
name: 'builddevpublish'
abbrev: 'bpd'
description: 'build dev version and publish.'
})
cmd_run.add_flag(Flag{
flag: .bool
required: false
name: 'update'
description: 'update your environment the template and the repo you are working on (git pull).'
})
cmd_run.add_flag(Flag{
flag: .bool
required: false
name: 'dev'
abbrev: 'd'
description: 'Run your dev environment on local browser.'
})
cmd_run.add_flag(Flag{
flag: .bool
required: false
name: 'new'
abbrev: 'n'
description: 'create a new starlight site.'
})
cmdroot.add_command(cmd_run)
}
fn cmd_starlight_execute(cmd Command) ! {
mut update := cmd.flags.get_bool('update') or { false }
mut init := cmd.flags.get_bool('new') or { false }
mut url := cmd.flags.get_string('url') or { '' }
mut publish_path := cmd.flags.get_string('publish') or { '' }
mut deploykey := cmd.flags.get_string('deploykey') or { '' }
mut path := cmd.flags.get_string('path') or { '' }
mut buildpublish := cmd.flags.get_bool('buildpublish') or { false }
mut builddevpublish := cmd.flags.get_bool('builddevpublish') or { false }
mut dev := cmd.flags.get_bool('dev') or { false }
// if build== false && build== false && build== false {
// eprintln("specify build, builddev or dev")
// exit(1)
// }
mut docs := starlight.new(update: update)!
mut site := docs.get(
url: url
path: path
update: update
publish_path: publish_path
deploykey: deploykey
init: init
)!
if publish_path.len > 0 {
site.build()!
}
if buildpublish {
site.build_publish()!
}
if builddevpublish {
site.build_dev_publish()!
}
if dev {
site.dev()!
}
}

View File

@@ -50,6 +50,9 @@ pub fn get_dir(args_ GetArgs) !Path {
mut p2 := get_no_check(args.path)
if args.check {
p2.check()
if args.delete {
p2.delete()!
}
p2.absolute()
if p2.exist == .no {
if args.create {
@@ -64,9 +67,7 @@ pub fn get_dir(args_ GetArgs) !Path {
if args.empty {
p2.empty()!
}
if args.delete {
p2.delete()!
}
}
return p2
}

View File

@@ -38,7 +38,7 @@ pub fn new(args NewArgs) !&DedupeStore {
return &DedupeStore{
radix: rt
data: db
data: &db
}
}

View File

@@ -36,27 +36,27 @@ fn deserialize_node(data []u8) !Node {
mut d := encoder.decoder_new(data)
// Read and verify version
version_byte := d.get_u8()
version_byte := d.get_u8()!
if version_byte != version {
return error('Invalid version byte: expected ${version}, got ${version_byte}')
}
// Read key segment
key_segment := d.get_string()
key_segment := d.get_string()!
// Read value as []u8
value_len := d.get_u16()
value_len := d.get_u16()!
mut value := []u8{len: int(value_len)}
for i in 0 .. int(value_len) {
value[i] = d.get_u8()
value[i] = d.get_u8()!
}
// Read children
children_len := d.get_u16()
children_len := d.get_u16()!
mut children := []NodeRef{cap: int(children_len)}
for _ in 0 .. children_len {
key_part := d.get_string()
node_id := d.get_u32()
key_part := d.get_string()!
node_id := d.get_u32()!
children << NodeRef{
key_part: key_part
node_id: node_id
@@ -64,7 +64,7 @@ fn deserialize_node(data []u8) !Node {
}
// Read leaf flag
is_leaf := d.get_u8() == 1
is_leaf := d.get_u8()! == 1
return Node{
key_segment: key_segment

View File

@@ -12,5 +12,6 @@
"title": "ThreeFold Technology Vision"
},
"buildDest":["root@info.ourworld.tf:/root/hero/www/info"],
"buildDestDev":["root@info.ourworld.tf:/root/hero/www/infodev"]
"buildDestDev":["root@info.ourworld.tf:/root/hero/www/infodev"],
"copyright": "someone"
}

View File

@@ -78,7 +78,10 @@ pub fn load_config(cfg_dir string) !Config {
// Load and parse footer config
footer_content := os.read_file(os.join_path(cfg_dir, 'footer.json'))!
footer := json.decode(Footer, footer_content)!
footer := json.decode(Footer, footer_content) or {
eprintln('footer.json in ${cfg_dir} is not in the right format please fix.\nError: ${err}')
exit(99)
}
// Load and parse main config
main_config_path := os.join_path(cfg_dir, 'main.json')
@@ -115,7 +118,10 @@ pub fn load_config(cfg_dir string) !Config {
// Load and parse navbar config
navbar_content := os.read_file(os.join_path(cfg_dir, 'navbar.json'))!
navbar := json.decode(Navbar, navbar_content)!
navbar := json.decode(Navbar, navbar_content) or {
eprintln('navbar.json in ${cfg_dir} is not in the right format please fix.\nError: ${err}')
exit(99)
}
return Config{
footer: footer

View File

@@ -209,13 +209,15 @@ fn (mut site DocSite) template_install() ! {
mut build_dev_publish_ := site.path_build.file_get_new('build_dev_publish.sh')!
build_dev_publish_.template_write(build_dev_publish, true)!
build_dev_publish_.chmod(0o700)!
develop_templ := $tmpl('templates/develop_src.sh')
mut develop2_ := site.path_src.file_get_new('develop.sh')!
develop2_.template_write(develop, true)!
develop2_.template_write(develop_templ, true)!
develop2_.chmod(0o700)!
build_templ := $tmpl('templates/build_src.sh')
mut build2_ := site.path_src.file_get_new('build.sh')!
build2_.template_write(build, true)!
build2_.template_write(build_templ, true)!
build2_.chmod(0o700)!
}

View File

@@ -55,4 +55,7 @@ fn (mut self DocusaurusFactory) template_install(args TemplateInstallArgs) ! {
)!
}
mut aa := template_path.dir_get("docs") or {return}
aa.delete()!
}

View File

@@ -0,0 +1,6 @@
#!/bin/bash -e
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
cd "??{script_dir}"
hero docusaurus -bp

View File

@@ -0,0 +1,6 @@
#!/bin/bash -e
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
cd "??{script_dir}"
hero docusaurus -d

View File

@@ -87,10 +87,10 @@ pub fn (mut s DocSite) dev()! {
console.print_item(' 2. To detach from screen: Press Ctrl+A then D')
console.print_item(' 3. To list all screens: screen -ls')
console.print_item('The site content is on::')
console.print_item(' 1. location of documents: ${s.path_src.path}/docs')
console.print_item(' 1. location of documents: ${s.path_src.path}/src')
if osal.cmd_exists('code') {
console.print_item(' 2. We opened above dir in vscode.')
osal.exec(cmd: 'code ${s.path_src.path}/docs')!
osal.exec(cmd: 'code ${s.path_src.path}/src')!
}
// Start the watcher in a separate thread
@@ -99,7 +99,7 @@ pub fn (mut s DocSite) dev()! {
println('\n')
if s.args.watch_changes {
docs_path := '${s.path_src.path}/docs'
docs_path := '${s.path_src.path}/src'
watch_docs(docs_path, s.path_src.path, s.path_build.path)!
}
@@ -154,7 +154,7 @@ pub fn (mut site DocSite) generate() ! {
aa.copy(dest: '${site.path_build.path}/${item}')!
}
}
for item in ['docs'] {
for item in ['src'] {
if os.exists('${site.path_src.path}/${item}') {
mut aa := site.path_src.dir_get(item)!
aa.copy(dest: '${site.path_build.path}/${item}', delete: true)!

View File

@@ -39,8 +39,8 @@ fn handle_file_change(event notifier.NotifyEvent, path string, args map[string]s
}
// Get relative path from docs directory
rel_path := path.replace('${args['path_src']}/docs/', '')
dest_path := '${args['path_build']}/docs/${rel_path}'
rel_path := path.replace('${args['path_src']}/src/', '')
dest_path := '${args['path_build']}/src/${rel_path}'
match event {
.create, .modify {

View File

@@ -181,6 +181,10 @@ systemd_process_test.v
data/graphdb
data/radixtree
clients/livekit
data/radixtree
data/dedupestor
core/playcmds
'