Fresque icon indicating copy to clipboard operation
Fresque copied to clipboard

Added --autoloader/-a option to fresque start command

Open shadyb opened this issue 10 years ago • 9 comments

Hey,

Great project. I noticed the start option did not have any ability to override the include option in the config file so I added it to the cli. Please review and let me know what you think.

Regards

shadyb avatar Jul 22 '14 18:07 shadyb

Did you take a look at https://github.com/kamisama/Fresque/blob/master/lib/Fresque.php#L194 ? Is it different ?

wa0x6e avatar Jul 23 '14 16:07 wa0x6e

Yes, that is where it was inspired from. Basically I needed the ability to add different bootstraps for different webapps on the same server so I used the --autoloader option from the test command and added it to the start command.

There is one other deficiency, I cannot pass custom arguments to the bootstrap. I would like to propose something like --arguments APPLICATION=staging FOO=bar At the moment I have hard coded an --environment option but that is too restrictive. What are your thoughts ?

shadyb avatar Jul 24 '14 12:07 shadyb

You can try using environment variables.

APPLICATION=staging FOO=bar fresque start

wa0x6e avatar Jul 24 '14 14:07 wa0x6e

And if you have different webapps, why don't you put these settings in a fresque .ini file, and have one .ini file per webapp ?

wa0x6e avatar Jul 24 '14 14:07 wa0x6e

Will try that and see what happens.

Because I am using jenkins and it is far easier to pass on the variable via cli than to have to grab the var, generate an entirely new ini file when all you want to do is override one variable.

shadyb avatar Jul 24 '14 15:07 shadyb

The suggested approach to setup the environment variables doesn't work. You are creating a new command, under a different user which spawns off to be a new process and the environment vars that are set will only affect the existing command. I recommend the --arguments option or some option in fresque.ini that'll allow you to initialise the environment variables when constructing the $cmd. Let me know what you think, if you think its a good idea, I'll whip something up.

Also, do let me know what you want to do with the --autoloader argument for the start command.

shadyb avatar Jul 24 '14 17:07 shadyb

For the environment variables in the config, I'd like something like https://github.com/kamisama/Cake-Resque/blob/master/Config/config.php#L135, to maintain compatibility between these 2 tools.

Maybe --env is a more appropriate name ?

I'm still reviewing the --autoloader, it's been a while since I last touched fresque, and even php ...

I propose that you separate the environment variables feature from the --autoloader, and submit another PR.

wa0x6e avatar Jul 24 '14 17:07 wa0x6e

I agree, --env is better than --arguments. Not sure what you mean by compatibility here; do you mean in terms of naming conventions or the code itself ? I haven't seen anything specific to cakephp in fresque.

I agree, I will remove the --environment option; let's get the --autoloader vetted and out and then focus on the --env cmd.

shadyb avatar Jul 25 '14 00:07 shadyb

Any luck with this ?

shadyb avatar Jul 30 '14 15:07 shadyb