elvanto/tapegun

Installs: 2 443

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 6

Forks: 0

Open Issues: 1

Type:project

v2.0.0 2022-08-17 06:12 UTC

This package is auto-updated.

Last update: 2024-03-24 07:41:22 UTC


README

A simple build system written in PHP.

Features:

  • Support for tasks written as shell commands or PHP classes
  • Multi-target builds with separate environments
  • Bundled tasks for Git, archiving and templated text files

Installation

The preferred installation method is composer;

composer require-dev elvanto/tapegun

Usage

Tapegun is configured through a JSON file that defines the environment, targets and tasks required to build a project. The basic structure is as follows.

{
  "name": "project-name",
  "env": {
      "foo": "bar",
      "staging": "/var/app/staging"
  },
  "targets": [
    {
      "name": "dev",
      "env": {
        "foo": "baz"
      }
    },
    {
      "name": "prod",
      "env": {
        "foo": "qux"
      }
    }
  ],
  "pre": [
    {
      "class": "Tapegun.Task.GitClone",
      "env": {
        "git:source": "https://github.com/company/project-name",
        "git:target": "{{staging}}"
      }
    }
  ],
  "build": [
    {
      "description": "Deploying project",
      "command": "project-deploy --foo={{foo}}"
    }
  ],
  "post": [
    {
      "description": "Cleaning staging directory",
      "command": "rm -rf /var/app/staging"
    }
  ]
}

Configuration

Key Description
name The project name.
env An object mapping environment variable names to values, which can be any data type support by JSON.
targets An array of objects defining build targets. Each task defined under build will be run once per target and inherit env from both the root and target configurations.
pre An array of tasks to be run once at the beginning of the build. See build for more details.
post An array of tasks to be run once at the end of the build. See build for more details.
build An array of tasks to be run once per build target.

The command property is used to execute a shell command. Environment variables surrounded by {{ and }} will be replaced with their corresponding values. A custom description can be provided through the description property. If async is set to true, the task will run asynchronously for all targets.

The class property is used to execute a task written in PHP. The namespace must be provided, with . used as a delimiter.

Environments

Environment variables may be specified on the task, target or root level and will be resolved in this order.

License

MIT License