Skip to content

Commit

Permalink
chore(release): v0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
twelvelabs committed Jan 8, 2024
1 parent 37c8973 commit e7f18d8
Show file tree
Hide file tree
Showing 23 changed files with 1,633 additions and 100 deletions.
48 changes: 48 additions & 0 deletions docs/action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Action

The action to perform on the destination.

## Properties

| Property | Type | Required | Enum | Default | Description |
| -------- | ---- | -------- | ---- | ------- | ----------- |
| [`merge`](#merge) | string ||| `"concat"` | <p>Determines merge behavior for arrays - either when modifying them directly or when recursively merging objects containing arrays. |
| [`type`](#type) | string ||| `"replace"` | <p>Determines what type of modification to perform. |

### `merge`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string ||| `"concat"` |

Determines merge behavior for arrays - either when modifying them directly
or when recursively merging objects containing arrays.

Allowed Values:

- `"concat"`: Concatenate source and destination arrays.
- `"upsert"`: Add source array items if not present in the destination.
- `"replace"`: Replace the destination with the source.

### `type`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string ||| `"replace"` |

Determines what type of modification to perform.

The append/prepend behavior differs slightly depending on
the destination content type. Strings are concatenated,
numbers are added, and objects are recursively merged.
Arrays are concatenated by default, but that behavior can
be customized via the 'merge' enum.

Replace and delete behave consistently across all types.

Allowed Values:

- `"append"`: Append to the destination content.
- `"prepend"`: Prepend to the destination content.
- `"replace"`: Replace the destination.
- `"delete"`: Delete the destination content.
15 changes: 15 additions & 0 deletions docs/conflict_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ConflictConfig

Determines what to do when creating a new file and
the destination path already exists.

> [!IMPORTANT]
> Only used in [create] tasks.
[create]: https://github.com/twelvelabs/stamp/tree/main/docs/create_task.md

Allowed Values:

- `"keep"`: Keep the existing path. The task becomes a noop.
- `"replace"`: Replace the existing path.
- `"prompt"`: Prompt the user.
155 changes: 155 additions & 0 deletions docs/create_task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# CreateTask

Creates a new path in the destination directory.

When using source templates, the [src.path](source_path.md#path)
attribute may be a file or a directory path. When the latter,
the source directory will be copied to the destination path recursively.

Examples:

```yaml
tasks:
- type: create
# Render <./_src/README.tpl> (using the values defined in the generator)
# and write it to <./README.md> in the destination directory.
# If the README file already exists in the destination dir,
# keep the existing file and do not bother prompting the user.
src:
path: "README.tpl"
dst:
path: "README.md"
conflict: keep
```
```yaml
values:
- key: "FirstName"
default: "Some Name"

tasks:
- type: create
# Render the inline content as a template and write it to
# <./some_name/greeting.txt> in the destination directory.
src:
content: "Hello, {{ .FirstName }}!"
dst:
path: "{{ .FirstName | underscore }}/greeting.txt"
```
```yaml
tasks:
- type: create
# Render all the files in <./_src/scripts/> (using the values defined in the generator),
# copy them to <./scripts/> in the destination directory, then make them executable.
src:
path: "scripts/"
dst:
path: "scripts/"
mode: "0755"
```
## Properties
| Property | Type | Required | Enum | Default | Description |
| -------- | ---- | -------- | ---- | ------- | ----------- |
| [`dst`](#dst) | [Destination](destination.md#destination) | ✅ | ➖ | ➖ | <p>The destination path. |
| [`each`](#each) | string | ➖ | ➖ | ➖ | <p>Set to a comma separated value and the task will be executued once per-item. |
| [`if`](#if) | string | ➖ | ➖ | `"true"` | <p>Determines whether the task should be executed. |
| [`src`](#src) | [Source](source.md#source) | ✅ | ➖ | ➖ | <p>The source path or inline content. |
| [`type`](#type) | string | ✅ | ✅ | `"create"` | <p>Creates a new path in the destination directory. |

### `dst`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| [Destination](destination.md#destination) | ✅ | ➖ | ➖ |

The destination path.

Examples:

```yaml
dst:
path: README.md
```

```yaml
dst:
mode: "0755"
path: bin/build.sh
```

### `each`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string | ➖ | ➖ | ➖ |

Set to a comma separated value and the task will be executued once per-item. On each iteration, the `_Item` and `_Index` values will be set accordingly.

Examples:

```yaml
each: foo, bar, baz
```

```yaml
each: '{{ .SomeList | join "," }}'
```

### `if`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string | ➖ | ➖ | `"true"` |

Determines whether the task should be executed. The value must be [coercible](https://pkg.go.dev/strconv#ParseBool) to a boolean.

Examples:

```yaml
if: "true"
```

```yaml
if: '{{ .SomeBool }}'
```

### `src`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| [Source](source.md#source) | ✅ | ➖ | ➖ |

The source path or inline content.

Examples:

```yaml
src:
path: README.tpl
```

```yaml
src:
content: Hello, {{ .FirstName }}!
```

### `type`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string | ✅ | ✅ | `"create"` |

Creates a new path in the destination directory.

Allowed Values:

- `"create"`

Examples:

```yaml
type: create
```
13 changes: 13 additions & 0 deletions docs/data_type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DataType

Specifies the data type of a [value].

[value]: https://github.com/twelvelabs/stamp/tree/main/docs/value.md

Allowed Values:

- `"bool"`: Boolean.
- `"int"`: Integer.
- `"intSlice"`: Integer array/slice.
- `"string"`: String.
- `"stringSlice"`: String array/slice.
68 changes: 68 additions & 0 deletions docs/delete_task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# DeleteTask

Deletes a path in the destination directory.

## Properties

| Property | Type | Required | Enum | Default | Description |
| -------- | ---- | -------- | ---- | ------- | ----------- |
| [`dst`](#dst) | [Destination](destination.md#destination) |||| <p>The destination path. |
| [`each`](#each) | string |||| <p>Set to a comma separated value and the task will be executued once per-item. |
| [`if`](#if) | string ||| `"true"` | <p>Determines whether the task should be executed. |
| [`type`](#type) | string ||| `"delete"` | <p>Deletes a path in the destination directory. |

### `dst`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| [Destination](destination.md#destination) ||||

The destination path.

### `each`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string ||||

Set to a comma separated value and the task will be executued once per-item. On each iteration, the `_Item` and `_Index` values will be set accordingly.

Examples:

```yaml
each: foo, bar, baz
```
```yaml
each: '{{ .SomeList | join "," }}'
```
### `if`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string | ➖ | ➖ | `"true"` |

Determines whether the task should be executed. The value must be [coercible](https://pkg.go.dev/strconv#ParseBool) to a boolean.

Examples:

```yaml
if: "true"
```

```yaml
if: '{{ .SomeBool }}'
```

### `type`

| Type | Required | Enum | Default |
| ---- | -------- | ---- | ------- |
| string | ✅ | ✅ | `"delete"` |

Deletes a path in the destination directory.

Allowed Values:

- `"delete"`
Loading

0 comments on commit e7f18d8

Please sign in to comment.