fix: Rename freeflowuniverse to incubaid
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
module builder
|
||||
|
||||
import os
|
||||
import freeflowuniverse.herolib.core.texttools
|
||||
import freeflowuniverse.herolib.core.pathlib
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.core.texttools
|
||||
import incubaid.herolib.core.pathlib
|
||||
import incubaid.herolib.ui.console
|
||||
|
||||
const heropath_ = os.dir(@FILE) + '/../'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.core.base
|
||||
import incubaid.herolib.core.base
|
||||
|
||||
@[heap]
|
||||
pub struct BuilderFactory {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.ui.console
|
||||
|
||||
pub fn (mut node Node) done_set(key string, val string) ! {
|
||||
if key in node.done {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.data.ipaddress
|
||||
import incubaid.herolib.data.ipaddress
|
||||
|
||||
type Executor = ExecutorLocal | ExecutorSSH | ExecutorCrun
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ module builder
|
||||
|
||||
import os
|
||||
import rand
|
||||
import freeflowuniverse.herolib.osal.core as osal
|
||||
import freeflowuniverse.herolib.core.pathlib
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import freeflowuniverse.herolib.core.texttools
|
||||
import incubaid.herolib.osal.core as osal
|
||||
import incubaid.herolib.core.pathlib
|
||||
import incubaid.herolib.ui.console
|
||||
import incubaid.herolib.core.texttools
|
||||
|
||||
@[heap]
|
||||
pub struct ExecutorCrun {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.osal.core as osal
|
||||
import freeflowuniverse.herolib.osal.rsync
|
||||
// import freeflowuniverse.herolib.core.pathlib
|
||||
import incubaid.herolib.osal.core as osal
|
||||
import incubaid.herolib.osal.rsync
|
||||
// import incubaid.herolib.core.pathlib
|
||||
import os
|
||||
|
||||
@[heap]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.ui.console
|
||||
|
||||
fn test_exec() {
|
||||
mut e := ExecutorLocal{}
|
||||
|
||||
@@ -2,12 +2,12 @@ module builder
|
||||
|
||||
import os
|
||||
import rand
|
||||
import freeflowuniverse.herolib.osal.core as osal
|
||||
import freeflowuniverse.herolib.osal.rsync
|
||||
import freeflowuniverse.herolib.core.pathlib
|
||||
import freeflowuniverse.herolib.data.ipaddress
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import freeflowuniverse.herolib.core.texttools
|
||||
import incubaid.herolib.osal.core as osal
|
||||
import incubaid.herolib.osal.rsync
|
||||
import incubaid.herolib.core.pathlib
|
||||
import incubaid.herolib.data.ipaddress
|
||||
import incubaid.herolib.ui.console
|
||||
import incubaid.herolib.core.texttools
|
||||
|
||||
@[heap]
|
||||
pub struct ExecutorSSH {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
module builder
|
||||
|
||||
import rand
|
||||
import freeflowuniverse.herolib.data.ipaddress { IPAddress }
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.data.ipaddress { IPAddress }
|
||||
import incubaid.herolib.ui.console
|
||||
|
||||
// Assuming this function runs first (which is the case)
|
||||
// This generates ssh keys on local machine to use for
|
||||
|
||||
@@ -57,11 +57,11 @@ Here is a full example of a Heroscript playbook for the builder module:
|
||||
To run a playbook, you can use the `play` function in `builder.play`.
|
||||
|
||||
```v
|
||||
import freeflowuniverse.herolib.core.playbook
|
||||
import freeflowuniverse.herolib.builder
|
||||
import incubaid.herolib.core.playbook
|
||||
import incubaid.herolib.builder
|
||||
|
||||
mut plbook := playbook.new(path: "path/to/your/playbook.hs")!
|
||||
builder.play(mut plbook)!
|
||||
```
|
||||
|
||||
This will parse the Heroscript file and execute the defined actions.
|
||||
This will parse the Heroscript file and execute the defined actions.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module builder
|
||||
|
||||
import json
|
||||
import freeflowuniverse.herolib.data.paramsparser { Params }
|
||||
import freeflowuniverse.herolib.core.base
|
||||
// import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.data.paramsparser { Params }
|
||||
import incubaid.herolib.core.base
|
||||
// import incubaid.herolib.ui.console
|
||||
import crypto.md5
|
||||
|
||||
pub enum PlatformType {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.core.texttools
|
||||
import incubaid.herolib.core.texttools
|
||||
import crypto.md5
|
||||
import time
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
// import freeflowuniverse.herolib.osal.core as osal
|
||||
import incubaid.herolib.data.ourtime
|
||||
import incubaid.herolib.ui.console
|
||||
// import incubaid.herolib.osal.core as osal
|
||||
|
||||
// check command exists on the platform, knows how to deal with different platforms
|
||||
pub fn (mut node Node) cmd_exists(cmd string) bool {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.data.ipaddress
|
||||
import incubaid.herolib.data.ipaddress
|
||||
|
||||
// get node connection to local machine
|
||||
pub fn (mut bldr BuilderFactory) node_local() !&Node {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.core.playbook
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.core.playbook
|
||||
import incubaid.herolib.ui.console
|
||||
|
||||
// execute a playbook which can build nodes
|
||||
pub fn play(mut plbook playbook.PlayBook) ! {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
module builder
|
||||
|
||||
import freeflowuniverse.herolib.osal.screen
|
||||
import freeflowuniverse.herolib.data.ipaddress
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.osal.screen
|
||||
import incubaid.herolib.data.ipaddress
|
||||
import incubaid.herolib.ui.console
|
||||
|
||||
@[params]
|
||||
pub struct ForwardArgsToLocal {
|
||||
|
||||
@@ -5,6 +5,7 @@ The Builder module is a powerful system automation and remote execution framewor
|
||||
## Overview
|
||||
|
||||
The Builder module consists of several key components:
|
||||
|
||||
- **BuilderFactory**: Creates and manages builder instances
|
||||
- **Node**: Represents a target system (local or remote) with its properties and state
|
||||
- **Executor**: Interface for command execution and file operations (SSH or Local)
|
||||
@@ -15,7 +16,7 @@ The Builder module consists of several key components:
|
||||
### Basic Initialization
|
||||
|
||||
```v
|
||||
import freeflowuniverse.herolib.builder
|
||||
import incubaid.herolib.builder
|
||||
|
||||
// Create a new builder instance
|
||||
mut b := builder.new()!
|
||||
@@ -30,6 +31,7 @@ mut local_node := builder.node_local()!
|
||||
### Node Configuration
|
||||
|
||||
Nodes can be configured with various properties:
|
||||
|
||||
```v
|
||||
// Full node configuration
|
||||
mut n := b.node_new(
|
||||
@@ -43,6 +45,7 @@ mut n := b.node_new(
|
||||
## Node Properties
|
||||
|
||||
Each node maintains information about:
|
||||
|
||||
- Platform type (OSX, Ubuntu, Alpine, Arch)
|
||||
- CPU architecture (Intel, ARM)
|
||||
- Environment variables
|
||||
@@ -56,6 +59,7 @@ The node automatically detects and caches system information for better performa
|
||||
The executor provides a unified interface for both local and remote operations:
|
||||
|
||||
### Command Execution
|
||||
|
||||
```v
|
||||
// Execute command and get output
|
||||
result := n.exec("ls -la")!
|
||||
@@ -68,6 +72,7 @@ n.shell("bash")!
|
||||
```
|
||||
|
||||
### File Operations
|
||||
|
||||
```v
|
||||
// Write file
|
||||
n.file_write("/path/to/file", "content")!
|
||||
@@ -90,6 +95,7 @@ n.upload("/local/file", "/remote/path")!
|
||||
```
|
||||
|
||||
### Environment Management
|
||||
|
||||
```v
|
||||
// Get all environment variables
|
||||
env := n.environ_get()!
|
||||
@@ -113,6 +119,7 @@ value := n.done["key"]
|
||||
```
|
||||
|
||||
This is useful for:
|
||||
|
||||
- Caching system information
|
||||
- Storing configuration state
|
||||
- Tracking execution history
|
||||
@@ -123,6 +130,7 @@ This is useful for:
|
||||
1. **Error Handling**: Always use the `!` operator for methods that can fail and handle errors appropriately.
|
||||
|
||||
2. **Resource Management**: Close connections and clean up resources when done:
|
||||
|
||||
```v
|
||||
defer {
|
||||
n.close()
|
||||
@@ -130,12 +138,14 @@ defer {
|
||||
```
|
||||
|
||||
3. **Debug Mode**: Enable debug mode when troubleshooting:
|
||||
|
||||
```v
|
||||
n.debug_on() // Enable debug output
|
||||
n.debug_off() // Disable debug output
|
||||
```
|
||||
|
||||
4. **Platform Awareness**: Check platform compatibility before executing commands:
|
||||
|
||||
```v
|
||||
if n.platform == .ubuntu {
|
||||
// Ubuntu-specific commands
|
||||
@@ -147,6 +157,7 @@ if n.platform == .ubuntu {
|
||||
## Examples
|
||||
|
||||
See complete examples in:
|
||||
|
||||
- Simple usage: `examples/builder/simple.vsh`
|
||||
- Remote execution: `examples/builder/remote_executor/`
|
||||
- Platform-specific examples:
|
||||
@@ -156,6 +167,7 @@ See complete examples in:
|
||||
## Implementation Details
|
||||
|
||||
The Builder module uses:
|
||||
|
||||
- Redis for caching node information
|
||||
- SSH for secure remote execution
|
||||
- MD5 hashing for unique node identification
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module builder
|
||||
|
||||
import os
|
||||
import freeflowuniverse.herolib.core.texttools
|
||||
import freeflowuniverse.herolib.osal.core as osal
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import incubaid.herolib.core.texttools
|
||||
import incubaid.herolib.osal.core as osal
|
||||
import incubaid.herolib.ui.console
|
||||
|
||||
@[params]
|
||||
pub struct ThisRemoteArgs {
|
||||
|
||||
Reference in New Issue
Block a user