function hosting_find_deploy_commands in Hosting 7.4
Load deploy command from site source code.
Possible sources: 1. Platform defaults: hosting_platform_load() (To be migrated to the devshop/platform class) 2. Platform composer.json: extra.devshop.commands.$COMMAND_NAME 3. Platform X.yml (@TODO). 4. Site {hosting_site_commands}: SQL table in control site stores site-specific command overrides. (@TODO)
Each source provides a command for each "phase". If subsequent sources provide a command for a phase, it will override the earlier one.
Examples:
Composer Platform: Development Site.
1. Platform composer.json defines default composer install command. in `extra.devshop.commands.build`: composer install --no-dev --no-suggest --no-progress 2. Site gets created with "install" option that overrides platform "install", which gets saved to {hosting_site_commands} entry: composer install --dev.
@TODO: Move to drupal/provision once hosting requires drupal/provision.
2 calls to hosting_find_deploy_commands()
- hosting_platform_load in platform/
hosting_platform.module - Implements hook_load().
- hosting_site_load in site/
hosting_site.nodeapi.inc - Implements hook_load().
File
- site/
hosting_site.nodeapi.inc, line 506 - Site nodeapi implementations.
Code
function hosting_find_deploy_commands($node) {
$composer_json_path = $node->git_root . DIRECTORY_SEPARATOR . 'composer.json';
if (file_exists($composer_json_path)) {
$composer_data = json_decode(file_get_contents($composer_json_path), TRUE);
$commands = isset($composer_data['extra']['devshop']['commands']) ? $composer_data['extra']['devshop']['commands'] : array();
}
else {
$commands = array();
}
return $commands;
// @TODO: Look for site command overrides. Remember platform nodes run this too
}