<commit_before>/*
 * generates
 * - all es6, amd and commonjs dependencies in the src tree
 */

const path  = require("path");
const madge = require("madge");
const utl   = require("./utl");
const fs    = require("fs");
const _     = require("lodash");

function sourcify(pBaseDir, pString) {
    return path.join(
        pBaseDir,
        // rather use endsWith, but not available in node < 4
        !!pString.match(/\.json$/) ? pString : pString + ".js"
    );
}

function addToMakefileString(pString, pAddition) {
    return pString + " \\\n\t" + pAddition;
}

function getDepString(pArray, pStartWith) {
    return _(pArray)
            .sort()
            .reduce(addToMakefileString, pStartWith + ":");
}

function thisFileOnly(pFile, pModDep) {
    return pModDep.module === pFile;
}

function concatModDep(pModDeps, pFileDepArray, pModDep) {
    return pFileDepArray
            .concat(pModDep)
            .concat(
                 pModDep.deplist.reduce(function(pDepSum, pListEntry) {
                     return pDepSum.concat(extractFileDeps(pModDeps, pListEntry));
                 }, [])
            )
    ;
}

function extractFileDeps(pModDeps, pFile) {
    return pModDeps
        .filter(_.curry(thisFileOnly)(pFile))
        .reduce(_.curry(concatModDep)(pModDeps), []);
}

function deps2String(pModDeps) {
    return pModDeps
        .reduce(function(pSum, pModDep) {
            return pSum + getDepString(pModDep.deplist, pModDep.module) + "\n\n";
        }, "");
}

function withDependenciesOnly(pModDeps) {
    return pModDeps.deplist.length > 0;
}

function toFilteredDepencyArray(pDepencyTreeObject, pBaseDir) {
    return Object.keys(pDepencyTreeObject)
        .map(function(pKey) {
            return {
                module: sourcify(pBaseDir, pKey),
                deplist: pDepencyTreeObject[pKey]
                            .map(_.curry(sourcify)(pBaseDir))

                            // Don't include dependencies for which no corresponding
                            // file exists. This prevents erroneous files from
                            // entering the dependency tree, but also from core node
                            // modules(path, fs, http, ...) from being mentioned
                            .filter(utl.fileExists),
            };
        })
        .filter(withDependenciesOnly);
}

function deps2FlatString(pDependencyList, pFlatDefine, pFile) {
    if (!!pFlatDefine && pDependencyList.length > 0) {
        return _(pDependencyList)
        .map("deplist")
        .flatten()
        .sort()
        .uniq(true)
        .reduce(addToMakefileString, pFlatDefine + "=" + (!!pFile ? pFile : ""))
        .concat("\n");

    } else {
        return "";
    }
}

function getDeps(pDirOrFile, pExclude, pFormat, pFlatDefine) {
    const lDeps = toFilteredDepencyArray(
        madge(
            [utl.getDirectory(pDirOrFile)],
            {format: pFormat, exclude: pExclude}
        ).tree,
        utl.getDirectory(pDirOrFile)
    );
    if (fs.statSync(pDirOrFile).isFile()) {
        return !!pFlatDefine ?
                deps2FlatString(
                    extractFileDeps(lDeps, pDirOrFile), pFlatDefine, pDirOrFile
                ) :
                deps2String(extractFileDeps(lDeps, pDirOrFile));
    } else {
        return !!pFlatDefine ?
                deps2FlatString(lDeps, pFlatDefine) :
                deps2String(lDeps, pDirOrFile);
    }
}

exports.getDependencyStrings = function(pDirOrFile, pOptions) {
    return pOptions.system.reduce(function(pSum, pSystem) {
        return pSum
                .concat(["# " + pSystem + " dependencies\n"])
                .concat(
                    getDeps(
                        pDirOrFile,
                        pOptions.exclude,
                        pSystem,
                        pOptions.flatDefine
                    )
                );
    }, !(pOptions.append) ? ["\n" + pOptions.delimiter + "\n\n"] : []);
};
<commit_msg>[stylecheck] whitespace police<commit_after>/*
 * generates
 * - all es6, amd and commonjs dependencies in the src tree
 */

const path  = require("path");
const madge = require("madge");
const utl   = require("./utl");
const fs    = require("fs");
const _     = require("lodash");

function sourcify(pBaseDir, pString) {
    return path.join(
        pBaseDir,
        // rather use endsWith, but not available in node < 4
        !!pString.match(/\.json$/) ? pString : pString + ".js"
    );
}

function addToMakefileString(pString, pAddition) {
    return pString + " \\\n\t" + pAddition;
}

function getDepString(pArray, pStartWith) {
    return _(pArray)
            .sort()
            .reduce(addToMakefileString, pStartWith + ":");
}

function thisFileOnly(pFile, pModDep) {
    return pModDep.module === pFile;
}

function concatModDep(pModDeps, pFileDepArray, pModDep) {
    return pFileDepArray
            .concat(pModDep)
            .concat(
                pModDep.deplist.reduce(function(pDepSum, pListEntry) {
                    return pDepSum.concat(extractFileDeps(pModDeps, pListEntry));
                }, [])
            )
    ;
}

function extractFileDeps(pModDeps, pFile) {
    return pModDeps
        .filter(_.curry(thisFileOnly)(pFile))
        .reduce(_.curry(concatModDep)(pModDeps), []);
}

function deps2String(pModDeps) {
    return pModDeps
        .reduce(function(pSum, pModDep) {
            return pSum + getDepString(pModDep.deplist, pModDep.module) + "\n\n";
        }, "");
}

function withDependenciesOnly(pModDeps) {
    return pModDeps.deplist.length > 0;
}

function toFilteredDepencyArray(pDepencyTreeObject, pBaseDir) {
    return Object.keys(pDepencyTreeObject)
        .map(function(pKey) {
            return {
                module: sourcify(pBaseDir, pKey),
                deplist: pDepencyTreeObject[pKey]
                            .map(_.curry(sourcify)(pBaseDir))

                            // Don't include dependencies for which no corresponding
                            // file exists. This prevents erroneous files from
                            // entering the dependency tree, but also from core node
                            // modules(path, fs, http, ...) from being mentioned
                            .filter(utl.fileExists),
            };
        })
        .filter(withDependenciesOnly);
}

function deps2FlatString(pDependencyList, pFlatDefine, pFile) {
    if (!!pFlatDefine && pDependencyList.length > 0) {
        return _(pDependencyList)
        .map("deplist")
        .flatten()
        .sort()
        .uniq(true)
        .reduce(addToMakefileString, pFlatDefine + "=" + (!!pFile ? pFile : ""))
        .concat("\n");

    } else {
        return "";
    }
}

function getDeps(pDirOrFile, pExclude, pFormat, pFlatDefine) {
    const lDeps = toFilteredDepencyArray(
        madge(
            [utl.getDirectory(pDirOrFile)],
            {format: pFormat, exclude: pExclude}
        ).tree,
        utl.getDirectory(pDirOrFile)
    );
    if (fs.statSync(pDirOrFile).isFile()) {
        return !!pFlatDefine ?
                deps2FlatString(
                    extractFileDeps(lDeps, pDirOrFile), pFlatDefine, pDirOrFile
                ) :
                deps2String(extractFileDeps(lDeps, pDirOrFile));
    } else {
        return !!pFlatDefine ?
                deps2FlatString(lDeps, pFlatDefine) :
                deps2String(lDeps, pDirOrFile);
    }
}

exports.getDependencyStrings = function(pDirOrFile, pOptions) {
    return pOptions.system.reduce(function(pSum, pSystem) {
        return pSum
                .concat(["# " + pSystem + " dependencies\n"])
                .concat(
                    getDeps(
                        pDirOrFile,
                        pOptions.exclude,
                        pSystem,
                        pOptions.flatDefine
                    )
                );
    }, !(pOptions.append) ? ["\n" + pOptions.delimiter + "\n\n"] : []);
};
<|endoftext|>


<commit_before> ;(function () {

    "use strict"

    // Create a safe reference to the DrawMeAKanji object for use below.
    var dmak = function(text, options) {
        this.text = text;
        this.options  = extend(dmak.options, options);
        this.strokes = [];
        this.papers = [];
        this.pointer  = 0;
        this.timeouts = [];

        if(!this.options.skipLoad) {
            var loader = new dmakLoader(this.options.uri);
            loader.load(text, function(strokes) {
                this.setStrokes(strokes);
                this.options.loaded(this.strokes);
            }.bind(this));
        }
    };

    // Current version.
    dmak.VERSION = '0.1';

    dmak.options = {
        uri : '',
        skipLoad : false,
        height : 109,
        width : 109,
        step : 0.03,
        duration : 750,
        element : 'draw',
        stroke : {
            animated : true,
            attr : {
                'active': '#F92672',
                'stroke' : "#272822",
                'stroke-width' : 3,
                'stroke-linecap' : 'round',
                'stroke-linejoin' : 'round'
            }
        },
        grid : {
            show: true,
            attr : {
                'stroke': '#CCCCCC',
                'stroke-width' : 0.5,
                'stroke-dasharray' : "--"
            }
        },
        loaded : function(){},
        drew:  function(){}
    };

    dmak.fn = dmak.prototype = {

        setStrokes: function(strokes) {
            this.strokes = preprocessStrokes(strokes);
            this.papers   = giveBirthToRaphael(strokes.length);
            if(this.options.grid.show) {
                showGrid(this.papers);
            }
        },

        /**
         * Clean all strokes on papers.
         */
        erase: function(end) {
            // Cannot have two rendering process for
            // the same draw. Keep it cool.
            if(this.timeouts.length) {
                return false;
            }

            // Don't go behind the beginning.
            if(this.pointer <= 0) {
                return false;
            }

            if(typeof end === "undefined") {
                end = 0;
            }

            do {
                this.pointer--;
                this.strokes[this.pointer].object.remove();
                this.strokes[this.pointer].object = null;
            }
            while(this.pointer > end)
        },

        /**
         * All the magic happens here.
         */
        render: function(end) {

            // Cannot have two rendering process for
            // the same draw. Keep it cool.
            if(this.timeouts.length) {
                return false;
            }

            if(typeof end === "undefined") {
                end = this.strokes.length;
            }
            else if(end > this.strokes.length) {
                return false;
            }

            var delay = 0;
            for (var i = this.pointer; i < end; i++) {
                var t = setTimeout(function(that){
                    createStroke(that.papers[that.strokes[that.pointer].char], that.strokes[that.pointer]);
                    that.pointer++;
                    that.timeouts.shift();
                    that.options.drew(that.pointer);
                }, delay, this);
                delay += this.strokes[i].duration;
                this.timeouts.push(t);
            }
        },

        /**
         * Pause rendering
         */
        pause: function(end) {
            for (var i = 0; i < this.timeouts.length; i++) {
                window.clearTimeout(this.timeouts[i]);
            }
            this.timeouts = [];
        },

        /**
         * Wrap the erase function to remove the x last strokes.
         */
        eraseLastStrokes: function(nbStrokes){
            this.erase(this.pointer - nbStrokes);
        },

        /**
         * Wrap the render function to render the x next strokes.
         */
        renderNextStrokes: function(nbStrokes){
            this.render(this.pointer + nbStrokes);
        }

    };

    // HELPERS

    /**
     * Flattens the array of strokes ; 3D > 2D
     * and does some preprocessing while looping
     * through all the strokes:
     *  - Maps to a character index
     *  - Calculates path length
     */
    var preprocessStrokes = function(strokes) {
        var s = [];
        for(var i = 0; i < strokes.length; i++) {
            for (var j = 0; j < strokes[i].length; j++) {
                var length = Raphael.getTotalLength(strokes[i][j]);
                var stroke = {
                    'char' : i,
                    'length' : length,
                    'duration' : length * dmak.options.step * 1000,
                    'path' : strokes[i][j],
                    'object' : null
                }
                s.push(stroke);
            }
        }

        return s;
    }

    /**
     * Init Raphael paper objects
     */
    var giveBirthToRaphael = function(nbChar) {
        var papers = []
        for(var i = 0; i < nbChar; i++) {
            var paper = new Raphael(dmak.options.element, dmak.options.width + "px", dmak.options.height +"px");
            paper.canvas.setAttribute("class","dmak-svg");
            papers.push(paper);
        }

        return papers.reverse();
    }

    /**
     * Draw the background grid
     */
    var showGrid = function(papers) {
        for(var i = 0; i < papers.length; i++) {
            papers[i].path("M" + (dmak.options.width / 2) + ",0 L" + (dmak.options.width / 2) + "," + dmak.options.height).attr(dmak.options.grid.attr);
            papers[i].path("M0," + (dmak.options.height / 2) + " L" + dmak.options.width + "," + (dmak.options.height / 2)).attr(dmak.options.grid.attr);
        }
    }

    /**
     * Draw a single stroke ; drawing can be animated if set as so.
     */
    var createStroke = function(paper, stroke) {
        stroke.object = paper.path(stroke.path);
        stroke.object.attr(dmak.options.stroke.attr);
        if(dmak.options.stroke.animated) {
            animateStroke(stroke);
        }
    }

    /**
     * Animate stroke drawing.
     * Based on the great article wrote by Jake Archibald
     * http://jakearchibald.com/2013/animated-line-drawing-svg/
     */
    var animateStroke = function(stroke) {
        stroke.object.attr({'stroke' : dmak.options.stroke.attr.active});
        stroke.object.node.style.transition = stroke.object.node.style.WebkitTransition = 'none';
        // Set up the starting positions
        stroke.object.node.style.strokeDasharray = stroke.length + ' ' + stroke.length;
        stroke.object.node.style.strokeDashoffset = stroke.length;
        // Trigger a layout so styles are calculated & the browser
        // picks up the starting position before animating
        stroke.object.node.getBoundingClientRect();
        stroke.object.node.style.transition = stroke.object.node.style.WebkitTransition = 'stroke-dashoffset ' + stroke.duration + 'ms ease';
        // Go!
        stroke.object.node.style.strokeDashoffset = '0';
        // Revert back to the options color when the animation is done.
        setTimeout(function(){
            // The stroke object may have been already erased when we reach this
            // timeout
            if(stroke.object == null) {
                return;
            }
            stroke.object.node.style.stroke = dmak.options.stroke.attr.stroke;
            stroke.object.node.style.transition = stroke.object.node.style.WebkitTransition = 'stroke 400ms ease';
        }, stroke.duration);
    };

    /**
     * Simplistic helper function for extending objects
     */
    var extend = function (defaults, replacement) {
        if(arguments.length != 2) {
            throw new Error('Missing arguments in extend function');
        }

        var result = defaults;
        for(var key in replacement) {
            if(typeof result[key] === 'object') {
                result[key] = extend(result[key], replacement[key]);
            } else if(result.hasOwnProperty(key)) {
                result[key] = replacement[key];
            }
        }

        return result;
    };

    window.dmak = dmak;
}());
<commit_msg>Add an "erased" callback<commit_after> ;(function () {

    "use strict"

    // Create a safe reference to the DrawMeAKanji object for use below.
    var dmak = function(text, options) {
        this.text = text;
        this.options  = extend(dmak.options, options);
        this.strokes = [];
        this.papers = [];
        this.pointer  = 0;
        this.timeouts = [];

        if(!this.options.skipLoad) {
            var loader = new dmakLoader(this.options.uri);
            loader.load(text, function(strokes) {
                this.setStrokes(strokes);
                this.options.loaded(this.strokes);
            }.bind(this));
        }
    };

    // Current version.
    dmak.VERSION = '0.1';

    dmak.options = {
        uri : '',
        skipLoad : false,
        height : 109,
        width : 109,
        step : 0.03,
        duration : 750,
        element : 'draw',
        stroke : {
            animated : true,
            attr : {
                'active': '#F92672',
                'stroke' : "#272822",
                'stroke-width' : 3,
                'stroke-linecap' : 'round',
                'stroke-linejoin' : 'round'
            }
        },
        grid : {
            show: true,
            attr : {
                'stroke': '#CCCCCC',
                'stroke-width' : 0.5,
                'stroke-dasharray' : "--"
            }
        },
        loaded : function(){},
        erased : function(){},
        drew:  function(){}
    };

    dmak.fn = dmak.prototype = {

        setStrokes: function(strokes) {
            this.strokes = preprocessStrokes(strokes);
            this.papers   = giveBirthToRaphael(strokes.length);
            if(this.options.grid.show) {
                showGrid(this.papers);
            }
        },

        /**
         * Clean all strokes on papers.
         */
        erase: function(end) {
            // Cannot have two rendering process for
            // the same draw. Keep it cool.
            if(this.timeouts.length) {
                return false;
            }

            // Don't go behind the beginning.
            if(this.pointer <= 0) {
                return false;
            }

            if(typeof end === "undefined") {
                end = 0;
            }

            do {
                this.pointer--;
                this.strokes[this.pointer].object.remove();
                this.strokes[this.pointer].object = null;
                this.options.erased(this.pointer);
            }
            while(this.pointer > end)
        },

        /**
         * All the magic happens here.
         */
        render: function(end) {

            // Cannot have two rendering process for
            // the same draw. Keep it cool.
            if(this.timeouts.length) {
                return false;
            }

            if(typeof end === "undefined") {
                end = this.strokes.length;
            }
            else if(end > this.strokes.length) {
                return false;
            }

            var delay = 0;
            for (var i = this.pointer; i < end; i++) {
                var t = setTimeout(function(that){
                    createStroke(that.papers[that.strokes[that.pointer].char], that.strokes[that.pointer]);
                    that.pointer++;
                    that.timeouts.shift();
                    that.options.drew(that.pointer);
                }, delay, this);
                delay += this.strokes[i].duration;
                this.timeouts.push(t);
            }
        },

        /**
         * Pause rendering
         */
        pause: function(end) {
            for (var i = 0; i < this.timeouts.length; i++) {
                window.clearTimeout(this.timeouts[i]);
            }
            this.timeouts = [];
        },

        /**
         * Wrap the erase function to remove the x last strokes.
         */
        eraseLastStrokes: function(nbStrokes){
            this.erase(this.pointer - nbStrokes);
        },

        /**
         * Wrap the render function to render the x next strokes.
         */
        renderNextStrokes: function(nbStrokes){
            this.render(this.pointer + nbStrokes);
        }

    };

    // HELPERS

    /**
     * Flattens the array of strokes ; 3D > 2D
     * and does some preprocessing while looping
     * through all the strokes:
     *  - Maps to a character index
     *  - Calculates path length
     */
    var preprocessStrokes = function(strokes) {
        var s = [];
        for(var i = 0; i < strokes.length; i++) {
            for (var j = 0; j < strokes[i].length; j++) {
                var length = Raphael.getTotalLength(strokes[i][j]);
                var stroke = {
                    'char' : i,
                    'length' : length,
                    'duration' : length * dmak.options.step * 1000,
                    'path' : strokes[i][j],
                    'object' : null
                }
                s.push(stroke);
            }
        }

        return s;
    }

    /**
     * Init Raphael paper objects
     */
    var giveBirthToRaphael = function(nbChar) {
        var papers = []
        for(var i = 0; i < nbChar; i++) {
            var paper = new Raphael(dmak.options.element, dmak.options.width + "px", dmak.options.height +"px");
            paper.canvas.setAttribute("class","dmak-svg");
            papers.push(paper);
        }

        return papers.reverse();
    }

    /**
     * Draw the background grid
     */
    var showGrid = function(papers) {
        for(var i = 0; i < papers.length; i++) {
            papers[i].path("M" + (dmak.options.width / 2) + ",0 L" + (dmak.options.width / 2) + "," + dmak.options.height).attr(dmak.options.grid.attr);
            papers[i].path("M0," + (dmak.options.height / 2) + " L" + dmak.options.width + "," + (dmak.options.height / 2)).attr(dmak.options.grid.attr);
        }
    }

    /**
     * Draw a single stroke ; drawing can be animated if set as so.
     */
    var createStroke = function(paper, stroke) {
        stroke.object = paper.path(stroke.path);
        stroke.object.attr(dmak.options.stroke.attr);
        if(dmak.options.stroke.animated) {
            animateStroke(stroke);
        }
    }

    /**
     * Animate stroke drawing.
     * Based on the great article wrote by Jake Archibald
     * http://jakearchibald.com/2013/animated-line-drawing-svg/
     */
    var animateStroke = function(stroke) {
        stroke.object.attr({'stroke' : dmak.options.stroke.attr.active});
        stroke.object.node.style.transition = stroke.object.node.style.WebkitTransition = 'none';
        // Set up the starting positions
        stroke.object.node.style.strokeDasharray = stroke.length + ' ' + stroke.length;
        stroke.object.node.style.strokeDashoffset = stroke.length;
        // Trigger a layout so styles are calculated & the browser
        // picks up the starting position before animating
        stroke.object.node.getBoundingClientRect();
        stroke.object.node.style.transition = stroke.object.node.style.WebkitTransition = 'stroke-dashoffset ' + stroke.duration + 'ms ease';
        // Go!
        stroke.object.node.style.strokeDashoffset = '0';
        // Revert back to the options color when the animation is done.
        setTimeout(function(){
            // The stroke object may have been already erased when we reach this
            // timeout
            if(stroke.object == null) {
                return;
            }
            stroke.object.node.style.stroke = dmak.options.stroke.attr.stroke;
            stroke.object.node.style.transition = stroke.object.node.style.WebkitTransition = 'stroke 400ms ease';
        }, stroke.duration);
    };

    /**
     * Simplistic helper function for extending objects
     */
    var extend = function (defaults, replacement) {
        if(arguments.length != 2) {
            throw new Error('Missing arguments in extend function');
        }

        var result = defaults;
        for(var key in replacement) {
            if(typeof result[key] === 'object') {
                result[key] = extend(result[key], replacement[key]);
            } else if(result.hasOwnProperty(key)) {
                result[key] = replacement[key];
            }
        }

        return result;
    };

    window.dmak = dmak;
}());
<|endoftext|>


