Skip to content

A simple build system written in PHP 📦

License

Notifications You must be signed in to change notification settings

elvanto/tapegun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tapegun

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

About

A simple build system written in PHP 📦

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages