#!/usr/bin/env php
<?php

/*
 * This file is part of the GeckoPackages.
 *
 * (c) GeckoPackages https://github.com/GeckoPackages
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

require_once __DIR__.'/../tests/autoload.php';
require_once __DIR__.'/../tests/PHPUnit/Tests/AbstractGeckoPHPUnitTest.php';
require_once __DIR__.'/../tests/PHPUnit/Tests/ReadMe/ReadMeTest.php';

$readMeFile = __DIR__.'/../README.md';
if (file_exists($readMeFile) && !is_writable($readMeFile)) {
    echo sprintf("\nCannot overwrite \"%s\".\n", realpath($readMeFile));
    exit(-1);
}

$builder = new ReadMeTest();
if (false === @file_put_contents($readMeFile, $builder->generateReadMe())) {
    echo sprintf("\nFailed to write content to \"%s\".", $readMeFile);
    exit(-1);
}

exit(0);
