nathggns / Scaffold

Lightweight PHP API Framework
Other
8 stars 2 forks source link

Console Applications #128

Closed nathggns closed 11 years ago

nathggns commented 11 years ago

I'd like to integrate console applications to the router. Maybe emulate a request like GET but make it CONSOLE.

nathggns commented 11 years ago

Couple of issues. I'd like your input on how to solve them.

coveralls commented 11 years ago

Coverage Status

Coverage increased (+0%) when pulling c0b7b29c9e622ffdc9efef8d4f2de7f6e6e0cbaa on issue-128 into 7ed9378c360294a75389e87d417b66d964175f5d on development.

nathggns commented 11 years ago

It is indeed possible to send CONSOLE requests via HTTP.

⇒ telnet projects.local 80
Trying 127.0.0.1...
Connected to projects.local.
Escape character is '^]'.
CONSOLE /Scaffold/ HTTP/1.0

HTTP/1.1 500 Internal Server Error
Date: Wed, 05 Jun 2013 20:54:53 GMT
Server: Apache/2.2.22 (Unix) DAV/2 PHP/5.4.11 mod_ssl/2.2.22 OpenSSL/0.9.8x
X-Powered-By: PHP/5.4.11
Content-Length: 178
Connection: close
Content-Type: application/json

{
    "error": {
        "code": 500,
        "message": "Internal Server Error",
        "debug": {
            "type": 1,
            "file": "system\/classes\/router.php:304",
            "error": "Call to undefined method ControllerIndex::console()"
        }
    }
}
ClaudioAlbertin commented 11 years ago

Implement it

nathggns commented 11 years ago

What do you mean?

coveralls commented 11 years ago

Coverage Status

Coverage increased (+0%) when pulling 85b1697af3a07d6f270a816b70e72c1c228b4de0 on issue-128 into 7ed9378c360294a75389e87d417b66d964175f5d on development.

nathggns commented 11 years ago

Also, need to add an environment argument

nathggns commented 11 years ago

Nope, don't need to add an environment argument. Possibly to pass that in as a environment variable.

$ SCAFFOLD_ENV=production php index.php
...
nathggns commented 11 years ago

What needs to be changed to merge this @ClaudioAlbertin?

coveralls commented 11 years ago

Coverage Status

Coverage remained the same when pulling 69f40b4e858db40cd3b537c6a95b29b090704d42 on issue-128 into 7ed9378c360294a75389e87d417b66d964175f5d on development.

coveralls commented 11 years ago

Coverage Status

Coverage remained the same when pulling 5bf3e44107c514f94756c6debe54009429f84027 on issue-128 into 7ed9378c360294a75389e87d417b66d964175f5d on development.

nathggns commented 11 years ago

Don't merge this.

nathggns commented 11 years ago

Okay, now it's ready. @ClaudioAlbertin

coveralls commented 11 years ago

Coverage Status

Coverage remained the same when pulling b21c510ac30d3c5e7a3c2cae514db745452e9d91 on issue-128 into 7ed9378c360294a75389e87d417b66d964175f5d on development.

coveralls commented 11 years ago

Coverage Status

Coverage decreased (-0%) when pulling 87d7c5ca5e26ec85c69251eed3d534b209e40865 on issue-128 into 7ed9378c360294a75389e87d417b66d964175f5d on development.

ClaudioAlbertin commented 11 years ago

Maybe the new middleware system will make this easier. I think we should merge it now and then improve it. If you agree, merge.