Commit 1e94e907 authored by drumm's avatar drumm Committed by Neil Drumm

Server option documentation

parent 575b6427
......@@ -30,6 +30,12 @@ function db_drush_help($section) {
class provisionService_db extends provisionService {
static function option_documentation() {
return array(
'--master_db' => 'server with db: Master database connection info, {type}://{user}:{password}@{host}',
);
}
function init() {
$this->setProperty('master_db');
$this->creds = array_map('urldecode', parse_url($this->master_db));
......
<?php
class provisionService_http_apache extends provisionService_http {
static function option_documentation() {
return array_merge(parent::option_documentation(), array(
'--restart_cmd' => 'server with apache: shell command to restart the server; working default will be attepted',
'--web_ports' => 'server with apache: array of ports to make available; default 80',
));
}
function init() {
parent::init();
$this->apache_site_conf_path = $this->config_path . '/vhost.d';
......
......@@ -9,6 +9,14 @@ function http_provision_services() {
class provisionService_http extends provisionService {
static function option_documentation() {
return array(
'--web_group' => 'server with http: OS group for permissions; working default will be attepted',
'--web_disable_url' => 'server with http: URL disabled sites are redirected to; default {master_url}/hosting/disabled',
'--web_maintenence_url' => 'server with http: URL maintenance sites are redirected to; default {master_url}/hosting/maintenance',
);
}
function init() {
parent::init();
// System account
......@@ -17,9 +25,6 @@ class provisionService_http extends provisionService {
// Redirection urls
$this->setProperty('web_disable_url', $this->master_url .'/hosting/disabled');
$this->setProperty('web_maintenence_url', $this->master_url .'/hosting/maintenance');
$this->setProperty('web_ip', '127.0.0.1');
$this->setProperty('web_port', 80);
}
/**
......
......@@ -45,7 +45,6 @@ function drush_provision_drupal_provision_clone($new_url, $platform = null) {
'redirection' => drush_get_option('redirection'),
'web_host' => drush_get_option('web_host'),
'profile' => drush_get_option('profile'),
'web_ip' => drush_get_option('web_ip'),
'db_host' => drush_get_option('db_host')
));
}
......@@ -61,7 +61,7 @@ function drush_provision_drupal_pre_provision_migrate_rollback($platform = null)
*/
function drush_provision_drupal_provision_migrate($platform) {
drush_backend_invoke('provision-deploy', array(drush_get_option('backup_file'), 'root' => $platform,
'web_host' => drush_get_option('web_host'), 'web_ip' => drush_get_option('web_ip'),
'web_host' => drush_get_option('web_host'),
'db_host' => drush_get_option('db_host'), 'profile' => drush_get_option('profile')));
}
......
......@@ -73,8 +73,13 @@ function provision_drush_init() {
*/
function provision_drush_command() {
$items['provision-named-context-save'] = array(
'arguments' => array(),
'description' => dt('Save Drush aliases'),
'description' => dt('Save Drush alias'),
'arguments' => array(
'@context_name' => 'Context to save',
),
'options' => array_merge(array(
'--context_type' => 'server, platform, or site; default server',
), provisionServer::option_documentation(), provisionPlatform::option_documentation(), provisionSite::option_documentation()),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
$items['provision-named-context-delete'] = array(
......
......@@ -178,6 +178,33 @@ class provisionEnvironment {
class provisionServer extends provisionEnvironment {
protected $services = array();
static function option_documentation() {
$options = array(
'--remote_host' => 'server: host name; default localhost',
'--script_user' => 'server: OS user name; default current user',
'--aegir_root' => 'server: Aegir root; default /var/aegir',
'--backup_path' => 'server: Aegir backup path; default {aegir_root}/backup',
'--config_path' => 'server: Aegir configuration path; default {aegir_root}/config',
'--alias_path' => 'server: Aegir Drush alias path; default {config_path}/drush.d',
'--master_url' => 'server: Hostmaster URL',
);
foreach (drush_command_invoke_all('provision_services') as $service => $default) {
$reflect = new reflectionClass('provisionService_' . $service);
$base_dir = dirname($reflect->getFilename());
$types = array();
$options['--' . $service . '-service-type'] = 'placeholder';
foreach (array_keys(drush_scan_directory($base_dir, '%.*_service\.inc%')) as $service_file) {
if (preg_match('%^' . $base_dir . '/([a-z]+)/(?:\1)_service.inc$%', $service_file, $match)) {
$types[] = $match[1];
include_once($service_file);
$options = array_merge($options, call_user_func(array(sprintf('provisionService_%s_%s', $service, $match[1]), 'option_documentation')));
}
}
$options['--' . $service . '-service-type'] = 'server: ' . implode(', ', $types) . ', or null; default ' . (empty($default) ? 'null' : $default);
}
return $options;
}
function init() {
parent::init();
......@@ -260,6 +287,11 @@ class provisionServer extends provisionEnvironment {
* Class for the platform environment.
*/
class provisionPlatform extends provisionEnvironment {
static function option_documentation() {
return array(
//todo
);
}
function init() {
$this->parent_key = 'server';
......@@ -282,10 +314,14 @@ class provisionPlatform extends provisionEnvironment {
function verify() {
$this->server->verify();
}
}
class provisionSite extends provisionEnvironment {
static function option_documentation() {
return array(
//todo
);
}
function init() {
$this->parent_key = 'platform';
......
......@@ -104,6 +104,16 @@ class provisionService {
return $this;
}
/**
* Return service-specific configuration options for help.
*
* @return
* array('--option' => 'description')
*/
static function option_documentation() {
return array();
}
}
class provisionService_null extends provisionService {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment