Permalink
Browse files

Merge branch 'release-0.2.5'

  • Loading branch information...
2 parents f433944 + 215ef48 commit f7d88dbdf398b47f6f6be74a97877f3fe802f581 @trq trq committed Mar 27, 2012
Showing with 887 additions and 263 deletions.
  1. +1 −0 .gitignore
  2. +61 −0 Phakefile
  3. +0 −14 bin/build
  4. +0 −36 bin/bump-version
  5. +0 −4 bin/runtests
  6. +19 −0 composer.json
  7. +8 −7 lib/Proem/Api/Bootstrap/Filter/Event/Dispatch.php
  8. +30 −9 lib/Proem/Api/Bootstrap/Filter/Event/Request.php
  9. +33 −10 lib/Proem/Api/Bootstrap/Filter/Event/Response.php
  10. +24 −9 lib/Proem/Api/Bootstrap/Filter/Event/Route.php
  11. +27 −2 lib/Proem/Api/Bootstrap/Signal/Event/Bootstrap.php
  12. +3 −2 lib/Proem/Api/Ext/Module/Generic.php
  13. +3 −2 lib/Proem/Api/Ext/Plugin/Generic.php
  14. +6 −6 lib/Proem/Api/Ext/{Generic.php → Template.php}
  15. +4 −3 lib/Proem/Api/Filter/Event/Generic.php
  16. +43 −0 lib/Proem/Api/Filter/Event/Template.php
  17. +7 −6 lib/Proem/Api/Filter/{Manager.php → Manager/Standard.php}
  18. +51 −0 lib/Proem/Api/Filter/Manager/Template.php
  19. +6 −5 lib/Proem/Api/IO/{Http/FakeRequest.php → Request/Http/Fake.php}
  20. +7 −6 lib/Proem/Api/IO/{Http/Request.php → Request/Http/Standard.php}
  21. +5 −16 bin/new-file → lib/Proem/Api/IO/Request/Template.php
  22. +6 −7 lib/Proem/Api/IO/{Http/Response.php → Response/Http/Standard.php}
  23. +44 −0 lib/Proem/Api/IO/Response/Template.php
  24. +40 −36 lib/Proem/Api/Proem.php
  25. +3 −2 lib/Proem/Api/Routing/Route/Generic.php
  26. +2 −1 lib/Proem/Api/Routing/Route/Standard.php
  27. +39 −0 lib/Proem/Api/Routing/Route/Template.php
  28. +5 −5 lib/Proem/Api/Routing/{Router.php → Router/Standard.php}
  29. +43 −0 lib/Proem/Api/Routing/Router/Template.php
  30. +4 −3 lib/Proem/Api/Service/Asset/{Generic.php → Standard.php}
  31. +55 −0 lib/Proem/Api/Service/Asset/Template.php
  32. +8 −7 lib/Proem/Api/Service/{Manager.php → Manager/Standard.php}
  33. +51 −0 lib/Proem/Api/Service/Manager/Template.php
  34. +15 −9 lib/Proem/Api/Signal/Event/{Generic.php → Standard.php}
  35. +52 −0 lib/Proem/Api/Signal/Event/Template.php
  36. +11 −10 lib/Proem/Api/Signal/{Manager.php → Manager/Standard.php}
  37. +41 −0 lib/Proem/Api/Signal/Manager/Template.php
  38. +3 −3 lib/Proem/Api/Util/Opt/Option.php
  39. +1 −0 phake
  40. +19 −0 tests/lib/Proem/Tests/Ext/Fixtures/MyApp/Module/Foo.php
  41. +64 −0 tests/lib/Proem/Tests/ExtTest.php
  42. +3 −3 tests/lib/Proem/Tests/FilterTest.php
  43. +2 −2 tests/lib/Proem/Tests/Fixtures/Proem/Ext/Plugin/Foo.php
  44. +1 −1 tests/lib/Proem/Tests/Fixtures/Proem/Service/Asset/Bar.php
  45. +1 −1 tests/lib/Proem/Tests/Fixtures/Proem/Service/Asset/Foo.php
  46. +7 −7 tests/lib/Proem/Tests/IO/Http/FakeRequestTest.php
  47. +2 −2 tests/lib/Proem/Tests/IO/Http/ResponseTest.php
  48. +7 −7 tests/lib/Proem/Tests/Routing/RouterTest.php
  49. +14 −14 tests/lib/Proem/Tests/ServiceTest.php
  50. +4 −4 tests/lib/Proem/Tests/SignalTest.php
  51. +2 −2 tests/lib/Proem/Tests/Util/OptTest.php
View
@@ -1 +1,2 @@
tests/log/*
+vendor
View
@@ -0,0 +1,61 @@
+<?php
+
+group('dev', function() {
+
+ desc('Run the unit tests');
+ task('tests', function($args) {
+ if (isset($args['verbose'])) {
+ system('phpunit --colors --debug --verbose --configuration tests/phpunit.xml');
+ } else {
+ system('phpunit --colors --configuration tests/phpunit.xml');
+ }
+ });
+
+ desc('Build the Phar archive');
+ task('build', 'tests', function($args) {
+ chdir('lib');
+ $phar = new Phar('proem.phar');
+ $phar->buildFromDirectory('.');
+ $phar->setStub("<?php
+ Phar::mapPhar('proem.phar');
+ require_once 'phar://proem.phar/Proem/Autoloader.php';
+ (new Proem\Autoloader())->registerNamespaces(['Proem' => 'phar://proem.phar'])->register();
+ __HALT_COMPILER();
+ ?>");
+ rename('proem.phar', '../build/proem.phar');
+ chdir('../');
+ if (isset($args['runtests'])) {
+ system('phpunit --colors tests/phar-test.php');
+ }
+ });
+
+ desc('Bump the version number');
+ task('bump', function($args) {
+ $file = file_get_contents('lib/Proem/Api/Proem.php');
+ preg_match('/VERSION = \'([0-9]?)\.([0-9]?)\.([a-z0-9])\';/', $file, $matches);
+ list($all, $major, $minor, $incr) = $matches;
+ if (isset($args['major'])) {
+ $major = (string) ++$major;
+ $minor = '0';
+ $incr = '0';
+ } elseif (isset($args['minor'])) {
+ $minor = (string) ++$minor;
+ $incr = '0';
+ } elseif (isset($args['incr'])) {
+ if ($args['incr'] === 'true') {
+ $incr = (string) ++$incr;
+ } else {
+ $incr = $args['incr'];
+ }
+ }
+ $version = "$major.$minor.$incr";
+ echo "VERSION = '$version'\n";
+ if (isset($args['write'])) {
+ $file = preg_replace('/VERSION = \'(.*)\';/', "VERSION = '$version';", $file);
+ file_put_contents('lib/Proem/Api/Proem.php', $file);
+ }
+ });
+
+});
+
+task('default', 'dev:tests');
View
@@ -1,14 +0,0 @@
-#!/usr/bin/env php
-<?php
-chdir('lib');
-$phar = new Phar('proem.phar');
-$phar->buildFromDirectory('.');
-$phar->setStub("<?php
-Phar::mapPhar('proem.phar');
-require_once 'phar://proem.phar/Proem/Autoloader.php';
-(new Proem\Autoloader())->registerNamespaces(['Proem' => 'phar://proem.phar'])->register();
-__HALT_COMPILER();
-?>");
-rename('proem.phar', '../build/proem.phar');
-chdir('../');
-system('phpunit --colors tests/phar-test.php');
View
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-option=$1;
-
-version=`grep 'VERSION' lib/Proem/Api/Proem.php`
-set -- $version
-
-IFS="'"; declare -a Array=($*)
-line="${Array[4]}"
-
-set -- $line
-
-IFS="."; declare -a Array=($*)
-major="${Array[0]}"
-minor="${Array[1]}"
-incr="${Array[2]}"
-
-if [ "$option" = "-major" ];
-then
- major=$((major+1))
- minor=0
- incr=0
-elif [ "$option" = "-minor" ]; then
- minor=$((minor+1))
- incr=0
-elif [ "$option" = "-incr" ]; then
- incr=$((incr+1))
-else
- echo "Usage: $0 -[major|minor|incr]";
- exit;
-fi
-
-echo "incremented to $major.$minor.$incr";
-
-sed "s/VERSION = '.*';/VERSION = '$major.$minor.$incr';/" lib/Proem/Api/Proem.php > lib/Proem/Api/Proem.php.new
-mv lib/Proem/Api/Proem.php.new lib/Proem/Api/Proem.php
View
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-# phpunit --colors --debug --verbose --configuration tests/phpunit.xml
-phpunit --colors --configuration tests/phpunit.xml
View
@@ -0,0 +1,19 @@
+{
+ "name": "proem/proem",
+ "description": "A lightweight, simple, fast MVC implementation for PHP5.4",
+ "keywords": ["MVC","Framework"],
+ "homepage": "http://proemframework.org",
+ "type": "library",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Tony R Quilkey",
+ "email": "trq@proemframework.org",
+ "homepage": "http://thorpesystems.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.4.0",
+ "jaz303/phake": "dev-master"
+ }
+}
@@ -30,15 +30,16 @@
*/
namespace Proem\Api\Bootstrap\Filter\Event;
-use Proem\Service\Manager,
- Proem\Bootstrap\Signal\Event\Bootstrap;
+use Proem\Service\Manager\Template as Manager,
+ Proem\Bootstrap\Signal\Event\Bootstrap,
+ Proem\Filter\Event\Generic as Event;
/**
* Proem\Api\Bootstrap\Filter\Event\Dispatch
*
* The default "Dispatch" filter event.
*/
-class Dispatch extends \Proem\Filter\Event\Generic
+class Dispatch extends Event
{
/**
* preIn
@@ -47,7 +48,7 @@ class Dispatch extends \Proem\Filter\Event\Generic
*/
public function preIn(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'pre.in.dispatch',
'params' => [],
@@ -76,7 +77,7 @@ public function inBound(Manager $assets)
*/
public function postIn(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'post.in.dispatch',
'params' => [],
@@ -95,7 +96,7 @@ public function postIn(Manager $assets)
*/
public function preOut(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'pre.out.dispatch',
'params' => [],
@@ -124,7 +125,7 @@ public function outBound(Manager $assets)
*/
public function postOut(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'post.out.dispatch',
'params' => [],
@@ -30,31 +30,42 @@
*/
namespace Proem\Api\Bootstrap\Filter\Event;
-use Proem\Service\Manager,
- Proem\Bootstrap\Signal\Event\Bootstrap;
+use Proem\Service\Manager\Template as Manager,
+ Proem\Bootstrap\Signal\Event\Bootstrap,
+ Proem\IO\Request\Http\Standard as HTTPRequest,
+ Proem\Service\Asset\Standard as Asset,
+ Proem\Filter\Event\Generic as Event;
/**
* Proem\Api\Bootstrap\Filter\Event\Request
*
* The default "Request" filter event.
*/
-class Request extends \Proem\Filter\Event\Generic
+class Request extends Event
{
/**
* preIn
*
* Called prior to inBound
+ *
+ * The preIn Filter event will trigger a pre.in.request Signal.
+ *
+ * If this Signal returns a Proem\IO\Http\Request object load it into the Asset Manager.
*/
public function preIn(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'pre.in.request',
'params' => [],
'target' => $this,
'method' => __FUNCTION__,
'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($e) {},
+ 'callback' => function($e) use ($assets) {
+ if ($e->provides('Proem\IO\Request\Template')) {
+ $assets->set('request', $e);
+ }
+ },
]);
}
}
@@ -63,10 +74,20 @@ public function preIn(Manager $assets)
* inBound
*
* Method to be called on the way into the filter.
+ *
+ * Checks to see if we already have an Asset providing Proem\IO\Http\Request, if not, we provide one.
*/
public function inBound(Manager $assets)
{
-
+ if (!$assets->provides('Proem\IO\Request\Template')) {
+ $asset = new Asset;
+ $assets->set(
+ 'request',
+ $asset->set('Proem\IO\Request\Template', $asset->single(function() {
+ return new HTTPRequest;
+ }))
+ );
+ }
}
/**
@@ -76,7 +97,7 @@ public function inBound(Manager $assets)
*/
public function postIn(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'post.in.request',
'params' => [],
@@ -95,7 +116,7 @@ public function postIn(Manager $assets)
*/
public function preOut(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'pre.out.request',
'params' => [],
@@ -124,7 +145,7 @@ public function outBound(Manager $assets)
*/
public function postOut(Manager $assets)
{
- if ($assets->provides('events', '\Proem\Signal\Manager')) {
+ if ($assets->provides('events', '\Proem\Signal\Manager\Template')) {
$assets->get('events')->trigger([
'name' => 'post.out.request',
'params' => [],
Oops, something went wrong.

0 comments on commit f7d88db

Please sign in to comment.