<commit_before>
import React from "react";
import LightComponent from "ui-lib/light_component";
import { CardTitle, CardText } from "react-toolbox/lib/card";
import { Button } from "react-toolbox/lib/button";
import FontIcon from "react-toolbox/lib/font_icon";
import UserAvatar from "ui-components/user_avatar";
import DateTime from "ui-components/datetime";
import Tags from "ui-components/tags";
import DataCard from "./DataCard";
import AppPager from "ui-components/app_pager";
import stateVar from "ui-lib/state_var";
import CodeRepoAndBackend from "ui-observables/code_repo_and_backend";
import { StringUtil } from "misc";
import UserName from "ui-components/user_name";
import { CodeRepoBackendIcon } from "ui-components/app_icons";
import { TypeChip } from "ui-components/data_chip";
import * as pathBuilder from "ui-lib/path_builder";

const FILE_STATUS_ICON = {
    added: "add",
    modified: "create",
    deleted: "remove",
    renamed: "forward",
    copied: "content_copy",
    rewrite: "create", // rewrite is a bigger change than modified
    "undefined": "help_outline"
};

class RevisionCard extends LightComponent {
    constructor(props) {
        super(props);

        this.repoAndBackend = new CodeRepoAndBackend({
            repoId: props.item && props.item.repository
        });

        this.state = {
            expanded: stateVar(this, "expanded", props.expanded),
            pageIndex: stateVar(this, "pageIndex", false),
            repoBackend: this.repoAndBackend.backend.getValue()
        };
    }

    componentDidMount() {
        this.addDisposable(this.repoAndBackend.start());
        this.addDisposable(this.repoAndBackend.backend.subscribe((repoBackend) => this.setState({ repoBackend })));
    }

    componentWillReceiveProps(nextProps) {
        this.repoAndBackend.setOpts({
            repoId: nextProps.item && nextProps.item.repository
        });
    }

    _getCurrentPatch() {
        const patchIndex = this.state.pageIndex.value !== false ? this.state.pageIndex.value : this.props.patchIndex;
        if (patchIndex < 0) {
            return this.props.item.patches[this.props.item.patches.length + patchIndex];
        }

        return this.props.item.patches[patchIndex];
    }

    _getSourceLinkLabels(backendType) {
        const labels = {
            review: "Revision review",
            commit: "Revision"
        };
        switch (backendType) {
        case "gerrit":
            labels.review = "Gerrit change";
            labels.commit = "Gerrit commit";
            break;
        case "github":
            labels.review = "Github pull request";
            labels.commit = "Github commit";
            break;
        }

        return labels;
    }

    render() {
        const patch = this._getCurrentPatch();
        const backendType = this.state.repoBackend.has("backendType") ? this.state.repoBackend.get("backendType") : "";
        const sourceLinkLabels = this._getSourceLinkLabels(backendType);
        const repoBackendIcon = (
            <CodeRepoBackendIcon
                backendType={backendType}
                theme={this.props.theme}
            />
        );

        let titlePrefix = "Submitted by";
        if (this.props.patchIndex < 0) {
            titlePrefix = "Revision by";
        } else if (this.props.patchIndex === this.props.item.patches.length - 1 && this.props.item.status === "merged") {
            titlePrefix = "Merged by";
        }

        const myItemPath = pathBuilder.fromType("coderepo.revision", this.props.item);

        let patchPager;
        if (this.props.patchIndex < 0 && this.props.item.patches.length > 1) {
            patchPager = (
                <AppPager
                    theme={this.props.theme}
                    pageIndex={this.state.pageIndex}
                    numPages={this.props.item.patches.length}
                    initialPageIndex={this.props.item.patches.length + this.props.patchIndex}
                />
            );
        }

        return (
            <DataCard
                theme={this.props.theme}
                expanded={this.state.expanded}
                expandable={this.props.expandable}
                path={myItemPath}
            >
                <CardTitle
                    avatar={(
                        <UserAvatar
                            className={this.props.theme.avatar}
                            userId={patch.userRef.id}
                        />
                    )}
                    title={(
                        <UserName
                            userId={patch.userRef.id}
                            notFoundText={patch.name}
                            prefixText={titlePrefix}
                        />
                    )}
                    subtitle={(
                        <DateTime
                            value={patch.submitted}
                            niceDate={true}
                        />
                    )}
                />
                <CardText>

                        {patch.comment}

                </CardText>
                <If condition={this.state.expanded.value}>
                    <table className={`${this.props.theme.table} ${this.props.theme.tableFixed}`}>

                                Status

                                    {StringUtil.toUpperCaseLetter(this.props.item.status)}

                                Repository

                                    <TypeChip
                                        itemRef={{
                                            _ref: true,
                                            type: "coderepo.repository",
                                            id: this.props.item.repository
                                        }}
                                    />

                                Links

                                    <If condition={ patch.change.reviewUrl }>
                                        <Button
                                            theme={this.props.theme}
                                            className={this.props.theme.linkButton}
                                            raised={true}
                                            label={sourceLinkLabels.review}
                                            icon={repoBackendIcon}
                                            href={patch.change.reviewUrl}
                                            target="_blank"
                                        />
                                    </If>
                                    <If condition={ patch.change.commitUrl }>
                                        <Button
                                            theme={this.props.theme}
                                            className={this.props.theme.linkButton}
                                            raised={true}
                                            label={sourceLinkLabels.commit}
                                            icon={repoBackendIcon}
                                            href={patch.change.commitUrl}
                                            target="_blank"
                                        />
                                    </If>

                            <Choose>
                                <When condition={this.props.patchIndex >= 0}>

                                        Patch

                                            {this.props.patchIndex + 1}
                                             of
                                            {this.props.item.patches.length}

                                </When>
                                <Otherwise>

                                        Patch

                                            {(this.state.pageIndex.value !== false
                                                ? this.state.pageIndex.value
                                                : (this.props.item.patches.length + this.props.patchIndex)
                                             ) + 1}
                                             of
                                            {this.props.item.patches.length}

                                </Otherwise>
                            </Choose>

                                Refname

                                    {patch.change.refname}

                                SHA1

                                    {patch.change.newrev}

                                Previous SHA1

                                    {patch.change.oldrev}

                                Files

                                        src/app/UI/lib/managers/administration/client/components/sections/stats/StatDataExplore.js

                                    <If condition={ patch.change.files }>
                                        {patch.change.files.map((item) => (

                                                <FontIcon
                                                    value={FILE_STATUS_ICON[item.status]}
                                                    className={this.props.theme.fileListItemIcon}
                                                />
                                                <a
                                                    className={`${this.props.theme.link} ${this.props.theme.fileListItemLink}`}
                                                    href={item.url}
                                                    target="_blank"
                                                >
                                                    {item.name}

                                        ))}
                                    </If>

                                Tags

                                    <Tags list={this.props.item.tags} />

                    <If condition={patchPager}>
                        <CardText>
                            {patchPager}
                        </CardText>
                    </If>
                </If>
            </DataCard>
        );
    }
}

RevisionCard.defaultProps = {
    expanded: false,
    expandable: true,
    clickable: false,
    patchIndex: -1
};

RevisionCard.propTypes = {
    theme: React.PropTypes.object,
    item: React.PropTypes.object.isRequired,
    patchIndex: React.PropTypes.number,
    expanded: React.PropTypes.bool,
    expandable: React.PropTypes.bool,
    clickable: React.PropTypes.bool
};

RevisionCard.contextTypes = {
    router: React.PropTypes.object.isRequired
};

export default RevisionCard;
<commit_msg>UI: Remove devcode that should not have been submitted in the last two commits<commit_after>
import React from "react";
import LightComponent from "ui-lib/light_component";
import { CardTitle, CardText } from "react-toolbox/lib/card";
import { Button } from "react-toolbox/lib/button";
import FontIcon from "react-toolbox/lib/font_icon";
import UserAvatar from "ui-components/user_avatar";
import DateTime from "ui-components/datetime";
import Tags from "ui-components/tags";
import DataCard from "./DataCard";
import AppPager from "ui-components/app_pager";
import stateVar from "ui-lib/state_var";
import CodeRepoAndBackend from "ui-observables/code_repo_and_backend";
import { StringUtil } from "misc";
import UserName from "ui-components/user_name";
import { CodeRepoBackendIcon } from "ui-components/app_icons";
import { TypeChip } from "ui-components/data_chip";
import * as pathBuilder from "ui-lib/path_builder";

const FILE_STATUS_ICON = {
    added: "add",
    modified: "create",
    deleted: "remove",
    renamed: "forward",
    copied: "content_copy",
    rewrite: "create", // rewrite is a bigger change than modified
    "undefined": "help_outline"
};

class RevisionCard extends LightComponent {
    constructor(props) {
        super(props);

        this.repoAndBackend = new CodeRepoAndBackend({
            repoId: props.item && props.item.repository
        });

        this.state = {
            expanded: stateVar(this, "expanded", props.expanded),
            pageIndex: stateVar(this, "pageIndex", false),
            repoBackend: this.repoAndBackend.backend.getValue()
        };
    }

    componentDidMount() {
        this.addDisposable(this.repoAndBackend.start());
        this.addDisposable(this.repoAndBackend.backend.subscribe((repoBackend) => this.setState({ repoBackend })));
    }

    componentWillReceiveProps(nextProps) {
        this.repoAndBackend.setOpts({
            repoId: nextProps.item && nextProps.item.repository
        });
    }

    _getCurrentPatch() {
        const patchIndex = this.state.pageIndex.value !== false ? this.state.pageIndex.value : this.props.patchIndex;
        if (patchIndex < 0) {
            return this.props.item.patches[this.props.item.patches.length + patchIndex];
        }

        return this.props.item.patches[patchIndex];
    }

    _getSourceLinkLabels(backendType) {
        const labels = {
            review: "Revision review",
            commit: "Revision"
        };
        switch (backendType) {
        case "gerrit":
            labels.review = "Gerrit change";
            labels.commit = "Gerrit commit";
            break;
        case "github":
            labels.review = "Github pull request";
            labels.commit = "Github commit";
            break;
        }

        return labels;
    }

