This commit is contained in:
2025-12-01 10:35:46 +01:00
parent d53043dd65
commit ed785c79df
5 changed files with 17 additions and 12 deletions

View File

@@ -18,7 +18,7 @@ AtlasClient provides methods to:
import incubaid.herolib.web.atlas_client
// Create client
mut client := atlas_client.new(export_dir: '/tmp/atlas_export')!
mut client := atlas_client.new(export_dir: '${os.home_dir()}/hero/var/atlas_export')!
// List collections
collections := client.list_collections()!

View File

@@ -3,6 +3,7 @@ module atlas
import incubaid.herolib.core.playbook { PlayBook }
import incubaid.herolib.develop.gittools
import incubaid.herolib.ui.console
import os
// Play function to process HeroScript actions for Atlas
pub fn play(mut plbook PlayBook) ! {
@@ -66,7 +67,7 @@ pub fn play(mut plbook PlayBook) ! {
for mut action in export_actions {
mut p := action.params
name = p.get_default('name', 'main')!
destination := p.get_default('destination', '/tmp/atlas_export')!
destination := p.get_default('destination', '${os.home_dir()}/hero/var/atlas_export')!
reset := p.get_default_true('reset')
include := p.get_default_true('include')
redis := p.get_default_true('redis')

View File

@@ -22,8 +22,8 @@ pub mut:
recursive bool
pull bool
reload bool // means reload the info into the cache
script bool = true // run non interactive
reset bool = true // means we will lose changes (only relevant for clone, pull)
script bool // run non interactive
reset bool // means we will lose changes (only relevant for clone, pull)
}
// do group actions on repo
@@ -38,14 +38,12 @@ pub mut:
// url string
// pull bool
// reload bool //means reload the info into the cache
// script bool = true // run non interactive
// reset bool = true // means we will lose changes (only relevant for clone, pull)
// script bool // run non interactive
// reset bool// means we will lose changes (only relevant for clone, pull)
//```
pub fn (mut gs GitStructure) do(args_ ReposActionsArgs) !string {
mut args := args_
console.print_debug('git do ${args.cmd}')
// println(args)
// $dbg;
if args.path.len > 0 && args.url.len > 0 {
panic('bug')
@@ -99,7 +97,9 @@ pub fn (mut gs GitStructure) do(args_ ReposActionsArgs) !string {
provider: args.provider
)!
if repos.len < 4 || args.cmd in 'pull,push,commit,delete'.split(',') {
// println(repos.map(it.name))
if repos.len < 4 || args.cmd in 'pull,push,commit'.split(',') {
args.reload = true
}

View File

@@ -19,7 +19,7 @@ pub fn (mut repo GitRepo) status_update(args StatusUpdateArgs) ! {
}
if args.reset || repo.last_load == 0 {
// console.print_debug('${repo.name} : Cache get')
// console.print_debug('${repo.name} : Cache Get')
repo.cache_get()!
}
@@ -30,6 +30,8 @@ pub fn (mut repo GitRepo) status_update(args StatusUpdateArgs) ! {
// Decide if a full load is needed.
if args.reset || repo.last_load == 0
|| current_time - repo.last_load >= repo.config.remote_check_period {
// console.print_debug("reload ${repo.name}:\n args reset:${args.reset}\n lastload:${repo.last_load}\n currtime-lastload:${current_time- repo.last_load}\n period:${repo.config.remote_check_period}")
// $dbg;
repo.load_internal() or {
// Persist the error state to the cache
console.print_stderr('Failed to load repository ${repo.name} at ${repo.path()}: ${err}')
@@ -51,7 +53,8 @@ fn (mut repo GitRepo) load_internal() ! {
repo.exec('fetch --all') or {
repo.status.error = 'Failed to fetch updates: ${err}'
return error('Failed to fetch updates for ${repo.name} at ${repo.path()}: ${err}. Please check network connection and repository access.')
console.print_stderr('Failed to fetch updates for ${repo.name} at ${repo.path()}: ${err}. \nPlease check git repo source, network connection and repository access.')
return
}
repo.load_branches()!
repo.load_tags()!

View File

@@ -1,6 +1,7 @@
module docusaurus
import incubaid.herolib.core.playbook { PlayBook }
import os
pub fn play(mut plbook PlayBook) ! {
if !plbook.exists(filter: 'docusaurus.') {
@@ -17,7 +18,7 @@ pub fn play(mut plbook PlayBook) ! {
reset: param_define.get_default_false('reset')
template_update: param_define.get_default_false('template_update')
install: param_define.get_default_false('install')
atlas_dir: param_define.get_default('atlas_dir', '/tmp/atlas_export')!
atlas_dir: param_define.get_default('atlas_dir', '${os.home_dir()}/hero/var/atlas_export')!
use_atlas: param_define.get_default_false('use_atlas')
)!