module.exports = function()

in portal/Gruntfile.js [53:452]


module.exports = function(grunt) {


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

    uglify: {
      options: {
        banner: licenseHeader +
          '\n /*! <%= pkg.name %>@<%= pkg.version %>  */\n'
      },
      'usergrid-libs': {
        options: {
          mangle: false,
          compress: {
            warnings: false
          },
          beautify: false
        },
        files: {
          'js/generated/usergrid-libs.min.js': [
            'js/libs/jquery/jquery-1.9.1.min.js',
            'js/libs/jquery/jquery-migrate-1.1.1.min.js',
            'js/libs/jquery/jquery.sparkline.min.js',
            'js/libs/angular-1.2.5/angular.min.js',
            'js/libs/angular-1.2.5/angular-route.min.js',
            'js/libs/angular-1.2.5/angular-resource.min.js',
            'js/libs/angular-1.2.5/angular-sanitize.min.js',
            'js/libs/usergrid.sdk.js',
            'js/libs/MD5.min.js',
            'js/libs/ui-bootstrap/ui-bootstrap-custom-tpls-0.3.0.min.js',
            'js/libs/jqueryui/jquery-ui-1.8.18.min.js',
            'js/libs/jqueryui/date.min.js',
            'bower_components/intro.js/minified/intro.min.js',
            'bower_components/angular-intro.js/src/angular-intro.js',
          ]
        }
      },
      'usergrid-dev': {
        options: {
          mangle: false,
          compress: false,
          beautify: true,
          wrap: false
        },
        files: {
          'js/generated/usergrid-dev.js': [
            'js/app.js',
            'js/**/*.js',
            '!js/config.js',
            '!js/libs/**/*.js',
            '!js/generated/*.js'
          ]
        }
      },
      'usergrid-coverage': {
        options: {
          mangle: false,
          compress: false,
          beautify: false,
          wrap: false
        },
        files: {
          'test/coverage/instrument/js/usergrid-coverage.min.js': [
            coverageDir + 'js/app.js',
            coverageDir + 'js/**/*.js',
            'js/generated-templates/templates.js',
            '!' + coverageDir + 'js/config.js',
            '!' + coverageDir + 'js/libs/**/*.js',
            '!' + coverageDir + 'js/generated/*.js',
            '!' + coverageDir + 'js/usergrid-coverage.min.js'
          ]
        }
      },
      'usergrid-coverage-min': {
        options: {
          mangle: false,
          compress: {
            warnings: false
          },
          beautify: false
        },
        files: {
          'test/coverage/instrument/js/usergrid.min.js': [
            coverageFile
          ]
        }
      },
      'usergrid': {
        options: {
          mangle: false,
          compress: {
            warnings: false
          },
          beautify: false
        },
        files: {
          'js/generated/usergrid.min.js': [
            devFile
          ]
        }
      }

    },
    ngtemplates: {
      "appservices": {
        options: {
          base: 'js/'
        },
        src: ['js/**/*.html', '!**/index*'],
        dest: templateFile,
        options: {
          url: function(url) {
            return url.replace('js/', '');
          }
        }
      }
    },

    cssmin: {
      combine: {
        files: {
          'css/main.min.css': ['css/main.css']
        }
      }
    },
    watch: {
      options: {
        livereload: true
      },
      files: [
        'index-template.html',
        'css/**/*.css',
        'js/**/*.js',
        'js/**/*.html',
        '!tests/',
        '!css/main.min.css',
        '!js/libs/',
        '!js/generated/*.js',
        '!js/generated-templates/*.js',
        'getStatus.js'
      ],
      tasks: ['build-dev']
    },
    connect: {
      server: {
        options: {
          target: 'http://localhost:3000/index-debug.html', // target url to open
          open: 'http://localhost:3000/index-debug.html',
          hostname: '*',
          livereload: true,
          port: 3000,
          base: ''
        }
      },
      'e2e-coverage-chrome': {
        options: {
          port: 3006,
          base: coveragePath
        }
      },
      'e2e-phantom': {
        options: {
          port: 3005,
          base: distPath
        }
      },
      'e2e-chrome': {
        options: {
          port: 3006,
          base: distPath
        }
      },
      'e2e-firefox': {
        options: {
          port: 3007,
          base: distPath
        }
      }
    },
    karma: {
      unit: {
        configFile: 'tests/karma.conf.js',
        runnerPort: 9999,
        singleRun: true,
        browsers: ['PhantomJS']
      },
      coverage: {
        configFile: 'tests/karma-coverage.conf.js',
        runnerPort: 9999,
        singleRun: true,
        browsers: ['PhantomJS']
      }
    },
    protractor: {
      options: {
        configFile: "tests/protractorConf.js", // Default config file
        keepAlive: true, // If false, the grunt process stops when the test fails.
        noColor: false, // If true, protractor will not use colors in its output.
        args: {
          baseUrl: 'http://localhost:3005/'
        }
      },
      phantom: {
        options: {
          args: {
            baseUrl: 'http://localhost:3005/',
            // Arguments passed to the command
            'browser': 'phantomjs'
          }
        }
      },
      chrome: {
        options: {
          args: {
            baseUrl: 'http://localhost:3006/?noHelp=true',
            // Arguments passed to the command
            'browser': 'chrome'
          }
        }
      },
      firefox: {
        options: {
          args: {
            baseUrl: 'http://localhost:3007/',
            // Arguments passed to the command
            'browser': 'firefox'
          }
        }
      }
    },
    copy: {
      coverage: {
        files: [{
          src: ['js/*.min.js', 'js/libs/**', 'sdk/**',
            'js/charts/*.json', 'css/**', 'img/**', 'js/libs/**',
            'config.js', 'bower_components/**'
          ],
          dest: coveragePath,
          expand: true
        }, {
          src: ['js/*.min.js'],
          dest: coveragePath,
          cwd: coverageDir,
          expand: true
        }]
      },
      main: {
        files: [
          // includes files within path
          {
            expand: true,
            src: ['*.html', 'config.js', '*.ico', 'helpJson.json', 'getStatus.js'],
            dest: distPath,
            filter: 'isFile'
          }, {
            expand: true,
            src: ['sdk/**', 'css/**', 'img/**', 'js/charts/*.json'],
            dest: distPath
          }, {
            expand: true,
            src: ['js/generated/**', 'js/libs/**', 'css/**', 'img/**',
              'bower_components/**'
            ],
            dest: distPath
          }

        ]
      }
    },
    clean: {
      build: ['dist/', 'dist-cov/', 'test/', 'js/generated/',
        'js/*.min.js', templateFile, 'index.html', 'index-debug.html'
      ],
      coverage: ['reports/']
    },
    dom_munger: {
      main: {
        options: {
          update: {
            selector: '#main-script',
            attribute: 'src',
            value: mainFile
          }

        },
        src: 'index-template.html', //update the dist/index.html (the src index.html is copied there)
        dest: 'index.html' //update the dist/index.html (the src index.html is copied there)

      },
      dev: {
        options: {
          update: {
            selector: '#main-script',
            attribute: 'src',
            value: devFile
          }
        },
        src: 'index-template.html', //update the dist/index.html (the src index.html is copied there)
        dest: 'index-debug.html' //update the dist/index.html (the src index.html is copied there)
      },
      coverage: {
        options: {
          update: {
            selector: '#main-script',
            attribute: 'src',
            value: 'js/usergrid-coverage.min.js'
          }
        },
        src: 'index-template.html', //update the dist/index.html (the src index.html is copied there)
        dest: coveragePath + '/index.html' //update the dist/index.html (the src index.html is copied there)
      }
    },
    bower: {
      install: {
        options: {
          cleanup: false,

          copy: false
        }
      }
    },
    compress: {
      main: {
        options: {
          mode: 'tar',
          archive: 'dist/' + distName + '.tar'
        },
        expand: true,
        cwd: distPath + '/',
        src: ['**/*'],
        dest: distName + '.' + bower.version
      }
    },

    instrument: {
      files: 'js/**/*.js',
      options: {
        lazy: true,
        basePath: coverageDir
      }
    },
    makeReport: {
      src: 'reports/**/*.json',
      options: {
        type: 'lcov',
        dir: 'reports',
        print: 'detail'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-angular-templates');
  grunt.loadNpmTasks('grunt-bower-task');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-protractor-runner');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-dom-munger');

  grunt.loadNpmTasks('grunt-istanbul');

  // Default task(s).
  grunt.registerTask('dev', ['connect:server', 'watch']);

  grunt.registerTask('validate', ['jshint', 'complexity']);
  grunt.registerTask('report', ['build', 'coverage']);

  grunt.registerTask('build', ['clean:build', 'bower:install', 'ngtemplates',
    'uglify', 'cssmin', 'dom_munger', 'karma:unit', 'copy'
  ]);
  grunt.registerTask('build-dev', ['build']);
  grunt.registerTask('build-coverage', ['ngtemplates', 'instrument',
    'uglify:usergrid-coverage', 'uglify:usergrid-coverage-min', 'cssmin',
    'dom_munger', 'copy:coverage'
  ]);

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

  grunt.registerTask('e2e', ['connect:e2e-phantom', 'protractor:phantom']);
  grunt.registerTask('e2e-chrome', ['connect:e2e-chrome', 'protractor:chrome']);
  grunt.registerTask('e2e-coverage', ['clean:coverage',
    'connect:e2e-coverage', 'protractor:coverage'
  ]);
  grunt.registerTask('e2e-coverage-chrome', ['clean:coverage',
    'connect:e2e-coverage-chrome', 'protractor:chrome', 'makeReport'
  ]);
  grunt.registerTask('e2e-firefox', ['connect:e2e-firefox',
    'protractor:firefox'
  ]);
  grunt.registerTask('no-monitoring', ['build', 'clean:perf', 'karma:unit']);

};