This commit is contained in:
2025-08-12 16:01:27 +02:00
parent ffff44f347
commit f885563982
3 changed files with 34 additions and 41 deletions

View File

@@ -15,7 +15,6 @@ pub fn (mut site DocSite) generate() ! {
mut f := factory_get()!
console.print_header(' site generate: ${site.name} on ${f.path_build.path}')
console.print_header(' site source on ${site.path_src.path}')
// lets make sure we remove the cfg dir so we rebuild
cfg_path := os.join_path(f.path_build.path, 'cfg')
@@ -29,24 +28,8 @@ pub fn (mut site DocSite) generate() ! {
url: 'https://github.com/freeflowuniverse/docusaurus_template/src/branch/main/template/'
)!
// we need to copy the template each time for these 2 items, otherwise there can be leftovers from other run
for item in ['src', 'static'] {
mut template_src_path := pathlib.get_dir(path: '${template_path}/${item}', create: true)!
template_src_path.copy(dest: '${f.path_build.path}/${item}', delete: true)!
// now copy the info which can be overruled from source in relation to the template
if os.exists('${site.path_src.path}/${item}') {
mut src_path := pathlib.get_dir(path: '${site.path_src.path}/${item}', create: false)!
src_path.copy(dest: '${f.path_build.path}/${item}', delete: false)!
}
}
osal.rm('${f.path_build.path}/docs')!
if os.exists('${site.path_src.path}/docs') {
mut aa := site.path_src.dir_get('docs')!
aa.copy(dest: '${f.path_build.path}/docs', delete: true)!
}
mut main_file := pathlib.get_file(path: '${cfg_path}/main.json', create: true)!
main_file.write(json.encode_pretty(site.config.main))!
@@ -66,4 +49,6 @@ pub fn (mut site DocSite) generate() ! {
site: website
)!
site.import()!
}

View File

@@ -16,34 +16,41 @@ pub struct ImportParams {
git_reset bool
git_root string
git_pull bool
dest string
}
pub fn (mut site DocSite) import(args ImportParams) ! {
pub fn (mut site DocSite) import() ! {
mypath := gittools.get_repo_path(
git_pull: args.git_pull
git_reset: args.git_reset
git_url: args.git_url
path: args.path
)!
for importparams in site.importparams {
console.print_header('Importing: ${importparams.path} from ${importparams.git_url}')
println(site)
if true{panic("3456789")}
mut f := factory_get()!
mut mypatho := pathlib.get(mypath)
mut mypath := gittools.get_repo_path(
git_pull: importparams.git_pull
git_reset: importparams.git_reset
git_url: importparams.git_url
path: importparams.path
)!
// mypatho.copy(dest: '${f.path_build.path}/docs/${item.dest}', delete: false)!
println(site)
if true{panic("3456789")}
// println(item)
// // replace: {'NAME': 'MyName', 'URGENCY': 'red'}
// mut ri := regext.regex_instructions_new()
// for key, val in item.replace {
// ri.add_item('\{${key}\}', val)!
// }
// ri.replace_in_dir(
// path: '${f.path_build.path}/docs/${item.dest}'
// extensions: [
// 'md',
// ]
// )!
mut mypatho := pathlib.get(mypath)
mypatho.copy(dest: '${f.path_build.path}/docs/${importparams.dest}', delete: false)!
// println(item)
// // replace: {'NAME': 'MyName', 'URGENCY': 'red'}
// mut ri := regext.regex_instructions_new()
// for key, val in item.replace {
// ri.add_item('\{${key}\}', val)!
// }
// ri.replace_in_dir(
// path: '${f.path_build.path}/docs/${item.dest}'
// extensions: [
// 'md',
// ]
// )!
}
}

View File

@@ -42,6 +42,7 @@ pub fn play(mut plbook PlayBook) ! {
git_url: p.get_default('git_url', '')!
git_reset: p.get_default_false('git_reset')
git_pull: p.get_default_false('git_pull')
dest: p.get_default('dest', '')!
}
action.done = true
}