Exemplo n.º 1
0
function CommitRepo($rootpath)
{
    if (GitRepoChanged($rootpath)) {
        // Commit all the things.
        system("git add -A");
        system("git commit -m \"Updated.\"");
        system("git push origin master");
        // Tag the new release.
        $ver = (int) @file_get_contents($rootpath . "/ver.dat");
        system("git tag -a 1.0." . $ver . " -m \"1.0." . $ver . "\"");
        system("git push --tags origin master");
        $ver++;
        file_put_contents($rootpath . "/ver.dat", (string) $ver);
    }
}
Exemplo n.º 2
0
if (!isset($_SERVER["argc"]) || !$_SERVER["argc"]) {
    echo "This file is intended to be run from the command-line.";
    exit;
}
$rootpath = str_replace("\\", "/", dirname(__FILE__));
require_once $rootpath . "/functions.php";
$srcpath = $rootpath . "/repos";
$destpath = $rootpath . "/src";
if (!is_dir($srcpath)) {
    mkdir($srcpath);
}
if (!is_dir($destpath)) {
    mkdir($destpath);
}
// Update the registered repo list.  If nothing has changed, exit.
$numchanged = (int) GitRepoChanged($rootpath) + GitPull($srcpath);
if (!$numchanged) {
    exit;
}
// Always do a full rebuild.
DeleteDirectory($destpath);
// Retrieve a list of all PHP files that contain 'class' + a name.
$files = array();
GetPHPFiles($files, $srcpath);
// Generate final file set.
foreach ($files as $name => $filename) {
    $data = file_get_contents($filename);
    // Remove standard inclusion lines so that the autoloader does its thing.
    $lines = explode("\n", $data);
    foreach ($lines as $num => $line) {
        $line = trim($line);