schmunk
(Schmunk)
October 18, 2011, 3:47pm
1
Hi,
I would like to run a custom command from the default framework installation via yiic.
Since the current yiic does not make use YII_CONSOLE_COMMANDS if you do not include a $config I can’t create my custom application skeleton (with the config).
This would be my requested feature, yiic should simply take a look in the YII_CONSOLE_COMMANDS path:
Index: framework/yiic.php
===================================================================
--- framework/yiic.php (Revision 3332)
+++ framework/yiic.php (Arbeitskopie)
@@ -19,15 +19,15 @@
require_once(dirname(__FILE__).'/yii.php');
-if(isset($config))
-{
+if(isset($config)) {
$app=Yii::createConsoleApplication($config);
$app->commandRunner->addCommands(YII_PATH.'/cli/commands');
- $env=@getenv('YII_CONSOLE_COMMANDS');
- if(!empty($env))
- $app->commandRunner->addCommands($env);
}
else
$app=Yii::createConsoleApplication(array('basePath'=>dirname(__FILE__).'/cli'));
+$env=@getenv('YII_CONSOLE_COMMANDS');
+if(!empty($env))
+ $app->commandRunner->addCommands($env);
+
$app->run();
\ No newline at end of file
It would be also an alternative if I could specify the commandPath for yiic, like
$ /path/to/yii/framework/yiic --commandPath=/path/to/my/commands p3webapp p3
Any objections?
Best regards,
schmunk
schmunk
(Schmunk)
April 4, 2012, 3:53pm
2
Bump!
Hi guys,
the use-case would be:
I want to create a custom webapp with yiic, but I don’t want to use the existing directory structure, so I have to create my own command.
Is there any way to specify a command, which is not included in the Yii Framework download?
Can I set $config manually when running yiic or yiic.bat.
Please help.
Thanks & best regards,
schmunk
Any progress with this?
I’m too want to add a custom command to create a different skeleton webapp.
schmunk
(Schmunk)
July 13, 2012, 2:16pm
4
jacmoe
(Jacob Moena)
July 14, 2012, 4:03pm
5
While I usually just copy and modify the webapp command plus create a new template dir in cli/views, it would be better if we could add our own yiic command paths so that we don’t taint the Yii installation.
+1 for this feature request.
schmunk
(Schmunk)
July 14, 2012, 4:06pm
6
I talked with Alex about this already.
Could you propose a simple, non-confusing way, an example, how we can do this?
jacmoe
(Jacob Moena)
July 15, 2012, 1:53pm
7
I don’t think it should be modified to grok YII_CONSOLE_COMMANDS by default…
How about letting it accept an additional command line argument instead?
That way, if no extra argument is provided, it would default to current behavior.
schmunk
(Schmunk)
July 16, 2012, 7:18am
8
Why?
Was also my first idea, but seemed to be too user confusing.
jacmoe
(Jacob Moena)
July 16, 2012, 4:49pm
9
Then how about allowing us to specify the command with absolute path?
yiic /home/jacmoe/yiicmds/webapp args
In addition to YII_CONSOLE_COMMANDS, I mean.
schmunk
(Schmunk)
July 16, 2012, 5:16pm
10
Feel free to write a pull request. But I won’t decide about the final outcome