<commit_before>const Plugin = require('./plugin')

module.exports = class Drag extends Plugin
{
    constructor(parent)
    {
        super(parent)
        this.moved = false
    }

    down(x, y, data)
    {
        if (this.paused)
        {
            return
        }

        const pointers = data.input.pointers
        if (pointers.length === 1)
        {
            this.last = { x, y }
        }
    }

    move(x, y, data)
    {
        if (this.paused)
        {
            return
        }

        if (this.last)
        {
            const pointers = data.input.pointers
            if (pointers.length === 1 || (pointers.length > 1 && !this.parent.plugin('pinch')))
            {
                const distX = x - this.last.x
                const distY = y - this.last.y
                if (this.moved || (this.parent.checkThreshold(distX) || this.parent.checkThreshold(distY)))
                {
                    this.parent.container.x += distX
                    this.parent.container.y += distY
                    this.last = { x, y }
                    if (!this.moved)
                    {
                        this.parent.emit('drag-start', this.parent)
                    }
                    this.moved = true
                }
            }
            else
            {
                this.moved = false
            }
        }
    }

    up()
    {
        if (this.last)
        {
            this.parent.emit('drag-end', this.parent)
            this.last = null
            this.moved = false
        }
    }

    resume()
    {
        this.last = null
        this.paused = false
    }
}<commit_msg>Fixed 'drag-end' firing prematurely<commit_after>const Plugin = require('./plugin')

module.exports = class Drag extends Plugin
{
    constructor(parent)
    {
        super(parent)
        this.moved = false
    }

    down(x, y, data)
    {
        if (this.paused)
        {
            return
        }

        const pointers = data.input.pointers
        if (pointers.length === 1)
        {
            this.last = { x, y }
        }
    }

    move(x, y, data)
    {
        if (this.paused)
        {
            return
        }

        if (this.last)
        {
            const pointers = data.input.pointers
            if (pointers.length === 1 || (pointers.length > 1 && !this.parent.plugin('pinch')))
            {
                const distX = x - this.last.x
                const distY = y - this.last.y
                if (this.moved || (this.parent.checkThreshold(distX) || this.parent.checkThreshold(distY)))
                {
                    this.parent.container.x += distX
                    this.parent.container.y += distY
                    this.last = { x, y }
                    if (!this.moved)
                    {
                        this.parent.emit('drag-start', this.parent)
                    }
                    this.moved = true
                }
            }
            else
            {
                this.moved = false
            }
        }
    }

    up()
    {
        if (this.last && && this.moved)
        {
            this.parent.emit('drag-end', this.parent)
            this.moved = false
        }
        this.last = null
    }

    resume()
    {
        this.last = null
        this.paused = false
    }
}<|endoftext|>


<commit_before>/**
 * This kind is the top kind of project handling. It contains:
 * - The project list
 * - the interface towards the user's file (harmonia)
 * - Popups to manage projects (create, scan, error ...)
 */
