Commit d2092e06 authored by Jon Pugh's avatar Jon Pugh

Adding PlatformContext, ServerContext, SiteContext classes and implementing...

Adding PlatformContext, ServerContext, SiteContext classes and implementing their options_documentation in the `save` command.
parent 538068fe
......@@ -3,6 +3,8 @@
namespace Aegir\Provision\Command;
use Aegir\Provision\Command;
use Aegir\Provision\Context\PlatformContext;
use Aegir\Provision\Context\ServerContext;
use Aegir\Provision\Context\SiteContext;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputDefinition;
......@@ -41,12 +43,18 @@ class SaveCommand extends Command
$inputDefinition[] = new InputOption('context_type', NULL, InputOption::VALUE_OPTIONAL, 'server, platform, or site; default server', 'server');
$inputDefinition[] = new InputOption('delete', NULL, InputOption::VALUE_OPTIONAL, 'Remove the alias.');
// @TODO: Load up all ProvisionContextTypes and inject their options.
// Load all SiteContext options
foreach (SiteContext::option_documentation() as $option => $description) {
$inputDefinition[] = new InputOption($option, NULL, InputOption::VALUE_OPTIONAL, $description);
// Load all Aegir\Provision\Context and inject their options.
// @TODO: Figure out a way to do discovery to include all classes that inherit Aegir\Provision\Context
$contexts[] = SiteContext::option_documentation();
$contexts[] = PlatformContext::option_documentation();
$contexts[] = ServerContext::option_documentation();
foreach ($contexts as $context_options) {
foreach ($context_options as $option => $description) {
$inputDefinition[] = new InputOption($option, NULL, InputOption::VALUE_OPTIONAL, $description);
}
}
return new InputDefinition($inputDefinition);
}
......
<?php
namespace Aegir\Provision\Context;
use Aegir\Provision\Context;
/**
* Class PlatformContext
*
* @package Aegir\Provision\Context
*
* @see \Provision_Context_platform
*/
class PlatformContext extends Context {
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 ' . getenv('HOME'),
'master_url' => 'server: Hostmaster URL',
);
return $options;
}
}
<?php
namespace Aegir\Provision\Context;
use Aegir\Provision\Context;
/**
* Class ServerContext
*
* @package Aegir\Provision\Context
*
* @see \Provision_Context_server
*/
class ServerContext extends Context {
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 ' . getenv('HOME'),
'master_url' => 'server: Hostmaster URL',
);
return $options;
}
}
......@@ -8,6 +8,8 @@ use Aegir\Provision\Context;
* Class SiteContext
*
* @package Aegir\Provision\Context
*
* @see \Provision_Context_site
*/
class SiteContext extends Context {
static function option_documentation() {
......
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