<commit_before>/*#ifndef(UMD)*/
(function () { /* Begin of privacy scope */
    "use strict";
/*#endif*/

    var
        _emptyMember = 0,
        _defAttrBase = gpf._genDefHandler("gpf.attributes", "Attribute");

    gpf.attributes = {};

    /**
     * Generates a factory capable of creating a new instance of a class
     *
     * @param {Function} objectClass Object constructor
     * @param {String} name Alias name (will be prefixed by $)
     * @private
     * @closure
     */
    function _alias(objectClass, name) {
        name = "$" + name;
        gpf[name] = (function(){
            var Proxy = (gpf._func("return function " + name + "(args) {" +
                "this.constructor.apply(this, args);" +
            "};"))();
            Proxy.prototype = objectClass.prototype;
            return function() {
                return new Proxy(arguments);
            };
        }());
    }

    /**
     * Defines an attribute (relies on gpf.define)
     *
     * @param {String} name Attribute name. If it contains a dot, it is
     * treated as absolute contextual. Otherwise, it is relative to
     * "gpf.attributes". If starting with $ (and no dot), the contextual name
     * will be the "gpf.attributes." + name(without $) + "Attribute" and an
     * alias is automatically created (otherwise, use $Alias attribute on class)
     * @param {Function|string} [base=undefined] base Base attribute
     * (or contextual name)
     * @param {Object} [definition=undefined] definition Attribute definition
     * @return {Function}
     * @private
     */
    gpf._defAttr = function (name, base, definition) {
        var
            isAlias = name.charAt(0) === "$",
            fullName,
            result;
        if (isAlias) {
            name = name.substr(1);
            fullName = name + "Attribute";
        } else {
            fullName = name;
        }
        result = _defAttrBase(fullName, base, definition);
        if (isAlias) {
            _alias(result, name);
        }
        return result;
    };

    /**
     * Base class for any attribute
     *
     * @class gpf.attributes.Attribute
     */
    gpf._defAttr("Attribute", {

        protected: {

            /**
             * Name of the member the attribute is associated to
             *
             * @type {String}
             * @protected
             * @friend {gpf.attributes.add}
             */
            _member: "",

            /**
             * This method is the implementation of the attribute: it receives
             * the prototype to alter.
             *
             * NOTE: this is called *after* all declared members are set
             *
             * @param {Object} objPrototype Class prototype
             * @protected
             * @friend {gpf.attributes.add}
             */
            _alterPrototype: function /*abstract*/ (objPrototype) {
                gpf.interfaces.ignoreParameter(objPrototype);
            }

        },

        public: {

            /**
             * Get the member name
             *
             * @return {String}
             */
            member: function () {
                return this._member;
            }

        }

    });

    /**
     * Generates an alias for the attribute. An alias is a factory function that
     * allocates an attribute instance (parameters are forwarded).
     * As a result, instead of using:
     * "[Class]" : [new gpf.attributes.AliasAttribute("Name")]
     * It is reduced to:
     * "[Class]" : [$Alias("Name")]
     *
     * @param {String} name Name of the alias to build below gpf
     *
     * @class gpf.attributes.AliasAttribute
     * @extends gpf.attributes.Attribute
     * @alias gpf.$Alias
     */
    gpf._defAttr("$Alias", {

        private: {

            /**
             * Name of the alias to create
             *
             * @type {String}
             * @private
             */
            _name: ""

        },

        protected: {

            /**
             * @inheritDoc gpf.attributes.Attribute:_alterPrototype
             */
            _alterPrototype: function (objPrototype) {
                _alias(objPrototype.constructor, this._name);
            }

        },

        public: {

            /**
             * Defines an alias
             *
             * @param {String} name Name of the alias to create
             * @constructor
             */
            constructor: function (name) {
                this._name = name;
            }

        }

    });

    /**
     * Attribute array, generally used to list attributes on a class member
     *
     * @class gpf.attributes.Array
     * @implements gpf.interfaces.IReadOnlyArray
     */
    gpf.define("gpf.attributes.Array", {

        private: {

            /**
             * @type {gpf.attributes.Attribute[]}
             * @private
             */
            _array: []

        },

        public: {

            /**
             * @constructor
             */
            constructor: function () {
                this._array = []; // Create a new instance of the array
            },

            /**
             * Return the first occurrence of the expected class
             *
             * @param {gpf.attributes.Attribute} expectedClass the class to
             * match
             * @return {gpf.attributes.Attribute}
             */
            has: function (expectedClass) {
                gpf.ASSERT("function" === typeof expectedClass,
                    "Expected a class parameter");
                gpf.ASSERT(
                    expectedClass.prototype instanceof gpf.attributes.Attribute,
                    "Expected an Attribute-like class parameter");
                var
                    idx,
                    array = this._array,
                    len = array.length,
                    item;
                for (idx = 0; idx < len; ++idx) {
                    item = array[idx];
                    if (item instanceof expectedClass) {
                        return item;
                    }
                }
                return null;
            },

            /**
             * Returns a new array with all attributes matching the expected
             * class
             *
             * @param {Function} expectedClass the class to match
             * @return {gpf.attributes.Array}
             */
            filter: function (expectedClass) {
                gpf.ASSERT("function" === typeof expectedClass,
                    "Expected a class parameter");
                gpf.ASSERT(
                    expectedClass.prototype instanceof gpf.attributes.Attribute,
                    "Expected an Attribute-like class parameter");
                var
                    idx,
                    array = this._array,
                    len = array.length,
                    attribute,
                    result = new gpf.attributes.Array(),
                    resultArray = result._array;
                for (idx = 0; idx < len; ++idx) {
                    attribute = array[idx];
                    if (attribute instanceof expectedClass) {
                        resultArray.push(attribute);
                    }
                }
                return result;
            },

            /**
             * Apply the callback for each attribute in the array.
             * If the callback returns anything, the loop stops and the result
             * is returned to the caller.
             *
             * @param {Function} callback, defined with parameters
             * * {gpf.attributes.Attribute} attribute
             * No result is expected
             * @param {Object} [scope=undefined] scope
             * @param {*} [params=undefined] params Additional parameters
             * appended at the end of the expected parameter list
             * @return {*}
             */
            each: function (callback, scope, params) {
                scope = gpf.Callback.resolveScope(scope);
                params = gpf.Callback.buildParamArray(1, params);
                var
                    idx,
                    array = this._array,
                    len = array.length,
                    result;
                for (idx = 0; idx < len; ++idx) {
                    result = gpf.Callback.doApply(callback, scope, params,
                        array[idx]);
                    if (undefined !== result) {
                        return result;
                    }
                }
            }
        }

    });

    /**
     * Attribute map, generally used to list attributes of a class
     *
     * @class gpf.attributes.Map
     */
    gpf.define("gpf.attributes.Map", {

        private: {

            /**
             * @type {Object} Map(String,gpf.attributes.Array)
             * @private
             */
            _members: {},

            /**
             * @type {Number}
             * @private
             */
            _count: 0,

            /**
             * Copy the content of this map to a new one
             *
             * @param {gpf.attributes.Map} attributesMap recipient of the copy
             * @param {Function} [callback=undefined] callback callback function
             * to test if the mapping should be added
             * @param {*} [param=undefined] param additional parameter for the
             * callback
             * @private
             */
            _copyTo: function (attributesMap, callback, param) {
                var
                    members = this._members,
                    member,
                    array,
                    idx,
                    attribute;
                if (this._count) {
                    for (member in members) {
                        if (members.hasOwnProperty(member)) {
                            array = members[member]._array;
                            for (idx = 0; idx < array.length; ++idx) {
                                attribute = array[ idx ];
                                if (!callback
                                    || callback(member, attribute, param)) {
                                    attributesMap.add(member, attribute);
                                }
                            }
                        }
                    }
                }
            },

            /**
             * Callback for _copyTo, test if attribute is of a given class
             *
             * @param {String} member
             * @param {gpf.attributes.Attribute} attribute
             * @param {Function} expectedClass
             * @return {Boolean}
             * @private
             */
            _filterCallback: function (member, attribute, expectedClass) {
                gpf.interfaces.ignoreParameter(member);
                return attribute instanceof expectedClass;
            }

        },

        public: {

            /**
             * @param {Object} [object=undefined] object Object to read
             *        attributes from
             * @constructor
             */
            constructor: function (object) {
                this._members = {}; // Creates a new dictionary
                this._count = 0;
                if (undefined !== object) {
                    this.fillFromObject(object);
                }
            },

            /**
             * Gives the total number of attributes enclosed in the map
             *
             * @return {Number}
             */
            count: function () {
                return this._count;
            },

            /**
             * Associate an attribute to a member
             *
             * @param {String} member member name
             * @param {gpf.attributes.Attribute} attribute attribute to map
             */
            add: function (member, attribute) {
                var array = this._members[member];
                if (undefined === array) {
                    array = this._members[member] = new gpf.attributes.Array();
                }
                array._array.push(attribute);
                ++this._count;
            },

            /**
             * Fill the map using object's attributes
             *
             * @param {Object} object object to get attributes from
             * @return {Number} number of attributes in the resulting map
             */
            fillFromObject: function (object) {
                return this.fillFromClassDef(gpf.classDef(object.constructor));
            },

            /**
             * Fill the map using class definition object
             *
             * @param {gpf.classDef} classDef class definition
             * @return {Number} number of attributes in the resulting map
             */
            fillFromClassDef: function (classDef) {
                var
                    attributes;
                while (classDef) { // !undefined && !null
                    attributes = classDef.attributes();
                    if (attributes) {
                        attributes._copyTo(this);
                    }
                    if (classDef.Base() !== Object) { // Can't go upper
                        classDef = gpf.classDef(classDef.Base());
                    } else {
                        break;
                    }
                }
                return this._count;
            },

            /**
             * Creates a new map that contains only instances of the given
             * attribute class
             *
             * @param {Function} expectedClass
             * @return {gpf.attributes.Map}
             */
            filter: function (expectedClass) {
                gpf.ASSERT("function" === typeof expectedClass,
                    "Expected a class parameter");
                gpf.ASSERT(
                    expectedClass.prototype instanceof gpf.attributes.Attribute,
                    "Expected an Attribute-like class parameter");
                var result = new gpf.attributes.Map();
                this._copyTo(result, this._filterCallback, expectedClass);
                return result;
            },

            /**
             * Returns the array of map associated to a member
             *
             * @param {String} name
             * @return {gpf.attributes.Array}
             */
            member: function (name) {
                /**
                 * When member is a known Object member (i.e. constructor),
                 * this generates weird results. Filter out by testing the
                 * result type.
                 */
                var result = this._members[name];
                if (undefined === result
                    || !(result instanceof gpf.attributes.Array)) {
                    if (0 === _emptyMember) {
                        _emptyMember = new gpf.attributes.Array();
                    }
                    result = _emptyMember;
                }
                return result;
            },

            /**
             * Returns the list of members stored in this map
             *
             * @perf_warn Result is computed on each call
             * @return {String[]}
             */
            members: function () {
                var
                    members = this._members,
                    result = [],
                    member;
                for (member in members) {
                    if (members.hasOwnProperty(member)) {
                        result.push(member);
                    }
                }
                return result;
            },

            /**
             * Apply the callback for each member in the map
             * If the callback returns anything, the loop stops and the result
             * is returned to the caller.
             *
             * @param {Function} callback, defined with parameters
             * * {String} member
             * * {gpf.attributes.Array} attributes
             * No result is expected
             * @param {Object} [scope=undefined] scope
             * @param {*} [params=undefined] params Additional parameters
             * appended at the end of the expected parameter list
             * @return {*}
             */
            each: function (callback, scope, params) {
                scope = gpf.Callback.resolveScope(scope);
                params = gpf.Callback.buildParamArray(2, params);
                var
                    members = this._members,
                    member,
                    result;
                for (member in members) {
                    if (members.hasOwnProperty(member)) {
                        result = gpf.Callback.doApply(callback, scope, params,
                            member, members[member]);
                        if (undefined !== result) {
                            return result;
                        }
                    }
                }
            },

            /**
             * Add the attributes contained in the map to the given prototype
             *
             * @param {Function} objectClass
             */
            addTo: function (objectClass) {
                var
                    members = this._members,
                    member;
                for (member in members) {
                    if (members.hasOwnProperty(member)) {
                        gpf.attributes.add(objectClass, member,
                            members[member]);
                    }
                }
            }

        }

    });

    /**
     * Add the attribute list to the given prototype associated with the
     * provided member name
     *
     * @param {Function} objectClass class constructor
     * @param {String} name member name
     * @param {gpf.attributes.Attribute[]} attributes
     */
    gpf.attributes.add = function (objectClass, name, attributes) {
        var
            attributeList,
            len,
            idx,
            attribute;
        attributeList = gpf.classDef(objectClass).attributes();
        len = attributes.length;
        for (idx = 0; idx < len; ++idx) {
            attribute = attributes[idx];
            attribute._member = name; // Assign member name
            attributeList.add(name, attribute);
            attribute._alterPrototype(objectClass.prototype);
        }
    };

/*#ifndef(UMD)*/
}()); /* End of privacy scope */
/*#endif*/<commit_msg>New source model<commit_after>/*#ifndef(UMD)*/
"use strict";
/*global _gpfFunc*/ // Create a new function using the source
// /*#endif*/

var
    _emptyMember = 0,
    _defAttrBase = gpf._genDefHandler("gpf.attributes", "Attribute");

gpf.attributes = {};

/**
 * Generates a factory capable of creating a new instance of a class
 *
 * @param {Function} objectClass Object constructor
 * @param {String} name Alias name (will be prefixed by $)
 * @private
 * @closure
 */
function _alias(objectClass, name) {
    name = "$" + name;
    gpf[name] = (function(){
        var Proxy = (_gpfFunc("return function " + name + "(args) {" +
            "this.constructor.apply(this, args);" +
        "};"))();
        Proxy.prototype = objectClass.prototype;
        return function() {
            return new Proxy(arguments);
        };
    }());
}

/**
 * Defines an attribute (relies on gpf.define)
 *
 * @param {String} name Attribute name. If it contains a dot, it is
 * treated as absolute contextual. Otherwise, it is relative to
 * "gpf.attributes". If starting with $ (and no dot), the contextual name
 * will be the "gpf.attributes." + name(without $) + "Attribute" and an
 * alias is automatically created (otherwise, use $Alias attribute on class)
 * @param {Function|string} [base=undefined] base Base attribute
 * (or contextual name)
 * @param {Object} [definition=undefined] definition Attribute definition
 * @return {Function}
 * @private
 */
gpf._defAttr = function (name, base, definition) {
    var
        isAlias = name.charAt(0) === "$",
        fullName,
        result;
    if (isAlias) {
        name = name.substr(1);
        fullName = name + "Attribute";
    } else {
        fullName = name;
    }
    result = _defAttrBase(fullName, base, definition);
    if (isAlias) {
        _alias(result, name);
    }
    return result;
};

/**
 * Base class for any attribute
 *
 * @class gpf.attributes.Attribute
 */
gpf._defAttr("Attribute", {

    protected: {

        /**
         * Name of the member the attribute is associated to
         *
         * @type {String}
         * @protected
         * @friend {gpf.attributes.add}
         */
        _member: "",

        /**
         * This method is the implementation of the attribute: it receives
         * the prototype to alter.
         *
         * NOTE: this is called *after* all declared members are set
         *
         * @param {Object} objPrototype Class prototype
         * @protected
         * @friend {gpf.attributes.add}
         */
        _alterPrototype: function /*abstract*/ (objPrototype) {
            gpf.interfaces.ignoreParameter(objPrototype);
        }

    },

    public: {

        /**
         * Get the member name
         *
         * @return {String}
         */
        member: function () {
            return this._member;
        }

    }

});

/**
 * Generates an alias for the attribute. An alias is a factory function that
 * allocates an attribute instance (parameters are forwarded).
 * As a result, instead of using:
 * "[Class]" : [new gpf.attributes.AliasAttribute("Name")]
 * It is reduced to:
 * "[Class]" : [$Alias("Name")]
 *
 * @param {String} name Name of the alias to build below gpf
 *
 * @class gpf.attributes.AliasAttribute
 * @extends gpf.attributes.Attribute
 * @alias gpf.$Alias
 */
gpf._defAttr("$Alias", {

    private: {

        /**
         * Name of the alias to create
         *
         * @type {String}
         * @private
         */
        _name: ""

    },

    protected: {

        /**
         * @inheritDoc gpf.attributes.Attribute:_alterPrototype
         */
        _alterPrototype: function (objPrototype) {
            _alias(objPrototype.constructor, this._name);
        }

    },

    public: {

        /**
         * Defines an alias
         *
         * @param {String} name Name of the alias to create
         * @constructor
         */
        constructor: function (name) {
            this._name = name;
        }

    }

});

/**
 * Attribute array, generally used to list attributes on a class member
 *
 * @class gpf.attributes.Array
 * @implements gpf.interfaces.IReadOnlyArray
 */
