<commit_before>module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);
  require('time-grunt')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    projectOptions: {
      src: "src",
      dist: "dist",
      deploy: "deploy"
    },

    concat: {
      plugin: {
        src: [
          '<%= projectOptions.src %>/open.js',
          '<%= projectOptions.src %>/resize.js',
          '<%= projectOptions.src %>/map.js',
          '<%= projectOptions.src %>/direction.js',
          '<%= projectOptions.src %>/hash.js',
          '<%= projectOptions.src %>/scrollTo.js',
          '<%= projectOptions.src %>/trigger.js',
          '<%= projectOptions.src %>/checkKey.js',
          '<%= projectOptions.src %>/setup.js',
          '<%= projectOptions.src %>/close.js'
        ],
        dest: '<%= projectOptions.src %>/jquery.ascensor.js'
      }
    },

    uglify: {
      options: {
        banner: '/*\n' +
          '<%= pkg.name %> \n' +
          'version: <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)\n' +
          'description: <%= pkg.description %>\n' +
          'repository: <%= pkg.repository %>\n' +
          'license: <%= pkg.license %>\n' +
          'author: <%= pkg.author %>\n' +
          '*/\n'
      },

      ascensor: {
        options: {
          beautify: true,
          mangle: false,
          preserveComments: true
        },
        files: {
          '<%= projectOptions.dist %>/jquery.ascensor.js': ['<%= projectOptions.src %>/jquery.ascensor.js']
        }
      },

      ascensormin: {
        src: '<%= projectOptions.src %>/jquery.ascensor.js',
        dest: '<%= projectOptions.dist %>/jquery.ascensor.min.js'
      },
    },

    jshint: {
      gruntfile: {
        src: 'Gruntfile.js'
      },

      ascensor: {
        src: '<%= projectOptions.src %>/jquery.ascensor.js'
      }
    },

    clean: {
      dist: {
        src: ["dist/"]
      },
      after: {
        src: ["src/jquery.ascensor.js"]
      },
    },

    watch: {
      plugin: {
        files: ['src/**/*.js', '!src/jquery.ascensor.js'],
        tasks: ['build']
      },
      examples: {
        files: ['examples/example_layout.ejs', 'Gruntfile.js'],
        tasks: ['template']
      },
    },

    template: {
      simple: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_simple.html',
        variables: {
          title: 'Simple',
          params: ''
        }
      },

      horizontal: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_horizontal.html',
        variables: {
          title: 'Horizontal',
          params: '{direction:"x"}'
        }
      },

      chocolat: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat.html',
        variables: {
          title: 'Chocolat',
          params: '{direction: [[0,0],[0,1],[0,2],[1,2],[1,3],[1,4],[2,4],[2,5]]}'
        }
      },

      urlcontrole: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_url.html',
        variables: {
          title: 'Chocolat',
          params: '{ascensorFloorName:["Home", "Implementation", "HTML" , "Jquery" , "CSS", "Smartphone", "End", "Yaaay"]}'
        }
      },

      queued: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_queued.html',
        variables: {
          title: 'Chocolat',
          params: '{direction: [[0,0],[0,1],[0,2],[1,2],[3,0],[5,0],[6,0],[2,5]], queued:"x"}'
        }
      },

      loop: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: true, direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      loop_x: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_x.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "loop-x", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      loop_y: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_y.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "loop-y", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      increment: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_increment.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "increment", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      increment_y: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_increment-y.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "increment-y", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      increment_x: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_increment-x.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "increment-x", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      jump: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_jump.html',
        variables: {
          title: 'Chocolat',
          params: '{jump: true, direction: [[0,0],[0,2],[0,4],[2,4],[4,4],[6,7],[1,9],[1,5]]}'
        }
      },

      custom_size: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_custom_size.html',
        variables: {
          title: 'Custom size',
          params: '{height: "80%", width: "400px"}'
        }
      }
    },

    sass: {
      homepage: {
        files: {
          '<%= projectOptions.deploy %>/homepage/dist/main.css': './deploy/homepage/src/main.scss'
        }
      }
    },

    jasmine: {

      options: {
        '--web-security': false,
        '--local-to-remote-url-access': true,
        '--ignore-ssl-errors': true,
        helpers: 'test/helpers/*Helper.js',
        specs: 'test/specs/*Spec.js'
      },

      jquery2_1: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-2.1.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      },

      jquery2: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-2.0.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      },
      jquery1_9: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-1.9.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      },
      jquery1_8: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-1.8.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      }
    }

  });

  grunt.registerTask('default', ['jshint']);

  grunt.registerTask('build', [
    'clean:dist',
    'concat:plugin',
    'jshint:ascensor',
    'uglify:ascensor',
    'uglify:ascensormin',
    'clean:after',
    //'jasmine',
  ]);

};<commit_msg>add jasmine as part of build<commit_after>module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);
  require('time-grunt')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    projectOptions: {
      src: "src",
      dist: "dist",
      deploy: "deploy"
    },

    concat: {
      plugin: {
        src: [
          '<%= projectOptions.src %>/open.js',
          '<%= projectOptions.src %>/resize.js',
          '<%= projectOptions.src %>/map.js',
          '<%= projectOptions.src %>/direction.js',
          '<%= projectOptions.src %>/hash.js',
          '<%= projectOptions.src %>/scrollTo.js',
          '<%= projectOptions.src %>/trigger.js',
          '<%= projectOptions.src %>/checkKey.js',
          '<%= projectOptions.src %>/setup.js',
          '<%= projectOptions.src %>/close.js'
        ],
        dest: '<%= projectOptions.src %>/jquery.ascensor.js'
      }
    },

    uglify: {
      options: {
        banner: '/*\n' +
          '<%= pkg.name %> \n' +
          'version: <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)\n' +
          'description: <%= pkg.description %>\n' +
          'repository: <%= pkg.repository %>\n' +
          'license: <%= pkg.license %>\n' +
          'author: <%= pkg.author %>\n' +
          '*/\n'
      },

      ascensor: {
        options: {
          beautify: true,
          mangle: false,
          preserveComments: true
        },
        files: {
          '<%= projectOptions.dist %>/jquery.ascensor.js': ['<%= projectOptions.src %>/jquery.ascensor.js']
        }
      },

      ascensormin: {
        src: '<%= projectOptions.src %>/jquery.ascensor.js',
        dest: '<%= projectOptions.dist %>/jquery.ascensor.min.js'
      },
    },

    jshint: {
      gruntfile: {
        src: 'Gruntfile.js'
      },

      ascensor: {
        src: '<%= projectOptions.src %>/jquery.ascensor.js'
      }
    },

    clean: {
      dist: {
        src: ["dist/"]
      },
      after: {
        src: ["src/jquery.ascensor.js"]
      },
    },

    watch: {
      plugin: {
        files: ['src/**/*.js', '!src/jquery.ascensor.js'],
        tasks: ['build']
      },
      examples: {
        files: ['examples/example_layout.ejs', 'Gruntfile.js'],
        tasks: ['template']
      },
    },

    template: {
      simple: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_simple.html',
        variables: {
          title: 'Simple',
          params: ''
        }
      },

      horizontal: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_horizontal.html',
        variables: {
          title: 'Horizontal',
          params: '{direction:"x"}'
        }
      },

      chocolat: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat.html',
        variables: {
          title: 'Chocolat',
          params: '{direction: [[0,0],[0,1],[0,2],[1,2],[1,3],[1,4],[2,4],[2,5]]}'
        }
      },

      urlcontrole: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_url.html',
        variables: {
          title: 'Chocolat',
          params: '{ascensorFloorName:["Home", "Implementation", "HTML" , "Jquery" , "CSS", "Smartphone", "End", "Yaaay"]}'
        }
      },

      queued: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_queued.html',
        variables: {
          title: 'Chocolat',
          params: '{direction: [[0,0],[0,1],[0,2],[1,2],[3,0],[5,0],[6,0],[2,5]], queued:"x"}'
        }
      },

      loop: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: true, direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      loop_x: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_x.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "loop-x", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      loop_y: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_y.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "loop-y", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      increment: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_increment.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "increment", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      increment_y: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_increment-y.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "increment-y", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      increment_x: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_loop_increment-x.html',
        variables: {
          title: 'Chocolat',
          params: '{loop: "increment-x", direction: [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]}'
        }
      },

      jump: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_chocolat_jump.html',
        variables: {
          title: 'Chocolat',
          params: '{jump: true, direction: [[0,0],[0,2],[0,4],[2,4],[4,4],[6,7],[1,9],[1,5]]}'
        }
      },

      custom_size: {
        src: 'examples/example_layout.ejs',
        dest: 'examples/example_custom_size.html',
        variables: {
          title: 'Custom size',
          params: '{height: "80%", width: "400px"}'
        }
      }
    },

    sass: {
      homepage: {
        files: {
          '<%= projectOptions.deploy %>/homepage/dist/main.css': './deploy/homepage/src/main.scss'
        }
      }
    },

    jasmine: {

      options: {
        '--web-security': false,
        '--local-to-remote-url-access': true,
        '--ignore-ssl-errors': true,
        helpers: 'test/helpers/*Helper.js',
        specs: 'test/specs/*Spec.js'
      },

      jquery2_1: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-2.1.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      },

      jquery2: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-2.0.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      },
      jquery1_9: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-1.9.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      },
      jquery1_8: {
        src: 'dist/jquery.ascensor.js',
        options: {
          vendor: [
            'http://code.jquery.com/jquery-1.8.0.min.js',
            'components/jasmine-jquery/lib/jasmine-jquery.js',
          ],
        }
      }
    }

  });

  grunt.registerTask('default', ['jshint']);

  grunt.registerTask('build', [
    'clean:dist',
    'concat:plugin',
    'jshint:ascensor',
    'uglify:ascensor',
    'uglify:ascensormin',
    'clean:after',
    'jasmine'
  ]);

};<|endoftext|>


<commit_before>module.exports = function(grunt) {

    /**
     * Build up several Javascript artifacts by combining source JS files from the
     * repo with files from kaazing-client-javascript-util loaded through bower.json.
     * The process is:
     *   Copy files from src/kaazing and the bower download into dist/tmp
     *   Remove existing banner comments using grunt-stripbanner from all
     *     files in dist/tmp
     *   Use concat to combine files into the final artifacts and add a banner comment
     *     to each constructed file.
     */

    // The banner comment to be added to the concatenated JS files.
    var banner = '/**\n' +
                 ' * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved.\n' +
                 ' * \n' +
                 ' * Licensed to the Apache Software Foundation (ASF) under one\n' +
                 ' * or more contributor license agreements.  See the NOTICE file\n' +
                 ' * distributed with this work for additional information\n' +
                 ' * regarding copyright ownership.  The ASF licenses this file\n' +
                 ' * to you under the Apache License, Version 2.0 (the\n' +
                 ' * "License"); you may not use this file except in compliance\n' +
                 ' * with the License.  You may obtain a copy of the License at\n' +
                 ' * \n' +
                 ' *   http://www.apache.org/licenses/LICENSE-2.0\n' +
                 ' * \n' +
                 ' * Unless required by applicable law or agreed to in writing,\n' +
                 ' * software distributed under the License is distributed on an\n' +
                 ' * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n' +
                 ' * KIND, either express or implied.  See the License for the\n' +
                 ' * specific language governing permissions and limitations\n' +
                 ' * under the License.\n' +
                 ' */\n';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        clean: {
            dist: {
                src: ['dist/']
            },
            tmp: {
                src: ['dist/tmp']
            },
        },

        copy: {
            src: {
                cwd: 'src/kaazing/gateway',
                src: '**',
                dest: 'dist/tmp/',
                expand: true,
            },
            utils: {
                cwd: 'bower_components/kaazing-client-javascript-util',
                src: '**',
                dest: 'dist/tmp/utils',
                expand: true,
            }
        },

        stripbanner: {
            tmpFiles: {
                options: {
                    cwd: './dist/tmp'
                }
            }
        },

        // Concatenate local source and util files into final artifacts.
        // The *-debug.js files are just the concatenated source files, with no
        // mangling of variable names or compression of the output or removal of
        // debug (;;;) lines. The non-debug files have been mangled and compressed.
        concat: {
            options: {
                banner: banner
            },
            XMLHttpBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/Events.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/utils/PostMessage.js',
                    'dist/tmp/XMLHttpBridge.js'
                ],
                dest: 'dist/js/XMLHttpBridge-debug.js'
            },
            EventSourceBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/Events.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/utils/PostMessage.js'
                ],
                dest: 'dist/js/EventSourceBridge-debug.js'
            },
            PostMessageParentBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/PostMessageParentBridge.js'
                ],
                dest: 'dist/js/PostMessageParentBridge-debug.js'
            },
            PostMessageChildBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/PostMessageChildBridge.js'
                ],
                dest: 'dist/js/PostMessageChildBridge-debug.js'
            },
        },

        // Remove the ;;; debug log lines from the concatenated files
        lineremover: {
            all: {
                options: {
                    exclusionPattern: /^.*\;\;\;.*$/g
                },
                files: [
                    {src: 'dist/js/XMLHttpBridge-debug.js',
                     dest: 'dist/js/XMLHttpBridge.js'},
                    {src: 'dist/js/EventSourceBridge-debug.js',
                     dest: 'dist/js/EventSourceBridge.js'},
                    {src: 'dist/js/PostMessageParentBridge-debug.js',
                     dest: 'dist/js/PostMessageParentBridge.js'},
                    {src: 'dist/js/PostMessageChildBridge-debug.js',
                     dest: 'dist/js/PostMessageChildBridge.js'}
                ]
            }
        },

        uglify: {
            options: {
                compress: {
                    unused: false,
                },
                mangle: true,
                unused: false,
                banner: banner
            },
            XMLHttpBridge: {
                src: 'dist/js/XMLHttpBridge.js',
                dest: 'dist/js/XMLHttpBridge.js'
            },
            EventSourceBridge: {
                src: 'dist/js/EventSourceBridge.js',
                dest: 'dist/js/EventSourceBridge.js'
            },
            PostMessageParentBridge: {
                src: 'dist/js/PostMessageParentBridge.js',
                dest: 'dist/js/PostMessageParentBridge.js'
            },
            PostMessageChildBridge: {
                src: 'dist/js/PostMessageChildBridge.js',
                dest: 'dist/js/PostMessageChildBridge.js'
            }
        },

        jsdoc: {
            dist: {
                options: {
                    configure: 'src/kaazing/jsdoc/configure.json'
                    //   template: 'src/kaazing/jsdoc',
                },
                src: ['dist/js'],
                //                src: ['dist/tmp'],
                dest: 'dist/jsdoc'
            }
        },

        karma: {
            test: {
                configFile: 'test/karma.config.js'
            },
        },
    });

    grunt.loadNpmTasks('grunt-contrib-concat');

    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.loadNpmTasks('grunt-contrib-clean');

    grunt.loadNpmTasks('grunt-karma');

    //    grunt.loadNpmTasks('grunt-jsdoc-to-markdown');

    grunt.loadNpmTasks('grunt-jsdoc');

    grunt.loadNpmTasks('grunt-line-remover');

    grunt.loadNpmTasks('grunt-contrib-uglify');

    grunt.loadNpmTasks('grunt-stripbanner');

    grunt.registerTask('default', ['clean', 'copy', 'stripbanner', 'concat', 'lineremover', 'uglify', 'jsdoc', 'clean:tmp']);

    grunt.registerTask('test', ['karma']);

};
<commit_msg>KG-14608: Removed the usage of uglify plugin as the resulting .js files in the bridge cause emulation to fail.<commit_after>module.exports = function(grunt) {

    /**
     * Build up several Javascript artifacts by combining source JS files from the
     * repo with files from kaazing-client-javascript-util loaded through bower.json.
     * The process is:
     *   Copy files from src/kaazing and the bower download into dist/tmp
     *   Remove existing banner comments using grunt-stripbanner from all
     *     files in dist/tmp
     *   Use concat to combine files into the final artifacts and add a banner comment
     *     to each constructed file.
     */

    // The banner comment to be added to the concatenated JS files.
    var banner = '/**\n' +
                 ' * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved.\n' +
                 ' * \n' +
                 ' * Licensed to the Apache Software Foundation (ASF) under one\n' +
                 ' * or more contributor license agreements.  See the NOTICE file\n' +
                 ' * distributed with this work for additional information\n' +
                 ' * regarding copyright ownership.  The ASF licenses this file\n' +
                 ' * to you under the Apache License, Version 2.0 (the\n' +
                 ' * "License"); you may not use this file except in compliance\n' +
                 ' * with the License.  You may obtain a copy of the License at\n' +
                 ' * \n' +
                 ' *   http://www.apache.org/licenses/LICENSE-2.0\n' +
                 ' * \n' +
                 ' * Unless required by applicable law or agreed to in writing,\n' +
                 ' * software distributed under the License is distributed on an\n' +
                 ' * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n' +
                 ' * KIND, either express or implied.  See the License for the\n' +
                 ' * specific language governing permissions and limitations\n' +
                 ' * under the License.\n' +
                 ' */\n';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        clean: {
            dist: {
                src: ['dist/']
            },
            tmp: {
                src: ['dist/tmp']
            },
        },

        copy: {
            src: {
                cwd: 'src/kaazing/gateway',
                src: '**',
                dest: 'dist/tmp/',
                expand: true,
            },
            utils: {
                cwd: 'bower_components/kaazing-client-javascript-util',
                src: '**',
                dest: 'dist/tmp/utils',
                expand: true,
            }
        },

        stripbanner: {
            tmpFiles: {
                options: {
                    cwd: './dist/tmp'
                }
            }
        },

        // Concatenate local source and util files into final artifacts.
        // The *-debug.js files are just the concatenated source files, with no
        // mangling of variable names or compression of the output or removal of
        // debug (;;;) lines. The non-debug files have been mangled and compressed.
        concat: {
            options: {
                banner: banner
            },
            XMLHttpBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/Events.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/utils/PostMessage.js',
                    'dist/tmp/XMLHttpBridge.js'
                ],
                dest: 'dist/js/XMLHttpBridge-debug.js'
            },
            EventSourceBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/Events.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/utils/PostMessage.js'
                ],
                dest: 'dist/js/EventSourceBridge-debug.js'
            },
            PostMessageParentBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/PostMessageParentBridge.js'
                ],
                dest: 'dist/js/PostMessageParentBridge-debug.js'
            },
            PostMessageChildBridge: {
                src: [
                    'dist/tmp/utils/Browser.js',
                    'dist/tmp/utils/URI.js',
                    'dist/tmp/PostMessageChildBridge.js'
                ],
                dest: 'dist/js/PostMessageChildBridge-debug.js'
            },
        },

        // Remove the ;;; debug log lines from the concatenated files
        lineremover: {
            all: {
                options: {
                    exclusionPattern: /^.*\;\;\;.*$/g
                },
                files: [
                    {src: 'dist/js/XMLHttpBridge-debug.js',
                     dest: 'dist/js/XMLHttpBridge.js'},
                    {src: 'dist/js/EventSourceBridge-debug.js',
                     dest: 'dist/js/EventSourceBridge.js'},
                    {src: 'dist/js/PostMessageParentBridge-debug.js',
                     dest: 'dist/js/PostMessageParentBridge.js'},
                    {src: 'dist/js/PostMessageChildBridge-debug.js',
                     dest: 'dist/js/PostMessageChildBridge.js'}
                ]
            }
        },

        jsdoc: {
            dist: {
                options: {
                    configure: 'src/kaazing/jsdoc/configure.json'
                    //   template: 'src/kaazing/jsdoc',
                },
                src: ['dist/js'],
                //                src: ['dist/tmp'],
                dest: 'dist/jsdoc'
            }
        },

        karma: {
            test: {
                configFile: 'test/karma.config.js'
            },
        },
    });

    grunt.loadNpmTasks('grunt-contrib-concat');

    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.loadNpmTasks('grunt-contrib-clean');

    grunt.loadNpmTasks('grunt-karma');

    //    grunt.loadNpmTasks('grunt-jsdoc-to-markdown');

    grunt.loadNpmTasks('grunt-jsdoc');

    grunt.loadNpmTasks('grunt-line-remover');

    grunt.loadNpmTasks('grunt-stripbanner');

    grunt.registerTask('default', ['clean', 'copy', 'stripbanner', 'concat', 'lineremover', 'jsdoc', 'clean:tmp']);

    grunt.registerTask('test', ['karma']);

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {

    'use strict';

    var lineEnding = '\n',
        _ = require('underscore');

    grunt.initConfig({
        portToUse : 3000,
        pm2pid : 0,
        pkg: grunt.file.readJSON('package.json'),
        mongodb : {
            test: {
                host: 'mongodb://localhost:27017/test',
                collections: ['users','contenttypes','nodes','content', 'tokens'],
                data: './fixtures/mongodb/test.js'
            },
            seed: {
                host: 'mongodb://localhost:27017/grasshopper',
                collections: ['users','contenttypes','tokens'],
                data: './fixtures/mongodb/test.js'
            },
            dev : {
                host: 'mongodb://localhost:27017/grasshopper',
                collections: ['users','contenttypes','nodes','content', 'tokens'],
                data: './fixtures/mongodb/dev.js'
            }
        },
        concurrent: {
            options: {
                logConcurrentOutput: true
            },
            setup: {
                tasks : ['shell:stopServer', 'generatePublicTest', 'mongodb:test', 'shell:stopTestServer']
            },
            test: {
                tasks : ['shell:startTestServer', 'startTestWithDelay:1500']
            }
        },
        shell : {
            options : {
                stdout : true,
                stderr : true
            },
            makeTest : {
                command : "make test",
                options : {
                    callback : function(err, stdout, stderr, cb) {
                        grunt.task.run(['deletePublicTest','shell:stopTestServer', 'exitTests']);
                        cb();
                    }
                }
            },
            startTestServer: {
                command: "node lib/grasshopper-api test"
            },
            startSeedServer: {
                command: "node lib/grasshopper-api grasshopper"
            },
            stopTestServer: {
                command: "tasks/killserver.sh lib/grasshopper-api"
            },
            startServer: {
                command : "pm2 start lib/grasshopper-api.js -i max -e log/grasshopper.err.log -o log/grasshopper.out.log"
            },
            stopServer : {
                command : "pm2 kill all"
            },
            restartServer : {
                command : "pm2 restart all"
            },
            'shortlog' : {
                options : {
                    stderr : true,
                    stdout : false,
                    failOnError : true,
                    callback : function(err, stdout, stderr, cb) {
                        stdout = stdout.split(lineEnding);
                        _.each(stdout, function(line, index) {
                            stdout[index] = line.replace(/^\s*\d+\s+([^\s])/,'* $1');
                        });
                        grunt.config.set('contributors', stdout.join(lineEnding));
                        cb();
                    }
                },
                command : 'git --no-pager shortlog -ns HEAD'
            }
        },
        nodemon: {
            dev: {
                options: {
                    file: 'lib/grasshopper-api.js',
                    ignoredFiles: ['README.md', 'node_modules/**', 'Gruntfile.js','*.log', '*.xml'],
                    legacyWatch: true,
                    env: {
                        PORT: '3000'
                    },
                    cwd: __dirname
                }
            },
            test: {
                options: {
                    file: 'lib/grasshopper-api.js',
                    args: ['test'],
                    ignoredFiles: ['README.md', 'node_modules/**', 'Gruntfile.js','*.log', '*.xml'],
                    legacyWatch: true,
                    env: {
                        PORT: '3000'
                    },
                    cwd: __dirname
                }
            }
        },
        jshint: {
            files: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
            options: {
                // options here to override JSHint defaults
                globals: {
                    jQuery: true,
                    console: true,
                    module: true,
                    document: true
                }
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint']
        },
        releaseNotes : {
            main : {
                src : 'templates/README.template.md',
                dest : 'README.md',
                baseLinkPath : 'https://github.com/Solid-Interactive/grasshopper-api-js/tree/master/'
            }
        }
    });

    grunt.registerTask('startTestWithDelay', function(delay) {
        var done = this.async();
        setTimeout(function() {
            grunt.task.run(['shell:makeTest']);
            done();
        }, delay);
    });

    grunt.registerTask('exitTests', function() {
        grunt.fail.fatal("Shutting down... tests are done.");
    });

    grunt.loadTasks('tasks');
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    grunt.registerTask('dev',['nodemon:dev']);
    grunt.registerTask('test', ['concurrent:setup', 'concurrent:test']);

    grunt.registerTask('seedDev', ['mongodb:dev']);

    grunt.registerTask('server:start', ['shell:startServer']);
    grunt.registerTask('server:stop', ['shell:stopServer']);
    grunt.registerTask('server:restart', ['shell:restartServer']);
    grunt.registerTask('seedServer', ['shell:stopServer', 'mongodb:seed', 'shell:startSeedServer']);

    grunt.registerTask('default', ['jshint']);

    grunt.config.set('warning', 'Compiled file. Do not modify directly.');
    grunt.registerTask('readme', ['shell:shortlog', 'releaseNotes']);
};
<commit_msg>Added task that will install data when the heroku:install environment is setup.<commit_after>module.exports = function(grunt) {

    'use strict';

    var lineEnding = '\n',
        _ = require('underscore');

    grunt.initConfig({
        portToUse : 3000,
        pm2pid : 0,
        pkg: grunt.file.readJSON('package.json'),
        mongodb : {
            test: {
                host: 'mongodb://localhost:27017/test',
                collections: ['users','contenttypes','nodes','content', 'tokens'],
                data: './fixtures/mongodb/test.js'
            },
            seed: {
                host: 'mongodb://localhost:27017/grasshopper',
                collections: ['users','contenttypes','tokens'],
                data: './fixtures/mongodb/test.js'
            },
            dev : {
                host: 'mongodb://localhost:27017/grasshopper',
                collections: ['users','contenttypes','nodes','content', 'tokens'],
                data: './fixtures/mongodb/dev.js'
            }
        },
        concurrent: {
            options: {
                logConcurrentOutput: true
            },
            setup: {
                tasks : ['shell:stopServer', 'generatePublicTest', 'mongodb:test', 'shell:stopTestServer']
            },
            test: {
                tasks : ['shell:startTestServer', 'startTestWithDelay:1500']
            }
        },
        shell : {
            options : {
                stdout : true,
                stderr : true
            },
            makeTest : {
                command : "make test",
                options : {
                    callback : function(err, stdout, stderr, cb) {
                        grunt.task.run(['deletePublicTest','shell:stopTestServer', 'exitTests']);
                        cb();
                    }
                }
            },
            startTestServer: {
                command: "node lib/grasshopper-api test"
            },
            startSeedServer: {
                command: "node lib/grasshopper-api grasshopper"
            },
            stopTestServer: {
                command: "tasks/killserver.sh lib/grasshopper-api"
            },
            startServer: {
                command : "pm2 start lib/grasshopper-api.js -i max -e log/grasshopper.err.log -o log/grasshopper.out.log"
            },
            stopServer : {
                command : "pm2 kill all"
            },
            restartServer : {
                command : "pm2 restart all"
            },
            'shortlog' : {
                options : {
                    stderr : true,
                    stdout : false,
                    failOnError : true,
                    callback : function(err, stdout, stderr, cb) {
                        stdout = stdout.split(lineEnding);
                        _.each(stdout, function(line, index) {
                            stdout[index] = line.replace(/^\s*\d+\s+([^\s])/,'* $1');
                        });
                        grunt.config.set('contributors', stdout.join(lineEnding));
                        cb();
                    }
                },
                command : 'git --no-pager shortlog -ns HEAD'
            }
        },
        nodemon: {
            dev: {
                options: {
                    file: 'lib/grasshopper-api.js',
                    ignoredFiles: ['README.md', 'node_modules/**', 'Gruntfile.js','*.log', '*.xml'],
                    legacyWatch: true,
                    env: {
                        PORT: '3000'
                    },
                    cwd: __dirname
                }
            },
            test: {
                options: {
                    file: 'lib/grasshopper-api.js',
                    args: ['test'],
                    ignoredFiles: ['README.md', 'node_modules/**', 'Gruntfile.js','*.log', '*.xml'],
                    legacyWatch: true,
                    env: {
                        PORT: '3000'
                    },
                    cwd: __dirname
                }
            }
        },
        jshint: {
            files: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
            options: {
                // options here to override JSHint defaults
                globals: {
                    jQuery: true,
                    console: true,
                    module: true,
                    document: true
                }
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint']
        },
        releaseNotes : {
            main : {
                src : 'templates/README.template.md',
                dest : 'README.md',
                baseLinkPath : 'https://github.com/Solid-Interactive/grasshopper-api-js/tree/master/'
            }
        }
    });

    grunt.registerTask('startTestWithDelay', function(delay) {
        var done = this.async();
        setTimeout(function() {
            grunt.task.run(['shell:makeTest']);
            done();
        }, delay);
    });

    grunt.registerTask('exitTests', function() {
        grunt.fail.fatal("Shutting down... tests are done.");
    });

    grunt.loadTasks('tasks');
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    grunt.registerTask('dev',['nodemon:dev']);
    grunt.registerTask('test', ['concurrent:setup', 'concurrent:test']);

    grunt.registerTask('seedDev', ['mongodb:dev']);
    grunt.registerTask('heroku:install', ['mongodb:dev']);

    grunt.registerTask('server:start', ['shell:startServer']);
    grunt.registerTask('server:stop', ['shell:stopServer']);
    grunt.registerTask('server:restart', ['shell:restartServer']);
    grunt.registerTask('seedServer', ['shell:stopServer', 'mongodb:seed', 'shell:startSeedServer']);

    grunt.registerTask('default', ['jshint']);

    grunt.config.set('warning', 'Compiled file. Do not modify directly.');
    grunt.registerTask('readme', ['shell:shortlog', 'releaseNotes']);
};
<|endoftext|>


<commit_before>/**
 * The-M-Project Build Script
 * Version: 0.0.1
 */

module.exports = function( grunt ) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner:   '/*!\n' +
                        '* Project:   The M-Project - Mobile HTML5 Application Framework\n' +
                        '* Version:   <%= pkg.version %>\n' +
                        '* Copyright: (c) <%= grunt.template.today("yyyy") %> M-Way Solutions GmbH. All rights reserved.\n' +
                        '* Date:      <%= grunt.template.today() %>\n' +
                        '* License:   Dual licensed under the MIT or GPL Version 2 licenses.\n' +
                        '*            http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE\n' +
                        '*            http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE\n' +
                        '*/\n'
        },
        jsonlint: {
            sample: {
                src: [ 'package.json' ]
            }
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                ignores: ['src/_*.js', 'src/themproject*.js']
            },
            src: [ 'src/**/*.js' ]
        },
        preprocess: {
            options: {
                context: {
                    DEBUG: false
                }
            },
            core: {
                files: {
                    'dist/themproject.js': 'src/themproject.js',
                    'dist/themproject.bd.js': 'src/themproject.bd.js'
                }
            }
        },
        uglify: {
            core: {
                src: 'dist/themproject.js',
                dest: 'dist/themproject.min.js',
                options: {
                    sourceMap: 'dist/themproject.map',
                    sourceMappingURL: 'themproject.map',
                    sourceMapPrefix: 1
                }
            },
            bd: {
                src: 'dist/themproject.bd.js',
                dest: 'dist/themproject.bd.min.js',
                options: {
                    sourceMap: 'dist/themproject.bd.map',
                    sourceMappingURL: 'themproject.bd.map',
                    sourceMapPrefix: 1
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'dist/',
                src: ['*.css', '!*.min.css'],
                dest: 'dist/',
                ext: '.min.css'
            }
        },
        copy: {
            minify: {
                expand: true,
                cwd: 'resources/vendor/',
                src: '*{css,js}',
                dest: 'dist/'
            }
        },
        watch: {
            dev: {
                files: ['src/**/*','test/**/*','resources/{,*/}*.{scss,sass,css}'],
                tasks: ['default'],
                options: {
                    spawn: false
                }
            },
            test: {
                files: ['src/**/*','test/**/*'],
                tasks: ['default', 'test'],
                options: {
                    spawn: false
                }
            }
        },
        compass: {
            options: {
                sassDir: 'resources/sass',
                cssDir: 'dist'
            },
            dist: {}
        },
        mocha: {
            options: {
                "reporter": "Spec"
            },
            all: ['test/test.html']
        }
    });

    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-preprocess');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-mocha');

    // TODO run jshint task
    grunt.registerTask('test', ['mocha']);
    grunt.registerTask('dev', ['default','watch:dev']);
    grunt.registerTask('default', ['preprocess', 'compass', 'copy', 'uglify', 'cssmin']);
};
<commit_msg>improve building performance<commit_after>/**
 * The-M-Project Build Script
 * Version: 0.0.1
 */

