/*!
Device Reporter

Copyright 2012 Raising the Floor - International

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/universal/LICENSE.txt
*/

(function () {
	var os = require("os");
    "use strict";

    var express = require("express"),
        fluid = require("infusion"),
        gpii = fluid.registerNamespace("gpii");
    
    fluid.defaults("gpii.deviceReporter", {
        gradeNames: ["fluid.littleComponent", "autoInit"],
		preInitFunction: "gpii.deviceReporter.preInit"
    
    });
    
    gpii.deviceReporter.preInit = function (that) {
		that.get = function (directModel, callback) {
			callback({
				OS: { 
					//TODO: need to report more details - windowmanager, etc.
					id: os.platform(), 
					version: os.release() 
				}
			});
		}
	}
})();
    
/*!
Device Reporter

Copyright 2012 Raising the Floor - International

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/universal/LICENSE.txt
*/

(function () {
	var os = require("os");
    "use strict";

    var express = require("express"),
        fluid = require("infusion"),
        gpii = fluid.registerNamespace("gpii");
    
    fluid.defaults("gpii.deviceReporter", {
        gradeNames: ["fluid.littleComponent", "autoInit"],
		preInitFunction: "gpii.deviceReporter.preInit"
    
    });
    
    gpii.deviceReporter.preInit = function (that) {
		that.get = function (directModel, callback) {
			callback({
				OS: { 
					//TODO: need to report more details - windowmanager, etc.
					id: os.platform(), 
					version: os.release().replace("_", "-") // TODO: Need a better strategy--Node semver fails horribly in the face of the benign underscore (eg. x86_64).
				}
			});
		}
	}
})();
    
Work around for semver's hatred of underscores. 64-bit linux kernels return a release version number to node containing the suffix ".x86_64". Node semver's regexps collapse in the face of underscores.
Work around for semver's hatred of underscores.
64-bit linux kernels return a release version number to node containing the suffix ".x86_64". Node semver's regexps collapse in the face of underscores.
