Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to customize & overwrite deployer stock commands #3802

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

cornelisonc
Copy link

@cornelisonc cornelisonc commented Apr 5, 2024

  • Bug fix #…?
  • New feature?
  • BC breaks?
  • Tests added?
  • Docs added?

I've reworked the init() function of Deployer.php to include a maybeAddCustomCommands() function, which checks for a DeployerCommands dir in the project root and, if any exist, integrate them with Deployer accordingly. Custom commands can either override stock Deployer commands or create new commands. These changes are 100% backwards-compatible, in that if no DeployerCommands dir is present, there are no changes to the current functionality.

One of the primary advantages of this restructure is the ability to customize the deployer.php templates being used, to include additional information or additional formats.

Here is a gist demonstrating an example implementation of a customized InitCommand.php file, which would be placed inside DeployerCommands/ at the project root. In this example file, I've customized

  1. configure() -- customized the init command description
  2. setDomain() -- new functionality to set project domain on initialization
  3. guessHost() -- an example of a customized host-guessing procedure where our site includes a host.php file serving the hostname; this hostname can later be used in the deployer.php script

An alternative implementation of guessHost() could also integrate with a registrar's API, implement nslookup, just for a few examples.

For developers or engineering teams, the ability to override Deployer's stock commands and templates would make a huge improvement in standardizing implementation across projects, and allow them to script out many of the initial configuration steps for deployer.php which aren't quite covered by custom recipes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant