Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka committed Aug 9, 2013
0 parents commit cde6f40
Show file tree
Hide file tree
Showing 14 changed files with 396 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
docs export-ignore
tests export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: php

php:
- 5.3.3
- 5.4
- 5.5

before_script:
- composer self-update
- composer install --no-interaction --prefer-source --dev

script: php tests/lint.php src/Kdyby/ tests/KdybyTests/ && VERBOSE=true ./tests/run-tests.sh -s tests/KdybyTests/
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Kdyby/Events [![Build Status](https://secure.travis-ci.org/Kdyby/Events.png?branch=master)](http://travis-ci.org/Kdyby/Events)
===========================


Requirements
------------

Kdyby/Events requires PHP 5.3.2 or higher.

- [Nette Framework 2.0.x](https://github.com/nette/nette)


Kdyby/Events are also compatible with events dispatcher in [doctrine/common](https://github.com/doctrine/common), so you can use them with Doctrine.


Installation
------------

The best way to install Kdyby/Events is using [Composer](http://getcomposer.org/):

```sh
$ composer require kdyby/events:@dev
```


-----

Homepage [http://www.kdyby.org](http://www.kdyby.org) and repository [http://github.com/kdyby/events](http://github.com/kdyby/events).
33 changes: 33 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "kdyby/aop",
"type": "library",
"description": "AOP for Nette Framework Dependency Injection Container",
"keywords": ["nette", "kdyby", "aop", "di", "dic", "aspect"],
"homepage": "http://kdyby.org",
"license": ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
"authors": [
{
"name": "Filip Procházka",
"homepage": "http://filip-prochazka.com"
}
],
"support": {
"email": "[email protected]",
"issues": "https://github.com/kdyby/aop/issues"
},
"require": {
"nette/nette": "@dev",
"doctrine/common": "~2.3"
},
"require-dev": {
"nette/tester": "@dev"
},
"autoload": {
"psr-0": {
"Kdyby\\Aop\\": "src/"
},
"classmap": [
"src/Kdyby/Aop/exceptions.php"
]
}
}
57 changes: 57 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Licenses
========

Good news! You may use Kdyby Framework under the terms of either
the New BSD License or the GNU General Public License (GPL) version 2 or 3.

The BSD License is recommended for most projects. It is easy to understand and it
places almost no restrictions on what you can do with the framework. If the GPL
fits better to your project, you can use the framework under this license.

You don't have to notify anyone which license you are using. You can freely
use Kdyby Framework in commercial projects as long as the copyright header
remains intact.



New BSD License
---------------

Copyright (c) 2008 Filip Procházka (http://filip-prochazka.com)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of "Kdyby Framework" nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are
disclaimed. In no event shall the copyright owner or contributors be liable for
any direct, indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused and on
any theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.



GNU General Public License
--------------------------

GPL licenses are very very long, so instead of including them here we offer
you URLs with full text:

- [GPL version 2](http://www.gnu.org/licenses/gpl-2.0.html)
- [GPL version 3](http://www.gnu.org/licenses/gpl-3.0.html)
13 changes: 13 additions & 0 deletions src/Kdyby/Aop/annotations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008 Filip Procházka ([email protected])
*
* For the full copyright and license information, please view the file license.txt that was distributed with this source code.
*/

namespace Kdyby\Aop;


31 changes: 31 additions & 0 deletions src/Kdyby/Aop/exceptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008 Filip Procházka ([email protected])
*
* For the full copyright and license information, please view the file license.txt that was distributed with this source code.
*/

namespace Kdyby\Aop;



/**
* @author Filip Procházka <[email protected]>
*/
interface Exception
{

}



/**
* @author Filip Procházka <[email protected]>
*/
class InvalidStateException extends \RuntimeException implements Exception
{

}
3 changes: 3 additions & 0 deletions tests/KdybyTests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage.dat
*.actual
*.expected
43 changes: 43 additions & 0 deletions tests/KdybyTests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008 Filip Procházka ([email protected])
*
* For the full copyright and license information, please view the file license.md that was distributed with this source code.
*/

if (!@include __DIR__ . '/../../vendor/autoload.php') {
echo 'Install Nette Tester using `composer update --dev`';
exit(1);
}

// configure environment
Tester\Helpers::setup();
class_alias('Tester\Assert', 'Assert');
date_default_timezone_set('Europe/Prague');

// create temporary directory
define('TEMP_DIR', __DIR__ . '/../tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
Tester\Helpers::purge(TEMP_DIR);


$_SERVER = array_intersect_key($_SERVER, array_flip(array(
'PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv')));
$_SERVER['REQUEST_TIME'] = 1234567890;
$_ENV = $_GET = $_POST = array();


if (extension_loaded('xdebug')) {
xdebug_disable();
Tester\CodeCoverage\Collector::start(__DIR__ . '/coverage.dat');
}

function id($val) {
return $val;
}

function run(Tester\TestCase $testCase) {
$testCase->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL);
}
26 changes: 26 additions & 0 deletions tests/conventions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Test case file name
===================

Nette\<class>.<method()>.<area>.<number>.phpt

Nette\Debug.phpt - tests for a class's basic behaviour
Nette\Debug.fireLog().phpt - tests for a method's basic behaviour
Nette\Debug.fireLog().inc - common code for more test cases
Nette\Debug.fireLog().expect - expected raw output
Nette\Debug.fireLog().area.phpt - tests for a specified area of class/method

- areas: basic, error, bug#123
- numbers have three digits


Test case phpDoc
================

/**
* Test: some test name
*
* @author John Doe
* @phpVersion < 5.3 default operator is >=
* @skip some reason why test is skipped
* @phpIni short_open_tag=on
*/
103 changes: 103 additions & 0 deletions tests/lint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/php
<?php

/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008 Filip Procházka ([email protected])
*
* For the full copyright and license information, please view the file license.txt that was distributed with this source code.
*/

$parseOptions = function () use ($_SERVER) {
$options = array('quiet' => false, 'files' => array());
foreach (array_keys(getopt('qh', array('quiet', 'help'))) as $arg) {
switch ($arg) {
case 'q':
case 'quiet':
$options['quiet'] = true;
break;

case 'h':
case 'help':
default:
echo <<<HELP
usage: lint [-q] [path]
options:
-q, --quiet: disable verbose output
-h, --help: display this help screen
HELP;
exit(0);
}
}

stream_set_blocking(STDIN, FALSE);
while ($line = trim(fgets(STDIN))) {
$options['files'][] = $_SERVER['PWD'] . '/' . $line;
}

if (empty($options['files']) && $_SERVER['argc'] > 1) {
foreach ($_SERVER['argv'] as $i => $arg) {
if (substr($arg, 0, 1) === '-' || $i === 0) continue;
$options['files'][] = $arg;
}
}

if (empty($options['files'])) $options['files'][] = $_SERVER['PWD'];

foreach ($options['files'] as $i => $file) {
if (($options['files'][$i] = realpath($file)) !== false) continue;
echo "$file is not a file or directory.\n";
exit(1);
}

return $options;
};

$echo = function () use (&$context) {
if ($context['quiet']) return;
foreach (func_get_args() as $arg) echo $arg;
};

$lintFile = function ($path) use (&$echo, &$context) {
if (substr($path, -4) != '.php') return;

if ($context['filesCount'] % 63 == 0) {
$echo("\n");
}

exec("php -l " . escapeshellarg($path) . " 2>&1 1> /dev/null", $output, $code);
if ($code) {
$context['errors'][] = implode($output);
$echo('E');
} else {
$echo('.');
}

$context['filesCount']++;
};

$check = function ($path) use (&$check, &$lintFile, &$context) {
if (!is_dir($path)) return $lintFile($path);
foreach (scandir($path) as $item) {
if ($item == '.' || $item == '..') continue;
$check(rtrim($path, '/') . '/' . $item);
}
};


$context = $parseOptions();
$context['filesCount'] = 0;
$context['errors'] = array();
foreach ($context['files'] as $file) $check($file);
if ($context['errors']) {
$echo("\n\n", implode($context['errors']));
}

$echo(
"\n\n", ($context['errors'] ? 'FAILED' : 'OK'),
' (', $context['filesCount'], " files checked, ", count($context['errors']), " errors)\n"
);
exit($context['errors'] ? 1 : 0);
Empty file added tests/php.ini-unix
Empty file.
Loading

0 comments on commit cde6f40

Please sign in to comment.