Skip to main content

Coder's simplest workflow automation tool.

Project description

# Pla

Pla helps you automate workflows in a very simple way. Much like make, but with a yaml file structure.

It's a coder's simplest workflow automation tool.

## Install

Pla requires Python 2.x.
Use the pip installer to install Pla.

``` bash
$ (sudo) pip install pla
```

If pip is not present on your system:
```
$ sudo easy_install pip
```

_**Note:** OS X Users reported that [Homebrew](http://brew.sh/)'s version of Python works better than the stock one._

### Upgrade an existing installation

When installed with Pip you can upgrade to the latest version using:
```shell
$ (sudo) pip install pla --upgrade
```

### Install from git
To install Pla from git you first need to make sure Pla is uninstalled. Then you must clone the repository and install
the development version:

```shell
$ pip uninstall pla
$ git clone git@github.com:rtuin/pla.git
$ cd pla
$ pip install -e .
```

## Usage

```shell
$ pla [target]
```

If you do not provide a target, the default target called `all` will run.

## Start working with Pla

Pla works similar to [Make](https://www.gnu.org/software/make/). You define the targets in a Yaml file called `Plafile.yml`
and run the targets from the command line.

Lets say we use Pla to kickstart our working day. We will make a Plafile which starts our local dev server, starts our IDE
and opens the application we're working on in the browser.

First create the Plafile with a target called `dev`:

```yaml
# Plafile.yml
dev:
- docker-compose up -d
- pstorm .
- open http://local.project.url/
```

Then simply run Pla from the command line:
```bash
$ pla dev
```

Pla will then run the shell commands you specified in the Plafile.

## Features

### Linking targets

As of Pla v0.2 it is possible to let your targets call each other. This is simply done by refering to the target
prepended with an `=` sign. Like so:

```yaml
# Plafile.yml
up:
- docker-compose up -d
- =updatecode
- pstorm .
- open http://local.project.url/

updatecode:
- git submodule update --init --recursive
- composer install
```

### Target parameters

Pla v0.3 gives you the ability to variables in target commands. This feature is called target parameters.

Simply define the parameters in the target definition, and put them in your command. Enclosing the parameters name with
`%` signs. For example:

```yaml
# Plafile.yml
pr[number]:
- git pr %number%
- git pull upstream master
```

You can then call the target like this:

```bash
$ pla pr 123
```

**Disclaimer** The current implementation of target parameters is built to work only when you directly call the
parametrized target.

### Command OS filter

When you run the same Pla target on multiple operating systems you might want to specify which command to execute on what OS.
You can do this by prefixing your command with a filter that indicates the OS's family name.

```yaml
# Plafile
os:
- (darwin) echo "Mac OS"
- (redhat) echo "RedHat family"
- (ubuntu|darwin) echo "Ubuntu or Mac OS"
- (debian) echo "Debian"
```

If you run `pla os` on a Mac, you'll get the following output:
```
Running target "os":
✔ (darwin) echo "Mac OS"
. (redhat) echo "RedHat family"
✔ (ubuntu|darwin) echo "Ubuntu or Mac OS"
. (debian) echo "Debian"
```

**Operating systems matches**

| System/Family | Match |
|---------------|---------|
| Linux | linux |
| Ubuntu | ubuntu |
| Red Hat | redhat |
| Mac OS | darwin |
| Windows | windows |

### Target descriptions

Sometimes you want insight in which part of the Plafile is running. You can do this by giving targets descriptions.
A description can be added in the form of a comment on the same line as the target definition, like so:

```yaml
targetname: # Echo sleep and echo
- echo "ohai"
- sleep 1
- echo "bar"
```

This will generate the following output:

```
$ pla targetname
Pla master by Richard Tuin - Coder's simplest workflow automation tool.

Running target "targetname":
Echo sleep and echo
✔ echo "ohai"
✔ sleep 1
✔ echo "bar"
```

## Changelog

All notable changes are documented in the [changelog file](CHANGELOG.md).

## Credits

- [Richard Tuin](https://github.com/rtuin)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see the [license file](LICENSE) for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pla-0.5.0.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

pla-0.5.0-py2-none-any.whl (5.4 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page