    render() {
        const patch = this._getCurrentPatch();
        const backendType = this.state.repoBackend.has("backendType") ? this.state.repoBackend.get("backendType") : "";
        const sourceLinkLabels = this._getSourceLinkLabels(backendType);
        const repoBackendIcon = (
            <CodeRepoBackendIcon
                backendType={backendType}
                theme={this.props.theme}
            />
        );

        let titlePrefix = "Submitted by";
        if (this.props.patchIndex < 0) {
            titlePrefix = "Revision by";
        } else if (this.props.patchIndex === this.props.item.patches.length - 1 && this.props.item.status === "merged") {
            titlePrefix = "Merged by";
        }

        const myItemPath = pathBuilder.fromType("coderepo.revision", this.props.item);

        let patchPager;
        if (this.props.patchIndex < 0 && this.props.item.patches.length > 1) {
            patchPager = (
                <AppPager
                    theme={this.props.theme}
                    pageIndex={this.state.pageIndex}
                    numPages={this.props.item.patches.length}
                    initialPageIndex={this.props.item.patches.length + this.props.patchIndex}
                />
            );
        }

        return (
            <DataCard
                theme={this.props.theme}
                expanded={this.state.expanded}
                expandable={this.props.expandable}
                path={myItemPath}
            >
                <CardTitle
                    avatar={(
                        <UserAvatar
                            className={this.props.theme.avatar}
                            userId={patch.userRef.id}
                        />
                    )}
                    title={(
                        <UserName
                            userId={patch.userRef.id}
                            notFoundText={patch.name}
                            prefixText={titlePrefix}
                        />
                    )}
                    subtitle={(
                        <DateTime
                            value={patch.submitted}
                            niceDate={true}
                        />
                    )}
                />
                <CardText>

                        {patch.comment}

                </CardText>
                <If condition={this.state.expanded.value}>
                    <table className={`${this.props.theme.table} ${this.props.theme.tableFixed}`}>

                                Status

                                    {StringUtil.toUpperCaseLetter(this.props.item.status)}

                                Repository

                                    <TypeChip
                                        itemRef={{
                                            _ref: true,
                                            type: "coderepo.repository",
                                            id: this.props.item.repository
                                        }}
                                    />

                                Links

                                    <If condition={ patch.change.reviewUrl }>
                                        <Button
                                            theme={this.props.theme}
                                            className={this.props.theme.linkButton}
                                            raised={true}
                                            label={sourceLinkLabels.review}
                                            icon={repoBackendIcon}
                                            href={patch.change.reviewUrl}
                                            target="_blank"
                                        />
                                    </If>
                                    <If condition={ patch.change.commitUrl }>
                                        <Button
                                            theme={this.props.theme}
                                            className={this.props.theme.linkButton}
                                            raised={true}
                                            label={sourceLinkLabels.commit}
                                            icon={repoBackendIcon}
                                            href={patch.change.commitUrl}
                                            target="_blank"
                                        />
                                    </If>

                            <Choose>
                                <When condition={this.props.patchIndex >= 0}>

                                        Patch

                                            {this.props.patchIndex + 1}
                                             of
                                            {this.props.item.patches.length}

                                </When>
                                <Otherwise>

                                        Patch

                                            {(this.state.pageIndex.value !== false
                                                ? this.state.pageIndex.value
                                                : (this.props.item.patches.length + this.props.patchIndex)
                                             ) + 1}
                                             of
                                            {this.props.item.patches.length}

                                </Otherwise>
                            </Choose>

                                Refname

                                    {patch.change.refname}

                                SHA1

                                    {patch.change.newrev}

                                Previous SHA1

                                    {patch.change.oldrev}

                                Files

                                    <If condition={ patch.change.files }>
                                        {patch.change.files.map((item) => (

                                                <FontIcon
                                                    value={FILE_STATUS_ICON[item.status]}
                                                    className={this.props.theme.fileListItemIcon}
                                                />
                                                <a
                                                    className={`${this.props.theme.link} ${this.props.theme.fileListItemLink}`}
                                                    href={item.url}
                                                    target="_blank"
                                                >
                                                    {item.name}

                                        ))}
                                    </If>

                                Tags

                                    <Tags list={this.props.item.tags} />

                    <If condition={patchPager}>
                        <CardText>
                            {patchPager}
                        </CardText>
                    </If>
                </If>
            </DataCard>
        );
    }
}

RevisionCard.defaultProps = {
    expanded: false,
    expandable: true,
    clickable: false,
    patchIndex: -1
};

RevisionCard.propTypes = {
    theme: React.PropTypes.object,
    item: React.PropTypes.object.isRequired,
    patchIndex: React.PropTypes.number,
    expanded: React.PropTypes.bool,
    expandable: React.PropTypes.bool,
    clickable: React.PropTypes.bool
};

RevisionCard.contextTypes = {
    router: React.PropTypes.object.isRequired
};

export default RevisionCard;
<|endoftext|>


<commit_before><commit_msg>Embedded songs test<commit_after><|endoftext|>


<commit_before>/* eslint-disable no-console */

var start = Date.now();

// ///////////////////////// //
//          IMPORTS          //
// ///////////////////////// //

var fs = require('fs-extra');
var path = require('path');
var exec = require('child_process').execSync;
var NwBuilder = require('nw-builder');
var rcedit = require('rcedit');
var zip = require('7zip-bin');

// ///////////////////////// //
//          SETTINGS         //
// ///////////////////////// //

var year = '2017';
var company = 'Open Indy Brigade';
var description = 'Find accessibility issues in webpages.';
var platforms = [ process.platform ];

var nwBuildSettings = {
    version: '0.14.7',
    flavor: 'normal',
    appName: 'Koa11y',
    appVersion: '3.0.0',
    files: [
        './_fonts/**/*',
        './_img/**/*',
        './_markup/**/*',
        './_scripts/**/*',
        './_style/style.css',
        './_style/ven.bootstrap.css',
        './_style/ven.bootstrap/bootstrap.css',
        './_style/ven.bootswatch/flatly.min.css',
        './index.htm',
        './package.json',
        './LICENSE'
    ],
    winIco: './_img/fav.ico',
    platforms: platforms,
    zip: false
};

var junk = [
    'd3dcompiler_47.dll',
    'dbghelp.dll',
    'libEGL.dll',
    'libexif.dll',
    'libGLESv2.dll',
    'nw_200_percent.pak',
    'snapshot_blob.bin',
    'package.nw/node_modules/vue/src/',
    'package.nw/node_modules/vue/types/',
    'package.nw/node_modules/vue/dist/vue.common.js',
    'package.nw/node_modules/vue/dist/vue.esm.js',
    'package.nw/node_modules/vue/dist/vue.js',
    'package.nw/node_modules/vue/dist/vue.runtime.common.js',
    'package.nw/node_modules/vue/dist/vue.runtime.esm.js',
    'package.nw/node_modules/vue/dist/vue.runtime.js',
    'package.nw/node_modules/vue/dist/vue.runtime.min.js',
    'package.nw/node_modules/performance-now/src/',
    'package.nw/node_modules/performance-now/test/',
    'package.nw/node_modules/ajv/dist/ajv.min.js.map',
    'package.nw/node_modules/ajv/scripts/',
    'package.nw/node_modules/ajv/lib/ajv.d.ts',
    'package.nw/node_modules/ajv/dist/',
    'package.nw/node_modules/truffler/example/',
    'package.nw/node_modules/truffler/test/',
    'package.nw/node_modules/hawk/example/',
    'package.nw/node_modules/hawk/test/',
    'package.nw/node_modules/hawk/images/',
    'package.nw/node_modules/pa11y/example/',
    'package.nw/node_modules/pa11y/test/',
    'package.nw/node_modules/es6-promise/es6-promise.d.ts',
    '_style'
];

// ///////////////////////// //
//         FUNCTIONS         //
// ///////////////////////// //

function updateExe (done) {
    var executable = './build/' + nwBuildSettings.appName + '/win32/' + nwBuildSettings.appName + '.exe';

    var options = {
        'version-string': {
            'CompanyName': company,
            'FileDescription': description,
            'LegalCopyright': 'Copyright ' + year + '. ' + company,
            'ProductName': nwBuildSettings.appName
        },
        'file-version': nwBuildSettings.appVersion,
        'product-version': nwBuildSettings.appVersion
    };

    rcedit(executable, options, function (a, b, c) {
        if (a) {
            console.log(a);
        }
        if (b) {
            console.log(b);
        }
        if (c) {
            console.log(c);
        }
        if (typeof(done) === 'function') {
            done();
        }
    });
}

function copyManifest () {
    var manifest = fs.readJsonSync('./package.json');
    manifest.devDependencies = {};
    var output = JSON.stringify(manifest, null, 2);
    fs.writeFileSync('./build/' + nwBuildSettings.appName + '/win32/package.json', output);
}

function changeDirectoryToBuildFolder () {
    var buildFolder = path.join(process.cwd(), 'build/' + nwBuildSettings.appName + '/win32');
    process.chdir(buildFolder);
}

function npmInstallBuildFolder () {
    exec('npm install');
}

function moveFilesIntoPackageNW () {
    console.log(' ∙ Started moving files into package.nw');
    nwBuildSettings.files.forEach(function (file) {
        var src = file.replace('/**/*', '');
        var dest = path.join('package.nw', src);

        fs.moveSync(src, dest);
        console.log('  ∙ moved ' + src.replace('./', ''));
    });
    fs.moveSync('./node_modules', path.join('.', 'package.nw', 'node_modules'));
    console.log('  ∙ moved node_modules');
}

function removeJunk () {
    console.log(' ∙ Started removing junk files');
    junk.forEach(function (item) {
        var file = path.join(process.cwd(), item);
        fs.removeSync(file);
        console.log('  ∙ deleted ' + item);
    });
}

function runApp () {
    exec(nwBuildSettings.appName + '.exe');
}

function goUpOneDirectory () {
    process.chdir('..');
}

function renameBuiltFolder () {
    fs.renameSync('./win32/', './' + nwBuildSettings.appName);
}

function zipApp () {
    var zipExe = zip.path7za;
    var buildInput = '';
    var outputZip = '';
    var filename = nwBuildSettings.appName + '_' + nwBuildSettings.appVersion + '.zip';
    if (process.platform === 'win32') {
        buildInput = nwBuildSettings.appName;
        outputZip = path.join('WIN_' + filename);
    } else if (process.platform === 'darwin') {
        buildInput = path.join(nwBuildSettings.appName + '.app');
        outputZip = path.join('OSX_' + filename);
    } else if (process.platform === 'linux') {
        buildInput = path.join('linux64');
        outputZip = path.join('LIN64_' + filename);
    }

    fs.removeSync(outputZip);
    // a     = create archive
    // -bd   = do not display a progress bar in the CLI
    // -tzip = create a zip formatted file
    // -mx=9 = use maximum compression
    // -y    = auto answer yes to all prompts
    exec(zipExe + ' a -tzip -mx=9 -y "' + outputZip + '" "' + buildInput) + '"';
    if (process.platform === 'linux') {
        buildInput = path.join('linux32');
        outputZip = path.join('LIN32_' + filename);
        fs.removeSync(outputZip);
        exec(zipExe + ' a -tzip -mx=9 -y ' + outputZip + ' ' + buildInput);
    }
}

function totalBuildTime () {
    var done = Date.now() - start;
    var time = Math.round(done / 1000);
    var minutes = Math.floor(time / 60);
    var seconds = time - (minutes * 60);
    seconds = (new Array(3).join('0') + seconds).slice(-2);

    var finalTime = minutes + ':' + seconds;
    var timeMinutes = '\nBuild took ' + finalTime;
    return timeMinutes;
}

// ///////////////////////// //
//         EXECUTION         //
// ///////////////////////// //

var nw = new NwBuilder(nwBuildSettings);

nw.on('log', function (msg) {
    console.log(msg);
});

nw.build().then(function () {
    console.log(' ∙ NW-Builder Complete');

    updateExe(function () {
        console.log(' ∙ Updated ' + nwBuildSettings.appName + '.exe');

        copyManifest();
        console.log(' ∙ Copied package.json');

        changeDirectoryToBuildFolder();
        console.log(' ∙ cd to build folder');

        npmInstallBuildFolder();
        console.log(' ∙ npm install build folder');

        moveFilesIntoPackageNW();
        console.log(' ∙ Finished moving files into package.nw');

        removeJunk();
        console.log(' ∙ Finished removing junk files');

        runApp();
        console.log(' ∙ Ran app');

        goUpOneDirectory();
        console.log(' ∙ Went up one directory');

        renameBuiltFolder();
        console.log(' ∙ Renamed built folder');

        zipApp();
        console.log(' ∙ Zipped app');

        console.log(totalBuildTime());
    });
}).catch(function (err) {
    console.log('nw-builder err', err);
});
<commit_msg>Started on Linux build<commit_after>/* eslint-disable no-console */

var start = Date.now();

// ///////////////////////// //
//          IMPORTS          //
// ///////////////////////// //

var fs = require('fs-extra');
var path = require('path');
var exec = require('child_process').execSync;
var NwBuilder = require('nw-builder');
var rcedit = require('rcedit');
var zip = require('7zip-bin');

// ///////////////////////// //
//          SETTINGS         //
// ///////////////////////// //

var year = '2017';
var company = 'Open Indy Brigade';
var description = 'Find accessibility issues in webpages.';
var platforms = [ process.platform ];

var nwBuildSettings = {
    version: '0.14.7',
    flavor: 'normal',
    appName: 'Koa11y',
    appVersion: '3.0.0',
    files: [
        './_fonts/**/*',
        './_img/**/*',
        './_markup/**/*',
        './_scripts/**/*',
        './_style/style.css',
        './_style/ven.bootstrap.css',
        './_style/ven.bootstrap/bootstrap.css',
        './_style/ven.bootswatch/flatly.min.css',
        './index.htm',
        './package.json',
        './LICENSE'
    ],
    winIco: './_img/fav.ico',
    platforms: platforms,
    zip: false
};

var junk = [
    'd3dcompiler_47.dll',
    'dbghelp.dll',
    'libEGL.dll',
    'libexif.dll',
    'libGLESv2.dll',
    'nw_200_percent.pak',
    'snapshot_blob.bin',
    'package.nw/node_modules/vue/src/',
    'package.nw/node_modules/vue/types/',
    'package.nw/node_modules/vue/dist/vue.common.js',
    'package.nw/node_modules/vue/dist/vue.esm.js',
    'package.nw/node_modules/vue/dist/vue.js',
    'package.nw/node_modules/vue/dist/vue.runtime.common.js',
    'package.nw/node_modules/vue/dist/vue.runtime.esm.js',
    'package.nw/node_modules/vue/dist/vue.runtime.js',
    'package.nw/node_modules/vue/dist/vue.runtime.min.js',
    'package.nw/node_modules/performance-now/src/',
    'package.nw/node_modules/performance-now/test/',
    'package.nw/node_modules/ajv/dist/ajv.min.js.map',
    'package.nw/node_modules/ajv/scripts/',
    'package.nw/node_modules/ajv/lib/ajv.d.ts',
    'package.nw/node_modules/ajv/dist/',
    'package.nw/node_modules/truffler/example/',
    'package.nw/node_modules/truffler/test/',
    'package.nw/node_modules/hawk/example/',
    'package.nw/node_modules/hawk/test/',
    'package.nw/node_modules/hawk/images/',
    'package.nw/node_modules/pa11y/example/',
    'package.nw/node_modules/pa11y/test/',
    'package.nw/node_modules/es6-promise/es6-promise.d.ts',
    '_style'
];

// ///////////////////////// //
//         FUNCTIONS         //
// ///////////////////////// //

function updateExe (done) {
    var executable = './build/' + nwBuildSettings.appName + '/win32/' + nwBuildSettings.appName + '.exe';

    var options = {
        'version-string': {
            'CompanyName': company,
            'FileDescription': description,
            'LegalCopyright': 'Copyright ' + year + '. ' + company,
            'ProductName': nwBuildSettings.appName
        },
        'file-version': nwBuildSettings.appVersion,
        'product-version': nwBuildSettings.appVersion
    };

    if (process.platform !== 'win32') {
        done();
    } else {
        rcedit(executable, options, function (a, b, c) {
            if (a) {
                console.log(a);
            }
            if (b) {
                console.log(b);
            }
            if (c) {
                console.log(c);
            }
            if (typeof(done) === 'function') {
                done();
            }
        });
    }
}

function copyManifest () {
    var manifest = fs.readJsonSync('./package.json');
    manifest.devDependencies = {};
    var output = JSON.stringify(manifest, null, 2);
    if (process.platform === 'win32') {
        fs.writeFileSync('./build/' + nwBuildSettings.appName + '/win32/package.json', output);
    } else if (process.platform === 'linux') {
        fs.writeFileSync('./build/' + nwBuildSettings.appName + '/linux32/package.json', output);
        fs.writeFileSync('./build/' + nwBuildSettings.appName + '/linux64/package.json', output);
    } else if (process.platform === 'darwin') {
        // Stub
    }
}

function changeDirectoryToBuildFolder () {
    var subfolder = '';
    var sub
    if (process.platform === 'win32') {
        subfolder = 'win32';
    } else if (process.platform === 'linux' && process.arch === 'ia32') {
        subfolder = 'linux32';
    } else if (process.platform === 'linux' && process.arch === 'x64') {
        subfolder = 'linux64';
    }

    var buildFolder = path.join(process.cwd(), 'build', nwBuildSettings.appName, subfolder);
    process.chdir(buildFolder);
}

function npmInstallBuildFolder () {
    exec('npm install');
}

function moveFilesIntoPackageNW () {
    console.log(' ∙ Started moving files into package.nw');
    nwBuildSettings.files.forEach(function (file) {
        var src = file.replace('/**/*', '');
        var dest = path.join('package.nw', src);

        fs.moveSync(src, dest);
        console.log('  ∙ moved ' + src.replace('./', ''));
    });
    fs.moveSync('./node_modules', path.join('.', 'package.nw', 'node_modules'));
    console.log('  ∙ moved node_modules');
}

function removeJunk () {
    console.log(' ∙ Started removing junk files');
    junk.forEach(function (item) {
        var file = path.join(process.cwd(), item);
        fs.removeSync(file);
        console.log('  ∙ deleted ' + item);
    });
}

function runApp () {
    exec(nwBuildSettings.appName + '.exe');
}

function goUpOneDirectory () {
    process.chdir('..');
}

function renameBuiltFolder () {
    fs.renameSync('./win32/', './' + nwBuildSettings.appName);
}

function zipApp () {
    var zipExe = zip.path7za;
    var buildInput = '';
    var outputZip = '';
    var filename = nwBuildSettings.appName + '_' + nwBuildSettings.appVersion + '.zip';
    if (process.platform === 'win32') {
        buildInput = nwBuildSettings.appName;
        outputZip = path.join('WIN_' + filename);
    } else if (process.platform === 'darwin') {
        buildInput = path.join(nwBuildSettings.appName + '.app');
        outputZip = path.join('OSX_' + filename);
    } else if (process.platform === 'linux') {
        buildInput = path.join('linux64');
        outputZip = path.join('LIN64_' + filename);
    }

    fs.removeSync(outputZip);
    // a     = create archive
    // -bd   = do not display a progress bar in the CLI
    // -tzip = create a zip formatted file
    // -mx=9 = use maximum compression
    // -y    = auto answer yes to all prompts
    exec(zipExe + ' a -tzip -mx=9 -y "' + outputZip + '" "' + buildInput) + '"';
    if (process.platform === 'linux') {
        buildInput = path.join('linux32');
        outputZip = path.join('LIN32_' + filename);
        fs.removeSync(outputZip);
        exec(zipExe + ' a -tzip -mx=9 -y ' + outputZip + ' ' + buildInput);
    }
}

function totalBuildTime () {
    var done = Date.now() - start;
    var time = Math.round(done / 1000);
    var minutes = Math.floor(time / 60);
    var seconds = time - (minutes * 60);
    seconds = (new Array(3).join('0') + seconds).slice(-2);

    var finalTime = minutes + ':' + seconds;
    var timeMinutes = '\nBuild took ' + finalTime;
    return timeMinutes;
}

// ///////////////////////// //
//         EXECUTION         //
// ///////////////////////// //

var nw = new NwBuilder(nwBuildSettings);

nw.on('log', function (msg) {
    console.log(msg);
});

nw.build().then(function () {
    console.log(' ∙ NW-Builder Complete');
    updateExe(function () {
        if (process.platform === 'win32') {
            console.log(' ∙ Updated ' + nwBuildSettings.appName + '.exe');
        }

        copyManifest();
        console.log(' ∙ Copied package.json');

        changeDirectoryToBuildFolder();
        console.log(' ∙ cd to build folder');

        npmInstallBuildFolder();
        console.log(' ∙ npm install build folder');

        moveFilesIntoPackageNW();
        console.log(' ∙ Finished moving files into package.nw');

    /*
        removeJunk();
        console.log(' ∙ Finished removing junk files');

        runApp();
        console.log(' ∙ Ran app');

        goUpOneDirectory();
        console.log(' ∙ Went up one directory');

        renameBuiltFolder();
        console.log(' ∙ Renamed built folder');

        zipApp();
        console.log(' ∙ Zipped app');

        console.log(totalBuildTime());
    */
    });
}).catch(function (err) {
    console.log('nw-builder err', err);
});
<|endoftext|>


<commit_before>/**
 * This module exports functions for checking types
 * and throwing exceptions.
 */

/*globals define, module */

(function (globals) {
    'use strict';

    var messages, predicates, functions, verify, maybe, not;

    predicates = {
        like: like,
        instance: instance,
        emptyObject: emptyObject,
        object: object,
        length: length,
        array: array,
        date: date,
        fn: fn,
        webUrl: webUrl,
        gitUrl: gitUrl,
        email: email,
        unemptyString: unemptyString,
        string: string,
        evenNumber: evenNumber,
        oddNumber: oddNumber,
        positiveNumber: positiveNumber,
        negativeNumber: negativeNumber,
        intNumber : intNumber,
        floatNumber : floatNumber,
        number: number
    };

    messages = {
        like: 'Invalid type',
        instance: 'Invalid type',
        emptyObject: 'Invalid object',
        object: 'Invalid object',
        length: 'Invalid length',
        array: 'Invalid array',
        date: 'Invalid date',
        fn: 'Invalid function',
        webUrl: 'Invalid URL',
        gitUrl: 'Invalid git URL',
        email: 'Invalid email',
        unemptyString: 'Invalid string',
        string: 'Invalid string',
        evenNumber: 'Invalid number',
        oddNumber: 'Invalid number',
        positiveNumber: 'Invalid number',
        negativeNumber: 'Invalid number',
        intNumber: 'Invalid number',
        floatNumber: 'Invalid number',
        number: 'Invalid number'
    };

    functions = {
        map: map,
        every: every,
        any: any
    };

    functions = mixin(functions, predicates);
    verify = createModifiedPredicates(verifyModifier);
    maybe = createModifiedPredicates(maybeModifier);
    not = createModifiedPredicates(notModifier);
    verify.maybe = createModifiedFunctions(verifyModifier, maybe);
    verify.not = createModifiedFunctions(verifyModifier, not);

    exportFunctions(mixin(functions, {
        verify: verify,
        maybe: maybe,
        not: not
    }));

    /**
     * Public function `like`.
     *
     * Tests whether an object 'quacks like a duck'.
     * Returns `true` if the first argument has all of
     * the properties of the second, archetypal argument
     * (the 'duck'). Returns `false` otherwise. If either
     * argument is not an object, an exception is thrown.
     *
     * @param thing {object} The object to test.
     * @param duck {object}  The archetypal object, or
     *                       'duck', that the test is
     *                       against.
     */
    function like (thing, duck) {
        var name;

        verify.object(thing);
        verify.object(duck);

        for (name in duck) {
            if (duck.hasOwnProperty(name)) {
                if (thing.hasOwnProperty(name) === false || typeof thing[name] !== typeof duck[name]) {
                    return false;
                }

                if (object(thing[name]) && like(thing[name], duck[name]) === false) {
                    return false;
                }
            }
        }

        return true;
    }

    /**
     * Public function `instance`.
     *
     * Returns `true` if an object is an instance of a prototype,
     * `false` otherwise.
     *
     * @param thing {object}       The object to test.
     * @param prototype {function} The prototype that the
     *                             test is against.
     */
    function instance (thing, prototype) {
        if (typeof thing === 'undefined' || thing === null) {
            return false;
        }

        if (fn(prototype) && thing instanceof prototype) {
            return true;
        }

        return false;
    }

    /**
     * Public function `emptyObject`.
     *
     * Returns `true` if something is an empty, non-null,
     * non-array object, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function emptyObject (thing) {
        var property;

        if (object(thing)) {
            for (property in thing) {
                if (thing.hasOwnProperty(property)) {
                    return false;
                }
            }

            return true;
        }

        return false;
    }

    /**
     * Public function `object`.
     *
     * Returns `true` if something is a non-null, non-array,
     * non-date object, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function object (thing) {
        return typeof thing === 'object' && thing !== null && array(thing) === false && date(thing) === false;
    }

    /**
     * Public function `length`.
     *
     * Returns `true` if something is has a length property
     * that equals `value`, `false` otherwise.
     *
     * @param thing The thing to test.
     * @param value The required length to test against.
     */
    function length (thing, value) {
        return thing && thing.length === value;
    }

    /**
     * Public function `array`.
     *
     * Returns `true` something is an array, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function array (thing) {
        if (Array.isArray) {
            return Array.isArray(thing);
        }

        return Object.prototype.toString.call(thing) === '[object Array]';
    }

    /**
     * Public function `date`.
     *
     * Returns `true` something is a date, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function date (thing) {
        return Object.prototype.toString.call(thing) === '[object Date]';
    }

    /**
     * Public function `fn`.
     *
     * Returns `true` if something is function, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function fn (thing) {
        return typeof thing === 'function';
    }

    /**
     * Public function `webUrl`.
     *
     * Returns `true` if something is an HTTP or HTTPS URL,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function webUrl (thing) {
        return unemptyString(thing) && /^https?:\/\/.+/.test(thing);
    }

    /**
     * Public function `gitUrl`.
     *
     * Returns `true` if something is a git+ssh, git+http or git+https URL,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function gitUrl (thing) {
        return unemptyString(thing) && /^git\+(ssh|https?):\/\/.+/.test(thing);
    }

    /**
     * Public function `email`.
     *
     * Returns `true` if something is an email,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function email (thing) {
        var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        return unemptyString(thing) && reg.test(thing);
    }

    /**
     * Public function `unemptyString`.
     *
     * Returns `true` if something is a non-empty string, `false`
     * otherwise.
     *
     * @param thing          The thing to test.
     */
    function unemptyString (thing) {
        return string(thing) && thing !== '';
    }

    /**
     * Public function `string`.
     *
     * Returns `true` if something is a string, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function string (thing) {
        return typeof thing === 'string';
    }

    /**
     * Public function `oddNumber`.
     *
     * Returns `true` if something is an odd number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function oddNumber (thing) {
        return number(thing) && (thing % 2 === 1 || thing % 2 === -1);
    }

    /**
     * Public function `evenNumber`.
     *
     * Returns `true` if something is an even number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function evenNumber (thing) {
        return number(thing) && thing % 2 === 0;
    }

    /**
     * Public function `intNumber`.
     *
     * Returns `true` if something is an integer number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function intNumber (thing) {
        return number(thing) && thing % 1 === 0;
    }

    /**
     * Public function `floatNumber`.
     *
     * Returns `true` if something is a float number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function floatNumber (thing) {
        return number(thing) && thing % 1 !== 0;
    }

    /**
     * Public function `positiveNumber`.
     *
     * Returns `true` if something is a positive number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function positiveNumber (thing) {
        return number(thing) && thing > 0;
    }

    /**
     * Public function `negativeNumber`.
     *
     * Returns `true` if something is a positive number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function negativeNumber (thing) {
        return number(thing) && thing < 0;
    }

    /**
     * Public function `number`.
     *
     * Returns `true` if something is a number other than NaN,
     * `false` otherwise.
     *
     * @param thing The thing to test.
     */
    function number (thing) {
        return typeof thing === 'number' && isNaN(thing) === false;
    }

    /**
     * Public function `map`.
     *
     * Returns the results hash of mapping each predicate to the
     * corresponding thing's property. Similar to `like` but
     * with functions instead of values.
     *
     * @param things {object}     The things to test.
     * @param predicates {object} The map of functions to call against
     *                            the corresponding properties from `things`.
     */
    function map (things, predicates) {
        var property, result = {}, predicate;

        verify.object(things);
        verify.object(predicates);

        for (property in predicates) {
            if (predicates.hasOwnProperty(property)) {
                predicate = predicates[property];

                if (fn(predicate)) {
                    result[property] = predicate(things[property]);
                } else if (object(predicate)) {
                    result[property] = map(things[property], predicate);
                }
            }
        }

        return result;
    }

    /**
     * Public function `every`
     *
     * Returns the conjunction of all booleans in a hash.
     *
     * @param predicateResults {object} The hash of evaluated predicates.
     */
    function every (predicateResults) {
        var property, value;

        verify.object(predicateResults);

        for (property in predicateResults) {
            if (predicateResults.hasOwnProperty(property)) {
                value = predicateResults[property];

                if (object(value) && every(value) === false) {
                    return false;
                }

                if (value === false) {
                    return false;
                }
            }
        }
        return true;
    }

    /**
     * Public function `any`
     *
     * Returns the disjunction of all booleans in a hash.
     *
     * @param predicateResults {object} The hash of evaluated predicates.
     */
    function any (predicateResults) {
        var property, value;

        verify.object(predicateResults);

        for (property in predicateResults) {
            if (predicateResults.hasOwnProperty(property)) {
                value = predicateResults[property];

                if (object(value) && any(value)) {
                    return true;
                }

                if (value === true) {
                    return true;
                }
            }
        }

        return false;
    }

    function mixin (target, source) {
        var property;

        for (property in source) {
            if (source.hasOwnProperty(property)) {
                target[property] = source[property];
            }
        }

        return target;
    }

    /**
     * Public modifier `verify`.
     *
     * Throws if `predicate` returns `false`.
     */
    function verifyModifier (predicate, defaultMessage) {
        return function() {
            var message;

            if (predicate.apply(null, arguments) === false) {
                message = arguments[arguments.length - 1];
                throw new Error(unemptyString(message) ? message : defaultMessage);
            }
        };
    }

    /**
     * Public modifier `maybe`.
     *
     * Returns `true` if `predicate` is  `null` or `undefined`,
     * otherwise propagates the return value from `predicate`.
     */
    function maybeModifier (predicate) {
        return function() {
            return arguments[0] === null || arguments[0] === undefined ?  true : predicate.apply(null, arguments);
        };
    }

    /**
     * Public modifier `not`.
     *
     * Negates `predicate`.
     */
    function notModifier (predicate) {
        return function () {
            return !predicate.apply(null, arguments);
        };
    }

    function createModifiedPredicates (modifier) {
        return createModifiedFunctions(modifier, predicates);
    }

    function createModifiedFunctions (modifier, functions) {
        var name, result = {};

        for (name in functions) {
            if (functions.hasOwnProperty(name)) {
                result[name] = modifier(functions[name], messages[name]);
            }
        }

        return result;
    }

    function exportFunctions (functions) {
        if (typeof define === 'function' && define.amd) {
            define(function () {
                return functions;
            });
        } else if (typeof module !== 'undefined' && module !== null) {
            module.exports = functions;
        } else {
            globals.check = functions;
        }
    }
}(this));
<commit_msg>intNumber => int style and simplify email<commit_after>/**
 * This module exports functions for checking types
 * and throwing exceptions.
 */

/*globals define, module */

(function (globals) {
    'use strict';

    var messages, predicates, functions, verify, maybe, not;

    predicates = {
        like: like,
        instance: instance,
        emptyObject: emptyObject,
        object: object,
        length: length,
        array: array,
        date: date,
        fn: fn,
        webUrl: webUrl,
        gitUrl: gitUrl,
        email: email,
        unemptyString: unemptyString,
        string: string,
        evenNumber: evenNumber,
        oddNumber: oddNumber,
        positiveNumber: positiveNumber,
        negativeNumber: negativeNumber,
        'int' : intNumber,
        'float' : floatNumber,
        number: number
    };

    messages = {
        like: 'Invalid type',
        instance: 'Invalid type',
        emptyObject: 'Invalid object',
        object: 'Invalid object',
        length: 'Invalid length',
        array: 'Invalid array',
        date: 'Invalid date',
        fn: 'Invalid function',
        webUrl: 'Invalid URL',
        gitUrl: 'Invalid git URL',
        email: 'Invalid email',
        unemptyString: 'Invalid string',
        string: 'Invalid string',
        evenNumber: 'Invalid number',
        oddNumber: 'Invalid number',
        positiveNumber: 'Invalid number',
        negativeNumber: 'Invalid number',
        'int': 'Invalid number',
        'float': 'Invalid number',
        number: 'Invalid number'
    };

    functions = {
        map: map,
        every: every,
        any: any
    };

    functions = mixin(functions, predicates);
    verify = createModifiedPredicates(verifyModifier);
    maybe = createModifiedPredicates(maybeModifier);
    not = createModifiedPredicates(notModifier);
    verify.maybe = createModifiedFunctions(verifyModifier, maybe);
    verify.not = createModifiedFunctions(verifyModifier, not);

    exportFunctions(mixin(functions, {
        verify: verify,
        maybe: maybe,
        not: not
    }));

    /**
     * Public function `like`.
     *
     * Tests whether an object 'quacks like a duck'.
     * Returns `true` if the first argument has all of
     * the properties of the second, archetypal argument
     * (the 'duck'). Returns `false` otherwise. If either
     * argument is not an object, an exception is thrown.
     *
     * @param thing {object} The object to test.
     * @param duck {object}  The archetypal object, or
     *                       'duck', that the test is
     *                       against.
     */
    function like (thing, duck) {
        var name;

        verify.object(thing);
        verify.object(duck);

        for (name in duck) {
            if (duck.hasOwnProperty(name)) {
                if (thing.hasOwnProperty(name) === false || typeof thing[name] !== typeof duck[name]) {
                    return false;
                }

                if (object(thing[name]) && like(thing[name], duck[name]) === false) {
                    return false;
                }
            }
        }

        return true;
    }

    /**
     * Public function `instance`.
     *
     * Returns `true` if an object is an instance of a prototype,
     * `false` otherwise.
     *
     * @param thing {object}       The object to test.
     * @param prototype {function} The prototype that the
     *                             test is against.
     */
    function instance (thing, prototype) {
        if (typeof thing === 'undefined' || thing === null) {
            return false;
        }

        if (fn(prototype) && thing instanceof prototype) {
            return true;
        }

        return false;
    }

    /**
     * Public function `emptyObject`.
     *
     * Returns `true` if something is an empty, non-null,
     * non-array object, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function emptyObject (thing) {
        var property;

        if (object(thing)) {
            for (property in thing) {
                if (thing.hasOwnProperty(property)) {
                    return false;
                }
            }

            return true;
        }

        return false;
    }

    /**
     * Public function `object`.
     *
     * Returns `true` if something is a non-null, non-array,
     * non-date object, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function object (thing) {
        return typeof thing === 'object' && thing !== null && array(thing) === false && date(thing) === false;
    }

    /**
     * Public function `length`.
     *
     * Returns `true` if something is has a length property
     * that equals `value`, `false` otherwise.
     *
     * @param thing The thing to test.
     * @param value The required length to test against.
     */
    function length (thing, value) {
        return thing && thing.length === value;
    }

    /**
     * Public function `array`.
     *
     * Returns `true` something is an array, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function array (thing) {
        if (Array.isArray) {
            return Array.isArray(thing);
        }

        return Object.prototype.toString.call(thing) === '[object Array]';
    }

    /**
     * Public function `date`.
     *
     * Returns `true` something is a date, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function date (thing) {
        return Object.prototype.toString.call(thing) === '[object Date]';
    }

    /**
     * Public function `fn`.
     *
     * Returns `true` if something is function, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function fn (thing) {
        return typeof thing === 'function';
    }

    /**
     * Public function `webUrl`.
     *
     * Returns `true` if something is an HTTP or HTTPS URL,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function webUrl (thing) {
        return unemptyString(thing) && /^https?:\/\/.+/.test(thing);
    }

    /**
     * Public function `gitUrl`.
     *
     * Returns `true` if something is a git+ssh, git+http or git+https URL,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function gitUrl (thing) {
        return unemptyString(thing) && /^git\+(ssh|https?):\/\/.+/.test(thing);
    }

    /**
     * Public function `email`.
     *
     * Returns `true` if something seems like a valid email address,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function email (thing) {
        return unemptyString(thing) && /\S+@\S+/.test(thing);
    }

    /**
     * Public function `unemptyString`.
     *
     * Returns `true` if something is a non-empty string, `false`
     * otherwise.
     *
     * @param thing          The thing to test.
     */
    function unemptyString (thing) {
        return string(thing) && thing !== '';
    }

    /**
     * Public function `string`.
     *
     * Returns `true` if something is a string, `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function string (thing) {
        return typeof thing === 'string';
    }

    /**
     * Public function `oddNumber`.
     *
     * Returns `true` if something is an odd number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function oddNumber (thing) {
        return number(thing) && (thing % 2 === 1 || thing % 2 === -1);
    }

    /**
     * Public function `evenNumber`.
     *
     * Returns `true` if something is an even number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function evenNumber (thing) {
        return number(thing) && thing % 2 === 0;
    }

    /**
     * Public function `intNumber`.
     *
     * Returns `true` if something is an integer number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function intNumber (thing) {
        return number(thing) && thing % 1 === 0;
    }

    /**
     * Public function `floatNumber`.
     *
     * Returns `true` if something is a float number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function floatNumber (thing) {
        return number(thing) && thing % 1 !== 0;
    }

    /**
     * Public function `positiveNumber`.
     *
     * Returns `true` if something is a positive number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function positiveNumber (thing) {
        return number(thing) && thing > 0;
    }

    /**
     * Public function `negativeNumber`.
     *
     * Returns `true` if something is a positive number,
     * `false` otherwise.
     *
     * @param thing          The thing to test.
     */
    function negativeNumber (thing) {
        return number(thing) && thing < 0;
    }

    /**
     * Public function `number`.
     *
     * Returns `true` if something is a number other than NaN,
     * `false` otherwise.
     *
     * @param thing The thing to test.
     */
    function number (thing) {
        return typeof thing === 'number' && isNaN(thing) === false;
    }

    /**
     * Public function `map`.
     *
     * Returns the results hash of mapping each predicate to the
     * corresponding thing's property. Similar to `like` but
     * with functions instead of values.
     *
     * @param things {object}     The things to test.
     * @param predicates {object} The map of functions to call against
     *                            the corresponding properties from `things`.
     */
    function map (things, predicates) {
        var property, result = {}, predicate;

        verify.object(things);
        verify.object(predicates);

        for (property in predicates) {
            if (predicates.hasOwnProperty(property)) {
                predicate = predicates[property];

                if (fn(predicate)) {
                    result[property] = predicate(things[property]);
                } else if (object(predicate)) {
                    result[property] = map(things[property], predicate);
                }
            }
        }

        return result;
    }

    /**
     * Public function `every`
     *
     * Returns the conjunction of all booleans in a hash.
     *
     * @param predicateResults {object} The hash of evaluated predicates.
     */
    function every (predicateResults) {
        var property, value;

        verify.object(predicateResults);

        for (property in predicateResults) {
            if (predicateResults.hasOwnProperty(property)) {
                value = predicateResults[property];

                if (object(value) && every(value) === false) {
                    return false;
                }

                if (value === false) {
                    return false;
                }
            }
        }
        return true;
    }

    /**
     * Public function `any`
     *
     * Returns the disjunction of all booleans in a hash.
     *
     * @param predicateResults {object} The hash of evaluated predicates.
     */
    function any (predicateResults) {
        var property, value;

        verify.object(predicateResults);

        for (property in predicateResults) {
            if (predicateResults.hasOwnProperty(property)) {
                value = predicateResults[property];

                if (object(value) && any(value)) {
                    return true;
                }

                if (value === true) {
                    return true;
                }
            }
        }

        return false;
    }

    function mixin (target, source) {
        var property;

        for (property in source) {
            if (source.hasOwnProperty(property)) {
                target[property] = source[property];
            }
        }

        return target;
    }

    /**
     * Public modifier `verify`.
     *
     * Throws if `predicate` returns `false`.
     */
    function verifyModifier (predicate, defaultMessage) {
        return function() {
            var message;

            if (predicate.apply(null, arguments) === false) {
                message = arguments[arguments.length - 1];
                throw new Error(unemptyString(message) ? message : defaultMessage);
            }
        };
    }

    /**
     * Public modifier `maybe`.
     *
     * Returns `true` if `predicate` is  `null` or `undefined`,
     * otherwise propagates the return value from `predicate`.
     */
    function maybeModifier (predicate) {
        return function() {
            return arguments[0] === null || arguments[0] === undefined ?  true : predicate.apply(null, arguments);
        };
    }

    /**
     * Public modifier `not`.
     *
     * Negates `predicate`.
     */
    function notModifier (predicate) {
        return function () {
            return !predicate.apply(null, arguments);
        };
    }

    function createModifiedPredicates (modifier) {
        return createModifiedFunctions(modifier, predicates);
    }

    function createModifiedFunctions (modifier, functions) {
        var name, result = {};

        for (name in functions) {
            if (functions.hasOwnProperty(name)) {
                result[name] = modifier(functions[name], messages[name]);
            }
        }

        return result;
    }

    function exportFunctions (functions) {
        if (typeof define === 'function' && define.amd) {
            define(function () {
                return functions;
            });
        } else if (typeof module !== 'undefined' && module !== null) {
            module.exports = functions;
        } else {
            globals.check = functions;
        }
    }
}(this));
<|endoftext|>


<commit_before>/**
 * This file/module contains all configuration for the build process.
 */
module.exports = {
    /**
     * The `build_dir` folder is where the project is compiled for development
     */
    build_dir: 'build',

    /**
     * Temp Directory used during the build and deleted afterwards.
     */
    temp_dir: 'temp',

    /**
     * Distribution Directory, where the project is compiled for production
     */
    dist_dir: 'dist',

    /**
     * This is a collection of file patterns that refer to the app. These file paths are used in
     * the configuration of build tasks. `ts` is all project typescript, except the tests.
     * 'jsunit' are all unit tests. `html` are all the HTML files, `less` are the stylesheets.
     */
    app_files: {
        ts: [ 'app/src/**/*.ts', '!app/src/**/*.spec.ts' ],
        tsunit: [ 'app/src/**/*.spec.ts' ],
        html: [ 'app/index.html', 'app/src/**/*.html' ],
        less: ['app/assets/style/style.less'],
        assets: ['fonts/**/*.*', 'resource/**/*.*']
    },

    /**
     * This is the same as `app_files`, except it contains patterns that
     * reference library code (`bower_components/`) that need to be placed into the build
     * process somewhere. While the `app_files` property ensures all
     * standardized files are collected for compilation, it is the user's job
     * to ensure non-standardized (i.e. vendor-related) files are handled
     * appropriately in `vendor_files.js`.
     *
     * The `vendor_files.js` property holds files to be automatically
     * concatenated and minified with the project source files.
     *
     * The `vendor_files.css` property holds any CSS files to be automatically
     * included in the app.
     *
     * The `vendor_files.assets` property holds any assets to be copied along
     * with the app's assets. This structure is flattened, so it is not
     * recommended to use wildcards.
     */
    vendor_files: {
        js: [
            'app/assets/libs/jquery/dist/jquery.js',
            'app/assets/libs/angular/angular.js',
            'app/assets/libs/angular-ui-router/release/angular-ui-router.js',
            'app/assets/libs/angular-ui-tree/dist/angular-ui-tree.js',
            'app/assets/libs/bootstrap/dist/js/bootstrap.js',
            'app/assets/libs/angular-bootstrap/ui-bootstrap-tpls.js',
            'app/assets/libs/angular-ui-grid/ui-grid.js',
            'app/assets/libs/angular-ui-validate/dist/validate.js',
            'app/assets/libs/lodash-compat/lodash.js',
            'app/assets/libs/path-loader/browser/path-loader.js',
            'app/assets/libs/traverse/traverse.js',
            'app/assets/libs/json-refs/browser/json-refs.js',
            'app/assets/libs/tv4/tv4.js',
            'app/assets/libs/jsonforms/dist/js/jsonforms.js',
            'app/assets/libs/material-design-lite/material.js',
            'app/assets/libs/angular-animate/angular-animate.js',
            'app/assets/libs/angular-aria/angular-aria.js',
            'app/assets/libs/angular-material/angular-material.js',
            'app/assets/libs/zeroclipboard/dist/ZeroClipboard.js',
            'app/assets/libs/ng-clip/src/ngClip.js'
        ],
        test: [
            'app/assets/libs/angular-mocks/angular-mocks.js'
        ],
        css: [
            'app/assets/libs/angular-ui-tree/dist/angular-ui-tree.min.css',
            'app/assets/libs/bootstrap/dist/css/bootstrap.css',
            'app/assets/libs/bootstrap/dist/css/bootstrap-theme.css',
            'app/assets/libs/material-design-lite/material.css',
            'app/assets/libs/angular-material/angular-material.css'
        ],
        assets: [
        ]
    }
};
<commit_msg>add jsonforms.css<commit_after>/**
 * This file/module contains all configuration for the build process.
 */
module.exports = {
    /**
     * The `build_dir` folder is where the project is compiled for development
     */
    build_dir: 'build',

    /**
     * Temp Directory used during the build and deleted afterwards.
     */
    temp_dir: 'temp',

    /**
     * Distribution Directory, where the project is compiled for production
     */
    dist_dir: 'dist',

    /**
     * This is a collection of file patterns that refer to the app. These file paths are used in
     * the configuration of build tasks. `ts` is all project typescript, except the tests.
     * 'jsunit' are all unit tests. `html` are all the HTML files, `less` are the stylesheets.
     */
    app_files: {
        ts: [ 'app/src/**/*.ts', '!app/src/**/*.spec.ts' ],
        tsunit: [ 'app/src/**/*.spec.ts' ],
        html: [ 'app/index.html', 'app/src/**/*.html' ],
        less: ['app/assets/style/style.less'],
        assets: ['fonts/**/*.*', 'resource/**/*.*']
    },

    /**
     * This is the same as `app_files`, except it contains patterns that
     * reference library code (`bower_components/`) that need to be placed into the build
     * process somewhere. While the `app_files` property ensures all
     * standardized files are collected for compilation, it is the user's job
     * to ensure non-standardized (i.e. vendor-related) files are handled
     * appropriately in `vendor_files.js`.
     *
     * The `vendor_files.js` property holds files to be automatically
     * concatenated and minified with the project source files.
     *
     * The `vendor_files.css` property holds any CSS files to be automatically
     * included in the app.
     *
     * The `vendor_files.assets` property holds any assets to be copied along
     * with the app's assets. This structure is flattened, so it is not
     * recommended to use wildcards.
     */
    vendor_files: {
        js: [
            'app/assets/libs/jquery/dist/jquery.js',
            'app/assets/libs/angular/angular.js',
            'app/assets/libs/angular-ui-router/release/angular-ui-router.js',
            'app/assets/libs/angular-ui-tree/dist/angular-ui-tree.js',
            'app/assets/libs/bootstrap/dist/js/bootstrap.js',
            'app/assets/libs/angular-bootstrap/ui-bootstrap-tpls.js',
            'app/assets/libs/angular-ui-grid/ui-grid.js',
            'app/assets/libs/angular-ui-validate/dist/validate.js',
            'app/assets/libs/lodash-compat/lodash.js',
            'app/assets/libs/path-loader/browser/path-loader.js',
            'app/assets/libs/traverse/traverse.js',
            'app/assets/libs/json-refs/browser/json-refs.js',
            'app/assets/libs/tv4/tv4.js',
            'app/assets/libs/jsonforms/dist/js/jsonforms.js',
            'app/assets/libs/material-design-lite/material.js',
            'app/assets/libs/angular-animate/angular-animate.js',
            'app/assets/libs/angular-aria/angular-aria.js',
            'app/assets/libs/angular-material/angular-material.js',
            'app/assets/libs/zeroclipboard/dist/ZeroClipboard.js',
            'app/assets/libs/ng-clip/src/ngClip.js'
        ],
        test: [
            'app/assets/libs/angular-mocks/angular-mocks.js'
        ],
        css: [
            'app/assets/libs/angular-ui-tree/dist/angular-ui-tree.min.css',
            'app/assets/libs/bootstrap/dist/css/bootstrap.css',
            'app/assets/libs/bootstrap/dist/css/bootstrap-theme.css',
            'app/assets/libs/material-design-lite/material.css',
            'app/assets/libs/angular-material/angular-material.css',
            'app/assets/libs/jsonforms/dist/css/jsonforms.css'
        ],
        assets: [
        ]
    }
};
<|endoftext|>


<commit_before>usemockups.models.Tool = Backbone.Model.extend({
    idAttribute: "name",
    defaults: {
        resizable: true,
        attributes: []
    },
    initialize: function () {
    },
    get_attributes: function (mockup) {
        var attributes = {};
        _.forEach(this.get("attributes"), function (attribute) {
            attributes[attribute.name] = (mockup || this).get(attribute.name) || attribute.default;
        }, this);
        return attributes;
    }
});

usemockups.collections.Toolbox = Backbone.Collection.extend({
    model: usemockups.models.Tool
});<commit_msg>fixed deep copy problem for table mockup<commit_after>usemockups.models.Tool = Backbone.Model.extend({
    idAttribute: "name",
    defaults: {
        resizable: true,
        attributes: []
    },
    initialize: function () {
    },
    get_attributes: function (mockup) {
        var attributes = {};
        _.forEach(this.get("attributes"), function (attribute) {
            var default_value;

            if (_.isArray(attribute.default)) {
                // deep copy for multi dimensional arrays.
                // http://stackoverflow.com/a/817050/498402
                default_value = $.extend(true, [], attribute.default);
            } else {
                default_value = attribute.default;
            }

            attributes[attribute.name] = (mockup || this).get(attribute.name) || default_value;

        }, this);
        return attributes;
    }
});

usemockups.collections.Toolbox = Backbone.Collection.extend({
    model: usemockups.models.Tool
});<|endoftext|>


<commit_before>/*
 * Copyright 2012 The Toolkitchen Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file.
 */(function(e){var t=function(e,t){return Array.prototype.slice.call(e,t||0)};Function.prototype.bind||(Function.prototype.bind=function(e){var n=this,r=t(arguments,1);return function(){var i=t(arguments,0);return n.apply(e,r.concat(i))}}),e=e||{},e.clone=function(e,n){var r=t(arguments,1);for(var i=0,s;s=r[i];i++)if(s)for(var o in s)e[o]=s[o];return e},window.__PointerEventShim__=e})(window.__PointerEventShim__),function(e){var t={pointers:[],addPointer:function(e,t){var n={id:e,event:t};return this.pointers.push(n),n},removePointer:function(e){var t=this.getPointerIndex(e);if(t>-1)return this.pointers.splice(t,1)},getPointerById:function(e){return this.pointers[this.getPointerIndex(e)]},getPointerIndex:function(e){for(var t=0,n=this.pointers.length,r;t<n&&(r=this.pointers[t]);t++)if(r.id===e)return t;return-1},getPointerList:function(){return this.pointers}};e.pointermap=t}(window.__PointerEventShim__),function(e){var t=e.clone,n=e.pointermap,r=n.getPointerList.bind(n),i={events:[],eventMap:{},eventSources:{},registerSource:function(e,t){this.events=t.events,this.events.forEach(function(e){t[e]&&(this.eventMap[e]=t[e].bind(t))},this),this.eventSources[e]=t},registerTarget:function(e){this.listen(this.events,e)},unregisterTarget:function(e){this.unlisten(this.events,e)},down:function(e){this.fireEvent(e,"pointerdown")},move:function(e){this.fireEvent(e,"pointermove")},up:function(e){this.fireEvent(e,"pointerup")},tap:function(e){this.disableTap||this.fireEvent(e,"pointertap")},enter:function(e){this.fireEvent(e,"pointerenter")},leave:function(e){this.fireEvent(e,"pointerleave")},eventHandler:function(e){if(e.__pointerHandled__)return;var t=e.type,n=this.eventMap&&this.eventMap[t];n&&n(e),e.__pointerHandled__=!0},listen:function(e,t){e.forEach(function(e){this.addEvent(e,this.boundHandler,!1,t)},this)},unlisten:function(e){e.forEach(function(e){this.removeEvent(e,this.boundHandler,!1,inTarget)},this)},addEvent:function(e,t,n,r){var i=r||document;i.addEventListener(e,t,n)},removeEvent:function(e,t,n,r){var i=r||document;i.removeEventListener(e,t,n)},makeEvent:function(e,t){var n;typeof e.buttons!="undefined"?n=e.buttons?e.button:-1:n=e.which?e.button:-1;var i=document.createEvent("MouseEvent");return i.initMouseEvent(t,e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,n,e.relatedTarget),i.__srcTarget__=e.__srcTarget__||e.target,i.pointerId=e.pointerId||-1,i.getPointerList=r,i},fireEvent:function(e,t){var n=this.makeEvent(e,t);return this.dispatchEvent(n)},cloneEvent:function(e){return t({},e)},dispatchEvent:function(e){return e.__srcTarget__.dispatchEvent(e)}};e.dispatcher=i,i.boundHandler=i.eventHandler.bind(i)}(window.__PointerEventShim__),function(e){var t=e.dispatcher,n=e.pointermap,r=function(e,t){var n=e;while(n){if(n===t)return!0;n=n.parentNode}},i={events:["click","touchstart","touchmove","touchend"],splitEvents:function(e){var n=Array.prototype.map.call(e.changedTouches,function(e){var n=t.cloneEvent(e);return n.pointerId=e.identifier,n.target=this.findTarget(n),n.bubbles=!0,n.cancelable=!0,n.which=1,n.button=0,n},this);return n},findTarget:function(e){return document.elementFromPoint(e.clientX,e.clientY)},click:function(e){t.tap(e)},touchstart:function(e){var t=this.splitEvents(e);t.forEach(this.downEnter,this)},downEnter:function(e){var r=n.addPointer(e.pointerId,e,null);t.down(e),r.over=e,t.enter(e)},touchmove:function(e){e.preventDefault();var t=this.splitEvents(e);t.forEach(this.moveEnterLeave,this)},moveEnterLeave:function(e){var i=e,s=n.getPointerById(i.pointerId),o=s.over;s.event=i,t.move(i),o&&o.target!==i.target&&(o.relatedTarget=i.target,i.relatedTarget=o.target,r(o.relatedTarget,o.target)||t.leave(o),r(i.relatedTarget,i.target)||t.enter(i)),s.over=i},touchend:function(e){var t=this.splitEvents(e);t.forEach(this.upLeave,this)},upLeave:function(e){t.up(e),t.leave(e),n.removePointer(e.pointerId)}},s={POINTER_ID:-1,buttons:0,events:["click","mousedown","mousemove","mouseup","mouseover","mouseout"],click:function(e){t.tap(e)},mousedown:function(e){if(e.button==2)return;this.buttons==0&&(n.addPointer(this.POINTER_ID,e),t.down(e)),this.buttons++},mousemove:function(e){var r=n.getPointerById(this.POINTER_ID);r&&(r.event=e),t.move(e)},mouseup:function(e){this.buttons--,this.buttons==0&&(t.up(e),n.removePointer(this.POINTER_ID))},mouseover:function(e){if(!r(e.relatedTarget,e.target)){var n=t.cloneEvent(e);n.bubbles=!1,t.enter(n)}},mouseout:function(e){if(!r(e.relatedTarget,e.target)){var n=t.cloneEvent(e);n.bubbles=!1,t.leave(n)}}};"ontouchstart"in window?t.registerSource("touch",i):t.registerSource("mouse",s),t.registerTarget(document)}(window.__PointerEventShim__);<commit_msg>update build with new registration functions<commit_after>/*
 * Copyright 2012 The Toolkitchen Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file.
 */(function(e){var t=function(e,t){return Array.prototype.slice.call(e,t||0)};Function.prototype.bind||(Function.prototype.bind=function(e){var n=this,r=t(arguments,1);return function(){var i=t(arguments,0);return n.apply(e,r.concat(i))}}),e=e||{},e.clone=function(e,n){var r=t(arguments,1);for(var i=0,s;s=r[i];i++)if(s)for(var o in s)e[o]=s[o];return e},window.__PointerEventShim__=e})(window.__PointerEventShim__),function(e){var t={pointers:[],addPointer:function(e,t){var n={id:e,event:t};return this.pointers.push(n),n},removePointer:function(e){var t=this.getPointerIndex(e);if(t>-1)return this.pointers.splice(t,1)},getPointerById:function(e){return this.pointers[this.getPointerIndex(e)]},getPointerIndex:function(e){for(var t=0,n=this.pointers.length,r;t<n&&(r=this.pointers[t]);t++)if(r.id===e)return t;return-1},getPointerList:function(){return this.pointers}};e.pointermap=t}(window.__PointerEventShim__),function(e){var t=e.clone,n=e.pointermap,r=n.getPointerList.bind(n),i={events:[],eventMap:{},eventSources:{},registerSource:function(e,t){this.events=t.events,this.events.forEach(function(e){t[e]&&(this.eventMap[e]=t[e].bind(t))},this),this.eventSources[e]=t},registerTarget:function(e){this.listen(this.events,e)},unregisterTarget:function(e){this.unlisten(this.events,e)},down:function(e){this.fireEvent(e,"pointerdown")},move:function(e){this.fireEvent(e,"pointermove")},up:function(e){this.fireEvent(e,"pointerup")},tap:function(e){this.disableTap||this.fireEvent(e,"pointertap")},enter:function(e){this.fireEvent(e,"pointerenter")},leave:function(e){this.fireEvent(e,"pointerleave")},eventHandler:function(e){if(e.__pointerHandled__)return;var t=e.type,n=this.eventMap&&this.eventMap[t];n&&n(e),e.__pointerHandled__=!0},listen:function(e,t){e.forEach(function(e){this.addEvent(e,this.boundHandler,!1,t)},this)},unlisten:function(e){e.forEach(function(e){this.removeEvent(e,this.boundHandler,!1,inTarget)},this)},addEvent:function(e,t,n,r){var i=r||document;i.addEventListener(e,t,n)},removeEvent:function(e,t,n,r){var i=r||document;i.removeEventListener(e,t,n)},makeEvent:function(e,t){var n;typeof e.buttons!="undefined"?n=e.buttons?e.button:-1:n=e.which?e.button:-1;var i=document.createEvent("MouseEvent");return i.initMouseEvent(t,e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,n,e.relatedTarget),i.__srcTarget__=e.__srcTarget__||e.target,i.pointerId=e.pointerId||-1,i.getPointerList=r,i},fireEvent:function(e,t){var n=this.makeEvent(e,t);return this.dispatchEvent(n)},cloneEvent:function(e){return t({},e)},dispatchEvent:function(e){return e.__srcTarget__.dispatchEvent(e)}};i.boundHandler=i.eventHandler.bind(i),e.dispatcher=i,e.register=function(e){i.registerTarget(e)},e.unregister=function(e){i.unregisterTarget(e)}}(window.__PointerEventShim__),function(e){var t=e.dispatcher,n=e.pointermap,r=function(e,t){var n=e;while(n){if(n===t)return!0;n=n.parentNode}},i={events:["click","touchstart","touchmove","touchend"],splitEvents:function(e){var n=Array.prototype.map.call(e.changedTouches,function(e){var n=t.cloneEvent(e);return n.pointerId=e.identifier,n.target=this.findTarget(n),n.bubbles=!0,n.cancelable=!0,n.which=1,n.button=0,n},this);return n},findTarget:function(e){return document.elementFromPoint(e.clientX,e.clientY)},click:function(e){t.tap(e)},touchstart:function(e){var t=this.splitEvents(e);t.forEach(this.downEnter,this)},downEnter:function(e){var r=n.addPointer(e.pointerId,e,null);t.down(e),r.over=e,t.enter(e)},touchmove:function(e){e.preventDefault();var t=this.splitEvents(e);t.forEach(this.moveEnterLeave,this)},moveEnterLeave:function(e){var i=e,s=n.getPointerById(i.pointerId),o=s.over;s.event=i,t.move(i),o&&o.target!==i.target&&(o.relatedTarget=i.target,i.relatedTarget=o.target,r(o.relatedTarget,o.target)||t.leave(o),r(i.relatedTarget,i.target)||t.enter(i)),s.over=i},touchend:function(e){var t=this.splitEvents(e);t.forEach(this.upLeave,this)},upLeave:function(e){t.up(e),t.leave(e),n.removePointer(e.pointerId)}},s={POINTER_ID:-1,buttons:0,events:["click","mousedown","mousemove","mouseup","mouseover","mouseout"],click:function(e){t.tap(e)},mousedown:function(e){if(e.button==2)return;this.buttons==0&&(n.addPointer(this.POINTER_ID,e),t.down(e)),this.buttons++},mousemove:function(e){var r=n.getPointerById(this.POINTER_ID);r&&(r.event=e),t.move(e)},mouseup:function(e){this.buttons--,this.buttons==0&&(t.up(e),n.removePointer(this.POINTER_ID))},mouseover:function(e){if(!r(e.relatedTarget,e.target)){var n=t.cloneEvent(e);n.bubbles=!1,t.enter(n)}},mouseout:function(e){if(!r(e.relatedTarget,e.target)){var n=t.cloneEvent(e);n.bubbles=!1,t.leave(n)}}};"ontouchstart"in window?t.registerSource("touch",i):t.registerSource("mouse",s),t.registerTarget(document)}(window.__PointerEventShim__);<|endoftext|>


<commit_before>import babel from 'rollup-plugin-babel';
import { uglify } from 'rollup-plugin-uglify';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';

export default [{
  input: 'src/main.js',
  output: {
    name: "_fetch",
    file: 'dist/index.umd.js',
    format: 'umd'
  },
  plugins: [
    babel({
      "include": "src/**",
      "plugins": [
        "istanbul",
      ]
    }),
    resolve(),
    commonjs()
  ]
}, {
  input: 'src/main.js',
  output: {
    name: "_fetch",
    file: 'dist/index.umd.min.js',
    format: 'umd'
  },
  plugins: [
    babel({
      "include": "src/**",
    }),
    uglify(),
    resolve(),
    commonjs()
  ]
}, {
  input: 'src/main.js',
  output: {
    file: 'dist/index.js',
    format: 'cjs'
  },
  plugins: [
    babel({
      "include": "src/**",
    }),
    uglify(),
    commonjs()
  ]
}]
<commit_msg>remove warn<commit_after>import babel from 'rollup-plugin-babel';
import { uglify } from 'rollup-plugin-uglify';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';

export default [{
  input: 'src/main.js',
  output: {
    name: "_fetch",
    file: 'dist/index.umd.js',
    format: 'umd'
  },
  plugins: [
    babel({
      "include": "src/**",
      "plugins": [
        "istanbul",
      ]
    }),
    resolve(),
    commonjs()
  ]
}, {
  input: 'src/main.js',
  output: {
    name: "_fetch",
    file: 'dist/index.umd.min.js',
    format: 'umd'
  },
  plugins: [
    babel({
      "include": "src/**",
    }),
    uglify(),
    resolve(),
    commonjs()
  ]
}, {
  input: 'src/main.js',
  output: {
    file: 'dist/index.js',
    format: 'cjs'
  },
  external: [ 'whatwg-fetch' ],
  plugins: [
    babel({
      "include": "src/**",
    }),
    uglify(),
    commonjs()
  ]
}]
<|endoftext|>


<commit_before>module.exports = function( grunt ) {
	"use strict";

	var releaseBranch,
		releaseVersion,
		isDryRun = !!grunt.option( "no-write" ),
		major, minor, patch, xbeta, isBeta,
		version,
		nextVersion;

	grunt.registerTask( "release:init", function() {
		releaseBranch = grunt.option( "releaseBranch" ) || "master";
		releaseVersion = grunt.option( "releaseVersion" ) || grunt.config.get( "version" );

		grunt.log.debug( "dry run: " + isDryRun );
		grunt.log.debug( "releaseBranch: " + releaseBranch );
		grunt.log.debug( "releaseVersion: " + releaseVersion );

		// First arg should be the version number being released
		var _ = grunt.util._,
			newver, oldver,
			options = grunt.config.get( "release.options", {
				versionRegExp: /^(\d)\.(\d+)\.(\d)(-(?:a|b|rc)\.\d|pre)$/
			}),
			rversion = options.versionRegExp,
			version = ( releaseVersion || "" ).toLowerCase().match( rversion ) || {};

		major = version[1],
		minor = version[2],
		patch = version[3],
		xbeta = version[4],
		isBeta = !!xbeta;

		grunt.log.debug( "options: " + JSON.stringify( options ) );

		grunt.log.debug( "major: " + major );
		grunt.log.debug( "minor: " + minor );
		grunt.log.debug( "patch: " + patch );

		if ( !releaseBranch || !major || !minor || !patch ) {
			grunt.fatal( "Usage: --releaseBranch=releaseBranch --releaseVersion=releaseVersion" );
		}

		grunt.config.set( "version", releaseVersion );
		grunt.config.set( "versionSuffix", "-" + releaseVersion );
	});

	grunt.registerTask( "release:fail-if-pre", function() {
		if ( xbeta === "pre" ) {
			grunt.fatal( "Cannot release/deploy a '"+xbeta+"' version!" );
		}
	});

	grunt.registerTask( "release:set-version", function( newVersion ) {
		var done = this.async(),
			pkg = grunt.file.readJSON( "package.json" ),
			newVersion = newVersion || releaseVersion,
			gitArgs = [ "commit", "-m", "'Changed version to: "+ newVersion+"'", "package.json" ],
			child;

		console.log( "Setting version to: " + newVersion );

		pkg.version = newVersion;

		grunt.file.write( "package.json", JSON.stringify( pkg, null, "\t" ) );

		grunt.log.writeln( "`git " + gitArgs.join( " " ) + "`" );

		if ( !isDryRun ) {
			// No point even running git in dry-run because there is nothing to commit
			child = grunt.util.spawn(
				{
					cmd: "git",
					args: gitArgs
				},
				function ( err, result ) {
					if ( err ) {
						grunt.log.error( result.stderr );
						return done( false );
					}

					grunt.log.ok( "Version bumped to " + newVersion );
					done();
				}
			);

			child.stdout.setEncoding( "utf8" );
			child.stdout.on( "data", function( data ) {
				grunt.log.write( data );
			});
		}
	});

	grunt.registerTask( "release:set-next-version", function() {
		var pkg = grunt.config.get( "pkg" );

		console.log( "Current version is " + pkg.version );
		nextVersion = major + "." + minor + "." + ( isBeta ? patch : +patch + 1 ) + "pre";
		console.log( "Next version is " + nextVersion );

		grunt.task.run( "release:set-version:" + nextVersion );
	});

	grunt.registerTask( 'release:check-git-status', 'Retrieve git status and ensures the workspace is clean', function() {
		var done = this.async();

		grunt.util.spawn(
			{
				cmd: "git",
				args: [ "status" ]
			},
			function ( err, result ) {
				if ( err ) {
					grunt.log.error( err );
					return done( false );
				}

				var stdout = result.stdout,
					onBranch = ((stdout || "").match( /On branch (\S+)/ ) || [])[1];

				if ( onBranch !== releaseBranch ) {
					grunt.fatal( "Branches don't match: Wanted " + releaseBranch + ", got " + onBranch );
				}
				if ( /Changes to be committed/i.test( stdout ) ) {
					grunt.warn( "Please commit changed files before attemping to push a release." );
				}
				if ( /Changes not staged for commit/i.test( stdout ) ) {
					grunt.warn( "Please stash files before attempting to push a release." );
				}
				done();
			}
		);
	});

	grunt.registerTask( 'release:tag', 'Tag the repo with the current release', function() {
		var done = this.async(),
			gitArgs = [ "tag", releaseVersion ],
			child;

		grunt.log.writeln( "`git " + gitArgs.join( " " ) + "`" );

		if ( !isDryRun ) {
			child = grunt.util.spawn(
				{
					cmd: "git",
					args: gitArgs
				},
				function ( err, result ) {
					if ( err ) {
						grunt.log.error( result.stderr );
						return done( false );
					}

					grunt.log.ok( "Created tag: " + releaseVersion );
					done();
				}
			);

			child.stdout.setEncoding( "utf8" );
			child.stdout.on( "data", function( data ) {
				grunt.log.write( data );
			});
		}
	})

	grunt.registerTask( 'release', [ "release:init", "release:git:status" ]);
};<commit_msg>Build: Removed redefinition of "release" task<commit_after>module.exports = function( grunt ) {
	"use strict";

	var releaseBranch,
		releaseVersion,
		isDryRun = !!grunt.option( "no-write" ),
		major, minor, patch, xbeta, isBeta,
		version,
		nextVersion;

	grunt.registerTask( "release:init", function() {
		releaseBranch = grunt.option( "releaseBranch" ) || "master";
		releaseVersion = grunt.option( "releaseVersion" ) || grunt.config.get( "version" );

		grunt.log.debug( "dry run: " + isDryRun );
		grunt.log.debug( "releaseBranch: " + releaseBranch );
		grunt.log.debug( "releaseVersion: " + releaseVersion );

		// First arg should be the version number being released
		var _ = grunt.util._,
			newver, oldver,
			options = grunt.config.get( "release.options", {
				versionRegExp: /^(\d)\.(\d+)\.(\d)(-(?:a|b|rc)\.\d|pre)$/
			}),
			rversion = options.versionRegExp,
			version = ( releaseVersion || "" ).toLowerCase().match( rversion ) || {};

		major = version[1],
		minor = version[2],
		patch = version[3],
		xbeta = version[4],
		isBeta = !!xbeta;

		grunt.log.debug( "options: " + JSON.stringify( options ) );

		grunt.log.debug( "major: " + major );
		grunt.log.debug( "minor: " + minor );
		grunt.log.debug( "patch: " + patch );

		if ( !releaseBranch || !major || !minor || !patch ) {
			grunt.fatal( "Usage: --releaseBranch=releaseBranch --releaseVersion=releaseVersion" );
		}

		grunt.config.set( "version", releaseVersion );
		grunt.config.set( "versionSuffix", "-" + releaseVersion );
	});

	grunt.registerTask( "release:fail-if-pre", function() {
		if ( xbeta === "pre" ) {
			grunt.fatal( "Cannot release/deploy a '"+xbeta+"' version!" );
		}
	});

	grunt.registerTask( "release:set-version", function( newVersion ) {
		var done = this.async(),
			pkg = grunt.file.readJSON( "package.json" ),
			newVersion = newVersion || releaseVersion,
			gitArgs = [ "commit", "-m", "'Changed version to: "+ newVersion+"'", "package.json" ],
			child;

		console.log( "Setting version to: " + newVersion );

		pkg.version = newVersion;

		grunt.file.write( "package.json", JSON.stringify( pkg, null, "\t" ) );

		grunt.log.writeln( "`git " + gitArgs.join( " " ) + "`" );

		if ( !isDryRun ) {
			// No point even running git in dry-run because there is nothing to commit
			child = grunt.util.spawn(
				{
					cmd: "git",
					args: gitArgs
				},
				function ( err, result ) {
					if ( err ) {
						grunt.log.error( result.stderr );
						return done( false );
					}

					grunt.log.ok( "Version bumped to " + newVersion );
					done();
				}
			);

			child.stdout.setEncoding( "utf8" );
			child.stdout.on( "data", function( data ) {
				grunt.log.write( data );
			});
		}
	});

	grunt.registerTask( "release:set-next-version", function() {
		var pkg = grunt.config.get( "pkg" );

		console.log( "Current version is " + pkg.version );
		nextVersion = major + "." + minor + "." + ( isBeta ? patch : +patch + 1 ) + "pre";
		console.log( "Next version is " + nextVersion );

		grunt.task.run( "release:set-version:" + nextVersion );
	});

	grunt.registerTask( 'release:check-git-status', 'Retrieve git status and ensures the workspace is clean', function() {
		var done = this.async();

		grunt.util.spawn(
			{
				cmd: "git",
				args: [ "status" ]
			},
			function ( err, result ) {
				if ( err ) {
					grunt.log.error( err );
					return done( false );
				}

				var stdout = result.stdout,
					onBranch = ((stdout || "").match( /On branch (\S+)/ ) || [])[1];

				if ( onBranch !== releaseBranch ) {
					grunt.fatal( "Branches don't match: Wanted " + releaseBranch + ", got " + onBranch );
				}
				if ( /Changes to be committed/i.test( stdout ) ) {
					grunt.warn( "Please commit changed files before attemping to push a release." );
				}
				if ( /Changes not staged for commit/i.test( stdout ) ) {
					grunt.warn( "Please stash files before attempting to push a release." );
				}
				done();
			}
		);
	});

	grunt.registerTask( 'release:tag', 'Tag the repo with the current release', function() {
		var done = this.async(),
			gitArgs = [ "tag", releaseVersion ],
			child;

		grunt.log.writeln( "`git " + gitArgs.join( " " ) + "`" );

		if ( !isDryRun ) {
			child = grunt.util.spawn(
				{
					cmd: "git",
					args: gitArgs
				},
				function ( err, result ) {
					if ( err ) {
						grunt.log.error( result.stderr );
						return done( false );
					}

					grunt.log.ok( "Created tag: " + releaseVersion );
					done();
				}
			);

			child.stdout.setEncoding( "utf8" );
			child.stdout.on( "data", function( data ) {
				grunt.log.write( data );
			});
		}
	})
};<|endoftext|>