elvanto/tapegun

Installs: 2 796

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 6

Forks: 0

Open Issues: 0

Type:project

v3.0.0 2024-05-07 02:30 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

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