Yii Framework Forum: Make YII_CONSOLE_COMMANDS available for framework yiic command - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Make YII_CONSOLE_COMMANDS available for framework yiic command Rate Topic: ***** 1 Votes

#1 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 568
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 18 October 2011 - 10:47 AM

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
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#2 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 568
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 04 April 2012 - 10:53 AM

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
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#3 User is offline   andredelorme 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 30-April 09

Posted 13 July 2012 - 07:30 AM

Any progress with this?
I'm too want to add a custom command to create a different skeleton webapp.
0

#4 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 568
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 13 July 2012 - 09:16 AM

Pull request here: https://github.com/y...ft/yii/pull/967
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#5 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 14 July 2012 - 11:03 AM

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.
"Less noise - more signal"
0

#6 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 568
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 14 July 2012 - 11:06 AM

I talked with Alex about this already.
Could you propose a simple, non-confusing way, an example, how we can do this?
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#7 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 15 July 2012 - 08:53 AM

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.
"Less noise - more signal"
0

#8 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 568
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 16 July 2012 - 02:18 AM

View Postjacmoe, on 15 July 2012 - 08:53 AM, said:

I don't think it should be modified to grok YII_CONSOLE_COMMANDS by default..

Why?

View Postjacmoe, on 15 July 2012 - 08:53 AM, said:

How about letting it accept an additional command line argument instead?

Was also my first idea, but seemed to be too user confusing.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#9 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 16 July 2012 - 11:49 AM

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.
"Less noise - more signal"
0

#10 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 568
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 16 July 2012 - 12:16 PM

Feel free to write a pull request. But I won't decide about the final outcome ;)
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users