Skip to content
This repository
Newer
Older
100644 61 lines (55 sloc) 2.043 kb
a2cf8e03 » trq
2012-03-05 Scripts moved to phake tasks within a main Phakefile
1 <?php
2
3 group('dev', function() {
4
5 desc('Run the unit tests');
6 task('tests', function($args) {
7 if (isset($args['verbose'])) {
8 system('phpunit --colors --debug --verbose --configuration tests/phpunit.xml');
9 } else {
c8643624 » trq
2012-03-06 Removing template from Phakefile
10 system('phpunit --colors --configuration tests/phpunit.xml');
a2cf8e03 » trq
2012-03-05 Scripts moved to phake tasks within a main Phakefile
11 }
12 });
13
14 desc('Build the Phar archive');
15 task('build', 'tests', function($args) {
16 chdir('lib');
17 $phar = new Phar('proem.phar');
18 $phar->buildFromDirectory('.');
19 $phar->setStub("<?php
20 Phar::mapPhar('proem.phar');
21 require_once 'phar://proem.phar/Proem/Autoloader.php';
22 (new Proem\Autoloader())->registerNamespaces(['Proem' => 'phar://proem.phar'])->register();
23 __HALT_COMPILER();
24 ?>");
25 rename('proem.phar', '../build/proem.phar');
26 chdir('../');
27 if (isset($args['runtests'])) {
28 system('phpunit --colors tests/phar-test.php');
29 }
30 });
31
32 desc('Bump the version number');
33 task('bump', function($args) {
34 $file = file_get_contents('lib/Proem/Api/Proem.php');
35 preg_match('/VERSION = \'([0-9]?)\.([0-9]?)\.([a-z0-9])\';/', $file, $matches);
36 list($all, $major, $minor, $incr) = $matches;
37 if (isset($args['major'])) {
38 $major = (string) ++$major;
39 $minor = '0';
40 $incr = '0';
41 } elseif (isset($args['minor'])) {
42 $minor = (string) ++$minor;
43 $incr = '0';
44 } elseif (isset($args['incr'])) {
45 if ($args['incr'] === 'true') {
46 $incr = (string) ++$incr;
47 } else {
48 $incr = $args['incr'];
49 }
50 }
51 $version = "$major.$minor.$incr";
52 echo "VERSION = '$version'\n";
53 if (isset($args['write'])) {
54 $file = preg_replace('/VERSION = \'(.*)\';/', "VERSION = '$version';", $file);
55 file_put_contents('lib/Proem/Api/Proem.php', $file);
56 }
57 });
58
59 });
2aaf3a81 » trq
2012-03-05 Added dev:tests as the default phake task.
60
61 task('default', 'dev:tests');
Something went wrong with that request. Please try again.