⌈⌋ ⎇ branch:  freshcode


Check-in [1534cf257a]

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

Overview
Comment:Add GitHub/Archive list and cache database polling.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1534cf257af3c0f8635624374dfd008ccf2fde63
User & Date: mario 2014-11-03 02:10:50
Context
2014-11-03
02:11
GitHub/Archive/API polling job. check-in: 81413c685e user: mario tags: trunk
02:10
Add GitHub/Archive list and cache database polling. check-in: 1534cf257a user: mario tags: trunk
02:10
Split news feeds and fossies.org scraping. check-in: f29bcd5c41 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added cron.daily/news_github.php.

























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
<?php
/**
 * title: github releases news feed
 * description: fetch from cache database, build feed and releases page
 * version: 0.3
 *
 * Short summary
 *     → ./template/feed.github.htm
 * Long table
 *     → ./template/github-releases.htm
 *
 */


chdir(dirname(__DIR__));
include("./config.php");
db(new PDO("sqlite:github.db"));


// query
$recent = db("
   SELECT *
     FROM (
       SELECT *
         FROM releases
        WHERE LENGTH(repo_description) > 0
     GROUP BY repo_name
     ORDER BY t_published DESC
        LIMIT 500
          )
  ORDER BY repo_language
");

// prepare output
$lang = "";
$out = [];
$full = "";

// printout
foreach ($recent as $r) {
    $r = array_map("htmlspecialchars", $r);

    
    #-- filter some
    if (preg_match("~/(test|main)$~", $r["repo_name"])
    or  preg_match("~Contribute to .+? by creating an account on GitHub~", $r["repo_description"]))
    {
       continue;
    }


    #-- sidebar feed
    if (count($out) < 25) {
       $name = trim(strstr($r["repo_name"], "/"), "/");
       $out[] = "   <a href='$r[release_url]' title='$r[repo_description]'>$name "
              . "<em class=version title='$r[release_title]'>$r[release_tag]</em></a>";
    }


    #-- complete list
    $verdesc = input::spaces(substr($r["release_body"], 0, 200));
    $name = explode("/", $r["repo_name"]);

    // project blob    
    $full .= <<<HTML
 <tr class="github release">
    <td class=author-avatar><img src="$r[author_avatar]&s=40" alt="$r[author_login]" height=40 width=40></td>
    <td class=repo-name>
       <a href='$r[repo_url]' title='$r[repo_name]'>
          <small class=repo-org>$name[0] /</small>
          <strong class=repo-localname>$name[1]</strong>
       </a>
       <span class=repo-language>$r[repo_language]<span>
    </td>
    <td class=repo-description>
       $r[repo_description]
       <a class=repo-homepage href="$r[repo_homepage]">$r[repo_homepage]</a>
    </td>
    <td class=release>
        <a class=release-tag href='$r[release_url]'><em class=version title='$r[release_title]'>$r[release_tag]</em></a>
        <span class=release-body>$verdesc</span>
    </td>
 </tr>
 
HTML;
}

// write
file_put_contents("./template/feed.github.htm", implode("\n", $out));
file_put_contents("./template/github-releases.htm", $full);


Changes to index.php.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
/**
 * api: php
 * type: main
 * title: Freshcode.club
 * description: FLOSS software release tracking website
 * version: 0.7.3
 * author: mario
 * license: AGPL
 * 
 * Implements a freshmeat/freecode-like directory for open source
 * release publishing / tracking.
 *
 */






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
/**
 * api: php
 * type: main
 * title: Freshcode.club
 * description: FLOSS software release tracking website
 * version: 0.7.4
 * author: mario
 * license: AGPL
 * 
 * Implements a freshmeat/freecode-like directory for open source
 * release publishing / tracking.
 *
 */
26
27
28
29
30
31
32

33
34
35
36
37
38
39
    case "projects":
    case "feed":
    case "links":
    case "tags":
    case "search":
    case "rc":
    case "drchangelog":

    case "login":
        include("page_$page.php");
        break;

    case "forum":
    case "meta":
        include("page_forum.php");







>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    case "projects":
    case "feed":
    case "links":
    case "tags":
    case "search":
    case "rc":
    case "drchangelog":
    case "githubreleases":
    case "login":
        include("page_$page.php");
        break;

    case "forum":
    case "meta":
        include("page_forum.php");

Added page_githubreleases.php.

























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
<?php
/**
 * api: freshcode
 * title: github-releases
 * description: dump releases feed
 * version: 0.3
 *
 * Shows the summarized GitHub releases from the stored template dump
 * (updated by cron.daily/news_github.php from GHA and cache DB.)
 *
 */

include("template/header.php");
?>

  <style>
    .github-releases {
       width: 100%;
    }
    #githubreleases {
       table-layout: fixed;
       width: 100%;
    }
    .github.release td {
       padding: 4pt 1pt;
       font-size: 95%;
       overflow: hidden;
       text-overflow: ellipsis;
       box-shadow: none;
    }
    .github.release .author-avatar {
    }
    .github.release .repo-name {
    }
    .github.release .repo-name small {
       display: block;
       font-size: 85%;
       color: #555;
    }
    .github.release .repo-name strong {
       font-weight: 400;
       display: block;
    }
    .github.release .repo-description {
       font-size: 90%;
    }
    .github.release .repo-homepage {
       font-size: 70%;
       display: block;
    }
    .github.release .release-tag {
       font-weight: 700;
    }
    .github.release .release-body {
       font: 70%/80% normal;
       max-height: 25pt;
       color: #999;
    }
    .github-releases .repo-language {
       font-size: 60%;
       padding: 0.5pt 1pt;
       border: dotted 1px #eef;
       background: #f1f3ff;
       color: #aae;
    }
  </style>

  <section id=main style="width:70%">
  <h2>GitHub Releases</h2>
  <article class=github-releases>

     <table id=githubreleases>
     <colgroup>
        <col width="5%">
        <col width="25%">
        <col width="35%">
        <col width="35%">
     </colgroup>
<?php include("template/github-releases.htm"); ?>
     </table>

  </article>

  <p style="break: both; clear: all; background: #f3f5f7; padding: 20pt;;">
    Project information courtesy of
    <a href="http://githubarchive.org/">http://githubarchive.org/</a>
    and the GitHub API.
  </p>

<?php
include("template/bottom.php");