Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Check-in [b03092cc52]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Introduce project.json listing
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b03092cc521108d9d7a4106004ab03ee66fd4ec5
User & Date: mario 2021-10-19 20:44:00
Context
2021-10-20
05:56
Support for real doc/trunk/file.txt browsing check-in: 9c6bfdeb8a user: mario tags: trunk
2021-10-19
20:44
Introduce project.json listing check-in: b03092cc52 user: mario tags: trunk
19:36
Extend config: regexp to allow for nested {} check-in: d2b9fb96f7 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added extroot/project.json.











































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: api
# title: project.json
# description: freshcode-style project.json w/ changelog
# version: 0.1
# state: beta
# depends: php:sqlite
# config: -
# access: public
#
# Generates a project.json containing general details
# as well as a `releases` changelog + download links.
#


#-- init
include("./fossil_common.php");


#-- changelog
function rc() {
    return db("
     SELECT event.mtime, tag.tagname, MAX(tag.tagid), DATE(event.mtime) AS d,
            event.comment AS comment
     FROM event
      LEFT JOIN tagxref ON event.objid=tagxref.rid
      LEFT JOIN tag ON tagxref.tagid=tag.tagid
     WHERE type='ci'
     GROUP BY objid
     ORDER BY event.mtime DESC
     LIMIT 1750
    ") + [99999=>["tagname"=>"end-0.0", "d"=>"0-0-0", "comment"=>"-"]];
}
# guess stability
function state($ver, $changes) {
    if (preg_match("/stable|beta|alpha/", $changes, $uu)) {
        return $uu[0];
    }
    elseif (preg_match("/\.0/", $ver)) {
        return "stable";
    }
    else {
        return "development";
    }
}
# judge fix/changeyness
function scope($ver, $changes) {
    $fix = preg_match_all("/fix|correct|merge/i", $changes, $uu);
    $add = preg_match_all("/add|change|intro/i", $changes, $uu);
    $s =  (($fix + $add) > 20) ? "major " : "minor ";
    $s .= ($fix > $add) ? "bugfix" : "changes";
    return $s;
}
# stack release notes by tag/version
function releases() {
    $ver = "trunk";
    $date = time();
    $changes = "";
    $releases = [];
    foreach(rc() as $r) {
        if (preg_match("/\d+\.\d+/", $r["tagname"]) and $r["tagname"] != $ver) {
#            if ($ver != "trunk")
            $releases[] = [
                "version" => preg_replace("/^.+?(?=\d+\.\d+)/", "", $ver),
                "state" => state($ver, $changes),
                "scope" => scope($ver, $changes),
                "changes" => substr($changes, 0, 1024),
                "download" => "$_SERVER[FOSSIL_SELF]zip?name=$ver",
                "published" => $date,
            ];
            $changes = "";
            $ver = $r["tagname"];
            $date = $r["d"];
        }
        $changes .= $r["comment"] . "\n";
    }
    return $releases;
}

#-- output
header("json/vnd.freshcode.club; charset=UTF-8");
print(json_encode([
    "\$feed-origin" => "$_SERVER[FOSSIL_SELF]",
    "\$feed-license" => "CC-BY-SA 4.0",
    "name" => preg_replace("/\.\w+$/", "", basename($_SERVER["FOSSIL_REPOSITORY"])),
    "title" => get_config("project-name", ""),
    "summary" => substr(get_config("project-description", NULL), 0, 50),
    "description" => get_config("project-description", ""),
    "homepage" => get_config("project-homepage", "$_SERVER[FOSSIL_SELF]"),
    "license" => get_config("project-license", ""),
    "tags" => get_config("project-tags", ""),
    "image" => "$_SERVER[FOSSIL_SELF]logo",
    "submitter" => "",
    "urls" => [],
    "releases" => releases(),
], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));