Skip to content

Commit

Permalink
update getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
goFrendiAsgard committed Dec 14, 2023
1 parent 6cddfd8 commit 2ff257e
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 13 deletions.
Binary file added docs/_images/emoji/feet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/emoji/page_facing_up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/emoji/pill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/emoji/shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/emoji/snake.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/emoji/truck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 59 additions & 13 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,8 @@ Welcome to Zrb's getting started guide. We will cover everything you need to kno
- [Creating a Project](#creating-a-project)
- [Using `project.sh`](#using-projectsh)
- [Creating a Task](#creating-a-task)
- [Scaffolding a Task](#scaffolding-a-task)
- [Updating Task definition](#updating-task-definition)
- [Understanding The Code](#understanding-the-code)
- [Task Definition](#task-definition)
- [Creating a Task Using Task Classes](#creating-a-task-using-task-classes)
- [Creating a Task Using Python Decorator](#creating-a-task-using-python-decorator)
- [Task Parameters](#task-parameters)
- [Task Dependencies](#task-dependencies)
- [Task Inputs](#task-inputs)
- [Task Environments](#task-environments)
- [Switching Environment](#switching-environment)
- [Creating a Long-Running Task](#creating-a-long-running-task)
- [More Example](#more-example)

This guide assumes you have some familiarity with CLI and Python.

Expand Down Expand Up @@ -375,6 +365,15 @@ Let's see some simple task definitions and break them down.

### The Example

<div align="center">
<img src="_images/emoji/feet.png">
<p>
<sub>
One small step for a man, one giant leap for mankind.
</sub>
</p>
</div>

```python
from zrb import runner, Parallel, Task, CmdTask, python_task, Env, StrInput

Expand Down Expand Up @@ -429,10 +428,19 @@ Finally, by invoking `runner.register(hello, hello_cmd, hello_py)`; we want the
<details>

<summary>🖱️ Click here to see the complete explanation</summary>
<summary>👉 <b>Click here to break down the code</b> 👈</summary>

### Import Statement

<div align="center">
<img src="_images/emoji/truck.png">
<p>
<sub>
<a href="https://xkcd.com/353/" target="blank">import antigravity.</a>
</sub>
</p>
</div>

```python
from zrb import runner, Parallel, Task, CmdTask, python_task, Env, StrInput
```
Expand All @@ -449,6 +457,15 @@ At the very beginning, we import some resources from `zrb` package:

### `hello-cmd` Definition

<div align="center">
<img src="_images/emoji/shell.png">
<p>
<sub>
Shell Script: Every problem is a line of code away from being solved.
</sub>
</p>
</div>

```python
hello_cmd = CmdTask(
name='hello-cmd',
Expand All @@ -470,6 +487,15 @@ Meanwhile, to access the value of `user-name` parameter, we can use `{{ input.us

### `hello-py` Definition

<div align="center">
<img src="_images/emoji/snake.png">
<p>
<sub>
Python: The programming language, not the snake.
</sub>
</p>
</div>

```python
@python_task(
name='hello-py',
Expand Down Expand Up @@ -510,6 +536,16 @@ mode = env_map.get('MODE')

### `hello` Definition And Its Dependencies


<div align="center">
<img src="_images/emoji/pill.png">
<p>
<sub>
Adding a new dependency is like inviting a stranger to live in your codebase.
</sub>
</p>
</div>

```python
hello = Task(name='hello')
Parallel(hello_cmd, hello_py) >> hello
Expand All @@ -527,6 +563,16 @@ hello-cmd ──┘

### Register Tasks to The `runner`

<div align="center">
<img src="_images/emoji/page_facing_up.png">
<p>
<sub>
Fotokopi KTP dan biaya registrasi lima ribu rupiah.
</sub>
</p>
</div>


```python
runner.register(hello, hello_cmd, hello_py)
```
Expand Down Expand Up @@ -567,7 +613,7 @@ zrb hello
Now you will see `Current mode: PROD` instead of `Current mode: DEV`.


## Use Case
# More Example

Let's start with a use case:

Expand Down

0 comments on commit 2ff257e

Please sign in to comment.