Merge: Extends catalog with a *try it* and a *download apk* links
authorJean Privat <jean@pryen.org>
Wed, 16 Sep 2015 17:11:55 +0000 (13:11 -0400)
committerJean Privat <jean@pryen.org>
Wed, 16 Sep 2015 17:11:55 +0000 (13:11 -0400)
Two new package metadata are added

* `upstream.tryit` for an URL that points to a demo version or a live version of the main web service offered by the package.
* `upstream.apk` for an URL that points to a dry `apk`, or an install page on some store, for the main android application offered by the package.

Moreover, packages that have one them will be respectively tagged `tryit` and `apk`

A demo is available: http://info.uqam.ca/~privat/catalog/#tag_tryit and http://info.uqam.ca/~privat/catalog/#tag_apk

Pull-Request: #1724
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

15 files changed:
contrib/benitlux/package.ini
contrib/crazy_moles/package.ini
contrib/friendz/package.ini
contrib/mnit_test/package.ini
contrib/nitrpg/package.ini
contrib/online_ide/package.ini
contrib/opportunity/package.ini
contrib/pep8analysis/package.ini
contrib/tinks/package.ini
contrib/tnitter/package.ini
examples/calculator/package.ini
examples/mnit_ballz/package.ini
examples/mnit_dino/package.ini
examples/shoot/package.ini
src/nitcatalog.nit

index 53acc9d..e53853c 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/benitlux/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+tryit=http://benitlux.xymus.net/
index 42eae16..719752f 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/crazy_moles/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/moles_android.apk
index b1398f2..7ef0618 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/friendz/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/friendz_android.apk
index 29856ff..adcdf8f 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=examples/mnit_simple/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/test_all.apk
index 125e96c..812edca 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/nitrpg/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+tryit=http://nitlanguage.org/rpg/games/nitlang/nit
index ee1afbd..841f552 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/online_ide/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+tryit=http://nitlanguage.org/online_ide/
index 9e3dae9..5f819b4 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/opportunity/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+tryit=http://xymus.net/opportunity/
index 5f5fba5..43d5e4a 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/pep8analysis/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+tryit=http://pep8.xymus.net/
index dc04026..cf4f9ee 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/tinks/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/tinks.apk
index 42a426c..26ba69a 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=contrib/tnitter/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+tryit=http://tnitter.xymus.net/
index adeb755..80b32cb 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=examples/calculator/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/calculator.apk
index 7314aeb..9db4745 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=examples/mnit_ballz/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/ballz.apk
index fbd7d4f..efa6693 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=examples/mnit_dino/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/dino.apk
index 0fe112a..099ba60 100644 (file)
@@ -9,3 +9,4 @@ git=https://github.com/nitlang/nit.git
 git.directory=examples/shoot/
 homepage=http://nitlanguage.org
 issues=https://github.com/nitlang/nit/issues
+apk=http://nitlanguage.org/fdroid/apk/shoot_android.apk
index 28ae918..59d76b0 100644 (file)
@@ -313,6 +313,21 @@ class Catalog
 <div class="sidebar">
 <ul class="box">
 """
+               var tryit = mpackage.metadata("upstream.tryit")
+               if tryit != null then
+                       score += 1.0
+                       var e = tryit.html_escape
+                       res.add "<li><a href=\"{e}\">Try<span style=\"color:white\">n</span>it!</a></li>\n"
+               end
+               var apk = mpackage.metadata("upstream.apk")
+               if apk != null then
+                       score += 1.0
+                       var e = apk.html_escape
+                       res.add "<li><a href=\"{e}\">Android apk</a></li>\n"
+               end
+
+               res.add """</ul>\n<ul class="box">\n"""
+
                var homepage = mpackage.metadata("upstream.homepage")
                if homepage != null then
                        score += 5.0
@@ -365,28 +380,27 @@ class Catalog
 
                res.add "<h3>Tags</h3>\n"
                var tags = mpackage.metadata("package.tags")
-               var ts2 = new Array[String]
-               var cat = null
+               var ts = new Array[String]
                if tags != null then
-                       var ts = tags.split(",")
-                       for t in ts do
+                       for t in tags.split(",") do
                                t = t.trim
                                if t == "" then continue
-                               if cat == null then cat = t
-                               tag2proj[t].add mpackage
-                               t = t.html_escape
-                               ts2.add "<a href=\"../index.html#tag_{t}\">{t}</a>"
+                               ts.add t
                        end
-                       res.add_list(ts2, ", ", ", ")
                end
-               if ts2.is_empty then
-                       var t = "none"
-                       cat = t
+               if ts.is_empty then ts.add "none"
+               if tryit != null then ts.add "tryit"
+               if apk != null then ts.add "apk"
+               var ts2 = new Array[String]
+               for t in ts do
                        tag2proj[t].add mpackage
-                       res.add "<a href=\"../index.html#tag_{t}\">{t}</a>"
+                       t = t.html_escape
+                       ts2.add "<a href=\"../index.html#tag_{t}\">{t}</a>"
                end
-               if cat != null then cat2proj[cat].add mpackage
-               score += ts2.length.score
+               res.add_list(ts2, ", ", ", ")
+               var cat = ts.first
+               cat2proj[cat].add mpackage
+               score += ts.length.score
 
                if deps.has(mpackage) then
                        var reqs = deps[mpackage].greaters.to_a