gpf.define("gpf.attributes.Array", {

    private: {

        /**
         * @type {gpf.attributes.Attribute[]}
         * @private
         */
        _array: []

    },

    public: {

        /**
         * @constructor
         */
        constructor: function () {
            this._array = []; // Create a new instance of the array
        },

        /**
         * Return the first occurrence of the expected class
         *
         * @param {gpf.attributes.Attribute} expectedClass the class to
         * match
         * @return {gpf.attributes.Attribute}
         */
        has: function (expectedClass) {
            gpf.ASSERT("function" === typeof expectedClass,
                "Expected a class parameter");
            gpf.ASSERT(
                expectedClass.prototype instanceof gpf.attributes.Attribute,
                "Expected an Attribute-like class parameter");
            var
                idx,
                array = this._array,
                len = array.length,
                item;
            for (idx = 0; idx < len; ++idx) {
                item = array[idx];
                if (item instanceof expectedClass) {
                    return item;
                }
            }
            return null;
        },

        /**
         * Returns a new array with all attributes matching the expected
         * class
         *
         * @param {Function} expectedClass the class to match
         * @return {gpf.attributes.Array}
         */
        filter: function (expectedClass) {
            gpf.ASSERT("function" === typeof expectedClass,
                "Expected a class parameter");
            gpf.ASSERT(
                expectedClass.prototype instanceof gpf.attributes.Attribute,
                "Expected an Attribute-like class parameter");
            var
                idx,
                array = this._array,
                len = array.length,
                attribute,
                result = new gpf.attributes.Array(),
                resultArray = result._array;
            for (idx = 0; idx < len; ++idx) {
                attribute = array[idx];
                if (attribute instanceof expectedClass) {
                    resultArray.push(attribute);
                }
            }
            return result;
        },

        /**
         * Apply the callback for each attribute in the array.
         * If the callback returns anything, the loop stops and the result
         * is returned to the caller.
         *
         * @param {Function} callback, defined with parameters
         * * {gpf.attributes.Attribute} attribute
         * No result is expected
         * @param {Object} [scope=undefined] scope
         * @param {*} [params=undefined] params Additional parameters
         * appended at the end of the expected parameter list
         * @return {*}
         */
        each: function (callback, scope, params) {
            scope = gpf.Callback.resolveScope(scope);
            params = gpf.Callback.buildParamArray(1, params);
            var
                idx,
                array = this._array,
                len = array.length,
                result;
            for (idx = 0; idx < len; ++idx) {
                result = gpf.Callback.doApply(callback, scope, params,
                    array[idx]);
                if (undefined !== result) {
                    return result;
                }
            }
        }
    }

});

/**
 * Attribute map, generally used to list attributes of a class
 *
 * @class gpf.attributes.Map
 */
gpf.define("gpf.attributes.Map", {

    private: {

        /**
         * @type {Object} Map(String,gpf.attributes.Array)
         * @private
         */
        _members: {},

        /**
         * @type {Number}
         * @private
         */
        _count: 0,

        /**
         * Copy the content of this map to a new one
         *
         * @param {gpf.attributes.Map} attributesMap recipient of the copy
         * @param {Function} [callback=undefined] callback callback function
         * to test if the mapping should be added
         * @param {*} [param=undefined] param additional parameter for the
         * callback
         * @private
         */
        _copyTo: function (attributesMap, callback, param) {
            var
                members = this._members,
                member,
                array,
                idx,
                attribute;
            if (this._count) {
                for (member in members) {
                    if (members.hasOwnProperty(member)) {
                        array = members[member]._array;
                        for (idx = 0; idx < array.length; ++idx) {
                            attribute = array[ idx ];
                            if (!callback
                                || callback(member, attribute, param)) {
                                attributesMap.add(member, attribute);
                            }
                        }
                    }
                }
            }
        },

        /**
         * Callback for _copyTo, test if attribute is of a given class
         *
         * @param {String} member
         * @param {gpf.attributes.Attribute} attribute
         * @param {Function} expectedClass
         * @return {Boolean}
         * @private
         */
        _filterCallback: function (member, attribute, expectedClass) {
            gpf.interfaces.ignoreParameter(member);
            return attribute instanceof expectedClass;
        }

    },

    public: {

        /**
         * @param {Object} [object=undefined] object Object to read
         *        attributes from
         * @constructor
         */
        constructor: function (object) {
            this._members = {}; // Creates a new dictionary
            this._count = 0;
            if (undefined !== object) {
                this.fillFromObject(object);
            }
        },

        /**
         * Gives the total number of attributes enclosed in the map
         *
         * @return {Number}
         */
        count: function () {
            return this._count;
        },

        /**
         * Associate an attribute to a member
         *
         * @param {String} member member name
         * @param {gpf.attributes.Attribute} attribute attribute to map
         */
        add: function (member, attribute) {
            var array = this._members[member];
            if (undefined === array) {
                array = this._members[member] = new gpf.attributes.Array();
            }
            array._array.push(attribute);
            ++this._count;
        },

        /**
         * Fill the map using object's attributes
         *
         * @param {Object} object object to get attributes from
         * @return {Number} number of attributes in the resulting map
         */
        fillFromObject: function (object) {
            return this.fillFromClassDef(gpf.classDef(object.constructor));
        },

        /**
         * Fill the map using class definition object
         *
         * @param {gpf.classDef} classDef class definition
         * @return {Number} number of attributes in the resulting map
         */
        fillFromClassDef: function (classDef) {
            var
                attributes;
            while (classDef) { // !undefined && !null
                attributes = classDef.attributes();
                if (attributes) {
                    attributes._copyTo(this);
                }
                if (classDef.Base() !== Object) { // Can't go upper
                    classDef = gpf.classDef(classDef.Base());
                } else {
                    break;
                }
            }
            return this._count;
        },

        /**
         * Creates a new map that contains only instances of the given
         * attribute class
         *
         * @param {Function} expectedClass
         * @return {gpf.attributes.Map}
         */
        filter: function (expectedClass) {
            gpf.ASSERT("function" === typeof expectedClass,
                "Expected a class parameter");
            gpf.ASSERT(
                expectedClass.prototype instanceof gpf.attributes.Attribute,
                "Expected an Attribute-like class parameter");
            var result = new gpf.attributes.Map();
            this._copyTo(result, this._filterCallback, expectedClass);
            return result;
        },

        /**
         * Returns the array of map associated to a member
         *
         * @param {String} name
         * @return {gpf.attributes.Array}
         */
        member: function (name) {
            /**
             * When member is a known Object member (i.e. constructor),
             * this generates weird results. Filter out by testing the
             * result type.
             */
            var result = this._members[name];
            if (undefined === result
                || !(result instanceof gpf.attributes.Array)) {
                if (0 === _emptyMember) {
                    _emptyMember = new gpf.attributes.Array();
                }
                result = _emptyMember;
            }
            return result;
        },

        /**
         * Returns the list of members stored in this map
         *
         * @perf_warn Result is computed on each call
         * @return {String[]}
         */
        members: function () {
            var
                members = this._members,
                result = [],
                member;
            for (member in members) {
                if (members.hasOwnProperty(member)) {
                    result.push(member);
                }
            }
            return result;
        },

        /**
         * Apply the callback for each member in the map
         * If the callback returns anything, the loop stops and the result
         * is returned to the caller.
         *
         * @param {Function} callback, defined with parameters
         * * {String} member
         * * {gpf.attributes.Array} attributes
         * No result is expected
         * @param {Object} [scope=undefined] scope
         * @param {*} [params=undefined] params Additional parameters
         * appended at the end of the expected parameter list
         * @return {*}
         */
        each: function (callback, scope, params) {
            scope = gpf.Callback.resolveScope(scope);
            params = gpf.Callback.buildParamArray(2, params);
            var
                members = this._members,
                member,
                result;
            for (member in members) {
                if (members.hasOwnProperty(member)) {
                    result = gpf.Callback.doApply(callback, scope, params,
                        member, members[member]);
                    if (undefined !== result) {
                        return result;
                    }
                }
            }
        },

        /**
         * Add the attributes contained in the map to the given prototype
         *
         * @param {Function} objectClass
         */
        addTo: function (objectClass) {
            var
                members = this._members,
                member;
            for (member in members) {
                if (members.hasOwnProperty(member)) {
                    gpf.attributes.add(objectClass, member,
                        members[member]);
                }
            }
        }

    }

});

/**
 * Add the attribute list to the given prototype associated with the
 * provided member name
 *
 * @param {Function} objectClass class constructor
 * @param {String} name member name
 * @param {gpf.attributes.Attribute[]} attributes
 */
gpf.attributes.add = function (objectClass, name, attributes) {
    var
        attributeList,
        len,
        idx,
        attribute;
    attributeList = gpf.classDef(objectClass).attributes();
    len = attributes.length;
    for (idx = 0; idx < len; ++idx) {
        attribute = attributes[idx];
        attribute._member = name; // Assign member name
        attributeList.add(name, attribute);
        attribute._alterPrototype(objectClass.prototype);
    }
};<|endoftext|>


