Skip to content

Commit

Permalink
[TASK] Final updates.. maby..
Browse files Browse the repository at this point in the history
  • Loading branch information
langeland committed Sep 4, 2015
1 parent a560531 commit 9c1ac81
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
29 changes: 29 additions & 0 deletions Classes/Command/AboutCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
namespace Rosemary\Command;

class AboutCommand extends \Symfony\Component\Console\Command\Command {

/**
* {@inheritdoc}
*/
protected function configure() {
$this
->setName('about')
->setDescription('Displays help for a command');
}

/**
* {@inheritdoc}
*/
protected function execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) {

$output->writeln(wordwrap(
file_get_contents(ROOT_DIR . '/Resources/About.text'),
80
));

// $helper = new \Symfony\Component\Console\Helper\DescriptorHelper();
// $helper->describe($output, $this->getApplication());

}
}
9 changes: 6 additions & 3 deletions Classes/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ public function __construct($name = null) {

if (!defined('LOG_FILE')) {
if ($this->configuration['locations']['log_dir']) {
// TODO: Add command name to logfile name. Issue #17605
$command = $_SERVER["argv"][1];
define('LOG_FILE', $this->configuration['locations']['log_dir'] . '/' . 'rosemary-' . $command . '-' . date('d-m-Y-H-i-s') . '.log');
if (array_key_exists(1, $_SERVER["argv"])) {
$command = $_SERVER["argv"][1];
define('LOG_FILE', $this->configuration['locations']['log_dir'] . '/' . 'rosemary-' . $command . '-' . date('d-m-Y-H-i-s') . '.log');
} else {
define('LOG_FILE', $this->configuration['locations']['log_dir'] . '/' . 'rosemary-' . date('d-m-Y-H-i-s') . '.log');
}
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions Resources/About.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<info> ______
(_____ \
_____) )___ ___ _____ ____ _____ ____ _ _
| __ // _ \ /___) ___ | \(____ |/ ___) | | |
| | \ \ |_| |___ | ____| | | / ___ | | | |_| |
|_| |_\___/(___/|_____)_|_|_\_____|_| \__ |
(____/</info>

"According to legend, it was draped around the Greek goddess Aphrodite when she rose from the sea, born of Uranus's semen. The Virgin Mary is said to have spread her blue cloak over a white-blossomed rosemary bush when she was resting, and the flowers turned blue. The shrub then became known as the "Rose of Mary"."

This script should NOT be run as root, but as vagrant

<comment>Available commands:</comment>
<info>delete</info> Delete an existing project
<info>help</info> Displays help for a command
<info>install</info> Install an existing or create blank project
<info>seed</info> Seed handling
<info>sync</info> Synchronize data from moc-files to local project

Empty file added Resources/HelpAboutCommand.text
Empty file.
8 changes: 5 additions & 3 deletions application.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
exec('git --git-dir=' . __DIR__ . '/.git rev-parse --verify HEAD 2> /dev/null', $output);
$version = substr($output[0], 0, 10);
} else {
$version = '0.4-dev';
$version = '2.0';
}

$application = new \Symfony\Component\Console\Application('Rosemary', $version);
$application->add(new Rosemary\Command\AboutCommand());
$application->add(new Rosemary\Command\InstallCommand());
$application->add(new Rosemary\Command\SynchronizeCommand());
$application->add(new Rosemary\Command\SeedCommand());
//$application->add(new Rosemary\Command\ListSeedsCommand());
//$application->add(new Rosemary\Command\UpdateSeedsCommand());
$application->add(new Rosemary\Command\DeleteCommand());

$application->setDefaultCommand('about');

$application->run();

0 comments on commit 9c1ac81

Please sign in to comment.