⌈⌋ ⎇ branch:  freshcode


Check-in [fd4c02c1ab]

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

Overview
Comment:Introduced "Dr.ChangeLog" for testing autoupdate rulesets (regex,xpath,jquery release notes scraping).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fd4c02c1abebc113b8fe4b727ca25b81cccb6748
User & Date: mario 2014-08-02 20:55:11
Context
2014-08-03
01:37
Updated autoupdate testing descriptions. check-in: 08b1e91919 user: mario tags: trunk
2014-08-02
20:55
Introduced "Dr.ChangeLog" for testing autoupdate rulesets (regex,xpath,jquery release notes scraping). check-in: fd4c02c1ab user: mario tags: trunk
20:54
Three new gallery links: IceWalkers, OpenHatch, OpenSourceArcade check-in: d02501074c user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to .htaccess.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
RewriteRule  ^projects/([\w-_]+)/releases/(\w+)\.json$  index.php?page=api&name=$1&api=version_%1&id=$2 [L,NS,QSA]
RewriteCond  %{REQUEST_METHOD}  ^(GET|PUT|POST|PUSH)$
RewriteRule  ^projects/([\w-_]+)/urls\.json$  index.php?page=api&name=$1&api=urls [L,NS,QSA] 


#-- Page dispatching
RewriteRule  ^$                 index.php?page=index    [L,NS,QSA]
RewriteRule  ^(projects|submit|search|flag|tags?|feed|login|links|forum|admin)\b/?(\w+(?:[-_]\w+)*)?(?:\.(json|atom|rss))?/?$   index.php?page=$1&name=$2&ext=$3   [L,NS,QSA]

#-- Deny direct invocations
RewriteRule  ^freshcode\.db.*$  -                       [F]
RewriteRule  ^\.                -                       [F]
RewriteCond  %{ENV:REDIRECT_STATUS}  !200
RewriteRule  ^\w+\.php(|/.*)$   -                       [F,L,NS]









|








34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
RewriteRule  ^projects/([\w-_]+)/releases/(\w+)\.json$  index.php?page=api&name=$1&api=version_%1&id=$2 [L,NS,QSA]
RewriteCond  %{REQUEST_METHOD}  ^(GET|PUT|POST|PUSH)$
RewriteRule  ^projects/([\w-_]+)/urls\.json$  index.php?page=api&name=$1&api=urls [L,NS,QSA] 


#-- Page dispatching
RewriteRule  ^$                 index.php?page=index    [L,NS,QSA]
RewriteRule  ^(projects|submit|search|flag|tags?|feed|login|links|forum|admin|drchangelog)\b/?(\w+(?:[-_]\w+)*)?(?:\.(json|atom|rss))?/?$   index.php?page=$1&name=$2&ext=$3   [L,NS,QSA]

#-- Deny direct invocations
RewriteRule  ^freshcode\.db.*$  -                       [F]
RewriteRule  ^\.                -                       [F]
RewriteCond  %{ENV:REDIRECT_STATUS}  !200
RewriteRule  ^\w+\.php(|/.*)$   -                       [F,L,NS]


Added cron.daily/autoupdate.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
<?php
/**
 * api: freshcode
 * title: Autoupdate runner
 * description: Cron job for invoking autoupdates on per-project basis
 * version: 0.5.0
 * depends: curl
 * author: mario
 * license: AGPL
 * 
 *
 * Each project listing can contain:
 *   `autoupdate_module` = none | regex | github | sourceforge | releases.json
 *   `autoupdate_url` = http://...
 *   `autoupdate_regex` = "version=/.../ \n changes=/.../"
 *
 * This module tries to load the mentioned reference URLs, extract version
 * and changelog, scope/state and download link; then updates the database.
 *
 */

// run in cron context
chdir(dirname(__DIR__));
include("config.php");

// go
$run = new Autoupdate();
$run->all();
#print_r($run->test("github", "youtube-dl"));

Changes to index.php.

23
24
25
26
27
28
29

30
31
32
33
34
35
36
    case "index":
    case "projects":
    case "feed":
    case "forum":
    case "links":
    case "tags":
    case "search":

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

    case "flag":
    case "submit":
        if ((LOGIN_REQUIRED or $page === "flag") and empty($_SESSION["openid"])) {







>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    case "index":
    case "projects":
    case "feed":
    case "forum":
    case "links":
    case "tags":
    case "search":
    case "drchangelog":
    case "login":
        include("page_$page.php");
        break;

    case "flag":
    case "submit":
        if ((LOGIN_REQUIRED or $page === "flag") and empty($_SESSION["openid"])) {

Added page_drchangelog.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
 * type: page
 * title: Dr. Changelog
 * description: Tool to experiment and try out Autoupdate modules
 * version: 0.1
 * license: AfferoLGPL
 *
 * Reuses fields from /submit form to start a live check run with
 * actual Autoupdate modules.
 *
 */


$header_add = "<meta name=robots content=noindex>";
include("template/header.php");
?> <section id=main> <?php


// run test
if ($_REQUEST->has("test")) {

    #-- prepare
    $run = new Autoupdate();
    $project = array(
         "name" => "testproject",
         "version" => "0.0.0.0.0.0.1",
         "homepage" => "",
         "download" => "",
         "urls" => "",
         "autoupdate_module" => $_REQUEST->name->in_array("autoupdate_module", "release.json,changelog,regex,github"),
         "autoupdate_url" => $_REQUEST->url["autoupdate_url"],
         "autoupdate_regex" => $_REQUEST->raw["autoupdate_regex"],
    );
    
    #-- exec
    $method = $run->map[$project["autoupdate_module"]];
    print "<h3>Results for <em>$method</em> extraction</h3>\n";
    $run->debug = 1;
    $result = $run->{$method}($project);
    var_dump($result);

}


// display form
else {

   $data = $_REQUEST->list->html["name,autoupdate_module,autoupdate_url,autoupdate_regex"];
   $select = "form_select_options";
   print<<<FORM
   
   <h3>Dr. Changelog</h3> 
   <form action=drchangelog method=POST>
        <p>
           Freshcode.club can be automated to track your software releases. There are various
           alternatives for uncovering them. You can try them out here.

           <label>
               Retrieval method
               <select name=autoupdate_module>
                   {$select("release.json,changelog,regex,github", $data["autoupdate_module"])}
               </select>
           </label>

           <table border=0 cellpadding=3>
           <colgroup><col width=25% valign=top><col width=25% valign=top><col width=25% valign=top><col width=25% valign=top>
           <tr>
           <td><em>releases.json</em> defines a coherent scheme for publishing version
             and release infos.</td>
           <td>While a <em>Changelog</em> text file is likely the easiest, if you already have
             one, in an accepted formatting.</td>
           <td><em>Github</em> tags fetching uncovers <nobr>/releases</nobr> notes, or as last resort
             extracts your git commit log.</td>
           <td>Using <em>regex/xpath</em> is however the most universal way to extract from
             project websites.</td>
           </tr></table>

        </p>
        <p>
           <label>
               Autoupdate URL
               <input name=autoupdate_url type=url size=80 value="$data[autoupdate_url]" placeholder="https://github.com/user/repo/tags.atom" maxlength=250>
           </label>
           Add the URL to your changelog, releases.json or github project here. For the regex method
           this will also be the first page to be extracted from.
        </p>

        <p>
           <h4>Regex</h4>
           <label>
               Extraction Rules (URLs, Regex, Xpath)
               <textarea cols=70 rows=10 name=autoupdate_regex placeholder="version = /-(\d+\.\d+\.\d+)\.txz/" maxlength=2500>$data[autoupdate_regex]</textarea>
               <small>
               <a href="http://fossil.include-once.org/freshcode/wiki/AutoupdateRegex">Regex automated updates</a>
               expect a list of <code>field=/regex/</code> names, like version=, changes=, download=, state=.
               Associatively-named "Other URLs" are also used for extraction.</small>
           </label>
        </p>
        <p>
          <input type=submit name=test value=Test-Run>
        </p>
   </form>
FORM;
}


include("template/bottom.php");

?>