<commit_before>(function ($) {
    $.mobiscroll.i18n.pl = $.extend($.mobiscroll.i18n.pl, {
      // Core
        setText: 'Set',
        cancelText: 'Cancel',
        clearText: 'Clear',
        selectedText: 'Selected',
        // Datetime component
        dateFormat: 'dd/mm/yy',
        dateOrder: 'ddmmy',
        dayNames: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
        dayNamesShort: ['Niedz.', 'Pon.', 'Wt.', 'Śr.', 'Czw.', 'Pt.', 'Sob.'],
        dayText: 'Day',
        hourText: 'Hours',
        minuteText: 'Minutes',
        monthNames: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
        monthNamesShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'],
        monthText: 'Month',
        secText: 'Seconds',
        timeFormat: 'hh:ii A',
        timeWheels: 'hhiiA',
        yearText: 'Year',
        nowText: 'Now',
        amText: 'am',
        pmText: 'pm',
        // Calendar component
        dateText: 'Date',
        timeText: 'Time',
        calendarText: 'Calendar',
        closeText: 'Close',
        // Daterange component
        fromText: 'Start',
        toText: 'End',
        // Measurement components
        wholeText: 'Whole',
        fractionText: 'Fraction',
        unitText: 'Unit',
        // Time / Timespan component
        labels: ['Years', 'Months', 'Days', 'Hours', 'Minutes', 'Seconds', ''],
        labelsShort: ['Yrs', 'Mths', 'Days', 'Hrs', 'Mins', 'Secs', ''],
        // Timer component
        startText: 'Start',
        stopText: 'Stop',
        resetText: 'Reset',
        lapText: 'Lap',
        hideText: 'Hide'
    });
})(jQuery);
<commit_msg>Polish support.<commit_after>(function ($) {
    $.mobiscroll.i18n.pl = $.extend($.mobiscroll.i18n.pl, {
      // Core
        setText: 'Zestaw',
        cancelText: 'Anuluj',
        clearText: 'Oczyścić',
        selectedText: 'Wybór',
        // Datetime component
        dateFormat: 'dz/mm/rr',
        dateOrder: 'ddmmy',
        dayNames: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
        dayNamesShort: ['Niedz.', 'Pon.', 'Wt.', 'Śr.', 'Czw.', 'Pt.', 'Sob.'],
        dayText: 'Dzień',
        hourText: 'Godziny',
        minuteText: 'Minuty',
        monthNames: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
        monthNamesShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'],
        monthText: 'Miesiąc',
        secText: 'Sekundy',
        timeFormat: 'hh:ii A',
        timeWheels: 'hhiiA',
        yearText: 'Rok',
        nowText: 'Teraz',
        amText: 'rano',
        pmText: 'po południu',
        // Calendar component
        dateText: 'Data',
        timeText: 'Czas',
        calendarText: 'Kalendarz',
        closeText: 'Zakończenie',
        // Daterange component
        fromText: 'Rozpoczęcie',
        toText: 'Koniec',
        // Measurement components
        wholeText: 'Cały',
        fractionText: 'Ułamek',
        unitText: 'Jednostka',
        // Time / Timespan component
        labels: ['Lata', 'Miesiąc', 'Dni', 'Godziny', 'Minuty', 'Sekundy', ''],
        labelsShort: ['R', 'M', 'Dz', 'Godz', 'Min', 'Sek', ''],
        // Timer component
        startText: 'Rozpoczęcie',
        stopText: 'Zatrzymać',
        resetText: 'Zresetować',
        lapText: 'Zakładka',
        hideText: 'Ukryć'
    });
})(jQuery);<|endoftext|>


<commit_before>Package.describe({
  name: 'elmarti:video-chat',
  version: '0.3.1',
  // Brief, one-line summary of the package.
  summary: 'Simple WebRTC Video Chat for your app.',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/elmarti/meteor-video-chat',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.use('ecmascript');
  api.use("mizzao:user-status@0.6.6");
  api.use(['templating'], 'client');
  api.addFiles(['services/server.js', 'services/publish.js'], "server");
  api.addFiles(['template.js', 'services/client.js'], "client");
  api.export(['VideoChatCallLog', 'VideoCallServices', "renderCallTemplate"]);
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tinytest');

  api.addFiles('video-chat-tests.js');
  api.export([]);
});
<commit_msg>call filtering<commit_after>Package.describe({
  name: 'elmarti:video-chat',
  version: '0.3.2',
  // Brief, one-line summary of the package.
  summary: 'Simple WebRTC Video Chat for your app.',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/elmarti/meteor-video-chat',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.use('ecmascript');
  api.use("mizzao:user-status@0.6.6");
  api.use(['templating'], 'client');
  api.addFiles(['services/server.js', 'services/publish.js'], "server");
  api.addFiles(['template.js', 'services/client.js'], "client");
  api.export(['VideoChatCallLog', 'VideoCallServices', "renderCallTemplate"]);
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tinytest');

  api.addFiles('video-chat-tests.js');
  api.export([]);
});
<|endoftext|>


<commit_before>// Copyright (c) Cognitect, Inc.
// All rights reserved.

"use strict";

var caching = require("./caching"),
    types   = require("./types"),
    d       = require("./delimiters");

// =============================================================================
// Utilities

function regexpEscape(s) {
    return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
};

var ESC_ESC = regexpEscape(d.ESC),
    ESC_SUB = regexpEscape(d.SUB),
    ESC_RES = regexpEscape(d.RES),
    IS_ESCAPED  = new RegExp("^"+ESC_ESC+"("+ESC_SUB+"|"+ESC_ESC+"|"+ESC_RES+")"),
    IS_UNRECOGNIZED = new RegExp("^"+d.ESC+"\\w");

// =============================================================================
// Decoder

var Decoder = function(options) {
  this.options = options || {};
  if(!this.options.decoders) {
    this.options.decoders = {};
  }
};

Decoder.prototype = {
  defaults: {
    decoders: {
      "_": function(v) { return types.nullValue(); },
      ":": function(v) { return types.keyword(v); },
      "?": function(v) { return types.boolValue(v); },
      "b": function(v) { return types.byteBuffer(v); },
      "i": function(v) { return types.intValue(v); },
      "d": function(v) { return types.floatValue(v); },
      "f": function(v) { return types.floatValue(v); },
      "c": function(v) { return types.charValue(v); },
      "$": function(v) { return types.symbol(v); },
      "r": function(v) { return types.uri(v); },

      // tagged
      "'": function(v) { return v; },
      "t": function(v) { return types.date(v); },
      "u": function(v) { return types.uuid(v); },
      "set": function(v) { return types.set(v); },
      "list": function(v) { return types.list(v); },
      "ints": function(v) { return types.ints(v); },
      "longs": function(v) { return types.longs(v); },
      "floats": function(v) { return types.floats(v); },
      "doubles": function(v) { return types.doubles(v); },
      "bools": function(v) { return types.bools(v); },
      "cmap": function(v) { return types.cmap(v); },
    },
    defaultStringDecoder: function(v) { return "`"+v },
    defaultHashDecoder: function(h) {
      var ks = Object.keys(h), key = ks[0];
      return types.taggedValue(key, h[key]);
    },
    convertMaps: false
  },

  getOption: function(key) {
    return this.options[key] || this.defaults[key];
  },

  getDecoder: function(key) {
    return this.options.decoders[key] || this.defaults.decoders[key];
  },

  setDecoder: function(key, b) {
    this.options.decoders[key] = b;
  },

  decode: function(node, cache, asMapKey) {
    cache = cache || new caching.readCache();
    asMapKey = asMapKey || false;

    if(typeof node === "string") {
      return this.decodeString(node, cache, asMapKey);
    } else if(Array.isArray(node)) {
      return this.decodeArray(node, cache);
    } else if(node === null) {
      return node;
    } else if(typeof node === "object") {
      return this.decodeHash(node, cache, asMapKey);
    } else {
      return node;
    }
  },

  decodeString: function(string, cache, asMapKey) {
    if(caching.isCacheable(string, asMapKey)) {
      var val = this.parseString(string, cache, asMapKey);
      cache.write(string, val);
      return val;
    } else if(caching.isCacheCode(string)) {
      return cache.read(string);
    } else {
      return this.parseString(string, cache, asMapKey);
    }
  },

  decodeHash: function(hash, cache, asMapKey) {
    var ks = Object.keys(hash);
    if((ks.length === 1) &&
       (ks[0][0]  === d.ESC) &&
       (ks[0][1]  === d.TAG)) {
      var key     = ks[0],
          val     = hash[ks[0]],
          decoder = this.getDecoder(key.substring(2));
      if(decoder) {
        return decoder(this.decode(val, cache, false));
      } else {
        var h = {}; h[key.substring(2)] = this.decode(val,cache);
        return this.getOption("defaultHashDecoder")(h, cache, false);
      }
    } else {
      var ret = {};
      for(var i = 0; i < ks.length; i++) {
        var key = this.getOption("covertMaps") ? this.decode(ks[i], cache, true) : ks[i];
        ret[key] = this.decode(hash[ks[i]], cache, false);
      }
      return ret;
    }
  },

  decodeArray: function(node, cache, asMapKey) {
    var res = [];
    for(var i = 0; i < node.length; i++) {
      res.push(this.decode(node[i], cache, asMapKey));
    }
    return res;
  },

  parseString: function(string, cache, asMapKey) {
    if(IS_ESCAPED.test(string)) {
      return string.substring(1);
    } else {
      var decoder = this.getDecoder(string[1]);
      if(decoder) {
        return decoder(string.substring(2));
      } else if(IS_UNRECOGNIZED.test(string)) {
        return this.getOption("defaultStringDecoder")(string);
      } else {
        return string;
      }
    }
  }
};

function decoder(options) {
  return new Decoder(options);
}

module.exports = {
  decoder: decoder,
  Decoder: Decoder
};

<commit_msg>move keyword case up in decoder<commit_after>// Copyright (c) Cognitect, Inc.
// All rights reserved.

"use strict";

var caching = require("./caching"),
    types   = require("./types"),
    d       = require("./delimiters");

// =============================================================================
// Utilities

function regexpEscape(s) {
    return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
};

