You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/03/26 22:28:05 UTC
[18/20] git commit: Added in the new view to only give us search
results we actually care about.
Added in the new view to only give us search results we actually care about.
Project: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/commit/9722c6ad
Tree: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/tree/9722c6ad
Diff: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/diff/9722c6ad
Branch: refs/heads/refactor
Commit: 9722c6adf6b2bc2b9f93fabdecd4e0f8eefc100e
Parents: 8ecff1c
Author: Josh Bavari <jo...@raisemore.com>
Authored: Tue Mar 25 14:02:30 2014 -0500
Committer: Josh Bavari <jo...@raisemore.com>
Committed: Tue Mar 25 14:02:30 2014 -0500
----------------------------------------------------------------------
app.js | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/9722c6ad/app.js
----------------------------------------------------------------------
diff --git a/app.js b/app.js
index a9f1e25..3865714 100644
--- a/app.js
+++ b/app.js
@@ -86,8 +86,28 @@ function dependencies (doc) {
}
}
+function searcher(doc) {
+ if (doc['dist-tags'] && doc['dist-tags'].latest) {
+ var dist = doc.versions[doc['dist-tags'].latest];
+ //We have latest version, now get the platforms available.
+ var engines = dist && dist.engines ? dist.engines : '';
+ var platforms = dist && dist.platforms ? dist.platforms : '';
+ var downloads = 0;
+ var obj = {
+ name: doc.name
+ , description: doc.description
+ , version: doc.dist
+ , downloads: downloads
+ , platforms: platforms
+ , engines: engines
+ };
+ emit(doc._id, obj);
+ }
+}
+
ddoc.views =
{ search: { map: packageSearch }
+ , searcher: { map: searcher }
, dependencies: {map: dependencies, reduce:"_count"}
, updated: {map: function (doc) {
var l = doc["dist-tags"].latest