...
This commit is contained in:
@@ -155,7 +155,7 @@ fn cmd_docusaurus_execute(cmd Command) ! {
|
|||||||
mut dev := cmd.flags.get_bool('dev') or { false }
|
mut dev := cmd.flags.get_bool('dev') or { false }
|
||||||
|
|
||||||
mut docs := docusaurus.new(
|
mut docs := docusaurus.new(
|
||||||
update: update
|
template_update: update // Changed 'update' to 'template_update'
|
||||||
path_build: build_path
|
path_build: build_path
|
||||||
heroscript_path: heroscript_config_dir // Pass the directory path
|
heroscript_path: heroscript_config_dir // Pass the directory path
|
||||||
)!
|
)!
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ module playbook
|
|||||||
import freeflowuniverse.herolib.core.texttools
|
import freeflowuniverse.herolib.core.texttools
|
||||||
import freeflowuniverse.herolib.data.paramsparser
|
import freeflowuniverse.herolib.data.paramsparser
|
||||||
import freeflowuniverse.herolib.core.pathlib
|
import freeflowuniverse.herolib.core.pathlib
|
||||||
// import freeflowuniverse.herolib.core.base
|
import freeflowuniverse.herolib.develop.gittools // Added import for gittools
|
||||||
// import freeflowuniverse.herolib.ui.console
|
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
start
|
start
|
||||||
@@ -17,7 +16,12 @@ pub fn (mut plbook PlayBook) add(args_ PlayBookNewArgs) ! {
|
|||||||
mut args := args_
|
mut args := args_
|
||||||
|
|
||||||
if args.git_url.len > 0 {
|
if args.git_url.len > 0 {
|
||||||
args.path = gitresolver.resolve_git_url(args.git_url, args.git_pull, args.git_reset)!
|
mut git_path_args := gittools.GitPathGetArgs{
|
||||||
|
git_url: args.git_url
|
||||||
|
git_pull: args.git_pull
|
||||||
|
git_reset: args.git_reset
|
||||||
|
}
|
||||||
|
args.path = gittools.path(git_path_args)!
|
||||||
}
|
}
|
||||||
|
|
||||||
// walk over directory
|
// walk over directory
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub fn run(mut plbook playbook.PlayBook, dagu bool) ! {
|
|||||||
|
|
||||||
play_core(mut plbook)!
|
play_core(mut plbook)!
|
||||||
play_ssh(mut plbook)!
|
play_ssh(mut plbook)!
|
||||||
play_git(mut plbook)!
|
play_git.play(mut plbook)! // Changed to play_git.play
|
||||||
// play_publisher(mut plbook)!
|
// play_publisher(mut plbook)!
|
||||||
// play_zola(mut plbook)!
|
// play_zola(mut plbook)!
|
||||||
// play_caddy(mut plbook)!
|
// play_caddy(mut plbook)!
|
||||||
|
|||||||
@@ -42,8 +42,13 @@ pub fn play_core(mut plbook playbook.PlayBook) ! {
|
|||||||
mut playrunpath := action.params.get_default('path', '')!
|
mut playrunpath := action.params.get_default('path', '')!
|
||||||
if playrunpath.len == 0 {
|
if playrunpath.len == 0 {
|
||||||
action.name = 'pull'
|
action.name = 'pull'
|
||||||
action2 := play_git_action(action)!
|
mut git_path_args := gittools.GitPathGetArgs{
|
||||||
playrunpath = action2.params.get_default('path', '')!
|
git_url: action.params.get_default('git_url', '')!
|
||||||
|
git_pull: action.params.get_default_false('git_pull')
|
||||||
|
git_reset: action.params.get_default_false('git_reset')
|
||||||
|
git_root: action.params.get_default('git_root', '')!
|
||||||
|
}
|
||||||
|
playrunpath = gittools.path(git_path_args)!
|
||||||
}
|
}
|
||||||
if playrunpath.len == 0 {
|
if playrunpath.len == 0 {
|
||||||
return error("can't run a heroscript didn't find url or path.")
|
return error("can't run a heroscript didn't find url or path.")
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
ssh_key_path := p.get_default('ssh_key_path', '')!
|
ssh_key_path := p.get_default('ssh_key_path', '')!
|
||||||
reload := p.get_default_false('reload')
|
reload := p.get_default_false('reload')
|
||||||
|
|
||||||
new(
|
gittools.new( // Changed to gittools.new
|
||||||
coderoot: coderoot
|
coderoot: coderoot
|
||||||
light: light
|
light: light
|
||||||
log: log
|
log: log
|
||||||
@@ -42,7 +42,7 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
)!
|
)!
|
||||||
} else {
|
} else {
|
||||||
// Initialize GitStructure with defaults
|
// Initialize GitStructure with defaults
|
||||||
new()!
|
gittools.get(gittools.GitStructureArgGet{})! // Changed to gittools.get with default args
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle !!git.clone action
|
// Handle !!git.clone action
|
||||||
@@ -55,14 +55,14 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
light := p.get_default_true('light')
|
light := p.get_default_true('light')
|
||||||
recursive := p.get_default_false('recursive')
|
recursive := p.get_default_false('recursive')
|
||||||
|
|
||||||
mut clone_args := GitCloneArgs{
|
mut clone_args := gittools.GitCloneArgs{ // Changed to gittools.GitCloneArgs
|
||||||
url: url
|
url: url
|
||||||
sshkey: sshkey
|
sshkey: sshkey
|
||||||
recursive: recursive
|
recursive: recursive
|
||||||
light: light
|
light: light
|
||||||
}
|
}
|
||||||
if coderoot.len > 0 {
|
if coderoot.len > 0 {
|
||||||
gs = new(coderoot: coderoot)!
|
gs = gittools.new(coderoot: coderoot)! // Changed to gittools.new
|
||||||
}
|
}
|
||||||
gs.clone(clone_args)!
|
gs.clone(clone_args)!
|
||||||
}
|
}
|
||||||
@@ -100,76 +100,31 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
for mut repo in repos {
|
for mut repo in repos {
|
||||||
match action_type {
|
match action_type {
|
||||||
'pull' {
|
'pull' {
|
||||||
repo.pull(submodules: submodules) or {
|
repo.pull(submodules: submodules)
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to pull repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to pull repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'commit' {
|
'commit' {
|
||||||
repo.commit(message) or {
|
repo.commit(message)
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to commit repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to commit repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'push' {
|
'push' {
|
||||||
repo.push() or {
|
repo.push()
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to push repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to push repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'reset' {
|
'reset' {
|
||||||
repo.reset() or {
|
repo.reset()
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to reset repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to reset repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'branch_create' {
|
'branch_create' {
|
||||||
repo.branch_create(branchname) or {
|
repo.branch_create(branchname)
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to create branch ${branchname} in repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to create branch ${branchname} in repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'branch_switch' {
|
'branch_switch' {
|
||||||
repo.branch_switch(branchname) or {
|
repo.branch_switch(branchname)
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to switch branch to ${branchname} in repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to switch branch to ${branchname} in repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'tag_create' {
|
'tag_create' {
|
||||||
repo.tag_create(tagname) or {
|
repo.tag_create(tagname)
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to create tag ${tagname} in repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to create tag ${tagname} in repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'tag_switch' {
|
'tag_switch' {
|
||||||
repo.tag_switch(tagname) or {
|
repo.tag_switch(tagname)
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to switch tag to ${tagname} in repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to switch tag to ${tagname} in repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'delete' {
|
'delete' {
|
||||||
repo.delete() or {
|
repo.delete()
|
||||||
if !error_ignore {
|
|
||||||
return error('Failed to delete repo ${repo.name}: ${err}')
|
|
||||||
}
|
|
||||||
console.print_stderr('Failed to delete repo ${repo.name}: ${err}. Ignoring due to error_ignore: true.')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if !error_ignore {
|
if !error_ignore {
|
||||||
@@ -197,7 +152,7 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
account: account
|
account: account
|
||||||
provider: provider
|
provider: provider
|
||||||
status_update: status_update
|
status_update: status_update
|
||||||
)!
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle !!git.reload_cache
|
// Handle !!git.reload_cache
|
||||||
@@ -206,8 +161,8 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
mut p := action.params
|
mut p := action.params
|
||||||
coderoot := p.get_default('coderoot', '')!
|
coderoot := p.get_default('coderoot', '')!
|
||||||
if coderoot.len > 0 {
|
if coderoot.len > 0 {
|
||||||
gs = new(coderoot: coderoot)!
|
gs = gittools.new(coderoot: coderoot)!
|
||||||
}
|
}
|
||||||
gs.load(true)! // Force reload
|
gs.load(true) // Force reload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module gittools
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import freeflowuniverse.herolib.core.pathlib
|
import freeflowuniverse.herolib.core.pathlib
|
||||||
|
import freeflowuniverse.herolib.develop.gitresolver // Added import for gitresolver
|
||||||
|
|
||||||
__global (
|
__global (
|
||||||
gsinstances map[string]&GitStructure
|
gsinstances map[string]&GitStructure
|
||||||
|
|||||||
@@ -23,6 +23,23 @@ pub mut:
|
|||||||
factory &DocusaurusFactory @[skip; str: skip] // Reference to the parent
|
factory &DocusaurusFactory @[skip; str: skip] // Reference to the parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@[params]
|
||||||
|
pub struct DSiteGetArgs {
|
||||||
|
pub mut:
|
||||||
|
name string
|
||||||
|
nameshort string
|
||||||
|
path string
|
||||||
|
git_url string
|
||||||
|
git_reset bool
|
||||||
|
git_root string
|
||||||
|
git_pull bool
|
||||||
|
open bool // Added
|
||||||
|
watch_changes bool // Added
|
||||||
|
path_publish string // Added
|
||||||
|
init bool // Added
|
||||||
|
update bool // Added (maps to template_update in DocusaurusArgs)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn (mut s DocSite) build() ! {
|
pub fn (mut s DocSite) build() ! {
|
||||||
s.generate()!
|
s.generate()!
|
||||||
osal.exec(
|
osal.exec(
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ pub fn new(args_ DocusaurusArgs) !&DocusaurusFactory {
|
|||||||
|
|
||||||
|
|
||||||
// get site from the docusaurus factory
|
// get site from the docusaurus factory
|
||||||
pub fn (mut self DocusaurusFactory) site_get(name string) ! {
|
pub fn (mut self DocusaurusFactory) site_get(name string) !&DocSite { // Changed return type to !&DocSite
|
||||||
name_:=texttools.name_fix(name: name)!
|
name_:=texttools.name_fix(name: name) // Removed !
|
||||||
return self.sites[name_] or {return error('site not found: ${name} in docusaurus factory.')!}
|
return self.sites[name_] or {return error('site not found: ${name} in docusaurus factory.') } // Removed ! from error()
|
||||||
}
|
}
|
||||||
@@ -21,18 +21,18 @@ fn (mut self DocusaurusFactory) install(args_ TemplateInstallArgs) ! {
|
|||||||
|
|
||||||
if args.reset {
|
if args.reset {
|
||||||
osal.rm('${self.path_build.path}')!
|
osal.rm('${self.path_build.path}')!
|
||||||
osal.mkdir('${self.path_build.path}')!
|
osal.mkdir_all('${self.path_build.path}')! // Changed mkdir to mkdir_all
|
||||||
}
|
}
|
||||||
|
|
||||||
template_path := gs.get_path(
|
template_path := gs.get_path(
|
||||||
pull: args.template_update
|
pull: args.template_update
|
||||||
reset: args.delete
|
reset: args.reset // Changed args.delete to args.reset
|
||||||
url: 'https://github.com/freeflowuniverse/docusaurus_template/src/branch/main/template'
|
url: 'https://github.com/freeflowuniverse/docusaurus_template/src/branch/main/template'
|
||||||
)!
|
)!
|
||||||
|
|
||||||
mut template_path0 := pathlib.get_dir(path: template_path, create: false)!
|
mut template_path0 := pathlib.get_dir(path: template_path, create: false)!
|
||||||
|
|
||||||
template_path0.copy(dest: '${self.path_build.path}', delete: args.delete)!
|
template_path0.copy(dest: '${self.path_build.path}', delete: args.reset)! // Changed args.delete to args.reset
|
||||||
|
|
||||||
if !os.exists('${self.path_build.path}/node_modules') {
|
if !os.exists('${self.path_build.path}/node_modules') {
|
||||||
args.install = true
|
args.install = true
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub fn play(args_ PlayArgs) ! {
|
|||||||
|
|
||||||
mut ds := new()!
|
mut ds := new()!
|
||||||
|
|
||||||
if plbook.if_once(filter: 'docusaurus.define') or {return error("docusarus.define should be there 0 or 1 time.\n${args}")!} {
|
if plbook.exists_once(filter: 'docusaurus.define') { // Changed if_once to exists_once and removed or block
|
||||||
mut action := plbook.action_get(actor: 'docusaurus', name: 'define')!
|
mut action := plbook.action_get(actor: 'docusaurus', name: 'define')!
|
||||||
|
|
||||||
mut p := action.params
|
mut p := action.params
|
||||||
|
|||||||
Reference in New Issue
Block a user