Esempio n. 1
0
 /**
  * Sorts the releases inside this log in accordance with semantic versioning, latest release first.
  */
 public function sortReleases()
 {
     // If there is an unreleased release pull that out and sort the rest
     $unreleased = null;
     if (isset($this->releases['unreleased'])) {
         $unreleased = $this->releases['unreleased'];
         unset($this->releases['unreleased']);
     }
     $order = Sort::sort(array_keys($this->releases));
     $order = array_reverse($order);
     $newOrder = [];
     /** @var Version $version */
     foreach ($order as $version) {
         $index = $version->__toString();
         $newOrder[$index] = $this->releases[$index];
     }
     if ($unreleased !== null) {
         $newOrder = ['unreleased' => $unreleased] + $newOrder;
     }
     $this->releases = $newOrder;
 }
Esempio n. 2
0
use Naneau\SemVer\Sort;
function isValid($path)
{
    return $path != 'index.html' && $path != '.' && $path != '..' && $path != 'latest';
}
// getting versions
$d = dir($argv[1]);
$arr = array();
while (false !== ($entry = $d->read())) {
    if (isValid($entry)) {
        $arr[] = $entry;
    }
}
$d->close();
//sorting in semver style
$sorted = Sort::sort($arr);
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Versions</title>
        <h1>Versions</h1>
</head>

<body>
    
<?php 
//printing up in the reverse order
for ($i = count($sorted) - 1; $i >= 0; --$i) {
    $entry = $sorted[$i];
Esempio n. 3
0
    $_GET['id'] = 1;
}
$branch = $mysqli->real_escape_string($_GET['branch']);
$addonResult = $mysqli->query("SELECT * FROM `addon_addons` WHERE id=" . $_GET['id']);
$addonObj = $addonResult->fetch_object();
$fileResult = $mysqli->query("SELECT * FROM `addon_files` WHERE id=" . $addonObj->file_stable);
$fileObj = $fileResult->fetch_object();
$updateResult = $mysqli->query("SELECT * FROM `addon_updates` WHERE aid=" . $addonObj->id);
$updateArray = array();
while ($up = $updateResult->fetch_object()) {
    if ($up->branch == $branch) {
        $updateArray[$up->version] = $up;
        $updates[] = $up->version;
    }
}
$updates = Sort::sort($updates);
$updates = array_reverse($updates);
$object = array();
foreach ($updates as $update) {
    $up = $updateArray[$update->getOriginalVersion()];
    echo "<version:" . $up->version . ">\n";
    echo $up->changelog;
    echo "\n</version>\n";
}
return;
?>
<version:1.8>
        <ul>
                <li>Added stuff.</li>
                <li>Changed some stuff.</li>
        </ul>
Esempio n. 4
0
 /**
  * Test sort of array
  *
  * @expectedException InvalidArgumentException
  * @return void
  **/
 public function testSortInvalid()
 {
     Sorter::sort('0.0.1', 2, '1.2.3');
 }