Skip to content

Commit 47ff22a

Browse files
committed
Import command flavor for genphp
1 parent d28b4f6 commit 47ff22a

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

flavors/command/Generator.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
namespace command;
3+
use GenPHP\Flavor\BaseGenerator;
4+
use GenPHP\Flavor\FlavorDirectory;
5+
use GenPHP\Path;
6+
use Exception;
7+
8+
class Generator extends BaseGenerator
9+
{
10+
11+
public function brief()
12+
{
13+
return "phpbrew command generator";
14+
}
15+
16+
/**
17+
* generate new flavor
18+
*
19+
* @param string $name flavor name, lower case, alphabets
20+
* @param string $path your code base path
21+
*/
22+
public function generate($commandName)
23+
{
24+
$commandClass = ucfirst($commandName) . 'Command';
25+
$commandFile = 'src' . DIRECTORY_SEPARATOR . 'PhpBrew' . DIRECTORY_SEPARATOR . 'Command' . DIRECTORY_SEPARATOR . $commandClass . '.php';
26+
$this->render( 'Command.php.twig', $commandFile, array(
27+
'commandClass' => $commandClass,
28+
'brief' => 'new command',
29+
));
30+
}
31+
}

flavors/command/Resource/.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
*.lo
2+
*.la
3+
missing
4+
mkinstalldirs
5+
Makefile
6+
Makefile.*
7+
configure
8+
configure.in
9+
config.status
10+
config.sub
11+
config.nice
12+
config.log
13+
config.guess
14+
config.h.*
15+
config.h
16+
acinclude.m4
17+
aclocal.m4
18+
autom4te.cache
19+
build
20+
install-sh
21+
run-tests.php
22+
.deps
23+
libtool
24+
ltmain.sh
25+
.gdbinit
26+
/vendor/
27+
.libs/
28+
modules/
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
namespace PhpBrew\Command;
3+
use CLIFramework\Command;
4+
5+
class {{commandClass}} extends Command
6+
{
7+
public function brief()
8+
{
9+
return '{{brief}}';
10+
}
11+
12+
public function execute()
13+
{
14+
echo 'Not implemented yet';
15+
}
16+
}

0 commit comments

Comments
 (0)