var ESC_ESC = regexpEscape(d.ESC),
    ESC_SUB = regexpEscape(d.SUB),
    ESC_RES = regexpEscape(d.RES),
    IS_ESCAPED  = new RegExp("^"+ESC_ESC+"("+ESC_SUB+"|"+ESC_ESC+"|"+ESC_RES+")"),
    IS_UNRECOGNIZED = new RegExp("^"+d.ESC+"\\w");

// =============================================================================
// Decoder

var Decoder = function(options) {
  this.options = options || {};
  if(!this.options.decoders) {
    this.options.decoders = {};
  }
};

Decoder.prototype = {
  defaults: {
    decoders: {
      "_": function(v) { return types.nullValue(); },
      "?": function(v) { return types.boolValue(v); },
      "b": function(v) { return types.byteBuffer(v); },
      "i": function(v) { return types.intValue(v); },
      "d": function(v) { return types.floatValue(v); },
      "f": function(v) { return types.floatValue(v); },
      "c": function(v) { return types.charValue(v); },
      ":": function(v) { return types.keyword(v); },
      "$": function(v) { return types.symbol(v); },
      "r": function(v) { return types.uri(v); },

      // tagged
      "'": function(v) { return v; },
      "t": function(v) { return types.date(v); },
      "u": function(v) { return types.uuid(v); },
      "set": function(v) { return types.set(v); },
      "list": function(v) { return types.list(v); },
      "ints": function(v) { return types.ints(v); },
      "longs": function(v) { return types.longs(v); },
      "floats": function(v) { return types.floats(v); },
      "doubles": function(v) { return types.doubles(v); },
      "bools": function(v) { return types.bools(v); },
      "cmap": function(v) { return types.cmap(v); },
    },
    defaultStringDecoder: function(v) { return "`"+v },
    defaultHashDecoder: function(h) {
      var ks = Object.keys(h), key = ks[0];
      return types.taggedValue(key, h[key]);
    },
    convertMaps: false
  },

  getOption: function(key) {
    return this.options[key] || this.defaults[key];
  },

  getDecoder: function(key) {
    return this.options.decoders[key] || this.defaults.decoders[key];
  },

  setDecoder: function(key, b) {
    this.options.decoders[key] = b;
  },

  decode: function(node, cache, asMapKey) {
    cache = cache || new caching.readCache();
    asMapKey = asMapKey || false;

    if(typeof node === "string") {
      return this.decodeString(node, cache, asMapKey);
    } else if(Array.isArray(node)) {
      return this.decodeArray(node, cache);
    } else if(node === null) {
      return node;
    } else if(typeof node === "object") {
      return this.decodeHash(node, cache, asMapKey);
    } else {
      return node;
    }
  },

  decodeString: function(string, cache, asMapKey) {
    if(caching.isCacheable(string, asMapKey)) {
      var val = this.parseString(string, cache, asMapKey);
      cache.write(string, val);
      return val;
    } else if(caching.isCacheCode(string)) {
      return cache.read(string);
    } else {
      return this.parseString(string, cache, asMapKey);
    }
  },

  decodeHash: function(hash, cache, asMapKey) {
    var ks = Object.keys(hash);
    if((ks.length === 1) &&
       (ks[0][0]  === d.ESC) &&
       (ks[0][1]  === d.TAG)) {
      var key     = ks[0],
          val     = hash[ks[0]],
          decoder = this.getDecoder(key.substring(2));
      if(decoder) {
        return decoder(this.decode(val, cache, false));
      } else {
        var h = {}; h[key.substring(2)] = this.decode(val,cache);
        return this.getOption("defaultHashDecoder")(h, cache, false);
      }
    } else {
      var ret = {};
      for(var i = 0; i < ks.length; i++) {
        var key = this.getOption("covertMaps") ? this.decode(ks[i], cache, true) : ks[i];
        ret[key] = this.decode(hash[ks[i]], cache, false);
      }
      return ret;
    }
  },

  decodeArray: function(node, cache, asMapKey) {
    var res = [];
    for(var i = 0; i < node.length; i++) {
      res.push(this.decode(node[i], cache, asMapKey));
    }
    return res;
  },

  parseString: function(string, cache, asMapKey) {
    if(IS_ESCAPED.test(string)) {
      return string.substring(1);
    } else {
      var decoder = this.getDecoder(string[1]);
      if(decoder) {
        return decoder(string.substring(2));
      } else if(IS_UNRECOGNIZED.test(string)) {
        return this.getOption("defaultStringDecoder")(string);
      } else {
        return string;
      }
    }
  }
};

function decoder(options) {
  return new Decoder(options);
}

module.exports = {
  decoder: decoder,
  Decoder: Decoder
};

<|endoftext|>


<commit_before>(function($) {
  Drupal.behaviors.islandoraOpenSeadragon = {
    attach: function(context, settings) {
      var resourceUri = settings.islandoraOpenSeadragon.resourceUri;
      var config = settings.islandoraOpenSeadragon.settings;

      config.prefixUrl = "/sites/all/themes/numa/images/openseadragon/";
      config.navigatorPosition = 'TOP_RIGHT';
      config.navImages = {
        zoomIn: {
          REST:   'zoomin.png',
          GROUP:  'zoomin.png',
          HOVER:  'zoomin.png',
          DOWN:   'zoomin.png'
        },
        zoomOut: {
          REST:   'zoomout.png',
          GROUP:  'zoomout.png',
          HOVER:  'zoomout.png',
          DOWN:   'zoomout.png'
        },
        home: {
          REST:   'home.png',
          GROUP:  'home.png',
          HOVER:  'home.png',
          DOWN:   'home.png'
        },
        fullpage: {
          REST:   'fullpage.png',
          GROUP:  'fullpage.png',
          HOVER:  'fullpage.png',
          DOWN:   'fullpage.png'
        },
        previous: {
          REST:   'previous.png',
          GROUP:  'previous.png',
          HOVER:  'previous.png',
          DOWN:   'previous.png'
        },
        next: {
          REST:   'next.png',
          GROUP:  'next.png',
          HOVER:  'next.png',
          DOWN:   'next.png'
        }
      };

      var openSeadragonId = '#' + config['id'];
      $(openSeadragonId).each(function () {
        if (!$(this).hasClass('processed')) {
          config.tileSources = new Array();
          resourceUri = (resourceUri instanceof Array) ? resourceUri : new Array(resourceUri);
          $.each(resourceUri, function(index, uri) {
            var tileSource = new OpenSeadragon.DjatokaTileSource(uri, settings.islandoraOpenSeadragon);
            config.tileSources.push(tileSource);
          });
          new OpenSeadragon(config);
          $(this).addClass('processed');
        }
      });
    }
  };
})(jQuery);
<commit_msg>LAADP-39: Theme catalog item responsively and update open sea dragon custom icons.<commit_after>(function($) {
  Drupal.behaviors.islandoraOpenSeadragon = {
    attach: function(context, settings) {
      var resourceUri = settings.islandoraOpenSeadragon.resourceUri;
      var config = settings.islandoraOpenSeadragon.settings;

      config.prefixUrl = "/sites/all/themes/numa/images/openseadragon/";
      config.navigatorPosition = 'TOP_RIGHT';
      /*config.navImages = {
        zoomIn: {
          REST:   'zoomin.png',
          GROUP:  'zoomin.png',
          HOVER:  'zoomin.png',
          DOWN:   'zoomin.png'
        },
        zoomOut: {
          REST:   'zoomout.png',
          GROUP:  'zoomout.png',
          HOVER:  'zoomout.png',
          DOWN:   'zoomout.png'
        },
        home: {
          REST:   'home.png',
          GROUP:  'home.png',
          HOVER:  'home.png',
          DOWN:   'home.png'
        },
        fullpage: {
          REST:   'fullpage.png',
          GROUP:  'fullpage.png',
          HOVER:  'fullpage.png',
          DOWN:   'fullpage.png'
        },
        previous: {
          REST:   'previous.png',
          GROUP:  'previous.png',
          HOVER:  'previous.png',
          DOWN:   'previous.png'
        },
        next: {
          REST:   'next.png',
          GROUP:  'next.png',
          HOVER:  'next.png',
          DOWN:   'next.png'
        }
      };*/

      var openSeadragonId = '#' + config['id'];
      $(openSeadragonId).each(function () {
        if (!$(this).hasClass('processed')) {
          config.tileSources = new Array();
          resourceUri = (resourceUri instanceof Array) ? resourceUri : new Array(resourceUri);
          $.each(resourceUri, function(index, uri) {
            var tileSource = new OpenSeadragon.DjatokaTileSource(uri, settings.islandoraOpenSeadragon);
            config.tileSources.push(tileSource);
          });
          new OpenSeadragon(config);
          $(this).addClass('processed');
        }
      });
    }
  };
})(jQuery);
<|endoftext|>


