all files / sync/gpii/node_modules/packagekit/ packageKitDeviceReporter.js

100% Statements 11/11
100% Branches 0/0
100% Functions 3/3
100% Lines 11/11
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× 33857×        
/**
 * GPII PackageKit Device Reporter
 *
 * Copyright 2014 Emergya
 *
 * Licensed under the New BSD license. You may not use this file except in
 * compliance with this License.
 *
 * You may obtain a copy of the License at
 * https://github.com/GPII/linux/blob/master/LICENSE.txt
 *
 * The research leading to these results has received funding from the European Union's
 * Seventh Framework Programme (FP7/2007-2013)
 * under grant agreement no. 289016.
 */
 
"use strict";
 
var fluid = require("universal");
var gpii = fluid.registerNamespace("gpii");
var packageKit = require("./nodepackagekit/build/Release/nodepackagekit.node");
 
fluid.registerNamespace("gpii.packageKit");
 
fluid.defaults("gpii.packageKit.get", {
    gradeNames: "fluid.function",
    argumentMap: {
        filters: 0
    }
});
 
gpii.packageKit.get = function (filters) {
    return {
        "id": "gpii.packageKit",
        "data": packageKit.getPackages(filters)
    };
};
 
fluid.defaults("gpii.packageKit.find", {
    gradeNames: "fluid.function",
    argumentMap: {
        name: 0
    }
});
 
gpii.packageKit.find = function (name) {
    return gpii.packageKit.installedPackagesCache.some(function (pkg) {
        return pkg.name === name;
    });
};