enyo.kind({
	name: "ProjectView",
	kind: "FittableColumns",
	classes: "enyo-unselectable shadow-panels",
	components: [
		{kind: "ProjectList",
			onModifySettings: "modifySettingsAction",
			onCreateProject: "createProjectAction",
			onScanProject: "scanProjectAction",
			onProjectRemoved: "projectRemoved",
			onProjectSelected: "handleProjectSelected",
			name: "projectList"},
		{kind: "Harmonia", fit:true, name: "harmonia", providerListNeeded: false},
		{kind: "ProjectWizardCreate", canGenerate: false, name: "projectWizardCreate"},
		{kind: "ProjectWizardScan", canGenerate: false, name: "projectWizardScan"},
		{kind: "ProjectWizardModify", canGenerate: false, name: "projectWizardModify"},
		{name: "errorPopup", kind: "Ares.ErrorPopup", msg: "unknown error", details: ""},
		{name: "waitPopup", kind: "onyx.Popup", centered: true, floating: true, autoDismiss: false, modal: true, style: "text-align: center; padding: 20px;", components: [
			{kind: "Image", src: "$phobos/images/save-spinner.gif", style: "width: 54px; height: 55px;"},
			{name: "waitPopupMessage", content: "Ongoing...", style: "padding-top: 10px;"}
		]}
	],
	handlers: {
		onAddProjectInList: "addProjectInList",
		onPhonegapBuild: "startPhonegapBuild",
		onBuildStarted: "phonegapBuildStarted",
		onPreview: "launchPreview",
		onError: "showError"
	},
	create: function() {
		this.inherited(arguments);
	},
	showError: function(inSender, inEvent) {
		if (this.debug) this.log("event:", inEvent, "from sender:", inSender);
		this.hideWaitPopup();
		this.showErrorPopup(inEvent.msg, inEvent.details);
		return true; //Stop event propagation
	},
	showErrorPopup : function(msg, details) {
		this.$.errorPopup.raise(msg, details);
	},

	scanProjectAction: function(inSender, inEvent) {
		this.$.projectWizardScan.setHeaderText('Select a directory containing one or more project.json files');
		this.$.projectWizardScan.show();
		return true; //Stop event propagation
	},
	createProjectAction: function(inSender, inEvent) {
		this.$.projectWizardCreate.start();
		return true; //Stop event propagation
	},
	modifySettingsAction: function(inSender, inEvent) {
		this.$.projectWizardModify.start(this.currentProject);
		return true; //Stop event propagation
	},

	addProjectInList: function(inSender, inEvent) {
		try {
			// Add an entry into the project list
			this.$.projectList.addProject(inEvent.name, inEvent.folderId, inEvent.service);
		} catch(e) {
				var msg = e.toString();
				this.showErrorPopup(msg);
				this.error(msg);
				return false;
		}
		return true; //Stop event propagation
	},
	handleProjectSelected: function(inSender, inEvent) {
		var project = inEvent.project;
		// Pass service definition & configuration to Harmonia
		// & consequently to HermesFileTree
		this.$.harmonia.setProject(project);
		// FIXME: temporary hack to create config.json on the
		// fly if needed... would be better to create/load it
		// when the workspace is loaded & when a new project
		// is created that would save per-click HTTP traffic
		// to the FileSystemService.
		self = this;
		var config = new ProjectConfig();
		config.init({
			service: project.getService(),
			folderId: project.getFolderId()
		}, function(err) {
			if (err) self.showErrorPopup(err.toString());
			project.setConfig(config);
		});
		this.currentProject = project;
		return true; //Stop event propagation
	},
	projectRemoved: function(inSender, inEvent) {
		this.$.harmonia.setProject(null);
	},
	showWaitPopup: function(inMessage) {
		this.$.waitPopupMessage.setContent(inMessage);
		this.$.waitPopup.show();
	},
	hideWaitPopup: function() {
		this.$.waitPopup.hide();
	},
	startPhonegapBuild: function(inSender, inEvent) {
		if (!this.currentProject) {
			return true; // stop bubble-up
		}
		var self = this;
		this.showWaitPopup("Starting project build");
		// [0] assumes a single builder
		var bdService =	ServiceRegistry.instance.getServicesByType('build')[0];
		if (bdService) {
			bdService.build( /*project*/ {
				name: this.currentProject.getName(),
				filesystem: this.currentProject.getService(),
				folderId: this.currentProject.getFolderId(),
				config: this.currentProject.getConfig()
			}, function(inError, inDetails) {
				self.hideWaitPopup();
				if (inError) {
					self.showErrorPopup(inError.toString(), inDetails);
				}
			});
		} else {
			this.error("No build service defined:", inEvent);
			this.doError({msg: 'No build service defined'});
		}
		return true; // stop bubble-up
	},
	phonegapBuildStarted: function(inSender, inEvent) {
		this.showWaitPopup("Phonegap build started");
		setTimeout(enyo.bind(this, "hideWaitPopup"), 2000);
	},

	/**
	 * Launch a preview widget of the selected project in a separate frame
	 */
	launchPreview: function(inSender, inEvent) {
		if ( this.currentProject) {
			var config = this.currentProject.getConfig() ;
			var topFile = config.data.preview.top_file ;
			var projectUrl = this.currentProject.getProjectUrl() + '/' + topFile ;

			var winLoc = window.location.toString().replace('ares','preview') ;
			var previewUrl = winLoc
				+ ( winLoc.indexOf('?') != -1 ? '&' : '?' )
				+ 'url=' + encodeURIComponent(projectUrl);

			this.log("preview on URL " + previewUrl) ;

			window.open(
				previewUrl,
				'_blank', // ensure that a new window is created each time preview is tapped
				'scrollbars=0,menubar=1',
				false
			);
		}
		return true; // stop the bubble
	}

});
<commit_msg>ENYO-1710: modify the launchPreview URL for tests - Enyo-DCO-1.1-Signed-off-by: Marie-Antoinette de Bonis-Hamelin (Marian) marie-antoinette.de-bonis-hamelin@hp.com<commit_after>/**
 * This kind is the top kind of project handling. It contains:
 * - The project list
 * - the interface towards the user's file (harmonia)
 * - Popups to manage projects (create, scan, error ...)
 */
enyo.kind({
	name: "ProjectView",
	kind: "FittableColumns",
	classes: "enyo-unselectable shadow-panels",
	components: [
		{kind: "ProjectList",
			onModifySettings: "modifySettingsAction",
			onCreateProject: "createProjectAction",
			onScanProject: "scanProjectAction",
			onProjectRemoved: "projectRemoved",
			onProjectSelected: "handleProjectSelected",
			name: "projectList"},
		{kind: "Harmonia", fit:true, name: "harmonia", providerListNeeded: false},
		{kind: "ProjectWizardCreate", canGenerate: false, name: "projectWizardCreate"},
		{kind: "ProjectWizardScan", canGenerate: false, name: "projectWizardScan"},
		{kind: "ProjectWizardModify", canGenerate: false, name: "projectWizardModify"},
		{name: "errorPopup", kind: "Ares.ErrorPopup", msg: "unknown error", details: ""},
		{name: "waitPopup", kind: "onyx.Popup", centered: true, floating: true, autoDismiss: false, modal: true, style: "text-align: center; padding: 20px;", components: [
			{kind: "Image", src: "$phobos/images/save-spinner.gif", style: "width: 54px; height: 55px;"},
			{name: "waitPopupMessage", content: "Ongoing...", style: "padding-top: 10px;"}
		]}
	],
	handlers: {
		onAddProjectInList: "addProjectInList",
		onPhonegapBuild: "startPhonegapBuild",
		onBuildStarted: "phonegapBuildStarted",
		onPreview: "launchPreview",
		onError: "showError"
	},
	create: function() {
		this.inherited(arguments);
	},
	showError: function(inSender, inEvent) {
		if (this.debug) this.log("event:", inEvent, "from sender:", inSender);
		this.hideWaitPopup();
		this.showErrorPopup(inEvent.msg, inEvent.details);
		return true; //Stop event propagation
	},
	showErrorPopup : function(msg, details) {
		this.$.errorPopup.raise(msg, details);
	},

	scanProjectAction: function(inSender, inEvent) {
		this.$.projectWizardScan.setHeaderText('Select a directory containing one or more project.json files');
		this.$.projectWizardScan.show();
		return true; //Stop event propagation
	},
	createProjectAction: function(inSender, inEvent) {
		this.$.projectWizardCreate.start();
		return true; //Stop event propagation
	},
	modifySettingsAction: function(inSender, inEvent) {
		this.$.projectWizardModify.start(this.currentProject);
		return true; //Stop event propagation
	},

	addProjectInList: function(inSender, inEvent) {
		try {
			// Add an entry into the project list
			this.$.projectList.addProject(inEvent.name, inEvent.folderId, inEvent.service);
		} catch(e) {
				var msg = e.toString();
				this.showErrorPopup(msg);
				this.error(msg);
				return false;
		}
		return true; //Stop event propagation
	},
	handleProjectSelected: function(inSender, inEvent) {
		var project = inEvent.project;
		// Pass service definition & configuration to Harmonia
		// & consequently to HermesFileTree
		this.$.harmonia.setProject(project);
		// FIXME: temporary hack to create config.json on the
		// fly if needed... would be better to create/load it
		// when the workspace is loaded & when a new project
		// is created that would save per-click HTTP traffic
		// to the FileSystemService.
		self = this;
		var config = new ProjectConfig();
		config.init({
			service: project.getService(),
			folderId: project.getFolderId()
		}, function(err) {
			if (err) self.showErrorPopup(err.toString());
			project.setConfig(config);
		});
		this.currentProject = project;
		return true; //Stop event propagation
	},
	projectRemoved: function(inSender, inEvent) {
		this.$.harmonia.setProject(null);
	},
	showWaitPopup: function(inMessage) {
		this.$.waitPopupMessage.setContent(inMessage);
		this.$.waitPopup.show();
	},
	hideWaitPopup: function() {
		this.$.waitPopup.hide();
	},
	startPhonegapBuild: function(inSender, inEvent) {
		if (!this.currentProject) {
			return true; // stop bubble-up
		}
		var self = this;
		this.showWaitPopup("Starting project build");
		// [0] assumes a single builder
		var bdService =	ServiceRegistry.instance.getServicesByType('build')[0];
		if (bdService) {
			bdService.build( /*project*/ {
				name: this.currentProject.getName(),
				filesystem: this.currentProject.getService(),
				folderId: this.currentProject.getFolderId(),
				config: this.currentProject.getConfig()
			}, function(inError, inDetails) {
				self.hideWaitPopup();
				if (inError) {
					self.showErrorPopup(inError.toString(), inDetails);
				}
			});
		} else {
			this.error("No build service defined:", inEvent);
			this.doError({msg: 'No build service defined'});
		}
		return true; // stop bubble-up
	},
	phonegapBuildStarted: function(inSender, inEvent) {
		this.showWaitPopup("Phonegap build started");
		setTimeout(enyo.bind(this, "hideWaitPopup"), 2000);
	},

	/**
	 * Launch a preview widget of the selected project in a separate frame
	 */
	launchPreview: function(inSender, inEvent) {
		if ( this.currentProject) {
			var config = this.currentProject.getConfig() ;
			var topFile = config.data.preview.top_file ;
			var projectUrl = this.currentProject.getProjectUrl() + '/' + topFile ;

			// the last replace method is needed for test environment only
			var winLoc = window.location.toString().replace('ares','preview').replace('test', 'index') ;
			var previewUrl = winLoc
				+ ( winLoc.indexOf('?') != -1 ? '&' : '?' )
				+ 'url=' + encodeURIComponent(projectUrl);

			this.log("preview on URL " + previewUrl) ;

			window.open(
				previewUrl,
				'_blank', // ensure that a new window is created each time preview is tapped
				'scrollbars=0,menubar=1',
				false
			);
		}
		return true; // stop the bubble
	}

});
<|endoftext|>


<commit_before>'use babel'

/* @flow */

import Path from 'path'
import FS from 'fs'
import Installer from '../'
import { exec } from 'sb-exec'
import { readJSON, writeJSON, exists } from 'motion-fs'

// const { it } = require(process.env.SPEC_HELPER_SCRIPT)
const { it } = require('/Users/steel/w/motion/scripts/../spec/helpers.js')

describe('Installer', function() {
  const testRoot = '/tmp/motion-spec'
  const testPackageName = 'sb-promisify' // <-- choosing because it's lightweight
  const testPackagePath = Path.join(testRoot, 'node_modules', testPackageName)

  beforeEach(function() {
    waitsForPromise(async function() {
      await exec(process.env.SHELL, ['-c', `mkdir -p ${testRoot}`])
      await writeJSON(Path.join(testRoot, 'package.json'), {dependencies: {}})
    })
  })

  afterEach(function() {
    waitsForPromise(async function() {
      await exec(process.env.SHELL, ['-c', `rm -rf ${testRoot} || true`])
    })
  })

  it('installs and saves properly', async function() {
    console = require('console')
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    expect(await exists(testPackagePath)).toBe(true)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('string')
  })

  it('installs without saving', async function() {
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName)
    expect(await exists(testPackagePath)).toBe(true)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('undefined')
  })

  it('uninstalls and saves properly', async function() {
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    await installer.uninstall(testPackageName, true)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('undefined')
  })

  it('uninstalls without saving', async function() {
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    await installer.uninstall(testPackageName)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('string')
  })

  it('installs peer dependencies properly', async function() {

    const onStarted = jasmine.createSpy('onStarted')
    const onProgress = jasmine.createSpy('onProgress')
    const onComplete = jasmine.createSpy('onComplete')

    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    await writeJSON(Path.join(testPackagePath, 'package.json'), {name: testPackageName, version: '0.0.0', peerDependencies: {'sb-debounce': '>=1.0.0'}})
    await installer.installPeerDependencies(testPackageName, onStarted, onProgress, onComplete)

    expect(onStarted).toHaveBeenCalled()
    expect(onProgress).toHaveBeenCalled()
    expect(onComplete).toHaveBeenCalled()

    expect(onStarted.calls.length).toBe(1)
    expect(onProgress.calls.length).toBe(1)
    expect(onComplete.calls.length).toBe(1)

    expect(onStarted.mostRecentCall.args[0]).toEqual([['sb-debounce', '1.0.0']])
    expect(onProgress.mostRecentCall.args).toEqual(['sb-debounce', null])
  })

  it('tells if a module is installed or not', async function() {
    const installer = new Installer({rootDirectory: __dirname})
    expect(await installer.isInstalled('some-package')).toBe(false)
    expect(await installer.isInstalled('motion-fs')).toBe(true)
  })

})
<commit_msg>:bug: Remove a literal require path<commit_after>'use babel'

/* @flow */

import Path from 'path'
import FS from 'fs'
import Installer from '../'
import { exec } from 'sb-exec'
import { readJSON, writeJSON, exists } from 'motion-fs'

const { it } = require(process.env.SPEC_HELPER_SCRIPT)

describe('Installer', function() {
  const testRoot = '/tmp/motion-spec'
  const testPackageName = 'sb-promisify' // <-- choosing because it's lightweight
  const testPackagePath = Path.join(testRoot, 'node_modules', testPackageName)

  beforeEach(function() {
    waitsForPromise(async function() {
      await exec(process.env.SHELL, ['-c', `mkdir -p ${testRoot}`])
      await writeJSON(Path.join(testRoot, 'package.json'), {dependencies: {}})
    })
  })

  afterEach(function() {
    waitsForPromise(async function() {
      await exec(process.env.SHELL, ['-c', `rm -rf ${testRoot} || true`])
    })
  })

  it('installs and saves properly', async function() {
    console = require('console')
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    expect(await exists(testPackagePath)).toBe(true)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('string')
  })

  it('installs without saving', async function() {
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName)
    expect(await exists(testPackagePath)).toBe(true)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('undefined')
  })

  it('uninstalls and saves properly', async function() {
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    await installer.uninstall(testPackageName, true)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('undefined')
  })

  it('uninstalls without saving', async function() {
    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    await installer.uninstall(testPackageName)
    const manifest = await readJSON(Path.join(testRoot, 'package.json'))
    expect(typeof manifest.dependencies[testPackageName]).toBe('string')
  })

  it('installs peer dependencies properly', async function() {

    const onStarted = jasmine.createSpy('onStarted')
    const onProgress = jasmine.createSpy('onProgress')
    const onComplete = jasmine.createSpy('onComplete')

    const installer = new Installer({rootDirectory: testRoot})
    await installer.install(testPackageName, true)
    await writeJSON(Path.join(testPackagePath, 'package.json'), {name: testPackageName, version: '0.0.0', peerDependencies: {'sb-debounce': '>=1.0.0'}})
    await installer.installPeerDependencies(testPackageName, onStarted, onProgress, onComplete)

    expect(onStarted).toHaveBeenCalled()
    expect(onProgress).toHaveBeenCalled()
    expect(onComplete).toHaveBeenCalled()

    expect(onStarted.calls.length).toBe(1)
    expect(onProgress.calls.length).toBe(1)
    expect(onComplete.calls.length).toBe(1)

    expect(onStarted.mostRecentCall.args[0]).toEqual([['sb-debounce', '1.0.0']])
    expect(onProgress.mostRecentCall.args).toEqual(['sb-debounce', null])
  })

  it('tells if a module is installed or not', async function() {
    const installer = new Installer({rootDirectory: __dirname})
    expect(await installer.isInstalled('some-package')).toBe(false)
    expect(await installer.isInstalled('motion-fs')).toBe(true)
  })

})
<|endoftext|>


<commit_before>import React from 'react'
import TestRenderer from 'react-test-renderer'
import Pie from '../src/Pie'
import PieSlice from '../src/PieSlice'

const sampleData = [{
    id: 'A',
    value: 30,
},{
    id: 'B',
    value: 20,
},{
    id: 'C',
    value: 50,
}]

const sampleDataWithCustomProps = sampleData.map(datum => ({
    name: datum.id,
    attributes: {
        volume: datum.value
    }
}))

describe('Pie', () => {
    describe('data', () => {
        it('should use default id and value properties', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleData}
                />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual(30)

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual(20)

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual(50)
        })

        it('should use custom id and value accessors expressed as path', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleDataWithCustomProps}
                    id="name"
                    value="attributes.volume"
                />
            )

            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual(30)

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual(20)

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual(50)
        })

        it('should use custom id and value accessors expressed as functions', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleDataWithCustomProps}
                    id={d => d.name}
                    value={d => d.attributes.volume}
                />
            )

            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual(30)

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual(20)

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual(50)
        })

        it('should support custom value formatting', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleData}
                    valueFormat=" >-$.2f"
                />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual('$30.00')

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual('$20.00')

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual('$50.00')
        })

        it('should support sorting data by value', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleData}
                    sortByValue
                />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            const slice30 = slices[0]
            const slice20 = slices[1]
            const slice50 = slices[2]

            expect(slice50.props.data.arc.startAngle).toEqual(0)
            expect(slice30.props.data.arc.startAngle).toBeGreaterThan(0)
            expect(slice20.props.data.arc.startAngle).toBeGreaterThan(slice30.props.data.arc.startAngle)
        })
    })

    describe('layout', () => {
        it('should support donut charts', () => {

        })

        it('should support padAngle', () => {

        })

        it('should support cornerRadius', () => {

        })

        it('should support custom start and end angles', () => {

        })

        it('should support optimizing space usage via the fit property', () => {

        })
    })

    describe('colors', () => {
        it('should use colors from scheme', () => {

        })

        it('should use colors from data', () => {

        })
    })

    describe('patterns & gradients', () => {
        it('should support patterns', () => {

        })

        it('should support gradients', () => {

        })
    })

    describe('legends', () => {
        it('should render legends', () => {

        })
    })

    describe('interactivity', () => {
        it('should support onClick handler', () => {

        })

        it('should support onMouseEnter handler', () => {

        })

        it('should support onMouseMove handler', () => {

        })

        it('should support onMouseLeave handler', () => {

        })
    })

    describe('tooltip', () => {
        it('should render a tooltip when hovering a slice', () => {
        })

        it('should allow to override the default tooltip', () => {
        })
    })

    describe('layers', () => {
        it('should support disabling a layer', () => {
        })

        it('should support adding a custom layer', () => {
        })
    })
})
<commit_msg>feat(pie): add tests for colors<commit_after>import React from 'react'
import TestRenderer from 'react-test-renderer'
import Pie from '../src/Pie'
import PieSlice from '../src/PieSlice'

const sampleData = [
    {
        id: 'A',
        value: 30,
        color: '#ff5500',
    },
    {
        id: 'B',
        value: 20,
        color: '#ffdd00',
    },
    {
        id: 'C',
        value: 50,
        color: '#99cc44',
    },
]

sampleData.forEach(datum => {
    datum.nested = {
        color: datum.color,
    }
})

const sampleDataWithCustomProps = sampleData.map(datum => ({
    name: datum.id,
    attributes: {
        volume: datum.value,
    },
}))

describe('Pie', () => {
    describe('data', () => {
        it('should use default id and value properties', () => {
            const pie = TestRenderer.create(<Pie width={400} height={400} data={sampleData} />)
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual(30)

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual(20)

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual(50)
        })

        it('should use custom id and value accessors expressed as path', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleDataWithCustomProps}
                    id="name"
                    value="attributes.volume"
                />
            )

            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual(30)

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual(20)

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual(50)
        })

        it('should use custom id and value accessors expressed as functions', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleDataWithCustomProps}
                    id={d => d.name}
                    value={d => d.attributes.volume}
                />
            )

            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual(30)

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual(20)

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual(50)
        })

        it('should support custom value formatting', () => {
            const pie = TestRenderer.create(
                <Pie width={400} height={400} data={sampleData} valueFormat=" >-$.2f" />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.value).toEqual(30)
            expect(slices[0].props.data.formattedValue).toEqual('$30.00')

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.value).toEqual(20)
            expect(slices[1].props.data.formattedValue).toEqual('$20.00')

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.value).toEqual(50)
            expect(slices[2].props.data.formattedValue).toEqual('$50.00')
        })

        it('should support sorting data by value', () => {
            const pie = TestRenderer.create(
                <Pie width={400} height={400} data={sampleData} sortByValue />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            const slice30 = slices[0]
            const slice20 = slices[1]
            const slice50 = slices[2]

            expect(slice50.props.data.arc.startAngle).toEqual(0)
            expect(slice30.props.data.arc.startAngle).toBeGreaterThan(0)
            expect(slice20.props.data.arc.startAngle).toBeGreaterThan(
                slice30.props.data.arc.startAngle
            )
        })
    })

    describe('layout', () => {
        it('should support donut charts', () => {})

        it('should support padAngle', () => {})

        it('should support cornerRadius', () => {})

        it('should support custom start and end angles', () => {})

        it('should support optimizing space usage via the fit property', () => {})
    })

    describe('colors', () => {
        it('should use colors from scheme', () => {
            const pie = TestRenderer.create(
                <Pie width={400} height={400} data={sampleData} colors={{ scheme: 'accent' }} />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.color).toEqual('#7fc97f')

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.color).toEqual('#beaed4')

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.color).toEqual('#fdc086')
        })

        it('should allow to use colors from data using a path', () => {
            const pie = TestRenderer.create(
                <Pie
                    width={400}
                    height={400}
                    data={sampleData}
                    colors={{ datum: 'data.nested.color' }}
                />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.color).toEqual('#ff5500')

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.color).toEqual('#ffdd00')

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.color).toEqual('#99cc44')
        })

        it('should allow to use colors from data using a function', () => {
            const pie = TestRenderer.create(
                <Pie width={400} height={400} data={sampleData} colors={d => d.data.color} />
            )
            const pieInstance = pie.root

            const slices = pieInstance.findAllByType(PieSlice)

            expect(slices[0].props.data.id).toEqual('A')
            expect(slices[0].props.data.color).toEqual('#ff5500')

            expect(slices[1].props.data.id).toEqual('B')
            expect(slices[1].props.data.color).toEqual('#ffdd00')

            expect(slices[2].props.data.id).toEqual('C')
            expect(slices[2].props.data.color).toEqual('#99cc44')
        })
    })

    describe('patterns & gradients', () => {
        it('should support patterns', () => {})

        it('should support gradients', () => {})
    })

    describe('legends', () => {
        it('should render legends', () => {})
    })

    describe('interactivity', () => {
        it('should support onClick handler', () => {})

        it('should support onMouseEnter handler', () => {})

        it('should support onMouseMove handler', () => {})

        it('should support onMouseLeave handler', () => {})
    })

    describe('tooltip', () => {
        it('should render a tooltip when hovering a slice', () => {})

        it('should allow to override the default tooltip', () => {})
    })

    describe('layers', () => {
        it('should support disabling a layer', () => {})

        it('should support adding a custom layer', () => {})
    })
})
<|endoftext|>


<commit_before>const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');

module.exports = (phase, { defaultConfig }) => {
  const dms = process.env.DMS;
  const cms = process.env.CMS;
  if (phase === PHASE_DEVELOPMENT_SERVER) {
    if (dms) {
      console.log('\nYou are running the app in dev mode 🌀');
      console.log(
        'Did you know that you can use mocked CKAN API? Just unset your `DMS` env var.'
      );
      console.log('Happy coding ☀\n');
    } else {
      const mocks = require('./mocks');
      mocks.initMocks();
      console.log(
        '\nYou have not defined any DMS API so we are activating the mocks ⚠'
      );
      console.log(
        'If you wish to run against your CKAN API, you can set `DMS` env var.'
      );
      console.log(
        'For example, to run against demo ckan site: `DMS=https://demo.ckan.org`\n'
      );
    }

    return {
      publicRuntimeConfig: {
        DMS: dms ? dms.replace(/\/?$/, '') : 'http://mock.ckan',
        CMS: cms ? cms.replace(/\/?$/, '') : 'oddk.home.blog',
      },
    };
  }
  return {
    publicRuntimeConfig: {
      DMS: dms ? dms.replace(/\/?$/, '') : 'https://demo.ckan.org',
      CMS: cms ? cms.replace(/\/?$/, '') : 'oddk.home.blog',
    },
  };
};
<commit_msg>[config][s]: setup i18n config<commit_after>const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');

module.exports = (phase, { defaultConfig }) => {
  const dms = process.env.DMS;
  const cms = process.env.CMS;
  if (phase === PHASE_DEVELOPMENT_SERVER) {
    if (dms) {
      console.log('\nYou are running the app in dev mode 🌀');
      console.log(
        'Did you know that you can use mocked CKAN API? Just unset your `DMS` env var.'
      );
      console.log('Happy coding ☀\n');
    } else {
      const mocks = require('./mocks');
      mocks.initMocks();
      console.log(
        '\nYou have not defined any DMS API so we are activating the mocks ⚠'
      );
      console.log(
        'If you wish to run against your CKAN API, you can set `DMS` env var.'
      );
      console.log(
        'For example, to run against demo ckan site: `DMS=https://demo.ckan.org`\n'
      );
    }

    return {
      i18n: {
        locales: ['en', 'fr', 'nl-NL'],
        defaultLocale: 'en',
      },
      publicRuntimeConfig: {
        DMS: dms ? dms.replace(/\/?$/, '') : 'http://mock.ckan',
        CMS: cms ? cms.replace(/\/?$/, '') : 'oddk.home.blog',
      },
    };
  }
  return {
    i18n: {
      locales: ['en-US', 'fr', 'nl-NL'],
      defaultLocale: 'en-US',
    },
    publicRuntimeConfig: {
      DMS: dms ? dms.replace(/\/?$/, '') : 'https://demo.ckan.org',
      CMS: cms ? cms.replace(/\/?$/, '') : 'oddk.home.blog',
    },
  };
};
<|endoftext|>


<commit_before>//-------------------------------------------------------------------------------
// Annotations
//-------------------------------------------------------------------------------

//@Export('buganno.BugAnno')

//@Require('Class')
//@Require('Obj')
//@Require('Proxy')
//@Require('buganno.AnnotationRegistryLibraryBuilder')
//@Require('bugflow.BugFlow')

//-------------------------------------------------------------------------------
// Common Modules
//-------------------------------------------------------------------------------

var bugpack                             = require('bugpack').context();

//-------------------------------------------------------------------------------
// BugPack
//-------------------------------------------------------------------------------

var Class                               = bugpack.require('Class');
var Obj                                 = bugpack.require('Obj');
var Proxy                               = bugpack.require('Proxy');
var AnnotationRegistryLibraryBuilder    = bugpack.require('buganno.AnnotationRegistryLibraryBuilder');
var BugFlow                             = bugpack.require('bugflow.BugFlow');

//-------------------------------------------------------------------------------
// Simplify References
//-------------------------------------------------------------------------------

var $series                             = BugFlow.$series;
var $task                               = BugFlow.$task;

//-------------------------------------------------------------------------------
// Declare Class
//-------------------------------------------------------------------------------

/**
 * @class
 * @extends {Obj}
 */
var BugAnno = Class.extend(Obj, {

    //-------------------------------------------------------------------------------
    // Constructor
    //-------------------------------------------------------------------------------

    /**
     * @constructs
     */
    _constructor: function() {

        this._super();

        //-------------------------------------------------------------------------------
        // Private Properties
        //-------------------------------------------------------------------------------

        /**
         * @private
         * @type {AnnotationRegistryLibraryBuilder}
         */
        this.annotationRegistryLibraryBuilder   = new AnnotationRegistryLibraryBuilder();
    },

    //-------------------------------------------------------------------------------
    // Getters and Setters
    //-------------------------------------------------------------------------------

    /**
     * @return {AnnotationRegistryLibraryBuilder}
     */
    getAnnotationRegistryLibraryBuilder: function() {
        return this.annotationRegistryLibraryBuilder;
    },

    //-------------------------------------------------------------------------------
    // Public Methods
    //-------------------------------------------------------------------------------

    /**
     * @param {function(Throwable=)} callback
     */
    deinitialize: function(callback) {
        this.ensureBuilderDeinitialized(callback);
    },

    /**
     * @param {function(Throwable=)} callback
     */
    initialize: function(callback) {
        this.ensureBuilderInitialized(callback);
    },

    /**
     * @param {(Array.<(string | Path)> | ICollection.<(string | Path)>)} filePaths
     * @param {function(Error, AnnotationRegistryLibrary=)} callback
     */
    parse: function(filePaths, callback) {
        var _this                       = this;
        var annotationRegistryLibrary   = null;
        $series([
            $task(function(flow) {
                _this.annotationRegistryLibraryBuilder.build(filePaths, function(throwable, returnedAnnotationRegistryLibrary) {
                    if (!throwable) {
                        annotationRegistryLibrary = returnedAnnotationRegistryLibrary;
                    }
                    flow.complete(throwable);
                });
            })
        ]).execute(function(throwable) {
            if (!throwable) {
                callback(null, annotationRegistryLibrary);
            } else {
                callback(throwable);
            }
        });
    },

    /**
     * @param {(Array.<(string | Path)> | ICollection.<(string | Path)>)} filePaths
     * @param {function(Error, AnnotationRegistryLibrary=)} callback
     */
    parseOnce: function(filePaths, callback) {
        var _this                       = this;
        var annotationRegistryLibrary   = null;
        $series([
            $task(function(flow) {
                _this.ensureBuilderInitialized(function(throwable) {
                    flow.complete(throwable);
                });
            }),
            $task(function(flow) {
                _this.annotationRegistryLibraryBuilder.build(filePaths, function(throwable, returnedAnnotationRegistryLibrary) {
                    if (!throwable) {
                        annotationRegistryLibrary = returnedAnnotationRegistryLibrary;
                    }
                    flow.complete(throwable);
                });
            }),
            $task(function(flow) {
                _this.ensureBuilderDeinitialized(function(throwable) {
                    flow.complete(throwable);
                });
            }),
        ]).execute(function(throwable) {
            if (!throwable) {
                callback(null, annotationRegistryLibrary);
            } else {
                callback(throwable);
            }
        });
    },

    //-------------------------------------------------------------------------------
    // Private Methods
    //-------------------------------------------------------------------------------

    /**
     * @private
     * @param {function(Throwable=)} callback
     */
    ensureBuilderDeinitialized: function(callback) {
        if (this.annotationRegistryLibraryBuilder.isInitialized()) {
            this.annotationRegistryLibraryBuilder.addEventListener(AnnotationRegistryLibraryBuilder.EventTypes.DEINITIALIZE_COMPLETE, function(event) {
                callback();
            });
            if (!this.annotationRegistryLibraryBuilder.isDeinitializing()) {
                this.annotationRegistryLibraryBuilder.deinitialize();
            }
        } else {
            callback();
        }
    },

    /**
     * @private
     * @param {function(Throwable=)} callback
     */
    ensureBuilderInitialized: function(callback) {
        if (!this.annotationRegistryLibraryBuilder.isInitialized()) {
            this.annotationRegistryLibraryBuilder.addEventListener(AnnotationRegistryLibraryBuilder.EventTypes.INITIALIZE_COMPLETE, function(event) {
                callback();
            });
            if (!this.annotationRegistryLibraryBuilder.isInitializing()) {
                this.annotationRegistryLibraryBuilder.initialize();
            }
        } else {
            callback();
        }
    }
});

//-------------------------------------------------------------------------------
// Private Static Variables
//-------------------------------------------------------------------------------

/**
 * @static
 * @private
 * @type {BugAnno}
 */
BugAnno.instance = null;

//-------------------------------------------------------------------------------
// Private Static Methods
//-------------------------------------------------------------------------------

/**
 * @static
 * @private
 * @return {BugAnno}
 */
BugAnno.getInstance = function() {
    if (BugAnno.instance === null) {
        BugAnno.instance = new BugAnno();
    }
    return BugAnno.instance;
};

//-------------------------------------------------------------------------------
// Static Proxy
//-------------------------------------------------------------------------------

Proxy.proxy(BugAnno, Proxy.method(BugAnno.getInstance), [
    "deinitialize",
    "initialize",
    "parse",
    "parseOnce"
]);

//-------------------------------------------------------------------------------
// Export
//-------------------------------------------------------------------------------

bugpack.export('buganno.BugAnno', BugAnno);
<commit_msg>Minor tweak to comments<commit_after>//-------------------------------------------------------------------------------
// Annotations
//-------------------------------------------------------------------------------

//@Export('buganno.BugAnno')

//@Require('Class')
//@Require('Obj')
//@Require('Proxy')
//@Require('buganno.AnnotationRegistryLibraryBuilder')
//@Require('bugflow.BugFlow')

//-------------------------------------------------------------------------------
// Common Modules
//-------------------------------------------------------------------------------

var bugpack                             = require('bugpack').context();

//-------------------------------------------------------------------------------
// BugPack
//-------------------------------------------------------------------------------

var Class                               = bugpack.require('Class');
var Obj                                 = bugpack.require('Obj');
var Proxy                               = bugpack.require('Proxy');
var AnnotationRegistryLibraryBuilder    = bugpack.require('buganno.AnnotationRegistryLibraryBuilder');
var BugFlow                             = bugpack.require('bugflow.BugFlow');

//-------------------------------------------------------------------------------
// Simplify References
//-------------------------------------------------------------------------------

var $series                             = BugFlow.$series;
var $task                               = BugFlow.$task;

//-------------------------------------------------------------------------------
// Declare Class
//-------------------------------------------------------------------------------

/**
 * @class
 * @extends {Obj}
 */
var BugAnno = Class.extend(Obj, {

    //-------------------------------------------------------------------------------
    // Constructor
    //-------------------------------------------------------------------------------

    /**
     * @constructs
     */
    _constructor: function() {

        this._super();

        //-------------------------------------------------------------------------------
        // Private Properties
        //-------------------------------------------------------------------------------

        /**
         * @private
         * @type {AnnotationRegistryLibraryBuilder}
         */
        this.annotationRegistryLibraryBuilder   = new AnnotationRegistryLibraryBuilder();
    },

    //-------------------------------------------------------------------------------
    // Getters and Setters
    //-------------------------------------------------------------------------------

    /**
     * @return {AnnotationRegistryLibraryBuilder}
     */
    getAnnotationRegistryLibraryBuilder: function() {
        return this.annotationRegistryLibraryBuilder;
    },

    //-------------------------------------------------------------------------------
    // Public Methods
    //-------------------------------------------------------------------------------

    /**
     * @param {function(Throwable=)} callback
     */
    deinitialize: function(callback) {
        this.ensureBuilderDeinitialized(callback);
    },

    /**
     * @param {function(Throwable=)} callback
     */
    initialize: function(callback) {
        this.ensureBuilderInitialized(callback);
    },

    /**
     * @param {(Array.<(string | Path)> | ICollection.<(string | Path)>)} filePaths
     * @param {function(Error, AnnotationRegistryLibrary=)} callback
     */
    parse: function(filePaths, callback) {
        var _this                       = this;
        var annotationRegistryLibrary   = null;
        $series([
            $task(function(flow) {
                _this.annotationRegistryLibraryBuilder.build(filePaths, function(throwable, returnedAnnotationRegistryLibrary) {
                    if (!throwable) {
                        annotationRegistryLibrary = returnedAnnotationRegistryLibrary;
                    }
                    flow.complete(throwable);
                });
            })
        ]).execute(function(throwable) {
            if (!throwable) {
                callback(null, annotationRegistryLibrary);
            } else {
                callback(throwable);
            }
        });
    },

    /**
     * @param {(Array.<(string | Path)> | ICollection.<(string | Path)>)} filePaths
     * @param {function(Error, AnnotationRegistryLibrary=)} callback
     */
    parseOnce: function(filePaths, callback) {
        var _this                       = this;
        var annotationRegistryLibrary   = null;
        $series([
            $task(function(flow) {
                _this.ensureBuilderInitialized(function(throwable) {
                    flow.complete(throwable);
                });
            }),
            $task(function(flow) {
                _this.annotationRegistryLibraryBuilder.build(filePaths, function(throwable, returnedAnnotationRegistryLibrary) {
                    if (!throwable) {
                        annotationRegistryLibrary = returnedAnnotationRegistryLibrary;
                    }
                    flow.complete(throwable);
                });
            }),
            $task(function(flow) {
                _this.ensureBuilderDeinitialized(function(throwable) {
                    flow.complete(throwable);
                });
            }),
        ]).execute(function(throwable) {
            if (!throwable) {
                callback(null, annotationRegistryLibrary);
            } else {
                callback(throwable);
            }
        });
    },

    //-------------------------------------------------------------------------------
    // Private Methods
    //-------------------------------------------------------------------------------

    /**
     * @private
     * @param {function(Throwable=)} callback
     */
    ensureBuilderDeinitialized: function(callback) {
        if (this.annotationRegistryLibraryBuilder.isInitialized()) {
            this.annotationRegistryLibraryBuilder.addEventListener(AnnotationRegistryLibraryBuilder.EventTypes.DEINITIALIZE_COMPLETE, function(event) {
                callback();
            });
            if (!this.annotationRegistryLibraryBuilder.isDeinitializing()) {
                this.annotationRegistryLibraryBuilder.deinitialize();
            }
        } else {
            callback();
        }
    },

    /**
     * @private
     * @param {function(Throwable=)} callback
     */
    ensureBuilderInitialized: function(callback) {
        if (!this.annotationRegistryLibraryBuilder.isInitialized()) {
            this.annotationRegistryLibraryBuilder.addEventListener(AnnotationRegistryLibraryBuilder.EventTypes.INITIALIZE_COMPLETE, function(event) {
                callback();
            });
            if (!this.annotationRegistryLibraryBuilder.isInitializing()) {
                this.annotationRegistryLibraryBuilder.initialize();
            }
        } else {
            callback();
        }
    }
});

//-------------------------------------------------------------------------------
// Private Static Variables
//-------------------------------------------------------------------------------

/**
 * @static
 * @private
 * @type {BugAnno}
 */
BugAnno.instance = null;

//-------------------------------------------------------------------------------
// Static Methods
//-------------------------------------------------------------------------------

/**
 * @static
 * @return {BugAnno}
 */
BugAnno.getInstance = function() {
    if (BugAnno.instance === null) {
        BugAnno.instance = new BugAnno();
    }
    return BugAnno.instance;
};

//-------------------------------------------------------------------------------
// Static Proxy
//-------------------------------------------------------------------------------

Proxy.proxy(BugAnno, Proxy.method(BugAnno.getInstance), [
    "deinitialize",
    "initialize",
    "parse",
    "parseOnce"
]);

//-------------------------------------------------------------------------------
// Export
//-------------------------------------------------------------------------------

bugpack.export('buganno.BugAnno', BugAnno);
<|endoftext|>


<commit_before>
Package.describe({
  description : 'Upload your images to s3.',
  version     : '0.0.0',
  name        : 's3uploader',
});

Npm.depends({
  'aws-sdk': '2.1.14'
});

Package.onUse(function (api) {

  api.use([ 'mongo', 'livedata' ]);

  api.addFiles([
    'collections.js'
  ]);

  api.addFiles([
    'uploader.js'
  ], 'server');

  api.export('S3');
});
<commit_msg>Added a reminder about slingshot<commit_after>
// maybe we could use slingshot instead?
// https://github.com/CulturalMe/meteor-slingshot

Package.describe({
  description : 'Upload your images to s3.',
  version     : '0.0.0',
  name        : 's3uploader',
});

Npm.depends({
  'aws-sdk': '2.1.14'
});

Package.onUse(function (api) {

  api.use([ 'mongo', 'livedata' ]);

  api.addFiles([
    'collections.js'
  ]);

  api.addFiles([
    'uploader.js'
  ], 'server');

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


<commit_before>Package.describe({
  name: 'vulcan:lib',
  summary: 'Vulcan libraries.',
  version: '1.11.0',
  git: 'https://github.com/VulcanJS/Vulcan.git',
});

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

  // note: if used, accounts-base should be loaded before vulcan:lib
  api.use('accounts-base', { weak: true });

  var packages = [
    'buffer@0.0.0', // see https://github.com/meteor/meteor/issues/8645

    // Minimal Meteor packages

    'meteor@1.9.0',
    'static-html',
    'standard-minifier-css@1.4.1',
    'standard-minifier-js@2.3.4',
    'es5-shim@4.8.0',
    'ecmascript@0.11.0',
    'shell-server@0.3.1',
    'webapp@1.6.0',
    'server-render@0.3.1',

    // Other meteor-base package
    // see https://github.com/meteor/meteor/blob/master/packages/meteor-base/package.js

    'underscore',
    // 'hot-code-push',
    // 'ddp',

    // Other packages

    'mongo',
    'check',
    'http',
    'email',
    'random',

    // Third-party packages

    // 'aldeed:collection2-core@2.0.0',
    'meteorhacks:picker@1.0.3',
    'percolatestudio:synced-cron@1.1.0',
    'meteorhacks:inject-initial@1.0.4',
  ];

  api.use(packages);

  api.imply(packages);

  api.export(['Vulcan']);

  api.mainModule('lib/server/main.js', 'server');
  api.mainModule('lib/client/main.js', 'client');
});
<commit_msg>Add hot-code-push<commit_after>Package.describe({
  name: 'vulcan:lib',
  summary: 'Vulcan libraries.',
  version: '1.11.0',
  git: 'https://github.com/VulcanJS/Vulcan.git',
});

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

  // note: if used, accounts-base should be loaded before vulcan:lib
  api.use('accounts-base', { weak: true });

  var packages = [
    'buffer@0.0.0', // see https://github.com/meteor/meteor/issues/8645

    // Minimal Meteor packages

    'meteor@1.9.0',
    'static-html',
    'standard-minifier-css@1.4.1',
    'standard-minifier-js@2.3.4',
    'es5-shim@4.8.0',
    'ecmascript@0.11.0',
    'shell-server@0.3.1',
    'webapp@1.6.0',
    'server-render@0.3.1',

    // Other meteor-base package
    // see https://github.com/meteor/meteor/blob/master/packages/meteor-base/package.js

    'underscore',
    'hot-code-push',
    // 'ddp',

    // Other packages

    'mongo',
    'check',
    'http',
    'email',
    'random',

    // Third-party packages

    // 'aldeed:collection2-core@2.0.0',
    'meteorhacks:picker@1.0.3',
    'percolatestudio:synced-cron@1.1.0',
    'meteorhacks:inject-initial@1.0.4',
  ];

  api.use(packages);

  api.imply(packages);

  api.export(['Vulcan']);

  api.mainModule('lib/server/main.js', 'server');
  api.mainModule('lib/client/main.js', 'client');
});
<|endoftext|>