module.exports = function( grunt ) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner:   '/*!\n' +
                        '* Project:   The M-Project - Mobile HTML5 Application Framework\n' +
                        '* Version:   <%= pkg.version %>\n' +
                        '* Copyright: (c) <%= grunt.template.today("yyyy") %> M-Way Solutions GmbH. All rights reserved.\n' +
                        '* Date:      <%= grunt.template.today() %>\n' +
                        '* License:   Dual licensed under the MIT or GPL Version 2 licenses.\n' +
                        '*            http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE\n' +
                        '*            http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE\n' +
                        '*/\n'
        },
        jsonlint: {
            sample: {
                src: [ 'package.json' ]
            }
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                ignores: ['src/_*.js', 'src/themproject*.js']
            },
            src: [ 'src/**/*.js' ]
        },
        preprocess: {
            options: {
                context: {
                    DEBUG: false
                }
            },
            core: {
                files: {
                    'dist/themproject.js': 'src/themproject.js',
                }
            },
            bd: {
                files: {
                    'dist/themproject.bd.js': 'src/themproject.bd.js'
                }
            }
        },
        uglify: {
            core: {
                src: 'dist/themproject.js',
                dest: 'dist/themproject.min.js',
                options: {
                    sourceMap: 'dist/themproject.map',
                    sourceMappingURL: 'themproject.map',
                    sourceMapPrefix: 1
                }
            },
            bd: {
                src: 'dist/themproject.bd.js',
                dest: 'dist/themproject.bd.min.js',
                options: {
                    sourceMap: 'dist/themproject.bd.map',
                    sourceMappingURL: 'themproject.bd.map',
                    sourceMapPrefix: 1
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'dist/',
                src: ['*.css', '!*.min.css'],
                dest: 'dist/',
                ext: '.min.css'
            }
        },
        copy: {
            minify: {
                expand: true,
                cwd: 'resources/vendor/',
                src: '*{css,js}',
                dest: 'dist/'
            }
        },
        watch: {
            dev: {
                files: ['src/**/*','test/**/*','resources/{,*/}*.{scss,sass,css}'],
                tasks: ['default'],
                options: {
                    spawn: false
                }
            },
            test: {
                files: ['src/**/*','test/**/*'],
                tasks: ['default', 'test'],
                options: {
                    spawn: false
                }
            }
        },
        compass: {
            options: {
                sassDir: 'resources/sass',
                cssDir: 'dist'
            },
            dist: {}
        },
        mocha: {
            options: {
                "reporter": "Spec"
            },
            all: ['test/test.html']
        }
    });

    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-preprocess');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-mocha');

    // TODO run jshint task
    grunt.registerTask('test', ['mocha']);
    grunt.registerTask('dev', ['build','watch:dev']);
    grunt.registerTask('release', ['default', 'preprocess:bd', 'uglify', 'cssmin']);
    grunt.registerTask('default', ['preprocess:core', 'compass', 'copy']);
};
<|endoftext|>


<commit_before>'use strict';

// All JS source files we want to check.
var allSources = ['Gruntfile.js', 'karma.conf.js', 'e2e-tests/**/*.js', 'app/**/*.js'];

module.exports = function(grunt){
  // Use Just In Time Grunt to prevent loading all modules via grunt.loadNpmTask(*) on every run.
  require('jit-grunt')(grunt, {
    protractor: 'grunt-protractor-runner'
  });

  grunt.initConfig({
    // Run Karma to run Jasmine unit test.
    karma: {
      options: {
        configFile: 'karma.conf.js',
        singleRun: true
      },
      unit: {}
    },

    // Run Protractor end to end tests.
    protractor: {
      options: {
        configFile: 'e2e-tests/protractor.conf.js'
      },
      all: {}
    },

    // Lint all files for JS style violations.
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },

      all: allSources
    },

    // Lint for two spaces as indentation as opposed to tabs.
    lintspaces: {
      options: {
        trailingspaces: true,
        indentation: 'spaces',
        spaces: 2
      },
      all: {
        src: allSources
      }
    },

    // Simple web server
    connect: {
      options: {
        port: 8000,
        hostname: 'localhost',
        protocol: 'https',
        base: './'
      },
      server: {},
      local: {
        options: {
          keepalive: true
        }
      }
    }
  });

  // Run all tests.
  grunt.registerTask('test', ['lintspaces', 'jshint', 'connect:server', 'karma:unit', 'protractor']);

  // Test and build application.
  grunt.registerTask('build', ['test']);

  // Default task.
  grunt.registerTask('default', ['build']);
};<commit_msg>Call this serve.<commit_after>'use strict';

// All JS source files we want to check.
var allSources = ['Gruntfile.js', 'karma.conf.js', 'e2e-tests/**/*.js', 'app/**/*.js'];

module.exports = function(grunt){
  // Use Just In Time Grunt to prevent loading all modules via grunt.loadNpmTask(*) on every run.
  require('jit-grunt')(grunt, {
    protractor: 'grunt-protractor-runner'
  });

  grunt.initConfig({
    // Run Karma to run Jasmine unit test.
    karma: {
      options: {
        configFile: 'karma.conf.js',
        singleRun: true
      },
      unit: {}
    },

    // Run Protractor end to end tests.
    protractor: {
      options: {
        configFile: 'e2e-tests/protractor.conf.js'
      },
      all: {}
    },

    // Lint all files for JS style violations.
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },

      all: allSources
    },

    // Lint for two spaces as indentation as opposed to tabs.
    lintspaces: {
      options: {
        trailingspaces: true,
        indentation: 'spaces',
        spaces: 2
      },
      all: {
        src: allSources
      }
    },

    // Simple web server
    connect: {
      options: {
        port: 8000,
        hostname: 'localhost',
        protocol: 'https',
        base: './'
      },
      server: {},
      serve: {
        options: {
          keepalive: true
        }
      }
    }
  });

  // Run all tests.
  grunt.registerTask('test', ['lintspaces', 'jshint', 'connect:server', 'karma:unit', 'protractor']);

  // Test and build application.
  grunt.registerTask('build', ['test']);

  // Default task.
  grunt.registerTask('default', ['build']);
};<|endoftext|>


