| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the symfony package.
|
|
|
5 |
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
/**
|
|
|
12 |
* Configures the main author of the project.
|
|
|
13 |
*
|
|
|
14 |
* @package symfony
|
|
|
15 |
* @subpackage task
|
|
|
16 |
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
17 |
* @version SVN: $Id: sfConfigureAuthorTask.class.php 6978 2008-01-06 18:53:47Z fabien $
|
|
|
18 |
*/
|
|
|
19 |
class sfConfigureAuthorTask extends sfBaseTask
|
|
|
20 |
{
|
|
|
21 |
/**
|
|
|
22 |
* @see sfTask
|
|
|
23 |
*/
|
|
|
24 |
protected function configure()
|
|
|
25 |
{
|
|
|
26 |
$this->addArguments(array(
|
|
|
27 |
new sfCommandArgument('author', sfCommandArgument::REQUIRED, 'The project author'),
|
|
|
28 |
));
|
|
|
29 |
|
|
|
30 |
$this->namespace = 'configure';
|
|
|
31 |
$this->name = 'author';
|
|
|
32 |
|
|
|
33 |
$this->briefDescription = 'Configure project author';
|
|
|
34 |
|
|
|
35 |
$this->detailedDescription = <<<EOF
|
|
|
36 |
The [configure:author|INFO] task configures the author for a project:
|
|
|
37 |
|
|
|
38 |
[./symfony configure:author "Fabien Potencier <fabien.potencier@symfony-project.com>"|INFO]
|
|
|
39 |
|
|
|
40 |
The author is used by the generates to pre-configure the PHPDoc header for each generated file.
|
|
|
41 |
|
|
|
42 |
The value is stored in [config/properties.ini].
|
|
|
43 |
EOF;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* @see sfTask
|
|
|
48 |
*/
|
|
|
49 |
protected function execute($arguments = array(), $options = array())
|
|
|
50 |
{
|
|
|
51 |
$file = sfConfig::get('sf_config_dir').'/properties.ini';
|
|
|
52 |
$content = parse_ini_file($file, true);
|
|
|
53 |
|
|
|
54 |
if (!isset($content['symfony']))
|
|
|
55 |
{
|
|
|
56 |
$content['symfony'] = array();
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
$content['symfony']['author'] = $arguments['author'];
|
|
|
60 |
|
|
|
61 |
$ini = '';
|
|
|
62 |
foreach ($content as $section => $values)
|
|
|
63 |
{
|
|
|
64 |
$ini .= sprintf("[%s]\n", $section);
|
|
|
65 |
foreach ($values as $key => $value)
|
|
|
66 |
{
|
|
|
67 |
$ini .= sprintf(" %s=%s\n", $key, $value);
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
file_put_contents($file, $ini);
|
|
|
72 |
}
|
|
|
73 |
}
|