Merge branch 'development_installers' of github.com:freeflowuniverse/herolib into development_installers

This commit is contained in:
2025-02-19 05:10:45 +03:00
138 changed files with 5044 additions and 5721 deletions

View File

@@ -8,7 +8,6 @@ import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.installers.ulist
import os
//////////////////// following actions are not specific to instance of the object
// checks if a certain version or above is installed

View File

@@ -3,15 +3,16 @@ module rust
import freeflowuniverse.herolib.osal
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.base
import freeflowuniverse.herolib.installers.ulist
import os
//////////////////// following actions are not specific to instance of the object
// checks if a certain version or above is installed
fn installed_() !bool {
fn installed() !bool {
res := os.execute('${osal.profile_path_source_and()!} rustc -V')
if res.exit_code != 0 {
return false
@@ -34,14 +35,14 @@ fn ulist_get() !ulist.UList {
}
// uploads to S3 server if configured
fn upload_() ! {
fn upload() ! {
// installers.upload(
// cmdname: 'rust'
// source: '${gitpath}/target/x86_64-unknown-linux-musl/release/rust'
// )!
}
fn install_() ! {
fn install() ! {
console.print_header('install rust')
base.install()!
@@ -58,14 +59,14 @@ fn install_() ! {
}
osal.profile_path_add_remove(paths2add: '${os.home_dir()}/.cargo/bin')!
return
console.print_header('rust is installed')
}
fn destroy_() ! {
osal.package_remove('
rust
')!
fn destroy() ! {
pl := core.platform()!
if pl == .arch {
osal.package_remove('rust')!
}
osal.exec(
cmd: '

View File

@@ -1,12 +1,9 @@
module rust
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.sysadmin.startupmanager
import freeflowuniverse.herolib.osal.zinit
import time
__global (
rust_global map[string]&RustInstaller
@@ -45,11 +42,11 @@ pub fn play(args_ PlayArgs) ! {
reset := p.get_default_false('reset')
if other_action.name == 'destroy' || reset {
console.print_debug('install action rust.destroy')
// destroy()!
destroy()!
}
if other_action.name == 'install' {
console.print_debug('install action rust.install')
// install()!
install()!
}
}
}
@@ -89,14 +86,14 @@ pub mut:
pub fn (mut self RustInstaller) install(args InstallArgs) ! {
switch(self.name)
// if args.reset || (!installed()!) {
// install()!
// }
if args.reset || (!installed()!) {
install()!
}
}
pub fn (mut self RustInstaller) destroy() ! {
switch(self.name)
// destroy()!
destroy()!
}
// switch instance to be used for rust

View File

@@ -1,6 +1,7 @@
module rust
import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.data.encoderhero
import os
pub const version = '1.83.0'
@@ -14,13 +15,24 @@ pub mut:
name string = 'default'
}
fn obj_init(obj_ RustInstaller) !RustInstaller {
// never call get here, only thing we can do here is work on object itself
mut obj := obj_
return obj
// your checking & initialization code if needed
fn obj_init(mycfg_ RustInstaller) !RustInstaller {
mut mycfg := mycfg_
return mycfg
}
// called before start if done
fn configure() ! {
// mut installer := get()!
}
/////////////NORMALLY NO NEED TO TOUCH
pub fn heroscript_dumps(obj RustInstaller) !string {
return encoderhero.encode[RustInstaller](obj)!
}
pub fn heroscript_loads(heroscript string) !RustInstaller {
mut obj := encoderhero.decode[RustInstaller](heroscript)!
return obj
}