#!/usr/bin/env php substr(getcwd(), strlen(LOCAL)), 'head' => basename($_SERVER['argv'][1] ?? 'master'), ]; list($entry['hash'], $entry['time'], $entry['author'], $entry['comment']) = explode(',', $log, 4); if (substr($entry['repo'], -4) != '.git') { $entry['repo'] .= '.git'; } // print_r($entry); $short = substr($entry['hash'], 0, 7); echo "RSS ENTRY: ${entry['author']} pushed to ${entry['repo']} (${entry['head']},$short): ${entry['comment']}"; // 50 recent changes $histo = array_merge([$entry], $histo); while (count($histo) > 50) { array_pop($histo); } file_put_contents(__DIR__ . '/git2rss.json', json_encode($histo, JSON_PRETTY_PRINT)); // Generate RSS $feed = new Feed(); $channel = new Channel(); $channel ->title("Remi's RPM git repostiories") ->description('Change') ->url(REMOTE) ->language('en-US') ->copyright('Copyright 2005-2017, Remi Collet') ->pubDate(time()) ->lastBuildDate(time()) ->ttl(60) ->appendTo($feed); foreach ($histo as $entry) { $short = substr($entry['hash'], 0, 7); $msg = "${entry['author']} pushed to ${entry['repo']} (${entry['head']},$short): ${entry['comment']}"; $item = new Item(); $item ->title($msg) ->description($msg) ->url(REMOTE . "${entry['repo']}/commit/?id=${entry['hash']}") ->author($entry['author']) ->pubDate($entry['time']) ->guid("${entry['repo']}_${entry['hash']}", true) ->appendTo($channel); } // Save RSS file_put_contents(__DIR__ . '/index.html', $feed);