Skip to content

installers #

Installers

This is a set of installers, they are all using the builder functionality.

TODO: need to finish & create examples

A simple example using brew

see imagemagick

import os

import installers.base
import process

//this gets the name of the directory
const installername = os.base(os.dir(@))

// install imagemagick will return true if it was already installed
pub fn  install() ! {

    console.print_header('$node.name: install $installername')
    if !osal.done_exists('install_${installername}') {
        if osal.platform() == .ubuntu{
            osal.package_install(name:"imagemagick")!
        } else {
            panic('only ubuntu and osx supported for now')
        }
    osal.done_set('install_${installername}', 'OK')!
    console.print_header('${installername} already done')
}

typically the factory is always the same, in this case we did the trick with installername to reuse even more

fn install_multi #

fn install_multi(args_ InstallArgs) !

fn names #

fn names(args_ InstallArgs) []string

fn upload #

fn upload(args_ UploadArgs) !

enum UCat #

enum UCat {
	file
	bin
	config
}

struct InstallArgs #

@[params]
struct InstallArgs {
pub mut:
	names     string
	reset     bool
	uninstall bool
	gitpull   bool
	gitreset  bool
	start     bool
}

struct UFile #

struct UFile {
pub mut:
	path  string
	alias string // if other name used for upload, otherwise is the filename
	cat   UCat
}

struct UList #

struct UList {
pub mut:
	root  string // common base for all UFiles
	items []UFile
}

U stands for Upload

struct UploadArgs #

@[params]
struct UploadArgs {
pub mut:
	cmdname string
	source  string
	reset   bool
}

import freeflowuniverse.crystallib.core.pathlib import freeflowuniverse.crystallib.develop.gittools