<commit_before>function	sync_sv()
{
	socket.emit("get seated players");
	socket.on("seated players info", function(seat, seat_idx)
	{
		$("#qr" + seat_idx).css("visibility", "hidden");
		$("#qr_spot" + seat_idx).css("visibility", "hidden");
		$("#scan_msg" + seat_idx).css("visibility", "hidden");
		$("#player_name" + seat_idx).css("visibility", "visible");
		$("#player_name" + seat_idx).text(seat.player.nickname);
		$("#player_bankroll" + seat_idx).css("visibility", "visible");
		$("#player_bankroll" + seat_idx).text((Math.floor(+seat.player.bankroll * 100)) / 100 + "$");
		$("#player_cards"+ seat_idx).css("visibility", "visible");
	});
	socket.on("new player", function(player)
	{
		$("#qr" + player.seat_nb).css("visibility", "hidden");
		$("#qr_spot" + player.seat_nb).css("visibility", "hidden");
		$("#scan_msg" + player.seat_nb).css("visibility", "hidden");
		$("#player_name" + player.seat_nb).css("visibility", "visible");
		$("#player_name" + player.seat_nb).text(player.nickname);
		$("#player_bankroll" + player.seat_nb).css("visibility", "visible");
		$("#player_bankroll" + player.seat_nb).text((Math.floor(+player.bankroll * 100)) / 100 + "$");
		$("#player_cards"+ player.seat_nb).css("visibility", "visible");
	});
	socket.on("kick player", function(seat_nb)
	{
		$("#qr" + seat_nb).css("visibility", "visible");
		$("#qr_spot" + seat_nb).css("visibility", "visible");
		$("#scan_msg" + seat_nb).css("visibility", "visible");
		$("#player_name" + seat_nb).css("visibility", "hidden");
		$("#player_name" + seat_nb).text("");
		$("#player_bankroll" + seat_nb).css("visibility", "hidden");
		$("#player_bankroll" + seat_nb).text("");
		$("#player_cards"+ seat_nb).css("visibility", "hidden");
		$("#btn" + seat_nb).attr("src", "");
		$("#btn" + seat_nb).css("visibility", "hidden");
	});
	socket.emit("ask buttons");
	socket.on("place button", function(type, seat_nb)
	{
		if (seat_nb <= 0 || seat_nb >= 7)
			return ;
		if (type == "dealer")
		{
			$("#btn" + seat_nb).attr("src", "../img/Dealer.png")
			$("#btn" + seat_nb).css("visibility", "visible");
		}
		else if (type == "sb")
		{
			$("#btn" + seat_nb).attr("src", "../img/sb.png")
			$("#btn" + seat_nb).css("visibility", "visible");
		}
		else if (type == "bb")
		{
			$("#btn" + seat_nb).attr("src", "../img/bb.png")
			$("#btn" + seat_nb).css("visibility", "visible");
		}
		$("#player_cards" + seat_nb).attr("src", "../img/hidden_cards.png");
	});
	socket.on("give cards", function(seat_nb)
	{
		$("#player_cards" + seat_nb).attr("src", "../img/hidden_cards.png");
	});
	socket.on("highlights", function(seat_idx, new_state)
	{
		if (new_state == "off")
			$("#seat" + seat_idx).css("background-color", "#006F60");
		else if (new_state == "on")
			$("#seat" + seat_idx).css("background-color", "#FE554C");
	});
	socket.on("bankroll modification", function(seat_idx, player)
	{
		if (player.bankroll == "ALL IN")
			$("#player_bankroll" + seat_idx).text("ALL IN");
		else
			$("#player_bankroll" + seat_idx).text((Math.floor(player.bankroll * 100)) / 100 + "$");
	});
	socket.on("pot modification", function(pot_amount)
	{
		$("#pot").text(Math.floor(+pot_amount * 100) / 100 + "$");
	});
	socket.on("bet", function(seat_idx, amount)
	{
		if (!amount)
			$("#bet_val" + seat_idx).text('');
		else {
			$("#bet_val" + seat_idx).text((Math.floor(amount * 100)) / 100 + "$");
		}
	});

	socket.on("last action", function(decision, seat_nb)
	{
		$("#last_action" + seat_nb).text(decision);
	});
	socket.on("fold", function(seat_nb)
	{
		$("#btn" + seat_nb).css("visibility", "hidden");
		$("#bet_val" + seat_nb).text('');
		$("#player_cards" + seat_nb).attr("src", "../img/avatar.png");
		$("#last_action" + seat_nb).text('');
	});
	socket.emit("get board");
	socket.on("send flop", function(card1, card2, card3)
	{
		$("#b1").attr("src", "img/cards/" + card1 + ".png");
		$("#b2").attr("src", "img/cards/" + card2 + ".png");
		$("#b3").attr("src", "img/cards/" + card3 + ".png");
		$("#b1, #b2, #b3").css("visibility", "visible");
	});
	socket.on("send turn", function(card4)
	{
		$("#b4").attr("src", "img/cards/" + card4 + ".png");
		$("#b4").css("visibility", "visible");
	});
	socket.on("send river", function(card5)
	{
		$("#b5").attr("src", "img/cards/" + card5 + ".png");
		$("#b5").css("visibility", "visible");
	});
	socket.on("remove last actions", function()
	{
		for (var idx = 1; idx <= 6; ++idx)
			$("#last_action" + idx).remove();
	});
	socket.on("remove board", function()
	{
		$("#b1, #b2, #b3, #b4, #b5").css("visibility", "hidden");
		for (var idx = 1; idx <= 6; ++idx)
			$("#player_cards" + idx).attr("src", "../img/avatar.png");
	});
	socket.on("remove emplacements", function()
	{
		for (var idx = 1; idx <= 6; ++idx)
			$("#btn" + idx).css("visibility", "hidden");
	});
	socket.on("show down", function(card1, card2, seat_nb)
	{
		if ($('#qr_spot' + seat_nb).css('visibility') == 'hidden') {
			$("#card1_" + seat_nb).attr("src", "../img/cards/" + card1 + ".png");
			$("#card2_" + seat_nb).attr("src", "../img/cards/" + card2 + ".png");
			$("#card1_" + seat_nb).css("visibility", "visible");
			$("#card2_" + seat_nb).css("visibility", "visible");
		}
	});
	socket.on("show down off", function(seat_nb)
	{
		$("#card1_" + seat_nb).css("visibility", "hidden");
		$("#card2_" + seat_nb).css("visibility", "hidden");
	});
	socket.on("winner", function(seat_nb, rank_name)
	{
		var disconnect = '
' + $("#player_name" + seat_nb).text() + ' won because player ' + rank_name + ' or folded
';
		var won = '
' + $("#player_name" + seat_nb).text() + ' won with ' + rank_name + '
';

		if (rank_name == 'disconnected') {
			//$("#winner_msg").text($("#player_name" + seat_nb).text());
			$('#histoContent').empty();
			$('#histoContent').append(disconnect);
		}
		else if (seat_nb == 42 && rank_name == 'null') {
			//$("#winner_msg").text("Split!");
			$('#histoContent').empty();
			$('#histoContent').append('
Split !
');
		}
		else {
			$('#histoContent').empty();
			$('#histoContent').append(won);
		}
		//$("#winner").css("visibility", "visible");
	});
	socket.on("win off", function()
	{
		$("#winner, #card1_1, #card2_1, #card1_2, #card2_2, #card1_3, #card2_3, #card1_4, #card2_4, #card1_5, #card2_5, #card1_6, #card2_6").css("visibility", "hidden");
	});
}

var aTable = [];
var aGame = [];
var tables = [];

function restart() {
	//fonction reinitialiser la game
	var i;
	var id;

	socket.emit('get table');
	socket.on('your table', function(table, game){
		aTable = table;
		aGame = game;
		id = aTable.id;

		for (i = 0; i <= tables.length; i++) {
			if (tables[i] != id)
			tables.push(id);
		}
	});

	console.log(tables);
}

socket.on('refresh game', function(){
	console.log('Ca refresh');
});
<commit_msg>tables fix<commit_after>function	sync_sv()
{
	socket.emit("get seated players");
	socket.on("seated players info", function(seat, seat_idx)
	{
		$("#qr" + seat_idx).css("visibility", "hidden");
		$("#qr_spot" + seat_idx).css("visibility", "hidden");
		$("#scan_msg" + seat_idx).css("visibility", "hidden");
		$("#player_name" + seat_idx).css("visibility", "visible");
		$("#player_name" + seat_idx).text(seat.player.nickname);
		$("#player_bankroll" + seat_idx).css("visibility", "visible");
		$("#player_bankroll" + seat_idx).text((Math.floor(+seat.player.bankroll * 100)) / 100 + "$");
		$("#player_cards"+ seat_idx).css("visibility", "visible");
	});
	socket.on("new player", function(player)
	{
		$("#qr" + player.seat_nb).css("visibility", "hidden");
		$("#qr_spot" + player.seat_nb).css("visibility", "hidden");
		$("#scan_msg" + player.seat_nb).css("visibility", "hidden");
		$("#player_name" + player.seat_nb).css("visibility", "visible");
		$("#player_name" + player.seat_nb).text(player.nickname);
		$("#player_bankroll" + player.seat_nb).css("visibility", "visible");
		$("#player_bankroll" + player.seat_nb).text((Math.floor(+player.bankroll * 100)) / 100 + "$");
		$("#player_cards"+ player.seat_nb).css("visibility", "visible");
	});
	socket.on("kick player", function(seat_nb)
	{
		$("#qr" + seat_nb).css("visibility", "visible");
		$("#qr_spot" + seat_nb).css("visibility", "visible");
		$("#scan_msg" + seat_nb).css("visibility", "visible");
		$("#player_name" + seat_nb).css("visibility", "hidden");
		$("#player_name" + seat_nb).text("");
		$("#player_bankroll" + seat_nb).css("visibility", "hidden");
		$("#player_bankroll" + seat_nb).text("");
		$("#player_cards"+ seat_nb).css("visibility", "hidden");
		$("#btn" + seat_nb).attr("src", "");
		$("#btn" + seat_nb).css("visibility", "hidden");
	});
	socket.emit("ask buttons");
	socket.on("place button", function(type, seat_nb)
	{
		if (seat_nb <= 0 || seat_nb >= 7)
			return ;
		if (type == "dealer")
		{
			$("#btn" + seat_nb).attr("src", "../img/Dealer.png")
			$("#btn" + seat_nb).css("visibility", "visible");
		}
		else if (type == "sb")
		{
			$("#btn" + seat_nb).attr("src", "../img/sb.png")
			$("#btn" + seat_nb).css("visibility", "visible");
		}
		else if (type == "bb")
		{
			$("#btn" + seat_nb).attr("src", "../img/bb.png")
			$("#btn" + seat_nb).css("visibility", "visible");
		}
		$("#player_cards" + seat_nb).attr("src", "../img/hidden_cards.png");
	});
	socket.on("give cards", function(seat_nb)
	{
		$("#player_cards" + seat_nb).attr("src", "../img/hidden_cards.png");
	});
	socket.on("highlights", function(seat_idx, new_state)
	{
		if (new_state == "off")
			$("#seat" + seat_idx).css("background-color", "#006F60");
		else if (new_state == "on")
			$("#seat" + seat_idx).css("background-color", "#FE554C");
	});
	socket.on("bankroll modification", function(seat_idx, player)
	{
		if (player.bankroll == "ALL IN")
			$("#player_bankroll" + seat_idx).text("ALL IN");
		else
			$("#player_bankroll" + seat_idx).text((Math.floor(player.bankroll * 100)) / 100 + "$");
	});
	socket.on("pot modification", function(pot_amount)
	{
		$("#pot").text(Math.floor(+pot_amount * 100) / 100 + "$");
	});
	socket.on("bet", function(seat_idx, amount)
	{
		if (!amount)
			$("#bet_val" + seat_idx).text('');
		else {
			$("#bet_val" + seat_idx).text((Math.floor(amount * 100)) / 100 + "$");
		}
	});

	socket.on("last action", function(decision, seat_nb)
	{
		$("#last_action" + seat_nb).text(decision);
	});
	socket.on("fold", function(seat_nb)
	{
		$("#btn" + seat_nb).css("visibility", "hidden");
		$("#bet_val" + seat_nb).text('');
		$("#player_cards" + seat_nb).attr("src", "../img/avatar.png");
		$("#last_action" + seat_nb).text('');
	});
	socket.emit("get board");
	socket.on("send flop", function(card1, card2, card3)
	{
		$("#b1").attr("src", "img/cards/" + card1 + ".png");
		$("#b2").attr("src", "img/cards/" + card2 + ".png");
		$("#b3").attr("src", "img/cards/" + card3 + ".png");
		$("#b1, #b2, #b3").css("visibility", "visible");
	});
	socket.on("send turn", function(card4)
	{
		$("#b4").attr("src", "img/cards/" + card4 + ".png");
		$("#b4").css("visibility", "visible");
	});
	socket.on("send river", function(card5)
	{
		$("#b5").attr("src", "img/cards/" + card5 + ".png");
		$("#b5").css("visibility", "visible");
	});
	socket.on("remove last actions", function()
	{
		for (var idx = 1; idx <= 6; ++idx)
			$("#last_action" + idx).remove();
	});
	socket.on("remove board", function()
	{
		$("#b1, #b2, #b3, #b4, #b5").css("visibility", "hidden");
		for (var idx = 1; idx <= 6; ++idx)
			$("#player_cards" + idx).attr("src", "../img/avatar.png");
	});
	socket.on("remove emplacements", function()
	{
		for (var idx = 1; idx <= 6; ++idx)
			$("#btn" + idx).css("visibility", "hidden");
	});
	socket.on("show down", function(card1, card2, seat_nb)
	{
		if ($('#qr_spot' + seat_nb).css('visibility') == 'hidden') {
			$("#card1_" + seat_nb).attr("src", "../img/cards/" + card1 + ".png");
			$("#card2_" + seat_nb).attr("src", "../img/cards/" + card2 + ".png");
			$("#card1_" + seat_nb).css("visibility", "visible");
			$("#card2_" + seat_nb).css("visibility", "visible");
		}
	});
	socket.on("show down off", function(seat_nb)
	{
		$("#card1_" + seat_nb).css("visibility", "hidden");
		$("#card2_" + seat_nb).css("visibility", "hidden");
	});
	socket.on("winner", function(seat_nb, rank_name)
	{
		var disconnect = '
' + $("#player_name" + seat_nb).text() + ' won because player ' + rank_name + ' or folded
';
		var won = '
' + $("#player_name" + seat_nb).text() + ' won with ' + rank_name + '
';

		if (rank_name == 'disconnected') {
			//$("#winner_msg").text($("#player_name" + seat_nb).text());
			$('#histoContent').empty();
			$('#histoContent').append(disconnect);
		}
		else if (seat_nb == 42 && rank_name == 'null') {
			//$("#winner_msg").text("Split!");
			$('#histoContent').empty();
			$('#histoContent').append('
Split !
');
		}
		else {
			$('#histoContent').empty();
			$('#histoContent').append(won);
		}
		//$("#winner").css("visibility", "visible");
	});
	socket.on("win off", function()
	{
		$("#winner, #card1_1, #card2_1, #card1_2, #card2_2, #card1_3, #card2_3, #card1_4, #card2_4, #card1_5, #card2_5, #card1_6, #card2_6").css("visibility", "hidden");
	});
}

var aTable = [];
var aGame = [];
var tables = [];

function restart() {
	//fonction reinitialiser la game
	var i;
	var id;

	socket.emit('get table');
	socket.on('your table', function(table, game){
		aTable = table;
		aGame = game;
		id = aTable.id;

		for (i = 0; i <= tables.length; i++) {
			tables.push(id);
		}
	});

	console.log(tables);
}

socket.on('refresh game', function(){
	console.log('Ca refresh');
});
<|endoftext|>


<commit_before>Package.describe({
  summary: "Authorization package for Meteor",
  version: "1.2.14",
  git: "https://github.com/alanning/meteor-roles.git",
  name: "alanning:roles"
});

Package.onUse(function (api) {
  var both = ['client', 'server'];

  api.versionsFrom("METEOR@1.2.0.2");

  api.use(['underscore',
           'accounts-base',
           'tracker',
           'mongo',
           'check'], both);

  api.use(['blaze'], 'client', {weak: true});

  api.export('Roles');

  api.addFiles('roles/roles_common.js', both);
  api.addFiles('roles/roles_server.js', 'server');
  api.addFiles(['roles/client/debug.js',
                'roles/client/uiHelpers.js',
                'roles/client/subscriptions.js'], 'client');
});

Package.onTest(function (api) {
  var both = ['client', 'server'];

  // `accounts-password` is included so `Meteor.users` exists

  api.use(['alanning:roles',
           'accounts-password',
           'underscore',
           'tinytest'], both);

  api.addFiles('roles/tests/client.js', 'client');
  api.addFiles('roles/tests/server.js', 'server');
});
<commit_msg>Fixed tests.<commit_after>Package.describe({
  summary: "Authorization package for Meteor",
  version: "1.2.14",
  git: "https://github.com/alanning/meteor-roles.git",
  name: "alanning:roles"
});

Package.onUse(function (api) {
  var both = ['client', 'server'];

  api.versionsFrom("METEOR@1.4.1");

  api.use(['underscore',
           'accounts-base',
           'tracker',
           'mongo',
           'check'], both);

  api.use(['blaze'], 'client', {weak: true});

  api.export('Roles');

  api.addFiles('roles/roles_common.js', both);
  api.addFiles('roles/roles_server.js', 'server');
  api.addFiles(['roles/client/debug.js',
                'roles/client/uiHelpers.js',
                'roles/client/subscriptions.js'], 'client');
});

Package.onTest(function (api) {
  api.versionsFrom("METEOR@1.4.1");

  var both = ['client', 'server'];

  // `accounts-password` is included so `Meteor.users` exists

  api.use(['alanning:roles',
           'accounts-password',
           'underscore',
           'tinytest'], both);

  api.addFiles('roles/tests/client.js', 'client');
  api.addFiles('roles/tests/server.js', 'server');
});
<|endoftext|>


<commit_before>import React from 'react';
import { bindActionCreators } from 'redux';
import { Connector } from 'redux/react';
import * as TodoActions from './actions/TodoActions';

export default class BinaryApp extends React.Component {
    render() {
        return (
            <Connector select={state => ({ todos: state.todos })}>
                {this.renderChild}
            </Connector>
        );
    }

    renderChild({ todos, dispatch }) {
        const actions = bindActionCreators(TodoActions, dispatch);
        return (

Hello

        );
    }
}
<commit_msg>Use decorators for Redux<commit_after>import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'redux/react';
import * as TodoActions from './actions/TodoActions';

@connect(state => ({ todos: state.todos }))
export default class BinaryApp extends React.Component {
    render() {
        const { dispatch } = this.props;
        return (

Hello World

        );
    }
}
<|endoftext|>


<commit_before>Package.describe({
  name: 'elevatedevdesign:autoform-jquery-payments',
  summary: 'Autoform package for jquery payments fields',
  version: '0.0.7-rc.1',
  git: 'https://github.com/ElevateDevelopmentAndDesign/' +
    'meteor-autoform-jquery-payments'
});

Package.onUse(function(api) {
  api.use([
    'jquery@1.11.4',
    'templating@1.0.0',
    'jeffpatzer:jquery-payment@0.0.5',
    'blaze@2.0.0',
    'aldeed:autoform@5.0.0',
    'aldeed:simple-schema@1.0.0',
    'aldeed:template-extension@4.0.0'
  ]);

  api.addFiles([
    'inputs.html',
    'inputs.js'
  ], 'client');

  api.addFiles([
    'simpleSchemaHelpers.js',
  ]);

  api.export('PaymentsHelpers');
});
<commit_msg>Bump version<commit_after>Package.describe({
  name: 'elevatedevdesign:autoform-jquery-payments',
  summary: 'Autoform package for jquery payments fields',
  version: '0.0.8',
  git: 'https://github.com/ElevateDevelopmentAndDesign/' +
    'meteor-autoform-jquery-payments'
});

Package.onUse(function(api) {
  api.use([
    'jquery@1.11.4',
    'templating@1.0.0',
    'jeffpatzer:jquery-payment@0.0.5',
    'blaze@2.0.0',
    'aldeed:autoform@5.0.0',
    'aldeed:simple-schema@1.0.0',
    'aldeed:template-extension@4.0.0'
  ]);

  api.addFiles([
    'inputs.html',
    'inputs.js'
  ], 'client');

  api.addFiles([
    'simpleSchemaHelpers.js',
  ]);

  api.export('PaymentsHelpers');
});
<|endoftext|>


<commit_before>// Generated on 2015-11-28 using generator-angular 0.14.0
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Automatically load required Grunt tasks
  require('jit-grunt')(grunt, {
    useminPrepare: 'grunt-usemin',
    ngtemplates: 'grunt-angular-templates',
    cdnify: 'grunt-google-cdn'
  });

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    buildcontrol: {
        options: {
            dir: 'dist',
            commit: true,
            push: true,
            message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
        },
        testing: {
            options: {
                remote: 'git@github.com:MLR-au/olac-visualisation.git',
                branch: 'testing',
                tag: pkg.version
           }
        },
        local: {
            options: {
                remote: '../',
                branch: 'build'
            }
        }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all', 'newer:jscs:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'newer:jscs:test', 'karma']
      },
      styles: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'postcss']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect().use(
                '/app/styles',
                connect.static('./app/styles')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Make sure code styles are up to par
    jscs: {
      options: {
        config: '.jscsrc',
        verbose: true
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git{,*/}*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    postcss: {
      options: {
        processors: [
          require('autoprefixer-core')({browsers: ['last 1 version']})
        ]
      },
      server: {
        options: {
          map: true
        },
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      test: {
        devDependencies: true,
        src: '<%= karma.unit.configFile %>',
        ignorePath:  /\.\.\//,
        fileTypes:{
          js: {
            block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
              detect: {
                js: /'(.*\.js)'/gi
              },
              replace: {
                js: '\'{{filePath}}\','
              }
            }
          }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>',
          '<%= yeoman.dist %>/images',
          '<%= yeoman.dist %>/styles'
        ],
        patterns: {
          js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
        }
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    ngtemplates: {
      dist: {
        options: {
          module: 'appApp',
          htmlmin: '<%= htmlmin.dist.options %>',
          usemin: 'scripts/scripts.js'
        },
        cwd: '<%= yeoman.app %>',
        src: 'views/{,*/}*.html',
        dest: '.tmp/templateCache.js'
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '*.html',
            'images/{,*/}*.{webp}',
            'styles/fonts/{,*/}*.*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'postcss:server',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'wiredep',
    'concurrent:test',
    'postcss',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'postcss',
    'ngtemplates',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'newer:jscs',
    'test',
    'build'
  ]);
};
<commit_msg>bugfix<commit_after>// Generated on 2015-11-28 using generator-angular 0.14.0
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Automatically load required Grunt tasks
  require('jit-grunt')(grunt, {
    useminPrepare: 'grunt-usemin',
    ngtemplates: 'grunt-angular-templates',
    cdnify: 'grunt-google-cdn'
  });

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    buildcontrol: {
        options: {
            dir: 'dist',
            commit: true,
            push: true,
            message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
        },
        testing: {
            options: {
                remote: 'git@github.com:MLR-au/olac-visualisation.git',
                branch: 'testing'
           }
        },
        local: {
            options: {
                remote: '../',
                branch: 'build'
            }
        }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all', 'newer:jscs:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'newer:jscs:test', 'karma']
      },
      styles: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'postcss']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect().use(
                '/app/styles',
                connect.static('./app/styles')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Make sure code styles are up to par
    jscs: {
      options: {
        config: '.jscsrc',
        verbose: true
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git{,*/}*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    postcss: {
      options: {
        processors: [
          require('autoprefixer-core')({browsers: ['last 1 version']})
        ]
      },
      server: {
        options: {
          map: true
        },
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      test: {
        devDependencies: true,
        src: '<%= karma.unit.configFile %>',
        ignorePath:  /\.\.\//,
        fileTypes:{
          js: {
            block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
              detect: {
                js: /'(.*\.js)'/gi
              },
              replace: {
                js: '\'{{filePath}}\','
              }
            }
          }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>',
          '<%= yeoman.dist %>/images',
          '<%= yeoman.dist %>/styles'
        ],
        patterns: {
          js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
        }
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    ngtemplates: {
      dist: {
        options: {
          module: 'appApp',
          htmlmin: '<%= htmlmin.dist.options %>',
          usemin: 'scripts/scripts.js'
        },
        cwd: '<%= yeoman.app %>',
        src: 'views/{,*/}*.html',
        dest: '.tmp/templateCache.js'
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '*.html',
            'images/{,*/}*.{webp}',
            'styles/fonts/{,*/}*.*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'postcss:server',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'wiredep',
    'concurrent:test',
    'postcss',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'postcss',
    'ngtemplates',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'newer:jscs',
    'test',
    'build'
  ]);
};
<|endoftext|>


<commit_before>Package.describe({
  name: 'planifica:file-encryption',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: '',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.1.0.2');

  api.use(['underscore', 'jparker:crypto-core', 'jparker:crypto-aes', 'reactive-var'], 'client');
  api.use('grigio:babel');

  api.addFiles('lzw.js', 'client', {isAsset: true});
  api.addFiles('crypto.js', 'client', {isAsset: true});
  api.addFiles('formatters.js', 'client', {isAsset: true});
  api.addFiles('CryptoJS/rollups/aes.js', 'client', {isAsset: true});
  api.addFiles('CryptoJS/rollups/hmac-sha1.js', 'client');
  api.addFiles('CryptoJS/rollups/sha1.js', 'client');
  api.addFiles('CryptoJS/components/hmac.js', 'client');
  api.addFiles('CryptoJS/components/sha1.js', 'client');

  api.addFiles('Utils.jsx', 'client');
  api.addFiles('BrowserDetect.js', 'client');

  api.addFiles('Encryptor.jsx', 'client');
  api.addFiles('Decryptor.jsx', 'client');

  api.export('Encryptor');
  api.export('Decryptor');

});
<commit_msg>Add hmacSHA256.<commit_after>Package.describe({
  name: 'planifica:file-encryption',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: '',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.1.0.2');

  api.use(['underscore', 'jparker:crypto-core', 'jparker:crypto-aes', 'reactive-var'], 'client');
  api.use('grigio:babel');

  api.addFiles('lzw.js', 'client', {isAsset: true});
  api.addFiles('crypto.js', 'client', {isAsset: true});
  api.addFiles('formatters.js', 'client', {isAsset: true});
  api.addFiles('CryptoJS/rollups/aes.js', 'client', {isAsset: true});
  api.addFiles('CryptoJS/rollups/hmac-sha1.js', 'client');
  api.addFiles('CryptoJS/rollups/hmac-sha256.js', 'client');
  api.addFiles('CryptoJS/rollups/sha1.js', 'client');
  api.addFiles('CryptoJS/rollups/sha256.js', 'client');
  api.addFiles('CryptoJS/components/hmac.js', 'client');
  api.addFiles('CryptoJS/components/sha1.js', 'client');
  api.addFiles('CryptoJS/components/sha256.js', 'client');

  api.addFiles('Utils.jsx', 'client');
  api.addFiles('BrowserDetect.js', 'client');

  api.addFiles('Encryptor.jsx', 'client');
  api.addFiles('Decryptor.jsx', 'client');

  api.export('Encryptor');
  api.export('Decryptor');

});
<|endoftext|>