<commit_before>({
    block: 'b-page',
    title: 'BEM: Methodology of Effective Site Development',
    favicon: '/favicon.ico',
    head: [
        { elem: 'css', url: '/bundles-desktop/index/_index.css' },
        // { elem: 'css', url: '/bundles-desktop/index/_index', ie: true },
        // { block: 'i-jquery', elem: 'core' },
        // { elem: 'js', url: '/bundles-desktop/index/_index.js' },
        { elem: 'meta', attrs: { name: 'description', content: 'BEM is abbreviation for Block-Element-Modifier. It\'s a way to write code which is easy to support and develop.' }},
        { elem: 'meta', attrs: { name: 'keywords', content: 'bem, block, element, modifier, bemjson, bemhtml, i-bem, i-bem.js, borschik, bem tools, csso' }}
    ],
    content: [
        {
            block: 'lang-switcher',
            content: [
                'English | ',
                {
                    block: 'b-link',
                    url: '//ru.bem.info/',
                    content: 'Русский'
                }
            ]
        },
        {
            block: 'logo',
            mods: { type: 'main' }
        },
        {
            block: 'content',
            content: [
                {
                    block: 'island',
                    mix: [{ block: 'whatisbem' }],
                    content: [
                        {
                            block: 'heading',
                            content: 'What is BEM'
                        },
                        {
                            block: 'description',
                            content: [
                                'BEM stands for Block-Element-Modifier. It\'s a way to modularize the development of pages. ',
                                'By breaking things into Blocks, being able to break those into Elements, and then use ',
                                'Modifiers on them, we get a neat TLA and a methodology where each part can advance ',
                                'rapidly and independently.',
                                'No matter if you are a large team or a single developer. ',
                                'BEM gives its benefits for all.'
                            ]
                        },
                        {
                            block: 'col',
                            content: [
                                {
                                    block: 'heading',
                                    mods: { size: 's' },
                                    content: 'Pros for developer'
                                },
                                {
                                    block: 'list',
                                    tag: 'ul',
                                    content: [
                                        {
                                            tag: 'li',
                                            content: 'Simplifies the development and support'
                                        },
                                        {
                                            tag: 'li',
                                            content: 'Eases switching between projects'
                                        },
                                        {
                                            tag: 'li',
                                            content: 'Enables reusing code'
                                        },
                                        {
                                            tag: 'li',
                                            content: 'Prevents code degradation when the project team grows'
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            block: 'col',
                            content: [
                                {
                                    block: 'heading',
                                    mods: { size: 's' },
                                    content: 'Pros for team'
                                },
                                {
                                    block: 'list',
                                    content: [
                                        {
                                            elem: 'item',
                                            content: 'Rapid involving new team members'
                                        },
                                        {
                                            elem: 'item',
                                            content: 'Different professionals share the same code base'
                                        },
                                        {
                                            elem: 'item',
                                            content: 'Independent work on the parts of the project'
                                        },
                                        {
                                            elem: 'item',
                                            content: 'Using someone else\'s code without diving into implementation'
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                {
                    block: 'island',
                    mix: [{ block: 'methodology' }],
                    content: [
                        {
                            block: 'heading',
                            content: {
                                block: 'b-link',
                                url: '/method/',
                                content: 'Methodology'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                'BEM gives useful patterns and methodological recommendations on ',
                                'writing CSS, JavaScript, templates (and other web-related techs) in an extra-semantic way. ',
                                'Besides, it\'s a pleasure for developers, it also helps to keep interfaces fast-to-develop ',
                                'and easy-to-maintain in the long run.'
                            ]
                        },
                        {
                            block: 'heading',
                            mods: { size: 'm' },
                            content: {
                                block: 'b-link',
                                url: '/method/definitions/',
                                content: 'Block, Element, Modifier'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                'The three terms uncover their meaning in this well-illustrated article.'
                            ]
                        },
                        {
                            block: 'heading',
                            mods: { size: 'm' },
                            content: {
                                block: 'b-link',
                                url: '/articles/start-with-project-stub/',
                                content: 'Quick start full BEM stack'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                'Try BEM idea of independent blocks, BEMHTML template engine, writing extra ',
                                'semantic JavaScript, linking a library to the project and redefining its ',
                                'functionality at the project level.'
                            ]
                        },
                        {
                            block: 'heading',
                            mods: { size: 'm' },
                            content: {
                                block: 'b-link',
                                url: '/method/history/',
                                content: 'The history of BEM'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                {
                                    content: 'Once upon a time, in a distant country far-far away, an IT company named Yandex started developing web search and affiliated services...'
                                }
                            ]
                        }
                    ]
                },
                {
                    block: 'island',
                    mix: [{ block: 'tools' }],
                    content: [
                        {
                            block: 'heading',
                            content: {
                                block: 'b-link',
                                url: '/tools/',
                                content: 'Tools'
                            }
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: '/tools/bem/',
                            content: 'BEM tools'
                        },
                        {
                            block: 'description',
                            content: 'Toolkit to work with files based on BEM methodology: create entities, dev server, build final runtime.'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: '/tools/csso/',
                            content: 'CSSO'
                        },
                        {
                            block: 'description',
                            content: 'CSSO (CSS Optimizer) is a CSS minimizer unlike others. In addition to usual minification techniques it can perform structural optimization of CSS files, resulting in smaller file size compared to other minifiers.'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'https://github.com/svg/svgo/#readme',
                            content: 'SVGO'
                        },
                        {
                            block: 'description',
                            content: [
                                '(SVG Optimizer) is a NodeJS-based tool for optimizing SVG vector graphics files.
',
                                'SVGO has a plugin-based architecture, so almost every optimization is a separate plugin, and you can easily add your own.'
                            ]
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'tools/',
                            content: 'All tools developed by BEM team'
                        }
                    ]
                },
                {
                    block: 'island',
                    mix: [{ block: 'libraries' }],
                    content: [
                        {
                            block: 'heading',
                            content: 'Block libraries'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 'm' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'http://bem.github.com/bem-bl/index.en.html',
                            content: 'bem-bl'
                        },
                        {
                            block: 'description',
                            content: [
                                'This is an open source UI block library implemented accroding to the BEM methodology.
',
                                'Blocks are implemented at bemhtml (templates), css, client-side js.
',
                                'You need BEM tools to use the library.'
                            ]
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 'm' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'http://gfranco.github.com/bootstrap-bl/',
                            content: 'bootstrap-bl'
                        },
                        {
                            block: 'description',
                            content: {
                                content: [
                                    'It\'s the Bootstrap, but better!
',
                                    'bootstrap-bl — half-assed attempt to implement original bootstrap using BEM methodology, modularity and stuff.'
                                ]
                            }
                        }
                    ]
                }
            ]
        },
/*
        {
            block: 'portfolio',
            content: [
                {
                    elem: 'title',
                    content: 'Showcase'
                },
                {
                    block: 'companies',
                    content: [
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'yandex' } }],
                            target: '_blank',
                            url: '//www.yandex.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'thk' } }],
                            target: '_blank',
                            url: '//www.tnk-racing.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'hh' } }],
                            target: '_blank',
                            url: '//hh.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'rambler' } }],
                            target: '_blank',
                            url: '//rambler.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'nile' } }],
                            target: '_blank',
                            url: '//nile.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'yota' } }],
                            target: '_blank',
                            url: '//yota.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'lj' } }],
                            target: '_blank',
                            url: '//livejournal.com/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'lenta' } }],
                            target: '_blank',
                            url: '//lenta.ru/'
                        }
                    ]
                }
            ]
        },
*/
        {
            block: 'footer'
        },
        {
            block: 'metrika'
        }
    ]
})
<commit_msg>Some height tuning<commit_after>({
    block: 'b-page',
    title: 'BEM: Methodology of Effective Site Development',
    favicon: '/favicon.ico',
    head: [
        { elem: 'css', url: '/bundles-desktop/index/_index.css' },
        // { elem: 'css', url: '/bundles-desktop/index/_index', ie: true },
        // { block: 'i-jquery', elem: 'core' },
        // { elem: 'js', url: '/bundles-desktop/index/_index.js' },
        { elem: 'meta', attrs: { name: 'description', content: 'BEM is abbreviation for Block-Element-Modifier. It\'s a way to write code which is easy to support and develop.' }},
        { elem: 'meta', attrs: { name: 'keywords', content: 'bem, block, element, modifier, bemjson, bemhtml, i-bem, i-bem.js, borschik, bem tools, csso' }}
    ],
    content: [
        {
            block: 'lang-switcher',
            content: [
                'English | ',
                {
                    block: 'b-link',
                    url: '//ru.bem.info/',
                    content: 'Русский'
                }
            ]
        },
        {
            block: 'logo',
            mods: { type: 'main' }
        },
        {
            block: 'content',
            content: [
                {
                    block: 'island',
                    mix: [{ block: 'whatisbem' }],
                    content: [
                        {
                            block: 'heading',
                            content: 'What is BEM'
                        },
                        {
                            block: 'description',
                            content: [
                                'BEM stands for Block-Element-Modifier. It\'s a way to modularize the development of pages. ',
                                'By breaking things into Blocks, being able to break those into Elements, and then use ',
                                'Modifiers on them, we get a neat TLA and a methodology where each part can advance ',
                                'rapidly and independently.',
                                'No matter if you are a large team or a single developer. ',
                                'BEM gives its benefits for all.'
                            ]
                        },
                        {
                            block: 'col',
                            content: [
                                {
                                    block: 'heading',
                                    mods: { size: 's' },
                                    content: 'Pros for developer'
                                },
                                {
                                    block: 'list',
                                    tag: 'ul',
                                    content: [
                                        {
                                            tag: 'li',
                                            content: 'Simplifies the development and support'
                                        },
                                        {
                                            tag: 'li',
                                            content: 'Eases switching between projects'
                                        },
                                        {
                                            tag: 'li',
                                            content: 'Enables reusing code'
                                        },
                                        {
                                            tag: 'li',
                                            content: 'Prevents code degradation when the project team grows'
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            block: 'col',
                            content: [
                                {
                                    block: 'heading',
                                    mods: { size: 's' },
                                    content: 'Pros for team'
                                },
                                {
                                    block: 'list',
                                    content: [
                                        {
                                            elem: 'item',
                                            content: 'Rapid involving new team members'
                                        },
                                        {
                                            elem: 'item',
                                            content: 'Different professionals share the same code base'
                                        },
                                        {
                                            elem: 'item',
                                            content: 'Independent work on the parts of the project'
                                        },
                                        {
                                            elem: 'item',
                                            content: 'Using someone else\'s code without diving into implementation'
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                {
                    block: 'island',
                    mix: [{ block: 'methodology' }],
                    content: [
                        {
                            block: 'heading',
                            content: {
                                block: 'b-link',
                                url: '/method/',
                                content: 'Methodology'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                'BEM gives useful patterns and methodological recommendations on ',
                                'writing CSS, JavaScript, templates (and other web-related techs) in an extra-semantic way.
',
                                'Besides it\'s a pleasure for developers, it also helps to keep interfaces fast-to-develop ',
                                'and easy-to-maintain in the long run.'
                            ]
                        },
                        {
                            block: 'heading',
                            mods: { size: 'm' },
                            content: {
                                block: 'b-link',
                                url: '/method/definitions/',
                                content: 'Block, Element, Modifier'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                'The three terms uncover their meaning in this well-illustrated article.'
                            ]
                        },
                        {
                            block: 'heading',
                            mods: { size: 'm' },
                            content: {
                                block: 'b-link',
                                url: '/articles/start-with-project-stub/',
                                content: 'Quick start full BEM stack'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                'Try BEM idea of independent blocks, BEMHTML template engine, writing extra ',
                                'semantic JavaScript, linking a library to the project and redefining its ',
                                'functionality at the project level.'
                            ]
                        },
                        {
                            block: 'heading',
                            mods: { size: 'm' },
                            content: {
                                block: 'b-link',
                                url: '/method/history/',
                                content: 'The history of BEM'
                            }
                        },
                        {
                            block: 'description',
                            content: [
                                {
                                    content: 'Once upon a time, in a distant country far-far away, an IT company named Yandex started developing web search and affiliated services...'
                                }
                            ]
                        }
                    ]
                },
                {
                    block: 'island',
                    mix: [{ block: 'tools' }],
                    content: [
                        {
                            block: 'heading',
                            content: {
                                block: 'b-link',
                                url: '/tools/',
                                content: 'Tools'
                            }
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: '/tools/bem/',
                            content: 'BEM tools'
                        },
                        {
                            block: 'description',
                            content: 'Toolkit to work with files based on BEM methodology: create entities, dev server, build final runtime.'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: '/tools/csso/',
                            content: 'CSSO'
                        },
                        {
                            block: 'description',
                            content: 'CSSO (CSS Optimizer) is a CSS minimizer unlike others. In addition to usual minification techniques it can perform structural optimization of CSS files, resulting in smaller file size compared to other minifiers.'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'https://github.com/svg/svgo/#readme',
                            content: 'SVGO'
                        },
                        {
                            block: 'description',
                            content: [
                                '(SVG Optimizer) is a NodeJS-based tool for optimizing SVG vector graphics files.
',
                                'SVGO has a plugin-based architecture, so almost every optimization is a separate plugin, and you can easily add your own.'
                            ]
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 's' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'tools/',
                            content: 'All tools developed by BEM team'
                        }
                    ]
                },
                {
                    block: 'island',
                    mix: [{ block: 'libraries' }],
                    content: [
                        {
                            block: 'heading',
                            content: 'Block libraries'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 'm' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'http://bem.github.com/bem-bl/index.en.html',
                            content: 'bem-bl'
                        },
                        {
                            block: 'description',
                            content: [
                                'This is an open source UI block library implemented accroding to the BEM methodology.
',
                                'Blocks are implemented at bemhtml (templates), css, client-side js.
',
                                'You need BEM tools to use the library.'
                            ]
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'heading', mods: { size: 'm' } }, { block: 'i-font', face: 'alsekibastuz' }],
                            url: 'http://gfranco.github.com/bootstrap-bl/',
                            content: 'bootstrap-bl'
                        },
                        {
                            block: 'description',
                            content: {
                                content: [
                                    'It\'s the Bootstrap, but better!
',
                                    'bootstrap-bl — half-assed attempt to implement original bootstrap using BEM methodology, modularity and stuff.'
                                ]
                            }
                        }
                    ]
                }
            ]
        },
/*
        {
            block: 'portfolio',
            content: [
                {
                    elem: 'title',
                    content: 'Showcase'
                },
                {
                    block: 'companies',
                    content: [
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'yandex' } }],
                            target: '_blank',
                            url: '//www.yandex.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'thk' } }],
                            target: '_blank',
                            url: '//www.tnk-racing.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'hh' } }],
                            target: '_blank',
                            url: '//hh.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'rambler' } }],
                            target: '_blank',
                            url: '//rambler.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'nile' } }],
                            target: '_blank',
                            url: '//nile.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'yota' } }],
                            target: '_blank',
                            url: '//yota.ru/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'lj' } }],
                            target: '_blank',
                            url: '//livejournal.com/'
                        },
                        {
                            block: 'b-link',
                            mix: [{ block: 'companies', elem: 'company',  elemMods: { name: 'lenta' } }],
                            target: '_blank',
                            url: '//lenta.ru/'
                        }
                    ]
                }
            ]
        },
*/
        {
            block: 'footer'
        },
        {
            block: 'metrika'
        }
    ]
})
<|endoftext|>


<commit_before>/**
 * Test client logic.
 *
 * @package randy
 * @author Andrew Sliwinski
 */

$(document).ready(function() {

    /**
     * Setup
     */
    var $user       = $('#user', '#base');
    var $actions    = $('#actions', '#base');
    var $activity   = $('#activity', '#notifications');
    var $notice     = $('#message-sent');

    /**
     * Generate unique (random) user id
     */
    var user        = 'test::1234';
    if (Math.floor(Math.random() * 3) % 2) {
        user        = 'test::' + Math.floor(Math.random()*99999);
    }
    $user.html(user);
    $('#target').val(user);

    /**
     * Socket.io events
     */
    //var socket = io.connect('//localhost:80');
    var socket = io.connect('//randy.jit.su:80');
    socket.emit('register', user);

    socket.on('notice', function (data) {
        $activity.prepend('
' + JSON.stringify(data) + '
');
        $activity.find('p').first().prepend('Dismiss ');
        $activity.find('p').first().prepend('Read ');

        if (data.read) {
            $activity.find('p').first().css('opacity', '0.5');
        }
    });

    /**
     * UI events
     */
    $('button').click(function (e) {
        e.preventDefault();

        var notice = {
            persist:    $('#input-persist').val(),
            target:     $('#input-target').val(),
            message:    $('#input-message').val()
        };

        if ($('#input-json').is(':checked')) {
            try {
                notice.message = JSON.parse(notice.message);
            } catch (e) {
                alert('Hold up, partner. Your message must be valid JSON.');
                return;
            }
        }

        socket.emit('loopback', notice);

        $notice.stop().css({opacity: 1}).html('Message sent!').show();
        window.setTimeout(function() {
            $notice.stop().animate({opacity: 0}, 2000);
        }, 5000);
    });

    $('a.read').live('click', function (e) {
        e.preventDefault();

        socket.emit('read', {
            id:     $(this).attr('id'),
            uid:    user
        });

        $(this).parent().css('opacity', '0.5');
    });

    $('a.dismiss').live('click', function (e) {
        e.preventDefault();

        socket.emit('dismiss', {
            id:     $(this).attr('id'),
            uid:    user
        });

        $(this).parent().css('display', 'none');
    });

});
<commit_msg>Fixed target setting (broken in da52f5f).<commit_after>/**
 * Test client logic.
 *
 * @package randy
 * @author Andrew Sliwinski
 */

$(document).ready(function() {

    /**
     * Setup
     */
    var $user       = $('#user', '#base');
    var $actions    = $('#actions', '#base');
    var $activity   = $('#activity', '#notifications');
    var $notice     = $('#message-sent');

    /**
     * Generate unique (random) user id
     */
    var user        = 'test::1234';
    if (Math.floor(Math.random() * 3) % 2) {
        user        = 'test::' + Math.floor(Math.random()*99999);
    }
    $user.html(user);
    $('#input-target').val(user);

    /**
     * Socket.io events
     */
    //var socket = io.connect('//localhost:80');
    var socket = io.connect('//randy.jit.su:80');
    socket.emit('register', user);

    socket.on('notice', function (data) {
        $activity.prepend('
' + JSON.stringify(data) + '
');
        $activity.find('p').first().prepend('Dismiss ');
        $activity.find('p').first().prepend('Read ');

        if (data.read) {
            $activity.find('p').first().css('opacity', '0.5');
        }
    });

    /**
     * UI events
     */
    $('button').click(function (e) {
        e.preventDefault();

        var notice = {
            persist:    $('#input-persist').val(),
            target:     $('#input-target').val(),
            message:    $('#input-message').val()
        };

        if ($('#input-json').is(':checked')) {
            try {
                notice.message = JSON.parse(notice.message);
            } catch (e) {
                alert('Hold up, partner. Your message must be valid JSON.');
                return;
            }
        }

        socket.emit('loopback', notice);

        $notice.stop().css({opacity: 1}).html('Message sent!').show();
        window.setTimeout(function() {
            $notice.stop().animate({opacity: 0}, 2000);
        }, 5000);
    });

    $('a.read').live('click', function (e) {
        e.preventDefault();

        socket.emit('read', {
            id:     $(this).attr('id'),
            uid:    user
        });

        $(this).parent().css('opacity', '0.5');
    });

    $('a.dismiss').live('click', function (e) {
        e.preventDefault();

        socket.emit('dismiss', {
            id:     $(this).attr('id'),
            uid:    user
        });

        $(this).parent().css('display', 'none');
    });

});
<|endoftext|>


<commit_before>'use strict';

require('colors');
var program = require('commander');

module.exports = function (argv) {

  require('./lib/notifier.js')('v14', function() {
    program
      .version(require('./package.json').version)
      .option('-f', '--firebase [firebasename]', 'Use the specified firebase instead of webhook main, for self hosting mode')
      .option('-s', '--server [uploadserver]', 'Use this server when uploading files, for self hosting mode');

    program
      .command('create <siteName>')
      .description('Create a new webhook site')
      .action(function (siteName) {
        require('./lib/create.js')({
          siteName: siteName.toLowerCase(),
          firebase: program.firebase
        });
      });

    program
      .command('init <siteName>')
      .description('Initializes a site with configuration files')
      .action(function (siteName) {
        require('./lib/init.js')({
          siteName: siteName.toLowerCase(),
          firebase: program.firebase
        });
      });

    program
      .command('list-sites')
      .description('Lists all the sites that the user is an owner/user on')
      .action(function () {
        require('./lib/list-sites.js')({
          firebase: program.firebase
        });
      });

    program
      .command('preset-build')
      .description('Generates a preset-data.json file from a webhook directory')
      .action(function () {
        require('./lib/preset-build.js')(false, {
          firebase: program.firebase
        });
      });

    program
      .command('preset-build-all')
      .description('Generates a preset-data.json file from a webhook directory which includes data')
      .action(function () {
        require('./lib/preset-build.js')(true, {
          firebase: program.firebase
        });
      });

    program
      .command('update')
      .description('Updates a webhook site with the latest generate code')
      .action(function () {
        require('./lib/update.js')({
          firebase: program.firebase
        });
      });

    program
      .command('push')
      .description('Push webhook directory to server')
      .action(function () {
        require('./lib/push.js')({
          firebase: program.firebase,
          server: server
        });
      });

    program
      .command('deploy')
      .description('Push webhook directory to server')
      .action(function () {
        require('./lib/push.js')({
          firebase: program.firebase,
          server: server
        });
      });

    program
      .command('serve [port]')
      .description('Serves a webhook site locally')
      .action(function (port) {
        require('./lib/serve.js')({
          port: port || null,
          firebase: program.firebase
        });
      });

    program
      .parse(argv);

    if (!program.args.length) program.help();
  });
};
<commit_msg>order matter<commit_after>'use strict';

require('colors');
var program = require('commander');

module.exports = function (argv) {

  require('./lib/notifier.js')('v14', function() {
    program
      .version(require('./package.json').version)
      .option('-f, --firebase [firebasename]', 'Use the specified firebase instead of webhook main, for self hosting mode')
      .option('-s, --server [uploadserver]', 'Use this server when uploading files, for self hosting mode');

    program
      .command('create <siteName>')
      .description('Create a new webhook site')
      .action(function (siteName) {
        require('./lib/create.js')({
          siteName: siteName.toLowerCase(),
          firebase: program.firebase
        });
      });

    program
      .command('init <siteName>')
      .description('Initializes a site with configuration files')
      .action(function (siteName) {
        require('./lib/init.js')({
          siteName: siteName.toLowerCase(),
          firebase: program.firebase
        });
      });

    program
      .command('list-sites')
      .description('Lists all the sites that the user is an owner/user on')
      .action(function () {
        require('./lib/list-sites.js')({
          firebase: program.firebase
        });
      });

    program
      .command('preset-build')
      .description('Generates a preset-data.json file from a webhook directory')
      .action(function () {
        require('./lib/preset-build.js')(false, {
          firebase: program.firebase
        });
      });

    program
      .command('preset-build-all')
      .description('Generates a preset-data.json file from a webhook directory which includes data')
      .action(function () {
        require('./lib/preset-build.js')(true, {
          firebase: program.firebase
        });
      });

    program
      .command('update')
      .description('Updates a webhook site with the latest generate code')
      .action(function () {
        require('./lib/update.js')({
          firebase: program.firebase
        });
      });

    program
      .command('push')
      .description('Push webhook directory to server')
      .action(function () {
        require('./lib/push.js')({
          firebase: program.firebase,
          server: server
        });
      });

    program
      .command('deploy')
      .description('Push webhook directory to server')
      .action(function () {
        require('./lib/push.js')({
          firebase: program.firebase,
          server: server
        });
      });

    program
      .command('serve [port]')
      .description('Serves a webhook site locally')
      .action(function (port) {
        require('./lib/serve.js')({
          port: port || null,
          firebase: program.firebase
        });
      });

    program
      .parse(argv);

    if (!program.args.length) program.help();
  });
};
<|endoftext|>


<commit_before>var nm = require("nodemailer");
var utils = require('./utils.js');
var t = nm.createTransport();

function sendAlert(stringerName, alertContent) {
  utils.readAsset('user-email.json', function(err, data) {
    t.sendMail({
      from: "bot@data.string.er",
      to: data,
      subject: "ALERT for " + stringerName,
      text: "On today's run, " + stringerName + "generated an alert, with the " +
          "following content:\n" + alertContent // TODO pretty print the object
    },
    function(err, info) {
      if(err) {
        console.log(err);
      }
    });
  });

}

module.exports = {
  sendAlert: sendAlert,
};
<commit_msg>Minor formatting correction<commit_after>var nm = require("nodemailer");
var utils = require('./utils.js');
var t = nm.createTransport();

function sendAlert(stringerName, alertContent) {
  utils.readAsset('user-email.json', function(err, data) {
    t.sendMail({
      from: "bot@data.string.er",
      to: data,
      subject: "ALERT for " + stringerName,
      text: "On today's run, " + stringerName + " generated an alert, with the " +
          "following content:\n" + alertContent // TODO pretty print the object
    },
    function(err, info) {
      if(err) {
        console.log(err);
      }
    });
  });

}

module.exports = {
  sendAlert: sendAlert,
};
<|endoftext|>


<commit_before>var _       = require('lodash');
var extend  = require('extend');
var fs      = require('fs');
var glob    = require('glob');
var path    = require('path');

module.exports = function (gulp, options) {
    var task = gulp.task;
    if (_.isString(options)) {
        options = {bundles: options};
    }
    options = extend({
        bundles: 'src/*',
        filename: 'gulptasks.js',
        namespace: function (bundle, task) {
            bundle = _.replace(bundle, /Bundle$/, '');
            return _.kebabCase(bundle) + ':' + task;
        }
    }, options || {});
    var bundles = [];
    if (_.isArray(options.bundles)) {
        bundles = options.bundles;
    } else if (_.isString(options.bundles)) {
        bundles = glob.sync(options.bundles);
    }
    bundles.forEach(function (bundle) {
        var file = path.join(bundle, options.filename);
        if (fs.existsSync(file)) {
            if (_.isFunction(options.namespace)) {
                gulp.task = function (name, dependencies, creator) {
                    name = options.namespace.call(options, path.basename(bundle), name);
                    return task.call(this, name, dependencies, creator);
                };
            }
            require('./' + file)(gulp);
        }
    });
    gulp.task = task;
};
<commit_msg>fix tasks file resolution<commit_after>var _       = require('lodash');
var extend  = require('extend');
var fs      = require('fs');
var glob    = require('glob');
var path    = require('path');

module.exports = function (gulp, options) {
    var task = gulp.task;
    if (_.isString(options)) {
        options = {bundles: options};
    }
    options = extend({
        bundles: 'src/*',
        filepath: 'Resources/public/gulptasks.js',
        namespace: function (bundle, task) {
            bundle = _.replace(bundle, /Bundle$/, '');
            return _.kebabCase(bundle) + ':' + task;
        }
    }, options || {});
    var bundles = [];
    if (_.isArray(options.bundles)) {
        bundles = options.bundles;
    } else if (_.isString(options.bundles)) {
        bundles = glob.sync(options.bundles);
    }
    bundles.forEach(function (bundle) {
        var filepath = path.join(bundle, options.filepath);
        if (fs.existsSync(filepath)) {
            if (_.isFunction(options.namespace)) {
                gulp.task = function (name, dependencies, creator) {
                    name = options.namespace.call(options, path.basename(bundle), name);
                    return task.call(this, name, dependencies, creator);
                };
            }
            require('./' + path.relative(__dirname, filepath))(gulp);
        }
    });
    gulp.task = task;
};
<|endoftext|>


<commit_before>import snabbdom from 'snabbdom'
const patch = snabbdom.init([
    require('snabbdom/modules/class'),
    require('snabbdom/modules/props'),
    require('snabbdom/modules/style'),
    require('snabbdom/modules/eventlisteners'),
    require('snabbdom/modules/attributes'),
]);
import h from 'snabbdom/h';

export default (app)=>{

    const wrapper = document.createElement('div');
    app.vdom.elm.parentNode.appendChild(wrapper);
    wrapper.appendChild(app.vdom.elm);

    let node = document.createElement('div')
    document.body.appendChild(node)

    wrapper.style.width = 'calc(100% - 350px)'
    wrapper.style.position = 'relative'
    wrapper.style.transition = '0.5s width'

    // State
    let state = {
        open: true,
        appIsFrozen: false,
        selectedViewNode: '',
        viewFoldersClosed: {},
        definition: app.definition,
    }
    // undo/redo
    let stateStack = [state]
    function setState(newState, pushToStack){
        if(newState === state){
            console.warn('state was mutated, search for a bug')
        }
        // some actions should not be recorded and controlled through undo/redo
        if(pushToStack){
            const currentIndex = stateStack.findIndex((a)=>a===state)
            stateStack = stateStack.slice(0, currentIndex+1).concat(newState);
        } else {
            // overwrite current
            stateStack[stateStack.findIndex((a)=>a===state)] = newState;
        }
        if(state.appIsFrozen !== newState.appIsFrozen || state.selectedViewNode !== newState.selectedViewNode ){
            app._freeze(newState.appIsFrozen, VIEW_NODE_SELECTED, newState.selectedViewNode)
        }
        if(state.definition !== newState.definition){
            app.render(newState.definition)
        }
        state = newState;
        render()
    }
    document.addEventListener('keydown', (e)=>{
        // 83 - s
        // 90 - z
        // 89 - y
        if(e.which == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
            e.preventDefault();
            fetch('/save', {method: 'POST', body: JSON.stringify(state.definition), headers: {"Content-Type": "application/json"}})
            return false;
        }
        if(e.which == 90 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
            const currentIndex = stateStack.findIndex((a)=>a===state)
            if(currentIndex > 0){
                const newState = stateStack[currentIndex-1]
                if(state.definition !== newState.definition){
                    app.render(newState.definition)
                }
                state = newState
                render()
            }

        }
        if(e.which == 89 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
            const currentIndex = stateStack.findIndex((a)=>a===state)
            if(currentIndex < stateStack.length-1){
                const newState = stateStack[currentIndex+1]
                if(state.definition !== newState.definition){
                    app.render(newState.definition)
                }
                state = newState
                render()
            }
        }
    })

    // Actions
    function ARROW_CLICKED() {
        setState({...state, open: !state.open})
        if(state.open){
            wrapper.style.width = 'calc(100% - 350px)'
        }
        else {
            wrapper.style.width = '100%'
        }
    }
    function FREEZER_CLICKED() {
        setState({...state, appIsFrozen: !state.appIsFrozen})
    }
    function VIEW_FOLDER_CLICKED(nodeId) {
        setState({...state, viewFoldersClosed:{...state.viewFoldersClosed, [nodeId]: !state.viewFoldersClosed[nodeId]}})
    }
    function VIEW_NODE_SELECTED(nodeId) {
        setState({...state, selectedViewNode:nodeId})
    }
    function DELETE_SELECTED_VIEW(nodeId, parentId, e) {
        // TODO rethink
        e.stopPropagation()
        if(nodeId === '_rootNode'){
            // immutably remove all nodes except rootNode
            return setState({...state, definition: {
                ...state.definition,
                nodes: {'_rootNode': {...state.definition.nodes['_rootNode'], childrenIds: []},
                styles: {'_rootStyle': state.definition.styles['_rootStyle']}
            }}}, true)
        }
        // traverse the tree and leave only used nodes
        // TODO
    }

    // Render
    function render() {
        const arrowComponent = h('div', {
            on: {
                click: ARROW_CLICKED
            },
            style: {
                position: 'absolute',
                left: '0',
                transform: 'translateX(-100%)',
                padding: '15px 15px 15px 15px',
                borderRadius: '5px 0 0 5px',
                top: '30px',
                width: '20px',
                textAlign: 'center',
                fontSize: '1em',
                background: '#4d4d4d',
                cursor: 'pointer',
                transition: 'all 0.5s',
            },
        }, [h('svg', {
                attrs: {width: 12, height: 16},
                style: { cursor: 'pointer', padding: '0 5px', transform: state.open ? 'rotate(0deg)': 'rotate(180deg)'},
            },
            [h('polygon', {attrs: {points: '12,8 0,1 3,8 0,15', fill: 'white'}})])])
        const freezeComponent = h('div', {
            on: {
                click: FREEZER_CLICKED
            },
            style: {
                position: 'absolute',
                left: '0',
                transform: 'translateX(-100%)',
                padding: '15px 15px 15px 15px',
                borderRadius: '5px 0 0 5px',
                top: '100px',
                width: '20px',
                textAlign: 'center',
                fontSize: '1em',
                background: '#4d4d4d',
                cursor: 'pointer',
                transition: 'all 0.5s',
            },
        }, state.appIsFrozen ? '►': '❚❚',)
        const stateComponent = h('div', {
            style: {
                flex: '1',
            }
        }, 'State')
        function listNodes(nodeId, parentId) {
            const node = state.definition.nodes[nodeId]
            if(node._type === 'vNode'){
                if(node.nodeType === 'box'){
                    const closed = state.viewFoldersClosed[nodeId]
                    return h('div', {
                            style: {
                                outline: state.selectedViewNode === nodeId ? '3px solid #3590df': '',
                                position: 'relative',
                            }
                        }, [
                            h('svg', {
                                    attrs: {width: 12, height: 16},
                                    style: { cursor: 'pointer', padding: '0 5px', transform: closed ? 'rotate(0deg)': 'rotate(90deg)'},
                                    on: {
                                        click: [VIEW_FOLDER_CLICKED, nodeId]
                                    },
                                },
                                [h('polygon', {attrs: {points: '12,8 0,1 3,8 0,15', fill: 'white'}})]),
                            h('span', { style: { cursor: 'pointer'}, on: {click: [VIEW_NODE_SELECTED, nodeId]}},node.nodeType),
                            h('div', {style: { display: closed ? 'none': 'block', marginLeft: '10px', paddingLeft: '10px', borderLeft:'1px solid white'}}, node.childrenIds.map((id)=> listNodes(id, nodeId))),
                            h('div', {style: {display: state.selectedViewNode === nodeId ? 'block': 'none' ,position: 'absolute', right: '5px', top: '0'}, on: {click: [DELETE_SELECTED_VIEW, nodeId, parentId]}}, 'x')
                        ]
                    )
                } else {
                    return h('div', {
                            style: {
                                cursor: 'pointer',
                                outline: state.selectedViewNode === nodeId ? '3px solid #3590df': '',
                                position: 'relative'
                            },
                            on: {click: [VIEW_NODE_SELECTED, nodeId]}
                        }, [
                            node.nodeType,
                            h('div', {style: {display: state.selectedViewNode === nodeId ? 'block': 'none' ,position: 'absolute', right: '5px', top: '0'}, on: {click: [DELETE_SELECTED_VIEW, nodeId, parentId]}}, 'x')
                        ]
                    )
                }
            }
        }
        const viewComponent = h('div', {
            style: {
                flex: '1',
                borderTop: '3px solid #333333',
                padding: '5px',
            }
        }, [listNodes('_rootNode')])

        const vnode =
            h('div', {
                style: {
                    display: 'flex',
                    flexDirection: 'column',
                    color: '#dddddd',
                    fontWeight: '300',
                    fontSize: '1.5em',
                    position: 'fixed',
                    top: '0',
                    right: '0',
                    width: '350px',
                    height: '100vh',
                    background: '#4d4d4d',
                    boxSizing: "border-box",
                    borderLeft: '3px solid #333333',
                    fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
                    transition: '0.5s transform',
                    transform: state.open ? 'translateX(0%)': 'translateX(100%)',
                },
            }, [
                arrowComponent,
                freezeComponent,
                stateComponent,
                viewComponent,
            ])

        node = patch(node, vnode)
    }

    render()
}<commit_msg>Finally add an actual remove<commit_after>import snabbdom from 'snabbdom'
const patch = snabbdom.init([
    require('snabbdom/modules/class'),
    require('snabbdom/modules/props'),
    require('snabbdom/modules/style'),
    require('snabbdom/modules/eventlisteners'),
    require('snabbdom/modules/attributes'),
]);
import h from 'snabbdom/h';

export default (app)=>{

    const wrapper = document.createElement('div');
    app.vdom.elm.parentNode.appendChild(wrapper);
    wrapper.appendChild(app.vdom.elm);

    let node = document.createElement('div')
    document.body.appendChild(node)

    wrapper.style.width = 'calc(100% - 350px)'
    wrapper.style.position = 'relative'
    wrapper.style.transition = '0.5s width'

    // State
    let state = {
        open: true,
        appIsFrozen: false,
        selectedViewNode: '',
        viewFoldersClosed: {},
        definition: app.definition,
    }
    // undo/redo
    let stateStack = [state]
    function setState(newState, pushToStack){
        if(newState === state){
            console.warn('state was mutated, search for a bug')
        }
        // some actions should not be recorded and controlled through undo/redo
        if(pushToStack){
            const currentIndex = stateStack.findIndex((a)=>a===state)
            stateStack = stateStack.slice(0, currentIndex+1).concat(newState);
        } else {
            // overwrite current
            stateStack[stateStack.findIndex((a)=>a===state)] = newState;
        }
        if(state.appIsFrozen !== newState.appIsFrozen || state.selectedViewNode !== newState.selectedViewNode ){
            app._freeze(newState.appIsFrozen, VIEW_NODE_SELECTED, newState.selectedViewNode)
        }
        if(state.definition !== newState.definition){
            app.render(newState.definition)
        }
        state = newState;
        render()
    }
    document.addEventListener('keydown', (e)=>{
        // 83 - s
        // 90 - z
        // 89 - y
        if(e.which == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
            e.preventDefault();
            fetch('/save', {method: 'POST', body: JSON.stringify(state.definition), headers: {"Content-Type": "application/json"}})
            return false;
        }
        if(e.which == 90 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
            const currentIndex = stateStack.findIndex((a)=>a===state)
            if(currentIndex > 0){
                const newState = stateStack[currentIndex-1]
                if(state.definition !== newState.definition){
                    app.render(newState.definition)
                }
                state = newState
                render()
            }

        }
        if(e.which == 89 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
            const currentIndex = stateStack.findIndex((a)=>a===state)
            if(currentIndex < stateStack.length-1){
                const newState = stateStack[currentIndex+1]
                if(state.definition !== newState.definition){
                    app.render(newState.definition)
                }
                state = newState
                render()
            }
        }
    })

    // Actions
    function ARROW_CLICKED() {
        setState({...state, open: !state.open})
        if(state.open){
            wrapper.style.width = 'calc(100% - 350px)'
        }
        else {
            wrapper.style.width = '100%'
        }
    }
    function FREEZER_CLICKED() {
        setState({...state, appIsFrozen: !state.appIsFrozen})
    }
    function VIEW_FOLDER_CLICKED(nodeId) {
        setState({...state, viewFoldersClosed:{...state.viewFoldersClosed, [nodeId]: !state.viewFoldersClosed[nodeId]}})
    }
    function VIEW_NODE_SELECTED(nodeId) {
        setState({...state, selectedViewNode:nodeId})
    }
    function DELETE_SELECTED_VIEW(nodeId, parentId, e) {
        e.stopPropagation()
        if(nodeId === '_rootNode'){
            // immutably remove all nodes except rootNode
            return setState({...state, definition: {
                ...state.definition,
                nodes: {'_rootNode': {...state.definition.nodes['_rootNode'], childrenIds: []}},
                styles: {'_rootStyle': state.definition.styles['_rootStyle']}
            }}, true)
        }
        // traverse the tree and leave only used nodes - Garbage collection
        const newNodes = {}
        const newStyles = {}
        function addNode(addNodeId) {
            let newNode = state.definition.nodes[addNodeId]
            if(parentId === addNodeId){
                newNode = {...newNode, childrenIds:newNode.childrenIds.filter((a)=>a!==nodeId)}
            }
            newNodes[addNodeId] = newNode
            const newStyleId = newNode.styleId
            newStyles[newStyleId] = state.definition.styles[newStyleId]
            if(newNode.childrenIds){
                newNode.childrenIds.forEach(addNode)
            }
        }
        addNode('_rootNode')
        setState({...state, definition: {
            ...state.definition,
            nodes: newNodes,
            styles: newStyles,
        }}, true)
    }

// Render
    function render() {
        const arrowComponent = h('div', {
            on: {
                click: ARROW_CLICKED
            },
            style: {
                position: 'absolute',
                left: '0',
                transform: 'translateX(-100%)',
                padding: '15px 15px 15px 15px',
                borderRadius: '5px 0 0 5px',
                top: '30px',
                width: '20px',
                textAlign: 'center',
                fontSize: '1em',
                background: '#4d4d4d',
                cursor: 'pointer',
                transition: 'all 0.5s',
            },
        }, [h('svg', {
                attrs: {width: 12, height: 16},
                style: { cursor: 'pointer', padding: '0 5px', transform: state.open ? 'rotate(0deg)': 'rotate(180deg)'},
            },
            [h('polygon', {attrs: {points: '12,8 0,1 3,8 0,15', fill: 'white'}})])])
        const freezeComponent = h('div', {
            on: {
                click: FREEZER_CLICKED
            },
            style: {
                position: 'absolute',
                left: '0',
                transform: 'translateX(-100%)',
                padding: '15px 15px 15px 15px',
                borderRadius: '5px 0 0 5px',
                top: '100px',
                width: '20px',
                textAlign: 'center',
                fontSize: '1em',
                background: '#4d4d4d',
                cursor: 'pointer',
                transition: 'all 0.5s',
            },
        }, state.appIsFrozen ? '►': '❚❚',)
        const stateComponent = h('div', {
            style: {
                flex: '1',
            }
        }, 'State')
        function listNodes(nodeId, parentId) {
            const node = state.definition.nodes[nodeId]
            if(node._type === 'vNode'){
                if(node.nodeType === 'box'){
                    const closed = state.viewFoldersClosed[nodeId]
                    return h('div', {
                            style: {
                                outline: state.selectedViewNode === nodeId ? '3px solid #3590df': '',
                                position: 'relative',
                            }
                        }, [
                            h('svg', {
                                    attrs: {width: 12, height: 16},
                                    style: { cursor: 'pointer', padding: '0 5px', transform: closed ? 'rotate(0deg)': 'rotate(90deg)'},
                                    on: {
                                        click: [VIEW_FOLDER_CLICKED, nodeId]
                                    },
                                },
                                [h('polygon', {attrs: {points: '12,8 0,1 3,8 0,15', fill: 'white'}})]),
                            h('span', { style: { cursor: 'pointer'}, on: {click: [VIEW_NODE_SELECTED, nodeId]}},node.nodeType),
                            h('div', {style: { display: closed ? 'none': 'block', marginLeft: '10px', paddingLeft: '10px', borderLeft:'1px solid white'}}, node.childrenIds.map((id)=> listNodes(id, nodeId))),
                            h('div', {style: {display: state.selectedViewNode === nodeId ? 'block': 'none' ,position: 'absolute', right: '5px', top: '0'}, on: {click: [DELETE_SELECTED_VIEW, nodeId, parentId]}}, 'x')
                        ]
                    )
                } else {
                    return h('div', {
                            style: {
                                cursor: 'pointer',
                                outline: state.selectedViewNode === nodeId ? '3px solid #3590df': '',
                                position: 'relative'
                            },
                            on: {click: [VIEW_NODE_SELECTED, nodeId]}
                        }, [
                            node.nodeType,
                            h('div', {style: {display: state.selectedViewNode === nodeId ? 'block': 'none' ,position: 'absolute', right: '5px', top: '0'}, on: {click: [DELETE_SELECTED_VIEW, nodeId, parentId]}}, 'x')
                        ]
                    )
                }
            }
        }
        const viewComponent = h('div', {
            style: {
                flex: '1',
                borderTop: '3px solid #333333',
                padding: '5px',
            }
        }, [listNodes('_rootNode')])

        const vnode =
            h('div', {
                style: {
                    display: 'flex',
                    flexDirection: 'column',
                    color: '#dddddd',
                    fontWeight: '300',
                    fontSize: '1.5em',
                    position: 'fixed',
                    top: '0',
                    right: '0',
                    width: '350px',
                    height: '100vh',
                    background: '#4d4d4d',
                    boxSizing: "border-box",
                    borderLeft: '3px solid #333333',
                    fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
                    transition: '0.5s transform',
                    transform: state.open ? 'translateX(0%)': 'translateX(100%)',
                },
            }, [
                arrowComponent,
                freezeComponent,
                stateComponent,
                viewComponent,
            ])

        node = patch(node, vnode)
    }

    render()
}<|endoftext|>


<commit_before>// Load in dependencies
var assert = require('assert');
var deepClone = require('clone');
var Completion = require('../');
var cursorUtils = require('./utils/cursor');

// Define set of utilities for `completion`
var completionUtils = {
  completeCommand: function (command) {
    before(function (done) {
      var params = cursorUtils.splitAtCursor(command);
      var that = this;
      this.completion.complete(params, function (err, results) {
        that.results = results;
        done(err);
      });
    });
    after(function () {
      delete this.results;
    });
  },
  init: function (params) {
    before(function initCompletion () {
      this.completion = new Completion(params);
    });
    after(function cleanupCompletion () {
      delete this.completion;
    });
  }
};

describe('A partial command with one completion match', function () {
  completionUtils.init({
    npm: {
      publish: null
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('npm pub|');

    it('returns its match', function () {
      assert.deepEqual(this.results, ['publish']);
    });
  });
});

describe('A partial command with multiple completions', function () {
  completionUtils.init({
    git: {
      checkout: function (params, cb) {
        cb(null, ['hello.world']);
      },
      'cherry-pick': function (params, cb) {
        cb(null, ['maraschino']);
      }
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('git ch|');

    it('returns all of its matches', function () {
      assert.deepEqual(this.results, ['checkout', 'cherry-pick']);
    });
  });
});

describe('A partial command in junction with the item', function () {
  completionUtils.init({
    git: {
      checkout: function (params, cb) {
        cb(null, ['hello.world']);
      },
      'cherry-pick': function (params, cb) {
        cb(null, ['maraschino']);
      }
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('git che|world');

    it('returns the command\'s match', function () {
      assert.deepEqual(this.results, ['checkout', 'cherry-pick']);
    });
  });
});

describe('A terminal command', function () {
  completionUtils.init({
    npm: {
      publish: null
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('npm publish|');

    it('returns the command (for spacing)', function () {
      assert.deepEqual(this.results, ['publish']);
    });
  });
});

describe('A terminal command with whitespace', function () {
 completionUtils.init({
    npm: {
      publish: null
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('npm publish |');

    it('returns nothing', function () {
      assert.deepEqual(this.results, []);
    });
  });
});

describe('A terminal command with a completion function', function () {
  completionUtils.init({
    git: {
      checkout: function (params, cb) {
        cb(null, ['hello-world', 'hello-there']);
      }
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('git checkout hello|');

    it('returns the results of the completion', function () {
      assert.deepEqual(this.results, ['hello-world', 'hello-there']);
    });
  });
});

describe('A command with options', function () {
  completionUtils.init({
    git: {
      '-b': function (params, cb) {
        // The `-b` has already been shifted because we matched `-b`
        // As a result, attempt to complete once again from `git's` context
        this.parentNode.completeInfo(params, cb);
      },
      checkout: function (params, cb) {
        cb(null, ['hello-world', 'hello-there']);
      }
    }
  });

  describe('being completed with a terminal command', function () {
    completionUtils.completeCommand('git -b chec|');

    it('returns the command without completion options', function () {
      assert.deepEqual(this.results, ['checkout']);
    });
  });

  describe('being completed with a non-terminal command', function () {
    completionUtils.completeCommand('git -b checkout hello|');

    it('returns the command without completion options', function () {
      assert.deepEqual(this.results, ['hello-world', 'hello-there']);
    });
  });
});
<commit_msg>Found regression case<commit_after>// Load in dependencies
var assert = require('assert');
var deepClone = require('clone');
var Completion = require('../');
var cursorUtils = require('./utils/cursor');

// Define set of utilities for `completion`
var completionUtils = {
  completeCommand: function (command) {
    before(function (done) {
      var params = cursorUtils.splitAtCursor(command);
      var that = this;
      this.completion.complete(params, function (err, results) {
        that.results = results;
        done(err);
      });
    });
    after(function () {
      delete this.results;
    });
  },
  init: function (params) {
    before(function initCompletion () {
      this.completion = new Completion(params);
    });
    after(function cleanupCompletion () {
      delete this.completion;
    });
  }
};

describe('A partial command with one completion match', function () {
  completionUtils.init({
    npm: {
      publish: null
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('npm pub|');

    it('returns its match', function () {
      assert.deepEqual(this.results, ['publish']);
    });
  });
});

describe('A partial command with multiple completions', function () {
  completionUtils.init({
    git: {
      checkout: function (params, cb) {
        cb(null, ['hello.world']);
      },
      'cherry-pick': function (params, cb) {
        cb(null, ['maraschino']);
      }
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('git ch|');

    it('returns all of its matches', function () {
      assert.deepEqual(this.results, ['checkout', 'cherry-pick']);
    });
  });
});

describe('A partial command in junction with the item', function () {
  completionUtils.init({
    git: {
      checkout: function (params, cb) {
        cb(null, ['hello.world']);
      },
      'cherry-pick': function (params, cb) {
        cb(null, ['maraschino']);
      }
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('git che|world');

    it('returns the command\'s match', function () {
      assert.deepEqual(this.results, ['checkout', 'cherry-pick']);
    });
  });
});

describe('A terminal command', function () {
  completionUtils.init({
    npm: {
      publish: null
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('npm publish|');

    it('returns the command (for spacing)', function () {
      assert.deepEqual(this.results, ['publish']);
    });
  });
});

describe('A terminal command with whitespace', function () {
 completionUtils.init({
    npm: {
      publish: null
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('npm publish |');

    it('returns nothing', function () {
      assert.deepEqual(this.results, []);
    });
  });
});

describe('A terminal command with a completion function', function () {
  completionUtils.init({
    git: {
      checkout: function (params, cb) {
        cb(null, ['hello-world', 'hello-there']);
      }
    }
  });

  describe('being completed', function () {
    completionUtils.completeCommand('git checkout hello|');

    it('returns the results of the completion', function () {
      assert.deepEqual(this.results, ['hello-world', 'hello-there']);
    });
  });
});

describe('A command with options', function () {
  completionUtils.init({
    git: {
      '-b': function (params, cb) {
        // The `-b` has already been shifted because we matched `-b`
        // As a result, attempt to complete once again from `git's` context
        this.parentNode.completeInfo(params, cb);
      },
      checkout: function (params, cb) {
        cb(null, ['hello-world', 'hello-there']);
      }
    }
  });

  describe('being completed with a terminal command', function () {
    completionUtils.completeCommand('git -b chec|');

    it('returns the command without completion options', function () {
      assert.deepEqual(this.results, ['checkout']);
    });
  });

  describe('being completed with a non-terminal command', function () {
    completionUtils.completeCommand('git -b checkout hello|');

    it('returns the command without completion options', function () {
      assert.deepEqual(this.results, ['hello-world', 'hello-there']);
    });
  });

  describe('being completed with a command followed by an option', function () {
    completionUtils.completeCommand('git checkout -b wat|');

    it('returns the command without completion options', function () {
      assert.deepEqual(this.results, []);
    });
  });
});
<|endoftext|>