Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 2.74 KB

README.md

File metadata and controls

65 lines (44 loc) · 2.74 KB

Example Composer Stager Console Command

This repository provides a reference implementation of Composer Stager as a console command for use via a terminal or a cron job. It is provides for illustration purposes only; it is unsupported.

Warning!

This repository is for testing and illustration only. It is unsupported. There are no plans to release it as an official, supported package unless the community indicates adequate demand.

Console command

The console command is used by installing it via Git and invoking its executable:

git clone https://github.com/php-tuf/composer-stager-console.git
composer install --working-dir=composer-stager-console
php composer-stager-console/bin/composer-stage

Optionally, an alias is handy:

alias cs=$(pwd)/composer-stager-console/bin/composer-stage

Available commands

  • begin - Begins the staging process by copying the active directory to the staging directory.
  • stage - Executes a Composer command in the staging directory.
  • commit - Makes the staged changes live by syncing the active directory with the staging directory.
  • clean - Removes the staging directory.

Example workflow:

# Copy the codebase to the staging directory.
bin/composer-stage begin

# Run a Composer command on it.
bin/composer-stage stage -- require example/package --update-with-all-dependencies

# Sync the changes back to the active directory.
bin/composer-stage commit --no-interaction

# Remove the staging directory.
bin/composer-stage clean --no-interaction

As an example of implementation

This repository provides the simplest implementation possible in its context. The fact that it is a Symfony Console application is incidental but does require certain scaffolding that is beside the point. The important files for the purpose of illustration are these: