Kdyby / Console

Symfony Console integration for Kdyby components
https://packagist.org/packages/kdyby/console
Other
52 stars 54 forks source link

Basic Nette commands #7

Closed fprochazka closed 7 years ago

fprochazka commented 10 years ago

What else do you have in mind?

grossmannmartin commented 10 years ago

remove send-mail file: when Tracy sends me email with error, i fix it and want to remove this file

fprochazka commented 10 years ago

Is it really more convinient to run a command, if you can just delete the file in your file manager?

grossmannmartin commented 10 years ago

Assuming that i'm on a production server. Everytime I type rm, I check it ten times. Run MC find file and delete is slow... so for me yes it is more convenient and cannot make mistake

vojtech-dobes commented 10 years ago

Enter/leave maintenance mode.

fprochazka commented 10 years ago

@vojtech-dobes good idea!

@snake-aas I'm really not sure it's that beneficial.

JanTvrdik commented 10 years ago

What about command for warming up cache?

fprochazka commented 10 years ago

@JanTvrdik you mean for compiling the application? That might require quite some effort, becase you cannot do that directly from console, but have to send a http request - and for that you have to know the url... and you can already just type the website to your browser, or call curl... I don't see how we could possibly do that to make it easier that current ways.

JanTvrdik commented 10 years ago

By warming up cache I mean two main things:

  1. Build RobotLoader cache
  2. Compile all Latte templates

This is something you should always do when deploying application before you switch from old version to the new one. Therefore you can't access the application via HTTP request and console is all you have.

fprochazka commented 10 years ago

@JanTvrdik good point. But I see a little problem here. How do I compile templates, if I don't know all the macros? There can be different macro set for every single template.

JanTvrdik commented 10 years ago

I've seen the problem too and was hoping that you'll find a solution =) For most websites it would be enough to use default template from DI container.

juniwalk commented 9 years ago

@fprochazka This is what I use in cli-config.php for Doctrine commands:

// Load Nette DI container instance and get EntityManager
$di = include __DIR__.'/../app/bootstrap.php';
$em = $di->getByType('Kdyby\Doctrine\EntityManager');

Which warms up cache, atleast for Doctrine, would it help if you get Application service and run it in the command? So you would not need to know the Url of the site?

Just correct me if I am wrong, my knowledge of Nette is not that great yet.

juniwalk commented 9 years ago

Also add command to fix permissions, this is something I use a lot!

I have created tiny CLI application juniwalk/darwin to do just that, but it still needs some work on that fix command - viz juniwalk/darwin#1.

//EDIT: I could modify my command, fix the issue and send pull to kdyby/console if you'd like.

fprochazka commented 9 years ago

@juniwalk I don't think this package should contain commands for doctrine

juniwalk commented 9 years ago

@fprochazka that was just example, you would put code from index.php there, meaning:

// Load Nette DI container instance and run Application service
$dic = include __DIR__.'/../app/bootstrap.php';
$dic->getByType('Nette\Application\Application')->run();

Thats for the cache warm up. //EDIT: IF that is usable for the task.

Buri commented 7 years ago

Regarding generation of container, easiest would be to spawn child process and run it with different temp folder. Nette will automatically generate the container and you could then run latte or do a dummy request to presenter in console. When cache is warmed up, just rename old folder, rename new folder and then delete the old folder.

Changing temp folder can be bit tricky, because by default its hardcoded in most examples. Options are:

fprochazka commented 7 years ago

Well, I don't wanna do this now and definitely not as a part of this repository. If anything, they should be in separate package, independent of Kdyby/Console.

Thank you all for your feedback! I really appreciate it!

If you wanna help, go check out this issue @f3l1x opened https://github.com/contributte/console/issues/3, he promised not to make it tightly coupled with contributte/console :)

f3l1x commented 5 years ago

For the record, we have made it. There is a new package contributte/console-extra with few useful Nette-based commands.

Check it out.