Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 299f6dea06 | |||
| ed025f9acb | |||
| c4ea066927 | |||
| 5f9c6ff2bb | |||
| 8965f7ae89 |
@@ -51,7 +51,7 @@ fn do() ! {
|
||||
mut cmd := Command{
|
||||
name: 'hero'
|
||||
description: 'Your HERO toolset.'
|
||||
version: '1.0.9'
|
||||
version: '1.0.13'
|
||||
}
|
||||
|
||||
// herocmds.cmd_run_add_flags(mut cmd)
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
|
||||
os_name="$(uname -s)"
|
||||
arch_name="$(uname -m)"
|
||||
version='1.0.9'
|
||||
version='1.0.13'
|
||||
|
||||
|
||||
# Base URL for GitHub releases
|
||||
|
||||
@@ -88,7 +88,7 @@ pub fn get(args_ GitStructureArgGet) !&GitStructure {
|
||||
if cfg.coderoot != "SKIP"{
|
||||
gs.config_ = cfg
|
||||
gs.config_save()!
|
||||
println(gs.config()!)
|
||||
//println(gs.config()!)
|
||||
}
|
||||
|
||||
gs.config()! // will load the config, don't remove
|
||||
|
||||
@@ -22,7 +22,7 @@ fn installed() !bool {
|
||||
if r.len != 1 {
|
||||
return error("couldn't parse bun version.\n${res.output}")
|
||||
}
|
||||
println(' ${texttools.version(version)} <= ${texttools.version(r[0])}')
|
||||
// println(' ${texttools.version(version)} <= ${texttools.version(r[0])}')
|
||||
if texttools.version(version) <= texttools.version(r[0]) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ pub mut:
|
||||
base_url string @[json: 'baseUrl']
|
||||
image string
|
||||
metadata MainMetadata
|
||||
build_dest string @[json: 'buildDest']
|
||||
build_dest_dev string @[json: 'buildDestDev']
|
||||
build_dest []string @[json: 'buildDest']
|
||||
build_dest_dev []string @[json: 'buildDestDev']
|
||||
}
|
||||
|
||||
// Navbar config structures
|
||||
@@ -80,8 +80,37 @@ pub fn load_config(cfg_dir string) !Config {
|
||||
footer := json.decode(Footer, footer_content)!
|
||||
|
||||
// Load and parse main config
|
||||
main_content := os.read_file(os.join_path(cfg_dir, 'main.json'))!
|
||||
main := json.decode(Main, main_content)!
|
||||
main_config_path := os.join_path(cfg_dir, 'main.json')
|
||||
main_content := os.read_file(main_config_path)!
|
||||
main := json.decode(Main, main_content) or {
|
||||
eprintln("${main_config_path} is not in the right format please fix.")
|
||||
println('
|
||||
|
||||
## EXAMPLE OF A GOOD ONE:
|
||||
|
||||
- note the list for buildDest and buildDestDev
|
||||
- note its the full path where the html is pushed too
|
||||
|
||||
{
|
||||
"title": "ThreeFold Web4",
|
||||
"tagline": "ThreeFold Web4",
|
||||
"favicon": "img/favicon.png",
|
||||
"url": "https://docs.threefold.io",
|
||||
"url_home": "docs/introduction",
|
||||
"baseUrl": "/",
|
||||
"image": "img/tf_graph.png",
|
||||
"metadata": {
|
||||
"description": "ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet.",
|
||||
"image": "https://threefold.info/kristof/img/tf_graph.png",
|
||||
"title": "ThreeFold Docs"
|
||||
},
|
||||
"buildDest":["root@info.ourworld.tf:/root/hero/www/info/tfgrid4"],
|
||||
"buildDestDev":["root@info.ourworld.tf:/root/hero/www/infodev/tfgrid4"]
|
||||
|
||||
}
|
||||
')
|
||||
exit(99)
|
||||
}
|
||||
|
||||
// Load and parse navbar config
|
||||
navbar_content := os.read_file(os.join_path(cfg_dir, 'navbar.json'))!
|
||||
|
||||
@@ -55,9 +55,6 @@ pub fn (mut f DocusaurusFactory) build(args_ DSiteNewArgs) !&DocSite {
|
||||
pub fn (mut f DocusaurusFactory) build_dev_publish(args_ DSiteNewArgs) !&DocSite {
|
||||
mut s := f.add(args_)!
|
||||
s.generate()!
|
||||
if s.config.main.build_dest_dev == ""{
|
||||
return error("build_dest_dev not specified, can't build publish.")
|
||||
}
|
||||
osal.exec(
|
||||
cmd: '
|
||||
cd ${s.path_build.path}
|
||||
@@ -72,9 +69,6 @@ pub fn (mut f DocusaurusFactory) build_publish(args_ DSiteNewArgs) !&DocSite {
|
||||
mut s := f.add(args_)!
|
||||
s.generate()!
|
||||
|
||||
if s.config.main.build_dest == ""{
|
||||
return error("build_dest not specified, can't build publish.")
|
||||
}
|
||||
|
||||
osal.exec(
|
||||
cmd: '
|
||||
@@ -228,6 +222,7 @@ pub fn (mut site DocSite) error(args ErrorArgs) {
|
||||
|
||||
pub fn (mut site DocSite) generate() ! {
|
||||
console.print_header(' site generate: ${site.name} on ${site.path_build.path}')
|
||||
console.print_header(' site source on ${site.path_src.path}')
|
||||
site.template_install()!
|
||||
// osal.exec(
|
||||
// cmd: '
|
||||
@@ -313,4 +308,5 @@ fn (mut site DocSite) template_install() ! {
|
||||
build2_.template_write(build, true)!
|
||||
build2_.chmod(0o700)!
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
set -ex
|
||||
|
||||
script_dir="??(cd "??(dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "??{script_dir}"
|
||||
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "???script_dir}"
|
||||
|
||||
echo "Docs directory: ??script_dir"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
script_dir="??(cd "??(dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "??{script_dir}"
|
||||
|
||||
|
||||
@@ -18,4 +18,6 @@ ${profile_include}
|
||||
|
||||
bun docusaurus build
|
||||
|
||||
rsync -rv --delete ${site.path_build.path}/build/ ${cfg.main.build_dest.trim_right("/")}/${cfg.main.name.trim_right("/")}/
|
||||
@for dest in cfg.main.build_dest_dev
|
||||
rsync -rv --delete ${site.path_build.path}/build/ ${dest.trim_right("/")}/
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -ex
|
||||
|
||||
script_dir="??(cd "??(dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "??{script_dir}"
|
||||
|
||||
echo "Docs directory: ??script_dir"
|
||||
@@ -17,4 +17,6 @@ ${profile_include}
|
||||
|
||||
bun docusaurus build
|
||||
|
||||
rsync -rv --delete ${site.path_build.path}/build/ ${cfg.main.build_dest.trim_right("/")}/${cfg.main.name.trim_right("/")}/
|
||||
@for dest in cfg.main.build_dest
|
||||
rsync -rv --delete ${site.path_build.path}/build/ ${dest.trim_right("/")}/
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
script_dir="??(cd "??(dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
script_dir="???cd "???dirname "??{BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "??{script_dir}"
|
||||
|
||||
echo "Docs directory: ??script_dir"
|
||||
|
||||
Reference in New Issue
Block a user