<commit_before>module.exports = function(grunt) {
    'use strict';
    var jsTagConfig = {
        scriptTemplate: '<script src="{{ path }}"></script>',
        openTag: '<!-- start js-templates tags -->',
        closeTag: '<!-- end js-templates tags -->'
    };
    var cssTagConfig = {
        linkTemplate: '<link rel="stylesheet" href="{{ path }}" />',
        openTag: '<!-- start css-templates tags -->',
        closeTag: '<!-- end css-templates tags -->'
    };

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        tags: {
            publicJs: {
                options: jsTagConfig,
                src: ['public/javascripts/*.js',
                      'public/javascripts/static/**/*.js',
                      'public/javascripts/public/**/*.js'],
                dest: 'views/index.html'
            },
            publicCss: {
                options: cssTagConfig,
                src: ['public/stylesheets/public.style.css'],
                dest: 'views/index.html'
            },
            privateJs: {
                options: jsTagConfig,
                src: ['public/javascripts/*.js',
                      'public/javascripts/static/**/*.js',
                      'public/javascripts/charts/**/*.js',
                      'public/javascripts/private/**/*.js'],
                dest: 'views/private/index.html'
            },
            privateCss: {
                options: cssTagConfig,
                src: ['public/stylesheets/private.style.css',
                      'public/stylesheets/auth-style.css'],
                dest: 'views/private/index.html'
            },
            tests: {
                options: {
                    scriptTemplate: '\'{{ path }}\',',
                    openTag: '// start js-templates tags',
                    closeTag: '// end js-templates tags'
                },
                src: ['public/javascripts/**/*.js'],
                dest: 'karma.conf.js'
            }
        },
        wiredep: {
            dev: {
                cwd: '.',
                src: ['views/index.html',
                      'views/private/index.html',
                      'karma.conf.js'],
                exclude: ['bower_components/angular-mocks/'],
                overrides: {
                    bootstrap: {
                        main: [
                          'dist/js/bootstrap.min.js',
                          'dist/css/bootstrap.min.css',
                          'dist/css/bootstrap-theme.min.css'
                        ]
                    }
                }
            }
        },
        'regex-replace': {
            dev: {
                src: ['views/index.html'],
                actions: [
                    {
                        name: 'static',
                        search: '"\.\./public',
                        replace: '"\.\.',
                        flags: 'g'
                    },
                    {
                        name: 'bower_static',
                        search: '"\.\./bower_components',
                        replace: '"\.\.',
                        flags: 'g'
                    }
                ]
            },
            devPrivate: {
                src: ['views/private/index.html'],
                actions: [
                    {
                        name: 'static',
                        search: '"\.\./\.\./public',
                        replace: '"\.\./\.\.',
                        flags: 'g'
                    },
                    {
                        name: 'bower_static',
                        search: '"\.\./\.\./bower_components',
                        replace: '"\.\./\.\.',
                        flags: 'g'
                    }
                ]
            }
        },
        bowercopy: {
            options: {
                clean: false,
                report: false
            },
            test: {
                options: {
                    destPrefix: 'public/fonts'
                },
                files: {
                    'glyphicons-halflings-regular.eot':
                        'bootstrap/dist/fonts/glyphicons-halflings-regular.eot',
                    'glyphicons-halflings-regular.ttf':
                        'bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
                    'glyphicons-halflings-regular.svg':
                        'bootstrap/dist/fonts/glyphicons-halflings-regular.svg',
                    'glyphicons-halflings-regular.woff':
                    'bootstrap/dist/fonts/glyphicons-halflings-regular.woff',
                    'glyphicons-halflings-regular.woff2':
                    'bootstrap/dist/fonts/glyphicons-halflings-regular.woff2',
                    'fontawesome-webfont.eot':
                        'fontawesome/fonts/fontawesome-webfont.eot',
                    'fontawesome-webfont.ttf':
                        'fontawesome/fonts/fontawesome-webfont.ttf',
                    'fontawesome-webfont.svg':
                        'fontawesome/fonts/fontawesome-webfont.svg',
                    'fontawesome-webfont.woff':
                        'fontawesome/fonts/fontawesome-webfont.woff',
                    'fontawesome-webfont.woff2':
                        'fontawesome/fonts/fontawesome-webfont.woff2',
                    'fontawesome-webfont.otf':
                        'fontawesome/fonts/FontAwesome.otf'
                }
            }
        },
        ngtemplates: {
            'brewbear-templates': {
                src: ['public/**/*.template.html'],
                dest: 'public/javascripts/templates.js',
                options: {
                    url: function(url) {
                        return url.replace('public/', '/');
                    }
                }
            }
        },
        jshint: {
            all: ['Gruntfile.js', 'app.js',
                'public/javascripts/!(charts)/**/*.js',
                'routes/**/*.js', 'views/**/*.js', 'tests/**/*.js',
                '!public/javascripts/templates.js'],
            options: {
                // options here to override JSHint defaults
                globals: {
                    jQuery: false,
                    console: false,
                    module: false,
                    document: false,
                    require: false,
                    __dirname: false,
                    process: false,
                    angular: false,
                    _: false,
                    expect: false,
                    beforeEach: false,
                    afterEach: false,
                    describe: false,
                    it: false,
                    inject: false,
                    spyOn: false
                },
                camelcase: true, //use camelCase,
                eqeqeq: true, //prohibit == and != in favor of !== and ===
                indent: 4, //tab width of 4 spaces
                latedef: true, //prohibit variable use before it's defined
                maxlen: 80, //max line length of 80 charts
                newcap: true, //capitalized names for constructor functions
                quotmark: 'single', //single quote marks for strings
                strict: true, //must use 'use strict' in function scopes
                undef: true, //cannot use undeclared variables
                unused: true //warn when vars are defined but not used
            }
        },
        jscs: {
            all: ['Gruntfile.js', 'app.js',
                'public/javascripts/!(charts)/**/*.js',
                'routes/**/*.js', 'views/**/*.js', 'tests/**/*.js',
                '!public/javascripts/templates.js'],
            options: {
                config: '.jscsrc'
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'jscs']
        },
        less: {
            public: {
                files: {
                    'public/stylesheets/public.style.css':
                        ['public/less/shared.less',
                        'public/less/public.less']
                }
            },
            private: {
                files: {
                    'public/stylesheets/private.style.css':
                        ['public/less/shared.less',
                        'public/less/private.less',
                        'public/less/tap.private.less',
                        'public/less/beer.private.less']
                }
            }
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js'
            }
        }
    });

    grunt.loadNpmTasks('grunt-script-link-tags');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.loadNpmTasks('grunt-jscs');
    grunt.loadNpmTasks('grunt-bowercopy');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-wiredep');
    grunt.loadNpmTasks('grunt-regex-replace');

    grunt.registerTask('test', ['jshint', 'jscs', 'karma']);
    grunt.registerTask('build', ['jshint', 'jscs', 'less', 'ngtemplates',
        'tags', 'wiredep', 'regex-replace', 'bowercopy']);

    grunt.registerTask('default',
        ['jshint', 'jscs', 'less', 'ngtemplates', 'tags', 'wiredep',
        'regex-replace', 'karma', 'bowercopy']);
};
<commit_msg>shame on me not running grunt before committing<commit_after>module.exports = function(grunt) {
    'use strict';
    var jsTagConfig = {
        scriptTemplate: '<script src="{{ path }}"></script>',
        openTag: '<!-- start js-templates tags -->',
        closeTag: '<!-- end js-templates tags -->'
    };
    var cssTagConfig = {
        linkTemplate: '<link rel="stylesheet" href="{{ path }}" />',
        openTag: '<!-- start css-templates tags -->',
        closeTag: '<!-- end css-templates tags -->'
    };

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        tags: {
            publicJs: {
                options: jsTagConfig,
                src: ['public/javascripts/*.js',
                      'public/javascripts/static/**/*.js',
                      'public/javascripts/public/**/*.js'],
                dest: 'views/index.html'
            },
            publicCss: {
                options: cssTagConfig,
                src: ['public/stylesheets/public.style.css'],
                dest: 'views/index.html'
            },
            privateJs: {
                options: jsTagConfig,
                src: ['public/javascripts/*.js',
                      'public/javascripts/static/**/*.js',
                      'public/javascripts/charts/**/*.js',
                      'public/javascripts/private/**/*.js'],
                dest: 'views/private/index.html'
            },
            privateCss: {
                options: cssTagConfig,
                src: ['public/stylesheets/private.style.css',
                      'public/stylesheets/auth-style.css'],
                dest: 'views/private/index.html'
            },
            tests: {
                options: {
                    scriptTemplate: '\'{{ path }}\',',
                    openTag: '// start js-templates tags',
                    closeTag: '// end js-templates tags'
                },
                src: ['public/javascripts/**/*.js'],
                dest: 'karma.conf.js'
            }
        },
        wiredep: {
            dev: {
                cwd: '.',
                src: ['views/index.html',
                      'views/private/index.html',
                      'karma.conf.js'],
                exclude: ['bower_components/angular-mocks/'],
                overrides: {
                    bootstrap: {
                        main: [
                          'dist/js/bootstrap.min.js',
                          'dist/css/bootstrap.min.css',
                          'dist/css/bootstrap-theme.min.css'
                        ]
                    }
                }
            }
        },
        'regex-replace': {
            dev: {
                src: ['views/index.html'],
                actions: [
                    {
                        name: 'static',
                        search: '"\.\./public',
                        replace: '"\.\.',
                        flags: 'g'
                    },
                    {
                        name: 'bower_static',
                        search: '"\.\./bower_components',
                        replace: '"\.\.',
                        flags: 'g'
                    }
                ]
            },
            devPrivate: {
                src: ['views/private/index.html'],
                actions: [
                    {
                        name: 'static',
                        search: '"\.\./\.\./public',
                        replace: '"\.\./\.\.',
                        flags: 'g'
                    },
                    {
                        name: 'bower_static',
                        search: '"\.\./\.\./bower_components',
                        replace: '"\.\./\.\.',
                        flags: 'g'
                    }
                ]
            }
        },
        bowercopy: {
            options: {
                clean: false,
                report: false
            },
            test: {
                options: {
                    destPrefix: 'public/fonts'
                },
                files: {
                    'glyphicons-halflings-regular.eot':
                        'bootstrap/dist/fonts/glyphicons-halflings-regular.eot',
                    'glyphicons-halflings-regular.ttf':
                        'bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
                    'glyphicons-halflings-regular.svg':
                        'bootstrap/dist/fonts/glyphicons-halflings-regular.svg',
                    'glyphicons-halflings-regular.woff':
                    'bootstrap/dist/fonts/glyphicons-halflings-regular.woff',
                    'glyphicons-halflings-regular.woff2':
                    'bootstrap/dist/fonts/glyphicons-halflings-regular.woff2',
                    'fontawesome-webfont.eot':
                        'fontawesome/fonts/fontawesome-webfont.eot',
                    'fontawesome-webfont.ttf':
                        'fontawesome/fonts/fontawesome-webfont.ttf',
                    'fontawesome-webfont.svg':
                        'fontawesome/fonts/fontawesome-webfont.svg',
                    'fontawesome-webfont.woff':
                        'fontawesome/fonts/fontawesome-webfont.woff',
                    'fontawesome-webfont.woff2':
                        'fontawesome/fonts/fontawesome-webfont.woff2',
                    'fontawesome-webfont.otf':
                        'fontawesome/fonts/FontAwesome.otf'
                }
            }
        },
        ngtemplates: {
            'brewbear-templates': {
                src: ['public/**/*.template.html'],
                dest: 'public/javascripts/templates.js',
                options: {
                    url: function(url) {
                        return url.replace('public/', '/');
                    }
                }
            }
        },
        jshint: {
            all: ['Gruntfile.js', 'app.js',
                'public/javascripts/!(charts)/**/*.js',
                'routes/**/*.js', 'views/**/*.js', 'tests/**/*.js',
                '!public/javascripts/templates.js'],
            options: {
                // options here to override JSHint defaults
                globals: {
                    jQuery: false,
                    console: false,
                    module: false,
                    document: false,
                    require: false,
                    __dirname: false,
                    process: false,
                    angular: false,
                    _: false,
                    expect: false,
                    beforeEach: false,
                    afterEach: false,
                    describe: false,
                    it: false,
                    inject: false,
                    spyOn: false
                },
                camelcase: true, //use camelCase,
                eqeqeq: true, //prohibit == and != in favor of !== and ===
                indent: 4, //tab width of 4 spaces
                latedef: true, //prohibit variable use before it's defined
                maxlen: 80, //max line length of 80 charts
                newcap: true, //capitalized names for constructor functions
                quotmark: 'single', //single quote marks for strings
                strict: true, //must use 'use strict' in function scopes
                undef: true, //cannot use undeclared variables
                unused: true //warn when vars are defined but not used
            }
        },
        jscs: {
            all: ['Gruntfile.js', 'app.js',
                'public/javascripts/!(charts)/**/*.js',
                'routes/**/*.js', 'views/**/*.js', 'tests/**/*.js',
                '!public/javascripts/templates.js'],
            options: {
                config: '.jscsrc'
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'jscs']
        },
        less: {
            public: {
                files: {
                    'public/stylesheets/public.style.css':
                        ['public/less/shared.less',
                        'public/less/public.less']
                }
            },
            private: {
                files: {
                    'public/stylesheets/private.style.css':
                        ['public/less/shared.less',
                        'public/less/private.less',
                        'public/less/tap.private.less',
                        'public/less/beer.private.less']
                }
            }
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js'
            }
        }
    });

    grunt.loadNpmTasks('grunt-script-link-tags');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.loadNpmTasks('grunt-jscs');
    grunt.loadNpmTasks('grunt-bowercopy');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-wiredep');
    grunt.loadNpmTasks('grunt-regex-replace');

    grunt.registerTask('test', ['jshint', 'jscs', 'karma']);
    grunt.registerTask('build', ['jshint', 'jscs', 'less', 'ngtemplates',
        'tags', 'wiredep', 'regex-replace', 'bowercopy']);

    grunt.registerTask('default',
        ['jshint', 'jscs', 'less', 'ngtemplates', 'tags', 'wiredep',
        'regex-replace', 'karma', 'bowercopy']);
};
<|endoftext|>


<commit_before>#!/usr/bin/env node

/*!
 * MeltXpert®
 * Improved Nucleic Acid homo & hetero duplexes thermal behavior analysis program.
 * ________________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/.
 * The JavaScript Task Runner.
 * ________________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ________________________________________________________________________________
 *
 * @date      : 11-Nov-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Umeå
 *              └────── A Sequømics Product — http://sequomics.com/.
 * ________________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "MeltXpert®".
 * ________________________________________________________________________________
 */

// "disallowMultipleSpaces": {"allowEOLComments": true}
// "disallowSemicolons": false
// "requireSemicolons": true
// "requireSpaceAfterLineComment": { "allExcept": ["#", "="] }

// global __dirname: true
// global require: true

//# Usage: $ node -v
//# Usage: $ npm -v
//# Usage: $ grunt -version

// Invoking strict mode.
// @purpose: Strict mode applies to entire scripts or to individual functions.
"use strict";

// To load required Node module.
//=-----------------------------
var fs          = require('fs');
var os          = require('os');
var path        = require('path');

// To load required NPM modules.
//=-----------------------------
var chalk       = require('chalk');
// Check if our code is running on Travis.
var isTravis    = require('is-travis');

// Global variables.
//=~~~~~~~~~~~~~~~~~
var rootPath    = './';
var appsPath    = './app/';
var docsPath    = './docs/';
var libsPath    = './libs/';
// A destination directory.
var buildPath   = './build/';

// Default color defined.
//=----------------------
var noop        = chalk.red;
var yeep        = chalk.green;
var okay        = chalk.blue;
var boop        = chalk.gray;

var message     = "SEED™ — Supported under Mac OS X and Linux only!";
// To use inside grunt task.
var pkg         = require('./package.json');
var bkg         = require('./bower.json');
var version     = process.env.VERSION || require('./package.json').version;

// ----------------------------------------------------------------------------------------------------------
var banner      =
    '/*!\n' +
    ' * ———————————\n' +
    ' * MeltXpert®: v' + version + '\n' +
    ' * ———————————\n' +
    ' * Improved Nucleic Acid homo & hetero duplexes thermal behavior analysis program.\n' +
    ' * Copyright © 2006 - ' + new Date().getFullYear() + ', Prabhat Kumar, All rights reserved.\n' +
    ' * Copyright © 2014 - ' + new Date().getFullYear() + ', Sequømics Corporation, All rights reserved.\n' +
    ' * Released under the Apache License (http://www.apache.org/licenses/).\n' +
    ' */';
// ----------------------------------------------------------------------------------------------------------
// All Grunt Operations Defined... |--------------------------------------------| 11/Nov/2016 | SEED™ — Umeå.
// ----------------------------------------------------------------------------------------------------------

