<commit_before>var globals = require('./bin/globals.js');
var reload = require('./bin/reload.js');

module.exports = function(grunt) {

    /**
     * @property options
     * @type Object
     */
    var options = {
        appname: grunt.option('appname'),
        architecture: grunt.option('architecture') === undefined ? 'arm' : grunt.option('architecture'),
        hostname: grunt.option('hostname') === undefined ? 'localhost' : grunt.option('hostname'),
        name: grunt.option('name') || false,
        noclean: grunt.option('noclean') || false,
        novalidate: grunt.option('novalidate') || false,
        port: grunt.option('port') === undefined ? '8080' : grunt.option('port'),
        protocol: grunt.option('protocol') === undefined ? 'http' : grunt.option('protocol')
    };

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-coffee');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.loadNpmTasks('grunt-contrib-jade');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-yuidoc');
    grunt.loadNpmTasks('grunt-react');
    grunt.loadNpmTasks('grunt-replace');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-zip');

    grunt.initConfig({
        /**
         * GLOBALS
         */
        globals: globals,
        /**
         * OPTIONS
         */
        options: options,
        /**
         * CLEAN
         */
        clean: {
            'build-android': {
                src: [
                    '<%= globals.project.build.path %>/android/**/*'
                ],
                options: {force: true}
            },
            'cordova': {
                src: [
                    '<%= globals.project.path %>/cordova'
                ],
                options: {force: true}
            },
            'cordova-android': {
                src: [
                    '<%= globals.project.path %>/cordova/platforms/android'
                ],
                options: {force: true}
            },
            'cordova-android-cordovalib': {
                src: [
                    '<%= globals.project.cordova.platforms.android.cordovalib.path %>/**/*'
                ],
                options: {force: true}
            },
            'cordova-crosswalk': {
                src: [
                    '<%= globals.gelato.includes.crosswalk.path %>/**/*',
                    '!<%= globals.gelato.includes.crosswalk.arm.path %>.zip',
                    '!<%= globals.gelato.includes.crosswalk.x86.path %>.zip'
                ],
                options: {force: true}
            },
            'cordova-www': {
                src: [
                    '<%= globals.project.path %>/cordova/www/**/*'
                ],
                options: {force: true}
            },
            'docs': {
                src: [
                    '<%= globals.project.docs.path %>'
                ],
                options: {force: true}
            },
            'project-gelato': {
                src: [
                    '<%= globals.project.gelato.path %>/**/*'
                ],
                options: {force: true}
            },
            'project-www': {
                src: [
                    '<%= globals.project.www.path %>/**/*'
                ],
                options: {force: true}
            }
        },
        /**
         * COFFEE
         */
        coffee: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: '**/*.coffee',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: '**/*.coffee',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    }
                ]
            }
        },
        /**
         * CONNECT
         */
        connect: {
            'project-www': {
                options: {
                    base: '<%= globals.project.www.path %>',
                    hostname: '<%= options.hostname %>',
                    keepalive: true,
                    open: {
                        appName: '<%= options.appname %>'
                    },
                    port: '<%= options.port %>',
                    protocol: '<%= options.protocol %>'
                }
            }
        },
        /**
         * COPY
         */
        copy: {
            'cordova-android-apk': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.project.cordova.platforms.android.path %>/ant-build',
                        src: ['MainActivity-debug.apk', 'MainActivity-release-unsigned.apk'],
                        dest: '<%= globals.project.build.path %>/android',
                        rename: function(dest, src) {
                            return dest + '/' + src.replace('MainActivity-', globals.project.pkg.name + '-' + options.architecture + '-');
                        }
                    }
                ]
            },
            'cordova-config': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.project.www.path %>/cordova',
                        src: ['**/*'],
                        dest: '<%= globals.project.cordova.path %>'
                    }
                ]
            },
            'cordova-crosswalk': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.crosswalk.base.path %>-<%= options.architecture %>/framework',
                        src: ['**/*'],
                        dest: '<%= globals.project.cordova.platforms.android.cordovalib.path %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.crosswalk.base.path %>-<%= options.architecture %>',
                        src: ['VERSION'],
                        dest: '<%= globals.project.cordova.platforms.android.path %>'
                    }
                ]
            },
            'cordova-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.project.www.path %>',
                        src: ['**/*', '!cordova/**/*'],
                        dest: '<%= globals.project.cordova.www.path %>'
                    }
                ]
            },
            'project-gelato': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['core/**/*', '!**/*.coffee', '!**/*.jade', '!**/*.jsx', '!**/*.scss', '!README.md'],
                        dest: '<%= globals.project.gelato.path %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.path %>',
                        src: ['plugins/**/*'],
                        dest: '<%= globals.project.gelato.path %>'
                    }
                ]
            },
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['**/*', '!**/*.coffee', '!**/*.jade', '!**/*.jsx', '!**/*.scss', '!README.md'],
                        dest: '<%= globals.project.www.path %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: ['**/*', '!**/*.coffee', '!**/*.jade', '!**/*.jsx', '!**/*.scss', '!README.md'],
                        dest: '<%= globals.project.www.path %>'
                    }
                ]
            },
            'structure': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.structure.path %>/',
                        src: [
                            'copy-gitattributes',
                            'copy-gitignore',
                            'copy-htaccess',
                            'copy-package',
                            'copy-readme'
                        ],
                        dest: '<%= globals.project.path %>',
                        rename: function(dest, src) {
                            switch (src) {
                                case 'copy-gitattributes':
                                    return dest + '/.gitattributes';
                                case 'copy-gitignore':
                                    return dest + '/.gitignore';
                                case 'copy-htaccess':
                                    return dest + '/.htaccess';
                                case 'copy-package':
                                    return dest + '/package.json';
                                case 'copy-readme':
                                    return dest + '/README.md';
                            }
                            return dest + '/' + src;
                        }
                    }
                ]
            }
        },
        /**
         * CSSLINT
         */
        csslint: {
            'project-www': {
                options: {
                    csslintrc: '.csslintrc',
                    import: 2
                },
                src: [
                    '<%= globals.project.www.path %>/styles/**/*.css',
                    '!<%= globals.project.www.path %>/styles/fonts.css'
                ]
            }
        },
        /**
         * JADE
         */
        jade: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['**/*.jade'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.html'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: ['**/*.jade'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.html'
                    }
                ]
            }
        },
        /**
         * JSHINT
         */
        jshint: {
            'project-www': {
                options: {
                    jshintrc: '.jshintrc'
                },
                src: [
                    'Gruntfile.js',
                    '<%= globals.project.www.path %>/**/*.js',
                    '!<%= globals.project.www.path %>/libraries/**/*.js',
                    '!<%= globals.project.www.path %>/core/libraries/**/*.js'
                ]
            }
        },
        /**
         * REACT
         */
        react: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: '**/*.jsx',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: '**/*.jsx',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    }
                ]
            }
        },
        /**
         * REPLACE
         */
        replace: {
            'cordova-config': {
                options: {
                    variables: {
                        'description': '<%= globals.project.pkg.description %>',
                        'packageBundleVersion': '<%= globals.project.pkg.version %>',
                        'packageId': '<%= globals.project.pkg.packageId %>',
                        'packageName': '<%= globals.project.pkg.packageName %>',
                        'packageVersionCode': function() {
                            return globals.project.pkg['packageVersionCode-' + options.architecture];
                        },
                        'version': '<%= globals.project.pkg.version %>'
                    }
                },
                files: [
                    {
                        expand: true,
                        src: ['config.xml'],
                        cwd: '<%= globals.project.cordova.path %>',
                        dest: '<%= globals.project.cordova.path %>'
                    }
                ]
            },
            'cordova-manifest': {
                options: {
                    patterns: [{
                        match: '"10" android:targetSdkVersion',
                        replacement: '"16" android:targetSdkVersion'
                    }],
                    usePrefix: false
                },
                files: [
                    {
                        src: 'AndroidManifest.xml',
                        dest: '<%= globals.project.cordova.platforms.android.path %>',
                        expand: true,
                        cwd: '<%= globals.project.cordova.platforms.android.path %>'
                    }
                ]
            },
            'project-www': {
                options: {
                    variables: {
                        'application-description': '<%= globals.project.pkg.description %>',
                        'application-name': '<%= globals.project.pkg.name %>',
                        'application-title': '<%= globals.project.pkg.title %>',
                        'application-version': '<%= globals.project.pkg.version %>',
                        'framework-version': '<%= globals.gelato.pkg.version %>'
                    }
                },
                files: [
                    {
                        expand: true,
                        src: ['index.html', 'tests.html'],
                        cwd: '<%= globals.project.www.path %>',
                        dest: '<%= globals.project.www.path %>'
                    },
                    {
                        expand: true,
                        src: 'core/config/app.js',
                        cwd: '<%= globals.project.www.path %>',
                        dest: '<%= globals.project.www.path %>'
                    },
                    {
                        expand: true,
                        src: 'locale/nls/**/*.js',
                        cwd: '<%= globals.project.www.path %>',
                        dest: '<%= globals.project.www.path %>'
                    }
                ]
            },
            'structure': {
                options: {
                    variables: {
                        'project-name': '<%= options.name %>'
                    }
                },
                files: [
                    {
                        expand: true,
                        src: ['package.json', 'README.md'],
                        cwd: '<%= globals.project.path %>',
                        dest: '<%= globals.project.path %>'
                    }
                ]
            }
        },
        /**
         * REQUIREJS
         */
        requirejs: {
            'cordova-www': {
                options: {
                    baseUrl: globals.project.www.path,
                    dir: globals.project.cordova.path + '/www',
                    fileExclusionRegExp: null,
                    generateSourceMaps: false,
                    keepBuildDir: false,
                    modules: globals.project.config.modules,
                    optimize: 'uglify',
                    optimizeCss: 'standard',
                    paths: globals.project.config.paths,
                    preserveLicenseComments: false,
                    removeCombined: true,
                    shim: globals.project.config.shim
                }
            },
            'web-www': {
                options: {
                    baseUrl: globals.project.www.path,
                    dir: globals.project.build.path + '/web',
                    fileExclusionRegExp: null,
                    generateSourceMaps: false,
                    keepBuildDir: false,
                    modules: globals.project.config.modules,
                    optimize: 'uglify',
                    optimizeCss: 'standard',
                    paths: globals.project.config.paths,
                    preserveLicenseComments: false,
                    removeCombined: true,
                    shim: globals.project.config.shim
                }
            }
        },
        /**
         * SASS
         */
        sass: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['core/styles/gelato.scss', 'styles/imports.scss'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.css'

                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: ['styles/imports.scss'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.css'
                    }
                ],
                options: {
                    sourcemap: 'none'
                }
            }
        },
        /**
         * SHELL
         */
        shell: {
            'build-cordova-android': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova build android'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'build-cordova-android-release': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova build android --release'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova': {
                command: [
                    'cd <%= globals.project.path %>',
                    'cordova create cordova <%= globals.project.pkg.packageId %> "<%= globals.project.pkg.packageName %>"'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova-android': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova platform add android'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova-crosswalk': {
                command: [
                    'cd <%= globals.project.cordova.platforms.android.cordovalib.path %>',
                    'android update project --subprojects --path . --target "android-21"',
                    'ant debug'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova-plugins': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova plugin add <%= globals.gelato.includes.plugins.path %>/core',
                    'cordova plugin add <%= globals.gelato.includes.plugins.path %>/google-playservices',
                    'cordova plugin add <%= globals.gelato.includes.plugins.path %>/mobfox'
                ].concat(globals.project.config.cordova.plugins.map(function(plugin) {
                        return 'cordova plugin add ' + plugin;
                    })
                ).join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'restart-adb': {<commit_msg>Removed all cordova plugins except core from default installation.<commit_after>var globals = require('./bin/globals.js');
var reload = require('./bin/reload.js');

module.exports = function(grunt) {

    /**
     * @property options
     * @type Object
     */
    var options = {
        appname: grunt.option('appname'),
        architecture: grunt.option('architecture') === undefined ? 'arm' : grunt.option('architecture'),
        hostname: grunt.option('hostname') === undefined ? 'localhost' : grunt.option('hostname'),
        name: grunt.option('name') || false,
        noclean: grunt.option('noclean') || false,
        novalidate: grunt.option('novalidate') || false,
        port: grunt.option('port') === undefined ? '8080' : grunt.option('port'),
        protocol: grunt.option('protocol') === undefined ? 'http' : grunt.option('protocol')
    };

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-coffee');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.loadNpmTasks('grunt-contrib-jade');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-yuidoc');
    grunt.loadNpmTasks('grunt-react');
    grunt.loadNpmTasks('grunt-replace');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-zip');

    grunt.initConfig({
        /**
         * GLOBALS
         */
        globals: globals,
        /**
         * OPTIONS
         */
        options: options,
        /**
         * CLEAN
         */
        clean: {
            'build-android': {
                src: [
                    '<%= globals.project.build.path %>/android/**/*'
                ],
                options: {force: true}
            },
            'cordova': {
                src: [
                    '<%= globals.project.path %>/cordova'
                ],
                options: {force: true}
            },
            'cordova-android': {
                src: [
                    '<%= globals.project.path %>/cordova/platforms/android'
                ],
                options: {force: true}
            },
            'cordova-android-cordovalib': {
                src: [
                    '<%= globals.project.cordova.platforms.android.cordovalib.path %>/**/*'
                ],
                options: {force: true}
            },
            'cordova-crosswalk': {
                src: [
                    '<%= globals.gelato.includes.crosswalk.path %>/**/*',
                    '!<%= globals.gelato.includes.crosswalk.arm.path %>.zip',
                    '!<%= globals.gelato.includes.crosswalk.x86.path %>.zip'
                ],
                options: {force: true}
            },
            'cordova-www': {
                src: [
                    '<%= globals.project.path %>/cordova/www/**/*'
                ],
                options: {force: true}
            },
            'docs': {
                src: [
                    '<%= globals.project.docs.path %>'
                ],
                options: {force: true}
            },
            'project-gelato': {
                src: [
                    '<%= globals.project.gelato.path %>/**/*'
                ],
                options: {force: true}
            },
            'project-www': {
                src: [
                    '<%= globals.project.www.path %>/**/*'
                ],
                options: {force: true}
            }
        },
        /**
         * COFFEE
         */
        coffee: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: '**/*.coffee',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: '**/*.coffee',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    }
                ]
            }
        },
        /**
         * CONNECT
         */
        connect: {
            'project-www': {
                options: {
                    base: '<%= globals.project.www.path %>',
                    hostname: '<%= options.hostname %>',
                    keepalive: true,
                    open: {
                        appName: '<%= options.appname %>'
                    },
                    port: '<%= options.port %>',
                    protocol: '<%= options.protocol %>'
                }
            }
        },
        /**
         * COPY
         */
        copy: {
            'cordova-android-apk': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.project.cordova.platforms.android.path %>/ant-build',
                        src: ['MainActivity-debug.apk', 'MainActivity-release-unsigned.apk'],
                        dest: '<%= globals.project.build.path %>/android',
                        rename: function(dest, src) {
                            return dest + '/' + src.replace('MainActivity-', globals.project.pkg.name + '-' + options.architecture + '-');
                        }
                    }
                ]
            },
            'cordova-config': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.project.www.path %>/cordova',
                        src: ['**/*'],
                        dest: '<%= globals.project.cordova.path %>'
                    }
                ]
            },
            'cordova-crosswalk': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.crosswalk.base.path %>-<%= options.architecture %>/framework',
                        src: ['**/*'],
                        dest: '<%= globals.project.cordova.platforms.android.cordovalib.path %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.crosswalk.base.path %>-<%= options.architecture %>',
                        src: ['VERSION'],
                        dest: '<%= globals.project.cordova.platforms.android.path %>'
                    }
                ]
            },
            'cordova-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.project.www.path %>',
                        src: ['**/*', '!cordova/**/*'],
                        dest: '<%= globals.project.cordova.www.path %>'
                    }
                ]
            },
            'project-gelato': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['core/**/*', '!**/*.coffee', '!**/*.jade', '!**/*.jsx', '!**/*.scss', '!README.md'],
                        dest: '<%= globals.project.gelato.path %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.path %>',
                        src: ['plugins/**/*'],
                        dest: '<%= globals.project.gelato.path %>'
                    }
                ]
            },
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['**/*', '!**/*.coffee', '!**/*.jade', '!**/*.jsx', '!**/*.scss', '!README.md'],
                        dest: '<%= globals.project.www.path %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: ['**/*', '!**/*.coffee', '!**/*.jade', '!**/*.jsx', '!**/*.scss', '!README.md'],
                        dest: '<%= globals.project.www.path %>'
                    }
                ]
            },
            'structure': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.includes.structure.path %>/',
                        src: [
                            'copy-gitattributes',
                            'copy-gitignore',
                            'copy-htaccess',
                            'copy-package',
                            'copy-readme'
                        ],
                        dest: '<%= globals.project.path %>',
                        rename: function(dest, src) {
                            switch (src) {
                                case 'copy-gitattributes':
                                    return dest + '/.gitattributes';
                                case 'copy-gitignore':
                                    return dest + '/.gitignore';
                                case 'copy-htaccess':
                                    return dest + '/.htaccess';
                                case 'copy-package':
                                    return dest + '/package.json';
                                case 'copy-readme':
                                    return dest + '/README.md';
                            }
                            return dest + '/' + src;
                        }
                    }
                ]
            }
        },
        /**
         * CSSLINT
         */
        csslint: {
            'project-www': {
                options: {
                    csslintrc: '.csslintrc',
                    import: 2
                },
                src: [
                    '<%= globals.project.www.path %>/styles/**/*.css',
                    '!<%= globals.project.www.path %>/styles/fonts.css'
                ]
            }
        },
        /**
         * JADE
         */
        jade: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['**/*.jade'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.html'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: ['**/*.jade'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.html'
                    }
                ]
            }
        },
        /**
         * JSHINT
         */
        jshint: {
            'project-www': {
                options: {
                    jshintrc: '.jshintrc'
                },
                src: [
                    'Gruntfile.js',
                    '<%= globals.project.www.path %>/**/*.js',
                    '!<%= globals.project.www.path %>/libraries/**/*.js',
                    '!<%= globals.project.www.path %>/core/libraries/**/*.js'
                ]
            }
        },
        /**
         * REACT
         */
        react: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: '**/*.jsx',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: '**/*.jsx',
                        dest: '<%= globals.project.www.path %>',
                        ext: '.js'
                    }
                ]
            }
        },
        /**
         * REPLACE
         */
        replace: {
            'cordova-config': {
                options: {
                    variables: {
                        'description': '<%= globals.project.pkg.description %>',
                        'packageBundleVersion': '<%= globals.project.pkg.version %>',
                        'packageId': '<%= globals.project.pkg.packageId %>',
                        'packageName': '<%= globals.project.pkg.packageName %>',
                        'packageVersionCode': function() {
                            return globals.project.pkg['packageVersionCode-' + options.architecture];
                        },
                        'version': '<%= globals.project.pkg.version %>'
                    }
                },
                files: [
                    {
                        expand: true,
                        src: ['config.xml'],
                        cwd: '<%= globals.project.cordova.path %>',
                        dest: '<%= globals.project.cordova.path %>'
                    }
                ]
            },
            'cordova-manifest': {
                options: {
                    patterns: [{
                        match: '"10" android:targetSdkVersion',
                        replacement: '"16" android:targetSdkVersion'
                    }],
                    usePrefix: false
                },
                files: [
                    {
                        src: 'AndroidManifest.xml',
                        dest: '<%= globals.project.cordova.platforms.android.path %>',
                        expand: true,
                        cwd: '<%= globals.project.cordova.platforms.android.path %>'
                    }
                ]
            },
            'project-www': {
                options: {
                    variables: {
                        'application-description': '<%= globals.project.pkg.description %>',
                        'application-name': '<%= globals.project.pkg.name %>',
                        'application-title': '<%= globals.project.pkg.title %>',
                        'application-version': '<%= globals.project.pkg.version %>',
                        'framework-version': '<%= globals.gelato.pkg.version %>'
                    }
                },
                files: [
                    {
                        expand: true,
                        src: ['index.html', 'tests.html'],
                        cwd: '<%= globals.project.www.path %>',
                        dest: '<%= globals.project.www.path %>'
                    },
                    {
                        expand: true,
                        src: 'core/config/app.js',
                        cwd: '<%= globals.project.www.path %>',
                        dest: '<%= globals.project.www.path %>'
                    },
                    {
                        expand: true,
                        src: 'locale/nls/**/*.js',
                        cwd: '<%= globals.project.www.path %>',
                        dest: '<%= globals.project.www.path %>'
                    }
                ]
            },
            'structure': {
                options: {
                    variables: {
                        'project-name': '<%= options.name %>'
                    }
                },
                files: [
                    {
                        expand: true,
                        src: ['package.json', 'README.md'],
                        cwd: '<%= globals.project.path %>',
                        dest: '<%= globals.project.path %>'
                    }
                ]
            }
        },
        /**
         * REQUIREJS
         */
        requirejs: {
            'cordova-www': {
                options: {
                    baseUrl: globals.project.www.path,
                    dir: globals.project.cordova.path + '/www',
                    fileExclusionRegExp: null,
                    generateSourceMaps: false,
                    keepBuildDir: false,
                    modules: globals.project.config.modules,
                    optimize: 'uglify',
                    optimizeCss: 'standard',
                    paths: globals.project.config.paths,
                    preserveLicenseComments: false,
                    removeCombined: true,
                    shim: globals.project.config.shim
                }
            },
            'web-www': {
                options: {
                    baseUrl: globals.project.www.path,
                    dir: globals.project.build.path + '/web',
                    fileExclusionRegExp: null,
                    generateSourceMaps: false,
                    keepBuildDir: false,
                    modules: globals.project.config.modules,
                    optimize: 'uglify',
                    optimizeCss: 'standard',
                    paths: globals.project.config.paths,
                    preserveLicenseComments: false,
                    removeCombined: true,
                    shim: globals.project.config.shim
                }
            }
        },
        /**
         * SASS
         */
        sass: {
            'project-www': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= globals.gelato.framework.path %>',
                        src: ['core/styles/gelato.scss', 'styles/imports.scss'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.css'

                    },
                    {
                        expand: true,
                        cwd: '<%= globals.project.src.path %>',
                        src: ['styles/imports.scss'],
                        dest: '<%= globals.project.www.path %>',
                        ext: '.css'
                    }
                ],
                options: {
                    sourcemap: 'none'
                }
            }
        },
        /**
         * SHELL
         */
        shell: {
            'build-cordova-android': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova build android'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'build-cordova-android-release': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova build android --release'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova': {
                command: [
                    'cd <%= globals.project.path %>',
                    'cordova create cordova <%= globals.project.pkg.packageId %> "<%= globals.project.pkg.packageName %>"'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova-android': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova platform add android'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova-crosswalk': {
                command: [
                    'cd <%= globals.project.cordova.platforms.android.cordovalib.path %>',
                    'android update project --subprojects --path . --target "android-21"',
                    'ant debug'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'install-cordova-plugins': {
                command: [
                    'cd <%= globals.project.cordova.path %>',
                    'cordova plugin add <%= globals.gelato.includes.plugins.path %>/core'
                ].concat(globals.project.config.cordova.plugins.map(function(plugin) {
                        return 'cordova plugin add ' + plugin;
                    })
                ).join(' && '),
                options: {
                    stdout: true,
                    stderr: true
                }
            },
            'restart-adb': {
{'fraction_non_alphanumeric': 0.13777545592705168, 'fraction_numerical': 0.0006174012158054711, 'mean_word_length': 0.8266319670353502, 'pattern_counts': {'":': 0, '<': 187, '<?xml version=': 0, '>': 187, 'https://': 0, 'lorem ipsum': 0, 'www.': 88, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6088498', 'n_tokens_mistral': 10975, 'n_tokens_neox': 9959, 'n_words': 1406}