summaryrefslogtreecommitdiff
path: root/src/Script/Command/Site/Create.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Script/Command/Site/Create.php')
-rw-r--r--src/Script/Command/Site/Create.php42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/Script/Command/Site/Create.php b/src/Script/Command/Site/Create.php
index 81df87e..e300ef7 100644
--- a/src/Script/Command/Site/Create.php
+++ b/src/Script/Command/Site/Create.php
@@ -58,10 +58,10 @@ class Create extends SyCommand
$domain = $input->getArgument('domain');
$output->writeln(
- 'Creating new site with domain: '
- . $input->getArgument('domain')
- . ' and name: '
+ 'Creating new site with name: '
. $input->getArgument('name')
+ . ' and domain: '
+ . $input->getArgument('domain')
);
// Set-up progress bar
@@ -79,12 +79,12 @@ class Create extends SyCommand
try {
$tasks['Creating site directory'] = new \App\Filesystem\CreateDirectory(
- SITES_ROOT . $name
+ $this->getFullSitesPath($name)
);
$tasks['Creating nginx config file'] = new \App\Filesystem\CreateFile(
CONFIG_ROOT . $name . '.conf',
- include_once(DIPPER_ROOT . 'nginx/stub.php')
+ include_once(DIPPER_ROOT . '/nginx/stub.php')
);
} catch (\Exception $e) {
$output->writeln('');
@@ -104,35 +104,35 @@ class Create extends SyCommand
$this->runTask(
new \App\Filesystem\CreateDirectory(
- SITES_ROOT . $name . '/logs'
+ $this->getFullSitesPath($name) . '/logs'
),
'Creating logs directory'
);
$this->runTask(
new \App\Filesystem\CreateFile(
- SITES_ROOT . $name . '/logs/' . $name . '.access_log'
+ $this->getFullSitesPath($name) . '/logs/' . $name . '.access_log'
),
'Creating access log file'
);
$this->runTask(
new \App\Filesystem\CreateFile(
- SITES_ROOT . $name . '/logs/' . $name . '.errors_log'
+ $this->getFullSitesPath($name) . '/logs/' . $name . '.errors_log'
),
'Creating error log file'
);
$this->runTask(
new \App\Filesystem\CreateDirectory(
- SITES_ROOT . $name . '/web'
+ $this->getFullSitesPath($name) . '/web'
),
'Creating web folder'
);
$this->runTask(
new \App\Filesystem\CreateFile(
- SITES_ROOT . $name . '/web/index.php'
+ $this->getFullSitesPath($name) . '/web/index.php'
),
'Creating directory index.php'
);
@@ -159,7 +159,27 @@ class Create extends SyCommand
$output->writeln('Complete');
}
- public function runTask($task, $message)
+ /**
+ * Return the full path of a given file
+ *
+ * @author Phil Burton <phil@pgburton.com>
+ * @param string $path
+ * @return string
+ */
+ protected function getFullSitesPath($path)
+ {
+ return SITES_ROOT . "/" . $path;
+ }
+
+ /**
+ * Run a task
+ *
+ * @author Phil Burton <phil@pgburton.com>
+ * @param mixed $task
+ * @param string $message
+ * @return string
+ */
+ protected function runTask($task, $message)
{
$this->progressBar->advance();
$this->progressBar->setMessage($message);