Skip to content

Instantly share code, notes, and snippets.

@vaclavbohac
Created January 8, 2012 20:48
Show Gist options
  • Save vaclavbohac/1579634 to your computer and use it in GitHub Desktop.
Save vaclavbohac/1579634 to your computer and use it in GitHub Desktop.
Makefile for Nette's make
<?php
/**
* Makefile for converting project from PHP 5.3 to PHP 5.2.
*
* Call task 'main' to build a full release.
* The release built will be stored in 'dist' directory.
*/
require 'tools/Nette/nette.min.php';
use Nette\Utils\Finder;
require 'tasks/convert52.php';
$project->main = function ($source, $destination = "dist") use ($project) {
$project->delete($destination);
$project->copy($source, $destination);
$project->log("Building 5.2 version");
$project->buildPackage($destination, '52n');
};
// supported packages: 53, 52p and 52n
$project->buildPackage = function($dir, $package = '5.3') use ($project) {
foreach (Finder::findFiles('*.php', '*.phpt', '*.phpc', '*.inc', '*.phtml', '*.latte', '*.neon')->from($dir)->exclude('www/adminer') as $file) {
$project->{"convert$package"}($file, TRUE);
}
};
#!/bin/bash
PHP_EXECUTABLE="/usr/bin/php"
if [ ! -x $PHP_EXECUTABLE ]; then
echo "PHP executable is missing."
exit
fi
DIR=$(readlink -f $(dirname $0))
$PHP_EXECUTABLE $DIR/Make/make.php $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment