<?php require __DIR__ . '/GitRepoFetcher.php'; require __DIR__ . '/RunLogger.php'; $projects = RunLogger::listProjects(); foreach ($projects as $project) { $repoPath = "/tmp/{$project->hash}"; $repo = new GitRepoFetcher($repoPath, $project->url); if ($repo->getChanges()) { $logger = new RunLogger($project->url, $repoPath); $logger->logRun(); } else { var_dump('nothing doin'); } } echo 'done';
<pre> <?php require __DIR__ . '/CommitCounter.php'; require __DIR__ . '/GitRepoFetcher.php'; require __DIR__ . '/RunLogger.php'; require __DIR__ . '/Command.php'; if (!empty($_POST) && isset($_POST['url'])) { $url = $_POST['url']; $repoPath = "/tmp/" . md5($_POST['url']); $repo = new GitRepoFetcher($repoPath, $_POST['url']); $updated = $repo->getChanges(); if ($updated) { $logger = new RunLogger($url, $repoPath); $logger->logRun(); } else { var_dump('nothing doin'); } $command = new PHPLOC_Horse_Command(); $command->main(array($repoPath), array(), array()); $commits = new CommitCounter($repoPath); $authorDataString = ''; $authorNameString = ''; foreach ($commits->getAuthors() as $author => $commits) { $angle = $commits / 16 * 360; $authorDataString .= $commits . ','; $authorNameString .= $author . '|'; } $authorDataString = trim($authorDataString, ','); $authorNameString = trim($authorNameString, '|'); $url = "http://chart.apis.google.com/chart?chs=300x225&cht=p&chd=t:{$authorDataString}&chdl={$authorNameString}&chp=0.233&chtt=Git+commits&chco=FFFF10,FF0000"; }