@katmer/core 0.0.3 → 0.0.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,7 +18,7 @@ declare module "../interfaces/task.interface" {
|
|
|
18
18
|
* - Works on SSHProvider and LocalProvider.
|
|
19
19
|
* - Matches flags available in bsdtar(1) with sensible defaults.
|
|
20
20
|
*
|
|
21
|
-
* @
|
|
21
|
+
* @examples
|
|
22
22
|
* ```yaml
|
|
23
23
|
* - name: Create a gzip archive
|
|
24
24
|
* archive:
|
|
@@ -28,20 +28,14 @@ declare module "../interfaces/task.interface" {
|
|
|
28
28
|
* dest: /tmp/system.tar.gz
|
|
29
29
|
* gzip: true
|
|
30
30
|
* verbose: true
|
|
31
|
-
* ```
|
|
32
31
|
*
|
|
33
|
-
*
|
|
34
|
-
* ```yaml
|
|
35
|
-
* - name: Extract release
|
|
32
|
+
* - name: Extract with strip components
|
|
36
33
|
* archive:
|
|
37
34
|
* src: /tmp/release.tar.gz
|
|
38
35
|
* dest: /opt/app
|
|
39
36
|
* strip_components: 1
|
|
40
|
-
* ```
|
|
41
37
|
*
|
|
42
|
-
*
|
|
43
|
-
* ```yaml
|
|
44
|
-
* - name: List archive
|
|
38
|
+
* - name: List archive contents
|
|
45
39
|
* archive:
|
|
46
40
|
* src: /tmp/archive.tar.xz
|
|
47
41
|
* list: true
|
|
@@ -35,7 +35,7 @@ declare module "../interfaces/task.interface" {
|
|
|
35
35
|
* Copies **content** or a **file** to a destination path.
|
|
36
36
|
*
|
|
37
37
|
* - If {@link CopyModuleOptions.content | `content`} is set, it is rendered **locally** using Twig
|
|
38
|
-
* against
|
|
38
|
+
* against context and written to {@link CopyModuleOptions.dest | `dest`}.
|
|
39
39
|
* - If {@link CopyModuleOptions.src | `src`} is set:
|
|
40
40
|
* - With **SSH** provider, it is treated as a **controller (local)** path and uploaded to the remote host,
|
|
41
41
|
* unless {@link CopyModuleOptions.remote_src | `remote_src`} is `true`.
|
|
@@ -240,7 +240,7 @@ export class CopyModule extends KatmerModule<
|
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* Execute the copy:
|
|
243
|
-
* - Renders string fields (including `content`) against
|
|
243
|
+
* - Renders string fields (including `content`) against context.
|
|
244
244
|
* - Branches to SSH or Local implementation.
|
|
245
245
|
* - Returns {@link CopyModuleResult} with `changed`, `checksum`, optional `backup_file`, etc.
|
|
246
246
|
*/
|
|
@@ -541,7 +541,7 @@ export class CopyModule extends KatmerModule<
|
|
|
541
541
|
// ────────────────────────────────────────────────────────────────────────────────
|
|
542
542
|
|
|
543
543
|
/**
|
|
544
|
-
* Render only the string-like fields against
|
|
544
|
+
* Render only the string-like fields against context.
|
|
545
545
|
* - `content` is rendered only if it is a `string`; `Uint8Array` is passed through untouched.
|
|
546
546
|
*
|
|
547
547
|
* @internal
|
|
@@ -21,8 +21,8 @@ declare module "../interfaces/task.interface" {
|
|
|
21
21
|
*
|
|
22
22
|
* @remarks
|
|
23
23
|
* - Accepts either a **string shorthand** (printed as a message) or a **full options object**.
|
|
24
|
-
* - `msg` entries support template expressions rendered against
|
|
25
|
-
* - When `var` is provided, values are looked up from
|
|
24
|
+
* - `msg` entries support template expressions rendered against context.
|
|
25
|
+
* - When `var` is provided, values are looked up from the context using dot-paths (e.g. `"app.version"`).
|
|
26
26
|
* - If nothing is provided, prints a default `"ok"` line.
|
|
27
27
|
*
|
|
28
28
|
* @examples
|
|
@@ -13,7 +13,7 @@ import { KatmerModule } from "../module"
|
|
|
13
13
|
* @remarks
|
|
14
14
|
* - Accepts either a **string** (backwards compatible) or an **object** with a `content` string
|
|
15
15
|
* and a `render` flag to enable/disable template rendering.
|
|
16
|
-
* - When `render` is `true` (default), the script string is rendered with Twig against
|
|
16
|
+
* - When `render` is `true` (default), the script string is rendered with Twig against context
|
|
17
17
|
* before execution. When `false`, the string is executed **as-is**.
|
|
18
18
|
* - Uses the provider's shell via {@link Katmer.TaskContext.exec | `ctx.exec`}.
|
|
19
19
|
* - Return semantics are simple: `changed` is always `false`; `failed` is set when the exit code is non-zero.
|
|
@@ -91,7 +91,7 @@ export type ScriptModuleOptions =
|
|
|
91
91
|
/** Inline script content to execute. */
|
|
92
92
|
content: string
|
|
93
93
|
/**
|
|
94
|
-
* Whether to render the script with Twig against
|
|
94
|
+
* Whether to render the script with Twig against context before execution.
|
|
95
95
|
* @defaultValue true
|
|
96
96
|
*/
|
|
97
97
|
render?: boolean
|
|
@@ -35,7 +35,7 @@ declare module "../interfaces/task.interface" {
|
|
|
35
35
|
* - `{ vars, render, deep }` for more control
|
|
36
36
|
*
|
|
37
37
|
* When `render` is true, string values that contain templates like `{{ ... }}` are
|
|
38
|
-
* evaluated using the current
|
|
38
|
+
* evaluated using the current context scope. When `deep` is true, objects
|
|
39
39
|
* and arrays are traversed and any string leaves are evaluated similarly.
|
|
40
40
|
*
|
|
41
41
|
* @public
|
|
@@ -43,7 +43,7 @@ declare module "../interfaces/task.interface" {
|
|
|
43
43
|
export type SetFactModuleOptions =
|
|
44
44
|
| Record<string, unknown>
|
|
45
45
|
| {
|
|
46
|
-
/** Key/value pairs to set on
|
|
46
|
+
/** Key/value pairs to set on the current context. */
|
|
47
47
|
vars: Record<string, unknown>
|
|
48
48
|
/**
|
|
49
49
|
* Evaluate string templates with `evalExpr`.
|
|
@@ -72,10 +72,10 @@ export interface SetFactModuleResult extends ModuleCommonReturn {
|
|
|
72
72
|
* Compute and set variables (facts) on the task context.
|
|
73
73
|
*
|
|
74
74
|
* @remarks
|
|
75
|
-
* - Values are merged into
|
|
75
|
+
* - Values are merged into current context.
|
|
76
76
|
* - `changed` is true when a value is added or changed.
|
|
77
|
-
* - When `render=true`, string values that contain `{{ ... }}` are evaluated
|
|
78
|
-
* with
|
|
77
|
+
* - When `render=true`, string values that contain `{{ ... }}` are evaluated
|
|
78
|
+
* with current context as scope. Set `deep=true` to render nested strings as well.
|
|
79
79
|
*
|
|
80
80
|
* @examples
|
|
81
81
|
* ```yaml
|
|
@@ -68,7 +68,7 @@ export interface TemplateModuleOptions {
|
|
|
68
68
|
dest: string
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* Extra variables merged **on top of**
|
|
71
|
+
* Extra variables merged **on top of** the current context for this render only.
|
|
72
72
|
* Task/target variables remain intact; these act as per-render overrides.
|
|
73
73
|
*/
|
|
74
74
|
variables?: Record<string, any>
|
|
@@ -123,7 +123,7 @@ export interface TemplateModuleResult extends ModuleCommonReturn {
|
|
|
123
123
|
* Render a Twig template locally and deploy the result to a file (remote for SSH, local for Local).
|
|
124
124
|
*
|
|
125
125
|
* @remarks
|
|
126
|
-
* - Renders with the
|
|
126
|
+
* - Renders with the current context + per-call `variables`.
|
|
127
127
|
* - If {@link TemplateModuleOptions.diff_check | diff_check} is `true` (default), content is compared to avoid needless writes.
|
|
128
128
|
* - On **SSH**:
|
|
129
129
|
* - Ensures parent directory via shell (`mkdir -p`).
|