module.exports = function(grunt) {

    // Force use of Unix newlines.
    grunt.util.linefeed = '\n';

    // A regular expression.
    RegExp.quote = function(string) {
        return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
    };

    // Date objects.
    var today    = new Date();
    var timems   = Date.now();

    // Advanced Grunt API.
    /// -->> A mode defaults to `0777`.
    var mode     = '0777';
    /// -->> A file globbing pattern.
    var pattern  = '**/*.js';
    // Exclude: remove from consideration.
    // grunt.file.expand([options, ] patterns)
    var excludes  = grunt.file.expand([
        '!/libs/assembly/assembly.js',
        '!/libs/assembly/convert.js'
    ]);
    // Includes: make part of a whole or set.
    // grunt.file.expand([options, ] patterns)
    var includes = grunt.file.expand([
        __dirname + '/core/source/script/' + pattern,
        __dirname + '/core/source/engine/' + pattern
    ]);
    // To write process log(s).
    var contents = null;

    // To generate data of nucleic acid(s).
    // ./pub/data/raw/ ——> ./pub/data/gold/
    var generateData = require('./pub/data/datagenerator.js');
    // A configuration bridge.
    var configBridge = grunt.file.readJSON('./grunt/configBridge.json', {
        encoding: 'utf8'
    });

    // A configuration bridge function.
    Object.keys(configBridge.paths).forEach(function(key) {
        configBridge.paths[key].forEach(function(val, i, arr) {
            arr[i] = path.join('./docs/', val);
        });
    });

    // 1. time-grunt
    // Display the elapsed execution time of grunt tasks.
    require('time-grunt')(grunt);
<commit_msg>Initial commit<commit_after>#!/usr/bin/env node

/*!
 * MeltXpert®
 * Improved Nucleic Acid homo & hetero duplexes thermal behavior analysis program.
 * ________________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/.
 * The JavaScript Task Runner.
 * ________________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ________________________________________________________________________________
 *
 * @date      : 11-Nov-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Umeå
 *              └────── A Sequømics Product — http://sequomics.com/.
 * ________________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "MeltXpert®".
 * ________________________________________________________________________________
 */

// "disallowMultipleSpaces": {"allowEOLComments": true}
// "disallowSemicolons": false
// "requireSemicolons": true
// "requireSpaceAfterLineComment": { "allExcept": ["#", "="] }

// global __dirname: true
// global require: true

//# Usage: $ node -v
//# Usage: $ npm -v
//# Usage: $ grunt -version

// Invoking strict mode.
// @purpose: Strict mode applies to entire scripts or to individual functions.
"use strict";

// To load required Node module.
//=-----------------------------
var fs          = require('fs');
var os          = require('os');
var path        = require('path');

// To load required NPM modules.
//=-----------------------------
var chalk       = require('chalk');
// Check if our code is running on Travis.
var isTravis    = require('is-travis');

// Global variables.
//=~~~~~~~~~~~~~~~~~
var rootPath    = './';
var appsPath    = './app/';
var docsPath    = './docs/';
var libsPath    = './libs/';
// A destination directory.
var buildPath   = './build/';

// Default color defined.
//=----------------------
var noop        = chalk.red;
var yeep        = chalk.green;
var okay        = chalk.blue;
var boop        = chalk.gray;

var message     = "SEED™ — Supported under Mac OS X and Linux only!";
// To use inside grunt task.
var pkg         = require('./package.json');
var bkg         = require('./bower.json');
var version     = process.env.VERSION || require('./package.json').version;

// ----------------------------------------------------------------------------------------------------------
var banner      =
    '/*!\n' +
    ' * ———————————\n' +
    ' * MeltXpert®: v' + version + '\n' +
    ' * ———————————\n' +
    ' * Improved Nucleic Acid homo & hetero duplexes thermal behavior analysis program.\n' +
    ' * Copyright © 2006 - ' + new Date().getFullYear() + ', Prabhat Kumar, All rights reserved.\n' +
    ' * Copyright © 2014 - ' + new Date().getFullYear() + ', Sequømics Corporation, All rights reserved.\n' +
    ' * Released under the Apache License (http://www.apache.org/licenses/).\n' +
    ' */';
// ----------------------------------------------------------------------------------------------------------
// All Grunt Operations Defined... |--------------------------------------------| 11/Nov/2016 | SEED™ — Umeå.
// ----------------------------------------------------------------------------------------------------------

module.exports = function(grunt) {

    // Force use of Unix newlines.
    grunt.util.linefeed = '\n';

    // A regular expression.
    RegExp.quote = function(string) {
        return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
    };

    // Date objects.
    var today    = new Date();
    var timems   = Date.now();

    // Advanced Grunt API.
    /// -->> A mode defaults to `0777`.
    var mode     = '0777';
    /// -->> A file globbing pattern.
    var pattern  = '**/*.js';
    // Exclude: remove from consideration.
    // grunt.file.expand([options, ] patterns)
    var excludes  = grunt.file.expand([
        '!/libs/assembly/assembly.js',
        '!/libs/assembly/convert.js'
    ]);
    // Includes: make part of a whole or set.
    // grunt.file.expand([options, ] patterns)
    var includes = grunt.file.expand([
        __dirname + '/core/source/script/' + pattern,
        __dirname + '/core/source/engine/' + pattern
    ]);
    // To write process log(s).
    var contents = null;

    // To generate data of nucleic acid(s).
    // ./pub/data/raw/ ——> ./pub/data/gold/
    var generateData = require('./pub/data/datagenerator.js');
    // A configuration bridge.
    var configBridge = grunt.file.readJSON('./grunt/configBridge.json', {
        encoding: 'utf8'
    });

    // A configuration bridge function.
    Object.keys(configBridge.paths).forEach(function(key) {
        configBridge.paths[key].forEach(function(val, i, arr) {
            arr[i] = path.join('./docs/', val);
        });
    });

    // 1. time-grunt
    // Display the elapsed execution time of grunt tasks.
    require('time-grunt')(grunt);

    // 2. load-grunt-tasks
    // Load multiple grunt tasks using globbing patterns.
    require('load-grunt-tasks')(grunt, {
        scope: ['devDependencies', 'dependencies']
    });
<|endoftext|>


<commit_before>module.exports = function (grunt) {

	'use strict';

	/**
	 * Project configuration
	 */
	grunt.initConfig({
		pkg: require('./package'), // <%=pkg.name%>

		/**
		 * Config - Edit this section
		 * ==========================
		 * Choose javascript dist filename
		 * Choose javascript dist location
		 * Choose javascript files to be uglified
		 */
		config : {
			js : {
				// <%=config.js.distDir%>
				distDir  : 'js/dist/',

				// <%=config.js.distFile%>
				distFile : 'app.min.js',

				// <%=config.js.fileList%>
				fileList : [
					'js/helpers/console.js',
					'js/script.js'
				]
			}
		},

		/**
		 * Watch
		 * https://github.com/gruntjs/grunt-contrib-watch
		 * Watches your scss, js etc for changes and compiles them
		 */
		watch: {
			scss: {
				files: ['scss/**/*.scss'],
				tasks: ['sass:kickoff', 'sass:styleguide', 'autoprefixer:dist']
			},

			js: {
				files: ['<%=config.js.fileList%>', 'Gruntfile.js'],
				tasks: ['uglify']
			},

			livereload: {
				options: { livereload: true },
				files: [
					'css/*.css'
				]
			},

			grunticon : {
				files: ['img/src/*.svg', 'img/src/*.png'],
				tasks: ['svgmin', 'grunticon']
			}
		},

		/**
		 * Sass compilation
		 * https://github.com/gruntjs/grunt-contrib-sass
		 * Includes kickoff.scss and kickoff-old-ie.scss by default
		 * Also creates source maps
		 */
		sass: {
			kickoff: {
				options: {
					unixNewlines: true,
					style: 'expanded',
					lineNumbers: false,
					debugInfo : false,
					precision : 8,
					sourcemap: true
				},
				files: {
					'css/kickoff.css'       : 'scss/kickoff.scss',
					'css/kickoff-old-ie.css': 'scss/kickoff-old-ie.scss'
				}
			},
			styleguide: {
				options: {
					unixNewlines: true,
					style: 'expanded',
					precision : 8,
					sourcemap: true
				},
				files: {
					'css/styleguide.css': 'scss/styleguide.scss'
				}
			}
		},

		/**
		 * Autoprefixer
		 * https://github.com/nDmitry/grunt-autoprefixer
		 * https://github.com/ai/autoprefixer
		 * Auto prefixes your CSS using caniuse data
		 */
		autoprefixer: {
			dist : {
				options: {
					// Task-specific options go here - we are supporting
					// the last 2 browsers, any browsers with >1% market share,
					// and ensuring we support IE7 + 8 with prefixes
					browsers: ['> 5%', 'last 4 versions', 'firefox > 3.6', 'ie > 6'],
					map: true
				},
				files: {
					'css/kickoff.css'       : 'css/kickoff.css',
					'css/kickoff-old-ie.css': 'css/kickoff-old-ie.css',
					'css/styleguide.css'    : 'css/styleguide.css'
				}
			}
		},

		/**
		 * Uglify
		 * https://github.com/gruntjs/grunt-contrib-uglify
		 * Minifies and concatinates your JS
		 * Also creates source maps
		 */
		uglify: {
			options: {

				mangle: true, // mangle: Turn on or off mangling
				beautify: false, // beautify: beautify your code for debugging/troubleshooting purposes
				compress: false,
				// report: 'gzip', // report: Show file size report
				sourceMap: '<%=config.js.distDir%><%=config.js.distFile%>.map',
				sourceMappingURL: '/<%=config.js.distFile%>.map',
			},
			js: {
				src: '<%=config.js.fileList%>',
				dest: '<%=config.js.distDir%><%=config.js.distFile%>'
			}
		},

		/**
		 * Grunticon
		 * https://github.com/filamentgroup/grunticon
		 */
		grunticon: {
			myIcons: {
				files: [{
					expand: true,
					cwd   : 'img/src-min',
					src   : ['*.svg', '*.png'],
					dest  : 'img/icons'
				}],
				options: {
					// customselectors: {
					// 	"*": [".icon-$1:before"]
					// }
				}
			}
		},

		/**
		 * SVGmin
		 * https://github.com/sindresorhus/grunt-svgmin
		 */
		svgmin: {
			options: {
				plugins: [
					{ removeViewBox: false },
					{ removeUselessStrokeAndFill: false }
				]
			},
			dist: {                     // Target
				files: [{               // Dictionary of files
					expand: true,       // Enable dynamic expansion.
					cwd: 'img/src',     // Src matches are relative to this path.
					src: ['**/*.svg'],  // Actual pattern(s) to match.
					dest: 'img/src-min',       // Destination path prefix.
					ext: '.svg'     // Dest filepaths will have this extension.
					// ie: optimise img/src/branding/logo.svg and store it in img/branding/logo.min.svg
				}]
			}
		},

		/**
		 * CSSO
		 * https://github.com/t32k/grunt-csso
		 * Minify CSS files with CSSO
		 */
		csso: {
			dist: {
				files: {
					'css/kickoff.css'       : 'css/kickoff.css',
					'css/kickoff-old-ie.css': 'css/kickoff-old-ie.css'
				},

			}
		},

		/**
		 * Connect
		 * https://github.com/gruntjs/grunt-contrib-connect
		 * Start a static web server
		 */
		connect: {
			server: {
				options: {
					// port: 9001,
					// hostname: 'mysite.local',
					open: true,
					livereload: true
				}
			}
		},

		/**
		 * Custom jQuery builder
		 * Check build numbers at jquery.com
		 */
		jquery: {
			build: {
				options: {
					prefix: "jquery-",
					minify: true
				},
				output: "js/libs/jquery",
				versions: {
					// Add items to the below arrays to remove them from the build
					// Remove everything we don't need from 2.x versions
					//"2.0.3": [ "deprecated", "dimensions", "offset", "wrap"],

					// We can't remove sizzle from 1.x versions, so let's not specify it
					"1.10.2": [ "deprecated"]
				}
			}
		},

		/**
		 * JSHint
		 * https://github.com/gruntjs/grunt-contrib-jshint
		 * Manage the options inside .jshintrc file
		 */
		jshint: {
			all: '<%=config.js.fileList%>',
			options: {
				jshintrc: '.jshintrc'
			}
		},

		/**
		 * JSCS
		 * https://github.com/dsheiko/grunt-jscs
		 * Manage the options inside .jscs.json file
		 */
		jscs: {
			src: '<%=config.js.fileList%>',
			options: {
				config: ".jscs.json"
			}
		}
	});

	// Load all the grunt tasks
	require('load-grunt-tasks')(grunt);

	/* ==========================================================================
		Available tasks:
		* grunt        : run jshint, uglify and sass:kickoff
		* grunt watch  : run sass:kickoff, uglify and livereload
		* grunt dev    : run jshint, uglify and sass:kickoff
		* grunt deploy : run jshint, uglify, sass:kickoff and csso
		* grunt jquery : build custom version of jquery
		* grunt serve  : watch js & scss and run a local server
		* grunt availabletasks : view all available tasks
		 ========================================================================== */

	/**
	 * GRUNT * Default task
	 * run jshint, uglify and sass:kickoff
	 */
	// Default task
	grunt.registerTask('default', [
		'jshint',
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist'
	]);

	/**
	 * GRUNT DEV * A task for development
	 * run jshint, uglify and sass:kickoff
	 */
	grunt.registerTask('dev', [
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist'
	]);

	/**
	 * GRUNT DEPLOY * A task for your production environment
	 * run jshint, uglify and sass:production
	 */
	grunt.registerTask('deploy', [
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist',
		'csso'
	]);

	/**
	 * GRUNT SERVE * A task for for a static server with a watch
	 * run connect and watch
	 */
	grunt.registerTask("serve", [
		'uglify',
		'sass:kickoff',
		'sass:styleguide',
		'autoprefixer:dist',
		'connect',
		'watch'
	]);

	/**
	 * TODO:
	 * Need task to update all grunt dependencies
	 * Need task to download all bower dependencies
	 */

	//Travis CI to test build
	grunt.registerTask('travis', [
		'jshint',
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist'
	]);
};
<commit_msg>add jeykyll config to Gruntfile<commit_after>module.exports = function (grunt) {

	'use strict';

	/**
	 * Project configuration
	 */
	grunt.initConfig({
		pkg: require('./package'), // <%=pkg.name%>

		/**
		 * Config - Edit this section
		 * ==========================
		 * Choose javascript dist filename
		 * Choose javascript dist location
		 * Choose javascript files to be uglified
		 */
		config : {
			js : {
				// <%=config.js.distDir%>
				distDir  : 'js/dist/',

				// <%=config.js.distFile%>
				distFile : 'app.min.js',

				// <%=config.js.fileList%>
				fileList : [
					'js/helpers/console.js',
					'js/script.js'
				]
			}
		},

		/**
		 * Watch
		 * https://github.com/gruntjs/grunt-contrib-watch
		 * Watches your scss, js etc for changes and compiles them
		 */
		watch: {
			scss: {
				files: ['scss/**/*.scss'],
				tasks: ['sass:kickoff', 'sass:styleguide', 'autoprefixer:dist']
			},

			js: {
				files: ['<%=config.js.fileList%>', 'Gruntfile.js'],
				tasks: ['uglify']
			},

			livereload: {
				options: { livereload: true },
				files: [
					'css/*.css'
				]
			},

			grunticon : {
				files: ['img/src/*.svg', 'img/src/*.png'],
				tasks: ['svgmin', 'grunticon']
			},

			jekyll : {
				files: [
					'_includes/**/*.html',
					'_layouts/**/*.html',
					'archive/**/*.html',
					'_posts/**/*.md',
					'_team/**/*.md',
					'_code/**/*.md',
					'_drafts/**/*.md',
					'css/**/*.css',
					'js/**/*.js',
					'authors/*.html',
					'*.html',
					'*.md',
					'Gruntfile.js'
				],
				tasks: 'jekyll',
				options: {
					livereload: true
				}
			},
		},

		/**
		 * Sass compilation
		 * https://github.com/gruntjs/grunt-contrib-sass
		 * Includes kickoff.scss and kickoff-old-ie.scss by default
		 * Also creates source maps
		 */
		sass: {
			kickoff: {
				options: {
					unixNewlines: true,
					style: 'expanded',
					lineNumbers: false,
					debugInfo : false,
					precision : 8,
					sourcemap: true
				},
				files: {
					'css/kickoff.css'       : 'scss/kickoff.scss',
					'css/kickoff-old-ie.css': 'scss/kickoff-old-ie.scss'
				}
			},
			styleguide: {
				options: {
					unixNewlines: true,
					style: 'expanded',
					precision : 8,
					sourcemap: true
				},
				files: {
					'css/styleguide.css': 'scss/styleguide.scss'
				}
			}
		},

		/**
		 * Autoprefixer
		 * https://github.com/nDmitry/grunt-autoprefixer
		 * https://github.com/ai/autoprefixer
		 * Auto prefixes your CSS using caniuse data
		 */
		autoprefixer: {
			dist : {
				options: {
					// Task-specific options go here - we are supporting
					// the last 2 browsers, any browsers with >1% market share,
					// and ensuring we support IE7 + 8 with prefixes
					browsers: ['> 5%', 'last 4 versions', 'firefox > 3.6', 'ie > 6'],
					map: true
				},
				files: {
					'css/kickoff.css'       : 'css/kickoff.css',
					'css/kickoff-old-ie.css': 'css/kickoff-old-ie.css',
					'css/styleguide.css'    : 'css/styleguide.css'
				}
			}
		},

		/**
		 * Uglify
		 * https://github.com/gruntjs/grunt-contrib-uglify
		 * Minifies and concatinates your JS
		 * Also creates source maps
		 */
		uglify: {
			options: {

				mangle: true, // mangle: Turn on or off mangling
				beautify: false, // beautify: beautify your code for debugging/troubleshooting purposes
				compress: false,
				// report: 'gzip', // report: Show file size report
				sourceMap: '<%=config.js.distDir%><%=config.js.distFile%>.map',
				sourceMappingURL: '/<%=config.js.distFile%>.map',
			},
			js: {
				src: '<%=config.js.fileList%>',
				dest: '<%=config.js.distDir%><%=config.js.distFile%>'
			}
		},

		/**
		 * Grunticon
		 * https://github.com/filamentgroup/grunticon
		 */
		grunticon: {
			myIcons: {
				files: [{
					expand: true,
					cwd   : 'img/src-min',
					src   : ['*.svg', '*.png'],
					dest  : 'img/icons'
				}],
				options: {
					// customselectors: {
					// 	"*": [".icon-$1:before"]
					// }
				}
			}
		},

		/**
		 * SVGmin
		 * https://github.com/sindresorhus/grunt-svgmin
		 */
		svgmin: {
			options: {
				plugins: [
					{ removeViewBox: false },
					{ removeUselessStrokeAndFill: false }
				]
			},
			dist: {                     // Target
				files: [{               // Dictionary of files
					expand: true,       // Enable dynamic expansion.
					cwd: 'img/src',     // Src matches are relative to this path.
					src: ['**/*.svg'],  // Actual pattern(s) to match.
					dest: 'img/src-min',       // Destination path prefix.
					ext: '.svg'     // Dest filepaths will have this extension.
					// ie: optimise img/src/branding/logo.svg and store it in img/branding/logo.min.svg
				}]
			}
		},

		/**
		 * CSSO
		 * https://github.com/t32k/grunt-csso
		 * Minify CSS files with CSSO
		 */
		csso: {
			dist: {
				files: {
					'css/kickoff.css'       : 'css/kickoff.css',
					'css/kickoff-old-ie.css': 'css/kickoff-old-ie.css'
				},

			}
		},

		/**
		 * Connect
		 * https://github.com/gruntjs/grunt-contrib-connect
		 * Start a static web server
		 */
		connect: {
			server: {
				options: {
					// port: 9001,
					// hostname: 'mysite.local',
					open: true,
					livereload: true,
					base: './_site'
				}
			}
		},

		/**
		 * Custom jQuery builder
		 * Check build numbers at jquery.com
		 */
		jquery: {
			build: {
				options: {
					prefix: "jquery-",
					minify: true
				},
				output: "js/libs/jquery",
				versions: {
					// Add items to the below arrays to remove them from the build
					// Remove everything we don't need from 2.x versions
					//"2.0.3": [ "deprecated", "dimensions", "offset", "wrap"],

					// We can't remove sizzle from 1.x versions, so let's not specify it
					"1.10.2": [ "deprecated"]
				}
			}
		},

		/**
		 * JSHint
		 * https://github.com/gruntjs/grunt-contrib-jshint
		 * Manage the options inside .jshintrc file
		 */
		jshint: {
			all: '<%=config.js.fileList%>',
			options: {
				jshintrc: '.jshintrc'
			}
		},

		/**
		 * JSCS
		 * https://github.com/dsheiko/grunt-jscs
		 * Manage the options inside .jscs.json file
		 */
		jscs: {
			src: '<%=config.js.fileList%>',
			options: {
				config: ".jscs.json"
			}
		},

		jekyll : {
			options : {
				server : false,
				auto : false,
				drafts : false,
				future : true
			},
			blog: {
				src: './',
				dest: '_site'
			}
		}
	});

	// Load all the grunt tasks
	require('load-grunt-tasks')(grunt);

	/* ==========================================================================
		Available tasks:
		* grunt        : run jshint, uglify and sass:kickoff
		* grunt watch  : run sass:kickoff, uglify and livereload
		* grunt dev    : run jshint, uglify and sass:kickoff
		* grunt deploy : run jshint, uglify, sass:kickoff and csso
		* grunt jquery : build custom version of jquery
		* grunt serve  : watch js & scss and run a local server
		 ========================================================================== */

	/**
	 * GRUNT * Default task
	 * run jshint, uglify and sass:kickoff
	 */
	// Default task
	grunt.registerTask('default', [
		'jshint',
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist'
	]);

	/**
	 * GRUNT DEV * A task for development
	 * run jshint, uglify and sass:kickoff
	 */
	grunt.registerTask('dev', [
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist'
	]);

	/**
	 * GRUNT DEPLOY * A task for your production environment
	 * run jshint, uglify and sass:production
	 */
	grunt.registerTask('deploy', [
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist',
		'csso'
	]);

	/**
	 * GRUNT SERVE * A task for for a static server with a watch
	 * run connect and watch
	 */
	grunt.registerTask("serve", [
		'jekyll',
		'uglify',
		'sass:kickoff',
		'sass:styleguide',
		'autoprefixer:dist',
		'connect',
		'watch'
	]);

	/**
	 * TODO:
	 * Need task to update all grunt dependencies
	 * Need task to download all bower dependencies
	 */

	//Travis CI to test build
	grunt.registerTask('travis', [
		'jshint',
		'uglify',
		'sass:kickoff',
		'autoprefixer:dist'
	]);
};
<|endoftext|>