kohana / minion

Everyone loves having a minion they can boss around
113 stars 76 forks source link

Execute a controller from minion #33

Closed BRMatt closed 13 years ago

BRMatt commented 13 years ago
<Kiall> Speaking of minion ..
<Kiall> I wonder if it'd be a good idea to have a "run controller" minion command (let me explain a tad ;)
<BRMatt> shoot
<Kiall> Think of the the default route .. then .. ./minion route default welcome index 12
<Kiall> wait ..
<Kiall>  ./minion route default --controller=welcome --action=index --id=12
<Kiall> so your route params become cmd line options .. custom CLI style routes could be callable without writing full tasks
<BRMatt> What benefit would a controller have over a task?
<Kiall> It wouldn't replace task classes - but would give you a quick way to call code from the CLI and give decent errors etc
<Kiall> Maybe your API controllers would respond well to this, no need to write tasks when all you want to do is expose your API for other tools to use etc
<BRMatt> That's a good use case
<BRMatt> But wouldn't it be better to specify a uri in case you need to change a controller / action?
<BRMatt> And if that were the case, couldn't you just do index.php --uri=xyz ?
<Kiall> well - URIs ould change more than code .. ;)
<Kiall> would
<Kiall> "php index.php --url=bla" doesnt feel right .. it feels like a hack everytime I add that to a cron ;)
<BRMatt> Yeah, I know what you mean in that sense :p
<Kiall> As i said .. just an idea .. not sure its really useful (I dont actually have a use case ... just thought of it ..)```
zeelot commented 13 years ago

I am leaning towards not wanting this. Seems like an edge case and can be coded up in your application fairly easily if needed. Personally, if I wanted to test a request from the command line in any way, I would probably use curl.

I sort of see the benefit, so I guess if you guys really want it, we can easily add this task.

BRMatt commented 13 years ago

At the end of the day I guess we should be encouraging people not to use controllers for cli requests, so based on that I'll close this.