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

    /**
     * Require it at the top and pass in the grunt instance
     */
    require('time-grunt')(grunt);

    /**
     * Setup configuration
     */
    grunt.initConfig({
        pkg: grunt.file.readJSON('config/banner.json'),
        buildTags: "/* Project Name : <%= pkg.application.name %> Release version : <%= pkg.application.version %> */",

        configuredFiles: grunt.file.readJSON('config/servefiles.json'),

        clean: {
            build: ['prod']
        },
        shell: {
            uglify: {
                command: 'node tools/r.js -o config/build.js'
            }
        },
        usebanner: {
            buildTags: {
                options: {
                    position: 'top',
                    banner: '<%= buildTags %>',
                    linebreak: true
                },
                files: {
                    src: '<%= configuredFiles.usebanner %>'
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'config/.jshintrc',
                ignores: '<%= configuredFiles.jshint.ignore %>'
            },
            all: '<%= configuredFiles.jshint.files %>'
        },
        jscs: {
            options: {
                config: 'config/.jscsrc'
            },
            src: '<%= configuredFiles.jscs.files %>',
        },
        jsonlint: {
            files: {
                src: '<%= configuredFiles.jsonlint %>'
            }
        },
        csslint: {
            strict: {
                options: {
                    csslintrc: 'config/.csslintrc',
                    ignores: '<%= configuredFiles.csslint.ignore %>'
                },
                src: '<%= configuredFiles.csslint.files %>'
            }
        },
        htmlhint: {
            Root_HTML_Files: {
                options: {
                    htmlhintrc: 'config/.htmlhint-n-rc',
                    ignores: '<%= configuredFiles.htmlhint.Root_HTML_Files.ignore %>'
                },
                src: '<%= configuredFiles.htmlhint.Root_HTML_Files.files %>'
            },
            Templates: {
                options: {
                    htmlhintrc: 'config/.htmlhint-t-rc',
                    ignores: '<%= configuredFiles.htmlhint.Templates.ignore %>'
                },
                src: '<%= configuredFiles.htmlhint.Templates.files %>'

            }
        },
        less: {
            readyMade: {
                options: {
                    compress: true
                },
                files: '<%= configuredFiles.less.readyMade.files %>'
            },
            customMade: {
                options: {
                    compress: false
                },
                files: '<%= configuredFiles.less.customMade.files %>'
            },
            prod: {
                options: {
                    compress: true
                },
                files: '<%= configuredFiles.less.customMade.files %>'
            }
        },
        watch: {
            less: {
                options: {
                    spawn: false
                },
                files: '<%= configuredFiles.watch.less.files %>',
                tasks: ['less:customMade']
            }
        },
        strip: {
            main: {
                src: 'prod/src/apps/**/*.js',
                options: {
                    inline: true,
                    nodes: ['console.log', 'debug']
                }
            }
        },
        autoprefixer: {
            options: {
                'browsers': ['ie 8', 'ie 9', 'Firefox >= 17', 'ios 7', 'last 10 Chrome versions', 'last 2 Safari versions', 'Android 4']
            },
            multiple: {
                expand: true,
                flatten: true,
                src: 'src/stylesheets/css/common/*.css',
                dest: 'src/stylesheets/css/common/'
            }
        },
        htmlmin: {
            dist: {
                options: {
                    removeComments: true,
                    collapseWhitespace: true
                },
                files: '<%= configuredFiles.htmlmin.files %>'
            }
        },
        qunit: {
            options: {
                '--web-security': 'no',
                coverage: {
                    src: ['src/**/*.js'],
                    instrumentedFiles: 'temp/',
                    htmlReport: 'report/coverage',
                    coberturaReport: 'report/'
                },
                timeout: 10000
            },
            all: ['tests/**/*.html']
        }
    });

    /**
     * Load tasks
     */
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-strip');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-jscs-checker');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-htmlhint');
    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-contrib-qunit');
    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-banner');

    /**
     * Define tasks : Tasks for development eco - system.
     */
    grunt.registerTask('default', [
        'htmlhint',
        'csslint',
        'jshint',
        'jscs',
        'jsonlint',
        'less:readyMade',
        'less:customMade',
        'autofix'
    ]);
    grunt.registerTask('dev', ['default']); // Alias for `default`.

    /**
     * Define tasks : Tasks for build eco - system.
     */
    grunt.registerTask('build', [
        'htmlhint',
        'csslint',
        'jshint',
        'jsonlint',
        'compileless',
        'autofix',
        'clean',
        'shell',
        'strip',
        'htmlmin',
        'usebanner'
    ]);

    /**
     * Define sub-tasks : Tasks for Less compilation.
     */
    grunt.registerTask('compileless', ['less:readyMade', 'less:customMade']);

    /**
     * Define sub-tasks : Alias for `autofix`
     */
    grunt.registerTask('autofix', ['autoprefixer']);

    /**
     * Define sub-tasks : Alias for `tests`
     */
    grunt.registerTask('tests', ['qunit']);

};<commit_msg>Renames grunt-jscs-checker to grunt-jscs<commit_after>module.exports = function(grunt) {
    'use strict';

    /**
     * Require it at the top and pass in the grunt instance
     */
    require('time-grunt')(grunt);

    /**
     * Setup configuration
     */
    grunt.initConfig({
        pkg: grunt.file.readJSON('config/banner.json'),
        buildTags: "/* Project Name : <%= pkg.application.name %> Release version : <%= pkg.application.version %> */",

        configuredFiles: grunt.file.readJSON('config/servefiles.json'),

        clean: {
            build: ['prod']
        },
        shell: {
            uglify: {
                command: 'node tools/r.js -o config/build.js'
            }
        },
        usebanner: {
            buildTags: {
                options: {
                    position: 'top',
                    banner: '<%= buildTags %>',
                    linebreak: true
                },
                files: {
                    src: '<%= configuredFiles.usebanner %>'
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'config/.jshintrc',
                ignores: '<%= configuredFiles.jshint.ignore %>'
            },
            all: '<%= configuredFiles.jshint.files %>'
        },
        jscs: {
            options: {
                config: 'config/.jscsrc'
            },
            src: '<%= configuredFiles.jscs.files %>',
        },
        jsonlint: {
            files: {
                src: '<%= configuredFiles.jsonlint %>'
            }
        },
        csslint: {
            strict: {
                options: {
                    csslintrc: 'config/.csslintrc',
                    ignores: '<%= configuredFiles.csslint.ignore %>'
                },
                src: '<%= configuredFiles.csslint.files %>'
            }
        },
        htmlhint: {
            Root_HTML_Files: {
                options: {
                    htmlhintrc: 'config/.htmlhint-n-rc',
                    ignores: '<%= configuredFiles.htmlhint.Root_HTML_Files.ignore %>'
                },
                src: '<%= configuredFiles.htmlhint.Root_HTML_Files.files %>'
            },
            Templates: {
                options: {
                    htmlhintrc: 'config/.htmlhint-t-rc',
                    ignores: '<%= configuredFiles.htmlhint.Templates.ignore %>'
                },
                src: '<%= configuredFiles.htmlhint.Templates.files %>'

            }
        },
        less: {
            readyMade: {
                options: {
                    compress: true
                },
                files: '<%= configuredFiles.less.readyMade.files %>'
            },
            customMade: {
                options: {
                    compress: false
                },
                files: '<%= configuredFiles.less.customMade.files %>'
            },
            prod: {
                options: {
                    compress: true
                },
                files: '<%= configuredFiles.less.customMade.files %>'
            }
        },
        watch: {
            less: {
                options: {
                    spawn: false
                },
                files: '<%= configuredFiles.watch.less.files %>',
                tasks: ['less:customMade']
            }
        },
        strip: {
            main: {
                src: 'prod/src/apps/**/*.js',
                options: {
                    inline: true,
                    nodes: ['console.log', 'debug']
                }
            }
        },
        autoprefixer: {
            options: {
                'browsers': ['ie 8', 'ie 9', 'Firefox >= 17', 'ios 7', 'last 10 Chrome versions', 'last 2 Safari versions', 'Android 4']
            },
            multiple: {
                expand: true,
                flatten: true,
                src: 'src/stylesheets/css/common/*.css',
                dest: 'src/stylesheets/css/common/'
            }
        },
        htmlmin: {
            dist: {
                options: {
                    removeComments: true,
                    collapseWhitespace: true
                },
                files: '<%= configuredFiles.htmlmin.files %>'
            }
        },
        qunit: {
            options: {
                '--web-security': 'no',
                coverage: {
                    src: ['src/**/*.js'],
                    instrumentedFiles: 'temp/',
                    htmlReport: 'report/coverage',
                    coberturaReport: 'report/'
                },
                timeout: 10000
            },
            all: ['tests/**/*.html']
        }
    });

    /**
     * Load tasks
     */
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-strip');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-jscs');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-htmlhint');
    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-contrib-qunit');
    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-banner');

    /**
     * Define tasks : Tasks for development eco - system.
     */
    grunt.registerTask('default', [
        'htmlhint',
        'csslint',
        'jshint',
        'jscs',
        'jsonlint',
        'less:readyMade',
        'less:customMade',
        'autofix'
    ]);
    grunt.registerTask('dev', ['default']); // Alias for `default`.

    /**
     * Define tasks : Tasks for build eco - system.
     */
    grunt.registerTask('build', [
        'htmlhint',
        'csslint',
        'jshint',
        'jsonlint',
        'compileless',
        'autofix',
        'clean',
        'shell',
        'strip',
        'htmlmin',
        'usebanner'
    ]);

    /**
     * Define sub-tasks : Tasks for Less compilation.
     */
    grunt.registerTask('compileless', ['less:readyMade', 'less:customMade']);

    /**
     * Define sub-tasks : Alias for `autofix`
     */
    grunt.registerTask('autofix', ['autoprefixer']);

    /**
     * Define sub-tasks : Alias for `tests`
     */
    grunt.registerTask('tests', ['qunit']);

};<|endoftext|>


<commit_before>/**
 * Gruntfile for freedom-for-chrome.js
 *
 * Here are the common tasks used
 *
 **/

var FILES = {
  platform: [
    'providers/*.js'
  ],
  platformSpec: [
    'spec/*.unit.spec.js'
  ],
  platformIntegration: [
    'spec/*.integration.spec.js'
  ]
};

var fileInfo = require('freedom'),
  freedomPrefix = require.resolve('freedom').substr(0,
      require.resolve('freedom').lastIndexOf('freedom') + 8);

var addPrefix = function (file) {
  if (file.indexOf('!') !== 0 && file.indexOf('/') !== 0) {
    return freedomPrefix + file;
  }
  return file;
};

var freedomSrc = [].concat(
  fileInfo.FILES.lib,
  fileInfo.FILES.srcCore,
  fileInfo.FILES.srcPlatform
).map(addPrefix);

FILES.karma = fileInfo.unGlob([].concat(
  fileInfo.FILES.srcCore,
  fileInfo.FILES.srcPlatform,
  fileInfo.FILES.srcJasmineHelper,
  fileInfo.FILES.specCoreUnit,
  fileInfo.FILES.specPlatformUnit,
  fileInfo.FILES.srcProviderIntegration,
  fileInfo.FILES.specProviderIntegration
//).map(addPrefix));
).map(addPrefix).concat(
  FILES.platform,
  FILES.platformSpec
));

FILES.karmaCoverage = [].concat(
  fileInfo.FILES.srcCore,
  fileInfo.FILES.srcPlatform
).map(addPrefix);

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    karma: {
      options: {
        configFile: 'karma.conf.js',
        //Need to run connect:default to host files
        proxies: {'/': 'http://localhost:8000/'}
      },
      single: { singleRun: true, autoWatch: false },
      watch: { singleRun: false, autoWatch: true },
      phantom: {
        exclude: FILES.karma.exclude.concat(
          fileInfo.FILES.specProviderIntegration.map(addPrefix)),
        browsers: ['PhantomJS'],
        singleRun: true,
        autoWatch: false
      },
      cordova: {
        browsers: ['Cordova'],
        singleRun: true,
        autoWatch: false,
        cordovaSettings: {
          platforms: ['android'],//, 'ios'],providers/tcpsocket.js
          plugins: [
            'org.chromium.common',
            'org.chromium.socket',
            'org.chromium.storage',
            'org.apache.cordova.console',
            //'org.chromium.polyfill.xhr_features',
          ]
        }
      }
    },
    connect: {
      default: {
        options: {
          port: 8000,
          keepalive: false,
          base: [freedomPrefix, './']
        }
      }
    },
    jshint: {
      providers: [FILES.platform],
      options: {
        '-W069': true
      }
    },
    uglify: {
      freedom: {
        options: {
          sourceMap: true,
          // sourceMapName must be the same as that defined in the final comment
          // of the `freedom/src/util/postamble.js`
          sourceMapName: 'freedom.map',
          sourceMapIncludeSources: true,
          mangle: false,
          // compress: false, wrap: false, // uncomment to get a clean out file.
          beautify: true,
          preserveComments: function(node, comment) {
            return comment.value.indexOf('jslint') !== 0;
          },
          banner: require('fs').readFileSync(freedomPrefix + 'src/util/preamble.js', 'utf8'),
          footer: require('fs').readFileSync(freedomPrefix + 'src/util/postamble.js', 'utf8')
        },
        files: {
          'freedom-for-chrome.js': freedomSrc.concat(FILES.platform)
        }
      }
    },
    integration: {
      providers: {
        options: {
          templateId: 'khhlpmfebmkkibipnllkeanfadmigbnj',
          spec: FILES.platformIntegration,
          helper: FILES.platform,
          keepBrowser: false
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-karma');

  grunt.loadTasks('tasks');

  grunt.registerTask('build', [
    'jshint:providers',
    'uglify',
    'connect:default'
  ]);
  grunt.registerTask('test', [
    'build',
    'karma:single',
    'integration'
  ]);
  grunt.registerTask('debug', [
    'build',
    'karma:watch'
  ]);
  grunt.registerTask('cordova', [
    'build',
    'karma:cordova'
  ]);

  grunt.registerTask('default', ['build', 'karma:phantom']);
};

module.exports.FILES = FILES;
<commit_msg>removed comment<commit_after>/**
 * Gruntfile for freedom-for-chrome.js
 *
 * Here are the common tasks used
 *
 **/

var FILES = {
  platform: [
    'providers/*.js'
  ],
  platformSpec: [
    'spec/*.unit.spec.js'
  ],
  platformIntegration: [
    'spec/*.integration.spec.js'
  ]
};

var fileInfo = require('freedom'),
  freedomPrefix = require.resolve('freedom').substr(0,
      require.resolve('freedom').lastIndexOf('freedom') + 8);

var addPrefix = function (file) {
  if (file.indexOf('!') !== 0 && file.indexOf('/') !== 0) {
    return freedomPrefix + file;
  }
  return file;
};

var freedomSrc = [].concat(
  fileInfo.FILES.lib,
  fileInfo.FILES.srcCore,
  fileInfo.FILES.srcPlatform
).map(addPrefix);

FILES.karma = fileInfo.unGlob([].concat(
  fileInfo.FILES.srcCore,
  fileInfo.FILES.srcPlatform,
  fileInfo.FILES.srcJasmineHelper,
  fileInfo.FILES.specCoreUnit,
  fileInfo.FILES.specPlatformUnit,
  fileInfo.FILES.srcProviderIntegration,
  fileInfo.FILES.specProviderIntegration
).map(addPrefix).concat(
  FILES.platform,
  FILES.platformSpec
));

FILES.karmaCoverage = [].concat(
  fileInfo.FILES.srcCore,
  fileInfo.FILES.srcPlatform
).map(addPrefix);

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    karma: {
      options: {
        configFile: 'karma.conf.js',
        //Need to run connect:default to host files
        proxies: {'/': 'http://localhost:8000/'}
      },
      single: { singleRun: true, autoWatch: false },
      watch: { singleRun: false, autoWatch: true },
      phantom: {
        exclude: FILES.karma.exclude.concat(
          fileInfo.FILES.specProviderIntegration.map(addPrefix)),
        browsers: ['PhantomJS'],
        singleRun: true,
        autoWatch: false
      },
      cordova: {
        browsers: ['Cordova'],
        singleRun: true,
        autoWatch: false,
        cordovaSettings: {
          platforms: ['android'],//, 'ios'],providers/tcpsocket.js
          plugins: [
            'org.chromium.common',
            'org.chromium.socket',
            'org.chromium.storage',
            'org.apache.cordova.console',
            //'org.chromium.polyfill.xhr_features',
          ]
        }
      }
    },
    connect: {
      default: {
        options: {
          port: 8000,
          keepalive: false,
          base: [freedomPrefix, './']
        }
      }
    },
    jshint: {
      providers: [FILES.platform],
      options: {
        '-W069': true
      }
    },
    uglify: {
      freedom: {
        options: {
          sourceMap: true,
          // sourceMapName must be the same as that defined in the final comment
          // of the `freedom/src/util/postamble.js`
          sourceMapName: 'freedom.map',
          sourceMapIncludeSources: true,
          mangle: false,
          // compress: false, wrap: false, // uncomment to get a clean out file.
          beautify: true,
          preserveComments: function(node, comment) {
            return comment.value.indexOf('jslint') !== 0;
          },
          banner: require('fs').readFileSync(freedomPrefix + 'src/util/preamble.js', 'utf8'),
          footer: require('fs').readFileSync(freedomPrefix + 'src/util/postamble.js', 'utf8')
        },
        files: {
          'freedom-for-chrome.js': freedomSrc.concat(FILES.platform)
        }
      }
    },
    integration: {
      providers: {
        options: {
          templateId: 'khhlpmfebmkkibipnllkeanfadmigbnj',
          spec: FILES.platformIntegration,
          helper: FILES.platform,
          keepBrowser: false
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-karma');

  grunt.loadTasks('tasks');

  grunt.registerTask('build', [
    'jshint:providers',
    'uglify',
    'connect:default'
  ]);
  grunt.registerTask('test', [
    'build',
    'karma:single',
    'integration'
  ]);
  grunt.registerTask('debug', [
    'build',
    'karma:watch'
  ]);
  grunt.registerTask('cordova', [
    'build',
    'karma:cordova'
  ]);

  grunt.registerTask('default', ['build', 'karma:phantom']);
};

module.exports.FILES = FILES;
<|endoftext|>


<commit_before>
// use chipper's gruntfile
module.exports = require( '../chipper/js/grunt/Gruntfile.js' );
<commit_msg>Added copyright statement for lint see https://github.com/phetsims/special-ops/issues/49<commit_after>// Copyright 2016, University of Colorado Boulder

// use chipper's gruntfile
module.exports = require( '../chipper/js/grunt/Gruntfile.js' );
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  var config = require('./config');
  var styleguide = require('sc5-styleguide');
  var path = require('path');
  var wiredep = require('wiredep');
  var cors_proxy = require('cors-anywhere');

  var gulp = require('gulp');
  // registering promisies for gulp...
  require("any-promise/register")("bluebird");
  var sass = require('gulp-sass');
  var bless = require('gulp-bless');
  var sourcemaps = require('gulp-sourcemaps');
  var concat = require('gulp-concat');
  var replace = require('gulp-replace');

  grunt.loadNpmTasks('grunt-ngdocs');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    clean: ['build', 'quality'],
    jshint: {
      options: {
        undef: false,
        strict: false,
        '-W030': true,
        unused: false,
        passfail: true,
        reporter: 'checkstyle',
        reporterOutput: 'quality/js/checkstyle-results.xml'
      },
      all: [config.app.src + '/webapp/public/js/**/*.js']
    },
    sasslint: {
      src: [
        path.join(config.app.src,'**/*.scss'),
        '!**/ng-grid.scss'
      ],
      options: {
        bench: false,
        config: '.sasslint.json'
      }
    },
    watch: {
      files: config.app.src + '/**/*',
      tasks: ['copy', 'concat', 'sass', 'replace'],
      options: {
        spawn: false
      }
    },
    uglify: {
      options: {
        mangle: false,
        beautify: true,
        report: 'min',
        preserveComments: false
      },
      files: {
        cwd: config.app.dest + '/public/',
        src: ['**/*.js'],
        dest: config.app.dest + '/public/',
        expand: true,
        flatten: false
      }
    },
    connect: {
      server: {
        options: {
          keepalive: true,
          debug: true,
          port: 9000,
          base: config.app.dest
        }
      }
    },
    karma: {
      options: {
        configFile: 'karma.config.js'
      },
      unit: {
        // default
      },
      tdd: {
        singleRun: false
      }
    },
    replace: {
      serverurl: {
        src: [config.app.dest + '/public/**/*.js'],
        overwrite: true,
        replacements: [{
          from: '@@OPENLMIS_SERVER_URL',
          to: makeURL('openlmisServerURL')
        },{
          from: '@@AUTH_SERVICE_URL',
          to: makeURL('authServiceURL')
        },{
          from: '@@REQUISITION_SERVICE_URL',
          to: makeURL('requisitionServiceURL')
        }]
      }
    },
    concat: {
      js: {
        options: {
          sourceMap: true
        },
        src: function(){
          var appFiles = [
            // Base files
            config.app.src + '/webapp/public/js/shared/util.js',
            config.app.src + '/webapp/public/js/shared/*.js',
            config.app.src + '/webapp/public/js/shared/services/services.js',
            config.app.src + '/webapp/public/js/shared/**/*.js',
            // Module registration
            config.app.src + '/webapp/public/**/module/*.js',
            config.app.src + '/webapp/public/**/*.module.js',
            // Special file types....
            config.app.src + '/webapp/public/**/*.config.js',
            config.app.src + '/webapp/public/**/*.routes.js',
            '!' + config.app.src + '/webapp/public/app.routes.js',
            // Everything else
            config.app.src + '/webapp/public/**/*.js',
            '!' + config.app.src + '/**/*.spec.js',
            '!' + config.app.src + '/webapp/public/app.js',
            '!' + config.app.src + '/webapp/public/app.routes.js',
            // Run time
            // NEED file to declare openlmis-app
            config.app.src + '/webapp/public/app.js',
            config.app.src + '/webapp/public/app.routes.js'
          ];
          // hack to make jquery load first
          return [
              'bower_components/jquery/dist/jquery.js',
              'bower_components/jquery-ui/jquery-ui.js'
            ].concat(
              wiredep().js,
              [
                'vendor/ng-grid-2.0.7.min.js',
                'vendor/base2.js'
              ],
              appFiles
            );
        }(),
        dest: config.app.dest + '/public/openlmis.js'
      }
    },
    copy: {
      main: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/',
            src: ['*'],
            dest: config.app.dest + '/public',
            filter: 'isFile'
          }
        ],
      },
      images: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/public/',
            src: [
              '**/*.png',
              '**/*.jpg',
              '**/*.gif'
            ],
            dest: config.app.dest + '/public'
          }
        ],
      },
      img: {
        files: [
          {
            expand: true,
            flatten: true,
            cwd: config.app.src + '/webapp/public/lib/',
            src: ['**/img/**'],
            dest: config.app.dest + '/public/img'
          }
        ],
      },
      fonts: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/public/fonts/',
            src: ['**'],
            dest: config.app.dest + '/public/fonts'
          }
        ],
      },
      pages: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/public/',
            src: ['**/**.html'],
            dest: config.app.dest + '/public'
          }
        ],
      },
      messages: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/resources',
            src: ['messages_*.json'],
            dest: config.app.dest + '/public/messages'
          }
        ]
      },
      credentials: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/resources',
            src: ['auth_server_client.json'],
            dest: config.app.dest + '/public/credentials'
          }
        ]
      },
      fontAwesomeFonts: {
        files: [
          {
            expand: true,
            cwd: 'bower_components/font-awesome/fonts/',
            src: '*',
            dest: path.join(config.app.dest, 'public/fonts')
          }
        ]
      },
      uiGridFonts: {
        files: [
          {
            expand: true,
            cwd: 'bower_components/angular-ui-grid/',
            src: [
              'ui-grid.eot',
              'ui-grid.svg',
              'ui-grid.ttf',
              'ui-grid.woff'
            ],
            dest: config.app.dest + '/public/fonts'
          }
        ]
      },
      bootstrapFonts: {
        files: [
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: [
              'glyphicons-halflings-regular.eot',
              'glyphicons-halflings-regular.svg',
              'glyphicons-halflings-regular.ttf',
              'glyphicons-halflings-regular.woff',
              'glyphicons-halflings-regular.woff2'
            ],
            dest: config.app.dest + '/public/fonts/bootstrap'
          }
        ]
      },
      selectTwoImages: {
        expand: true,
        cwd: 'bower_components/select2/',
        src: [
            '*.png',
            '*.gif'
        ],
        dest: path.join(config.app.dest, 'public/images')
      }
    },
    ngdocs: {
      options:{
        dest: "./build/docs",
        title: "OpenLMIS-UI Documentation"
      },
      api: {
        src: [
          path.join(config.app.src, "**/*.js"),
          "!" + path.join(config.app.src, "**/*.spec.js")
        ],
        title: "API"
      }
    },
    gulp: {
      'styleguide-generate': function() {
        return gulp.src([
                        path.join(config.styleguide.src,"**/*.scss"),
                        "!"+path.join(config.styleguide.src,"**/scss/*.scss")
                        ])
          .pipe(styleguide.generate({
            title: 'OpenLMIS Styleguide',
            appRoot: '/styleguide',
            //extraHead: '<link rel="stylesheet" type="text/css" href="/openlmis-requisition-refUI/docs/body.css"/>',
            //disableHtml5Mode: true,
            overviewPath: './overview.md'
          }))
          .pipe(gulp.dest(config.styleguide.dest));
      },
      'styleguide-applystyles': function() {
        return gulp.src([
                  path.join(config.app.dest,"/public/openlmis*.css")
                  ])
          .pipe(styleguide.applyStyles())
          .pipe(gulp.dest(config.styleguide.dest));
      },
      'styleguide-fonts': function() {
        return gulp.src([
            path.join(config.app.dest, "public/fonts/*"),
          ])
          .pipe(gulp.dest(path.join(config.styleguide.dest,"fonts")));
      },
      'styleguide-png': function() {
        return gulp.src([
                    config.app.dest + "/public/images/*",
                    config.app.dest + "/public/images/*"
                   ])
          .pipe(gulp.dest(path.join(config.styleguide.dest,"images")));
      },
      'sass': function(){
   var includePaths = require('node-bourbon').includePaths.concat([
        config.app.src,
        'bower_components/font-awesome/scss',
        'bower_components/bootstrap-sass/assets/stylesheets',
        'bower_components/select2/src/scss'
    ]);

    var bowerCss = wiredep().css;
    var bowerSass = wiredep().scss;

    var files = [].concat(
      [
        path.join(config.app.src, "**/*variables.scss"),
        path.join(config.app.src, "**/*.variables.scss")
      ],
      bowerSass,
      bowerCss,
      [
        path.join(config.app.src, "/**/*mixins.scss"),
        path.join(config.app.src, "/**/*.mixins.scss"),
        path.join(config.app.src, '**/*.css'),
        path.join(config.app.src, '**/*.scss'),
        "!" + path.join(config.app.src, "webapp/public/scss/*")
      ]);

    var outputStyle = "expanded";
    if(grunt.option('production')) outputStyle = "compressed";

    return gulp.src(files)
   .pipe(sourcemaps.init())
    .pipe(concat({
      path:'openlmis.scss'
    }))
    .pipe(sass({
      includePaths: includePaths,
      outputStyle: outputStyle,
    }))
    .pipe(sourcemaps.write())
    .pipe(concat('openlmis.css'))
    .pipe(sass().on('error', sass.logError))
    .pipe(replace('../','')) // remove non-relative strings
    //Replace UI-Grid font paths
    .pipe(replace('ui-grid.eot','fonts/ui-grid.eot'))
    .pipe(replace('ui-grid.ttf','fonts/ui-grid.ttf'))
    .pipe(replace('ui-grid.woff','fonts/ui-grid.woff'))
    .pipe(replace('ui-grid.svg','fonts/ui-grid.svg'))
    //Replace Select2 image locations
    .pipe(replace('select2.png','images/select2.png'))
    .pipe(replace('select2-spinner.gif','images/select2-spinner.gif'))
    .pipe(replace('select2x2.png','images/select2x2.png'))
    .pipe(bless())
    .pipe(gulp.dest(
      path.join(config.app.dest, "public")
    ));
      }
    }
  });

  grunt.registerTask('sass', ['gulp:sass']);

  function makeURL(key){
    if (!key) {
      return false;
    }
    var url = grunt.option(key) || config[key];
    if (grunt.option('addProxyService') && url && url.substr(0,4).toLowerCase() == "http") {
      return 'http://127.0.0.1:3030/' + url;
    } else {
      return url;
    }
  }

  grunt.registerTask('serve:proxy', 'Start proxy server', function(){
    var host = '127.0.0.1';
    var port = 3030;

    if (grunt.option('addProxyService')){
      grunt.log.writeln('starting proxy server at ' + host + ':' + port);
      cors_proxy.createServer().listen(port, host);
    }
  });

  grunt.registerTask('serve', ['serve:proxy', 'connect:server']);

  var buildTasks = ['clean', 'copy', 'concat', 'sass', 'replace'];
  var styleguideTasks = ['gulp:styleguide-generate', 'gulp:styleguide-png', 'gulp:styleguide-fonts', 'gulp:styleguide-applystyles'];

  if(grunt.option('production')) buildTasks.push('uglify');
  if(grunt.option('test')) buildTasks.push('karma:unit');
  if(grunt.option('styleguide')) buildTasks = buildTasks.concat(styleguideTasks);
  if(grunt.option('docs')) buildTasks.push('ngdocs');

  grunt.registerTask('build', buildTasks);

  grunt.registerTask('check', ['clean', 'jshint', 'sasslint']);

  grunt.registerTask('docs', ['build'].concat('ngdocs'));
  grunt.registerTask('styleguide', ['build'].concat(styleguideTasks));
};
<commit_msg>OLMIS-1067: Made tests, styleguide, and docs build when 'grunt build' is run<commit_after>module.exports = function(grunt) {
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  var config = require('./config');
  var styleguide = require('sc5-styleguide');
  var path = require('path');
  var wiredep = require('wiredep');
  var cors_proxy = require('cors-anywhere');

  var gulp = require('gulp');
  // registering promisies for gulp...
  require("any-promise/register")("bluebird");
  var sass = require('gulp-sass');
  var bless = require('gulp-bless');
  var sourcemaps = require('gulp-sourcemaps');
  var concat = require('gulp-concat');
  var replace = require('gulp-replace');

  grunt.loadNpmTasks('grunt-ngdocs');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    clean: ['build', 'quality'],
    jshint: {
      options: {
        undef: false,
        strict: false,
        '-W030': true,
        unused: false,
        passfail: true,
        reporter: 'checkstyle',
        reporterOutput: 'quality/js/checkstyle-results.xml'
      },
      all: [config.app.src + '/webapp/public/js/**/*.js']
    },
    sasslint: {
      src: [
        path.join(config.app.src,'**/*.scss'),
        '!**/ng-grid.scss'
      ],
      options: {
        bench: false,
        config: '.sasslint.json'
      }
    },
    watch: {
      files: config.app.src + '/**/*',
      tasks: ['copy', 'concat', 'sass', 'replace'],
      options: {
        spawn: false
      }
    },
    uglify: {
      options: {
        mangle: false,
        beautify: true,
        report: 'min',
        preserveComments: false
      },
      files: {
        cwd: config.app.dest + '/public/',
        src: ['**/*.js'],
        dest: config.app.dest + '/public/',
        expand: true,
        flatten: false
      }
    },
    connect: {
      server: {
        options: {
          keepalive: true,
          debug: true,
          port: 9000,
          base: config.app.dest
        }
      }
    },
    karma: {
      options: {
        configFile: 'karma.config.js'
      },
      unit: {
        // default
      },
      tdd: {
        singleRun: false
      }
    },
    replace: {
      serverurl: {
        src: [config.app.dest + '/public/**/*.js'],
        overwrite: true,
        replacements: [{
          from: '@@OPENLMIS_SERVER_URL',
          to: makeURL('openlmisServerURL')
        },{
          from: '@@AUTH_SERVICE_URL',
          to: makeURL('authServiceURL')
        },{
          from: '@@REQUISITION_SERVICE_URL',
          to: makeURL('requisitionServiceURL')
        }]
      }
    },
    concat: {
      js: {
        options: {
          sourceMap: true
        },
        src: function(){
          var appFiles = [
            // Base files
            config.app.src + '/webapp/public/js/shared/util.js',
            config.app.src + '/webapp/public/js/shared/*.js',
            config.app.src + '/webapp/public/js/shared/services/services.js',
            config.app.src + '/webapp/public/js/shared/**/*.js',
            // Module registration
            config.app.src + '/webapp/public/**/module/*.js',
            config.app.src + '/webapp/public/**/*.module.js',
            // Special file types....
            config.app.src + '/webapp/public/**/*.config.js',
            config.app.src + '/webapp/public/**/*.routes.js',
            '!' + config.app.src + '/webapp/public/app.routes.js',
            // Everything else
            config.app.src + '/webapp/public/**/*.js',
            '!' + config.app.src + '/**/*.spec.js',
            '!' + config.app.src + '/webapp/public/app.js',
            '!' + config.app.src + '/webapp/public/app.routes.js',
            // Run time
            // NEED file to declare openlmis-app
            config.app.src + '/webapp/public/app.js',
            config.app.src + '/webapp/public/app.routes.js'
          ];
          // hack to make jquery load first
          return [
              'bower_components/jquery/dist/jquery.js',
              'bower_components/jquery-ui/jquery-ui.js'
            ].concat(
              wiredep().js,
              [
                'vendor/ng-grid-2.0.7.min.js',
                'vendor/base2.js'
              ],
              appFiles
            );
        }(),
        dest: config.app.dest + '/public/openlmis.js'
      }
    },
    copy: {
      main: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/',
            src: ['*'],
            dest: config.app.dest + '/public',
            filter: 'isFile'
          }
        ],
      },
      images: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/public/',
            src: [
              '**/*.png',
              '**/*.jpg',
              '**/*.gif'
            ],
            dest: config.app.dest + '/public'
          }
        ],
      },
      img: {
        files: [
          {
            expand: true,
            flatten: true,
            cwd: config.app.src + '/webapp/public/lib/',
            src: ['**/img/**'],
            dest: config.app.dest + '/public/img'
          }
        ],
      },
      fonts: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/public/fonts/',
            src: ['**'],
            dest: config.app.dest + '/public/fonts'
          }
        ],
      },
      pages: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/webapp/public/',
            src: ['**/**.html'],
            dest: config.app.dest + '/public'
          }
        ],
      },
      messages: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/resources',
            src: ['messages_*.json'],
            dest: config.app.dest + '/public/messages'
          }
        ]
      },
      credentials: {
        files: [
          {
            expand: true,
            cwd: config.app.src + '/resources',
            src: ['auth_server_client.json'],
            dest: config.app.dest + '/public/credentials'
          }
        ]
      },
      fontAwesomeFonts: {
        files: [
          {
            expand: true,
            cwd: 'bower_components/font-awesome/fonts/',
            src: '*',
            dest: path.join(config.app.dest, 'public/fonts')
          }
        ]
      },
      uiGridFonts: {
        files: [
          {
            expand: true,
            cwd: 'bower_components/angular-ui-grid/',
            src: [
              'ui-grid.eot',
              'ui-grid.svg',
              'ui-grid.ttf',
              'ui-grid.woff'
            ],
            dest: config.app.dest + '/public/fonts'
          }
        ]
      },
      bootstrapFonts: {
        files: [
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: [
              'glyphicons-halflings-regular.eot',
              'glyphicons-halflings-regular.svg',
              'glyphicons-halflings-regular.ttf',
              'glyphicons-halflings-regular.woff',
              'glyphicons-halflings-regular.woff2'
            ],
            dest: config.app.dest + '/public/fonts/bootstrap'
          }
        ]
      },
      selectTwoImages: {
        expand: true,
        cwd: 'bower_components/select2/',
        src: [
            '*.png',
            '*.gif'
        ],
        dest: path.join(config.app.dest, 'public/images')
      }
    },
    ngdocs: {
      options:{
        dest: "./build/docs",
        title: "OpenLMIS-UI Documentation"
      },
      api: {
        src: [
          path.join(config.app.src, "**/*.js"),
          "!" + path.join(config.app.src, "**/*.spec.js")
        ],
        title: "API"
      }
    },
    gulp: {
      'styleguide-generate': function() {
        return gulp.src([
                        path.join(config.styleguide.src,"**/*.scss"),
                        "!"+path.join(config.styleguide.src,"**/scss/*.scss")
                        ])
          .pipe(styleguide.generate({
            title: 'OpenLMIS Styleguide',
            appRoot: '/styleguide',
            //extraHead: '<link rel="stylesheet" type="text/css" href="/openlmis-requisition-refUI/docs/body.css"/>',
            //disableHtml5Mode: true,
            overviewPath: './overview.md'
          }))
          .pipe(gulp.dest(config.styleguide.dest));
      },
      'styleguide-applystyles': function() {
        return gulp.src([
                  path.join(config.app.dest,"/public/openlmis*.css")
                  ])
          .pipe(styleguide.applyStyles())
          .pipe(gulp.dest(config.styleguide.dest));
      },
      'styleguide-fonts': function() {
        return gulp.src([
            path.join(config.app.dest, "public/fonts/*"),
          ])
          .pipe(gulp.dest(path.join(config.styleguide.dest,"fonts")));
      },
      'styleguide-png': function() {
        return gulp.src([
                    config.app.dest + "/public/images/*",
                    config.app.dest + "/public/images/*"
                   ])
          .pipe(gulp.dest(path.join(config.styleguide.dest,"images")));
      },
      'sass': function(){
   var includePaths = require('node-bourbon').includePaths.concat([
        config.app.src,
        'bower_components/font-awesome/scss',
        'bower_components/bootstrap-sass/assets/stylesheets',
        'bower_components/select2/src/scss'
    ]);

    var bowerCss = wiredep().css;
    var bowerSass = wiredep().scss;

    var files = [].concat(
      [
        path.join(config.app.src, "**/*variables.scss"),
        path.join(config.app.src, "**/*.variables.scss")
      ],
      bowerSass,
      bowerCss,
      [
        path.join(config.app.src, "/**/*mixins.scss"),
        path.join(config.app.src, "/**/*.mixins.scss"),
        path.join(config.app.src, '**/*.css'),
        path.join(config.app.src, '**/*.scss'),
        "!" + path.join(config.app.src, "webapp/public/scss/*")
      ]);

    var outputStyle = "expanded";
    if(grunt.option('production')) outputStyle = "compressed";

    return gulp.src(files)
   .pipe(sourcemaps.init())
    .pipe(concat({
      path:'openlmis.scss'
    }))
    .pipe(sass({
      includePaths: includePaths,
      outputStyle: outputStyle,
    }))
    .pipe(sourcemaps.write())
    .pipe(concat('openlmis.css'))
    .pipe(sass().on('error', sass.logError))
    .pipe(replace('../','')) // remove non-relative strings
    //Replace UI-Grid font paths
    .pipe(replace('ui-grid.eot','fonts/ui-grid.eot'))
    .pipe(replace('ui-grid.ttf','fonts/ui-grid.ttf'))
    .pipe(replace('ui-grid.woff','fonts/ui-grid.woff'))
    .pipe(replace('ui-grid.svg','fonts/ui-grid.svg'))
    //Replace Select2 image locations
    .pipe(replace('select2.png','images/select2.png'))
    .pipe(replace('select2-spinner.gif','images/select2-spinner.gif'))
    .pipe(replace('select2x2.png','images/select2x2.png'))
    .pipe(bless())
    .pipe(gulp.dest(
      path.join(config.app.dest, "public")
    ));
      }
    }
  });

  grunt.registerTask('sass', ['gulp:sass']);

  function makeURL(key){
    if (!key) {
      return false;
    }
    var url = grunt.option(key) || config[key];
    if (grunt.option('addProxyService') && url && url.substr(0,4).toLowerCase() == "http") {
      return 'http://127.0.0.1:3030/' + url;
    } else {
      return url;
    }
  }

  grunt.registerTask('serve:proxy', 'Start proxy server', function(){
    var host = '127.0.0.1';
    var port = 3030;

    if (grunt.option('addProxyService')){
      grunt.log.writeln('starting proxy server at ' + host + ':' + port);
      cors_proxy.createServer().listen(port, host);
    }
  });

  grunt.registerTask('serve', ['serve:proxy', 'connect:server']);

  var buildTasks = ['clean', 'copy', 'concat', 'sass', 'replace'];
  var styleguideTasks = ['gulp:styleguide-generate', 'gulp:styleguide-png', 'gulp:styleguide-fonts', 'gulp:styleguide-applystyles'];

  if(grunt.option('production')) buildTasks.push('uglify');
  if(!grunt.option('no-test')) buildTasks.push('karma:unit');
  if(!grunt.option('no-styleguide')) buildTasks = buildTasks.concat(styleguideTasks);
  if(!grunt.option('no-docs')) buildTasks.push('ngdocs');

  grunt.registerTask('build', buildTasks);

  grunt.registerTask('check', ['clean', 'jshint', 'sasslint']);

  grunt.registerTask('docs', ['build'].concat('ngdocs'));
  grunt.registerTask('styleguide', ['build'].concat(styleguideTasks));
};
<|endoftext|>


<commit_before>/*
 * Copyright 2013, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/eduardolundgren/dotfiles/blob/master/LICENSE.md
 *
 * @author Eduardo Lundgren <eduardo.lundgren@gmail.com>
 */

'use strict';

var userhome = require('userhome');

module.exports = function(grunt) {

    grunt.initConfig({

        // -- Bump -------------------------------------------------------------

        bump: {
            options: {
                commit: true,
                commitFiles: ['package.json'],
                commitMessage: 'Release v%VERSION%',
                createTag: true,
                files: ['package.json'],
                push: true,
                pushTo: 'origin',
                tagMessage: '',
                tagName: 'v%VERSION%'
            }
        },

        // -- Config -----------------------------------------------------------

        config: {

            git: {
                path_gitconfig: userhome('.gitconfig'),
                path_gitignore: userhome('.gitignore_global')
            },

            osx: {
                path_osx: userhome('.osx')
            },

            ruby: {
                path_build: userhome('.rbenv/plugins/ruby-build'),
                path_rbenv: userhome('.rbenv')
            },

            themes: {
                path_dracula: userhome('.themes/dracula'),
            },

            zsh: {
                path_oh_my_zsh: userhome('.oh-my-zsh'),
                path_syntax_highlighting: userhome('.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'),
                path_theme_dracula: userhome('.oh-my-zsh/themes/dracula.zsh-theme'),
                path_z: userhome('.z'),
                path_zshrc: userhome('.zshrc')
            }

        },

        // -- Prompt -----------------------------------------------------------

        prompt: {
            config: {
                options: {
                    questions: [
                        {
                            config: 'config.osx.computername',
                            default: 'eduardo',
                            message: 'Which computer name would you like to use?'
                        },
                        {
                            config: 'config.osx.hostname',
                            default: 'eduardo',
                            message: 'Which hostname would you like to use?'
                        },
                        {
                            config: 'config.osx.localhostname',
                            default: 'eduardo',
                            message: 'Which local hostname would you like to use?'
                        },
                        {
                            config: 'config.osx.netbiosname',
                            default: 'eduardo',
                            message: 'Which netbios name would you like to use?'
                        },
                        {
                            config: 'config.git.name',
                            default: 'Eduardo Lundgren',
                            message: 'Which Git name would you like to use?'
                        },
                        {
                            config: 'config.git.email',
                            default: 'eduardo.lundgren@liferay.com',
                            message: 'Which Git email would you like to use?'
                        },
                        {
                            config: 'config.editor',
                            default: 'subl',
                            message: 'Which editor would you like to use?'
                        },
                        {
                            config: 'config.zsh.plugins',
                            default: 'ant git history-substring-search z zsh-syntax-highlighting',
                            message: 'Which Oh my zsh! plugins would you like to use (https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins)?'
                        },
                        {
                            config: 'config.zsh.theme_oh_my_zsh',
                            default: 'dracula',
                            message: 'Which Oh my zsh! theme would you like to use (https://github.com/robbyrussell/oh-my-zsh/tree/master/themes)?'
                        }
                    ]
                }
            }
        },

        // -- Clean ------------------------------------------------------------

        clean: {

            all: {
                options: {
                    force: true
                },
                src: [
                    '<%= config.git.path_gitconfig %>',
                    '<%= config.git.path_gitignore %>',
                    '<%= config.osx.path_osx %>',
                    '<%= config.ruby.path_build %>',
                    '<%= config.ruby.path_rbenv %>',
                    '<%= config.themes.path_dracula %>',
                    '<%= config.zsh.path_oh_my_zsh %>',
                    '<%= config.zsh.path_syntax_highlighting %>',
                    '<%= config.zsh.path_theme_dracula %>',
                    '<%= config.zsh.path_zshrc %>'
                ]
            }

        },

        // -- Templates --------------------------------------------------------

        template: {

            git: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.git.path_gitconfig %>': ['templates/.gitconfig'],
                    '<%= config.git.path_gitignore %>': ['templates/.gitignore_global']
                }
            },

            osx: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.osx.path_osx %>': ['templates/.osx']
                }
            },

            zsh: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.zsh.path_zshrc %>': ['templates/.zshrc']
                }
            }

        },

        // -- Git --------------------------------------------------------------

        gitclone: {

            ruby_rbenv: {
                options: {
                    directory: '<%= config.ruby.path_rbenv %>',
                    repository: 'https://github.com/sstephenson/rbenv.git'
                }
            },

            ruby_build: {
                options: {
                    directory: '<%= config.ruby.path_build %>',
                    repository: 'https://github.com/sstephenson/ruby-build.git'
                }
            },

            oh_my_zsh: {
                options: {
                    directory: '<%= config.zsh.path_oh_my_zsh %>',
                    repository: 'https://github.com/robbyrussell/oh-my-zsh.git'
                }
            },

            theme_dracula: {
                options: {
                    directory: '<%= config.themes.path_dracula %>',
                    repository: 'https://github.com/zenorocha/dracula-theme.git'
                }
            },

            zsh_syntax_highlighting: {
                options: {
                    directory: '<%= config.zsh.path_syntax_highlighting %>',
                    repository: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
                }
            }

        },

        // -- Symbolic links ---------------------------------------------------

        symlink: {

            sublime: {
                dest: '/usr/local/bin/subl',
                relativeSrc: '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'
            },

            zsh_theme_dracula: {
                dest: '<%= config.zsh.path_theme_dracula %>',
                relativeSrc: '<%= config.themes.path_dracula %>/zsh/dracula.zsh-theme'
            }

        },

        // -- Exec -------------------------------------------------------------

        shell: {

            osx: {
                command: 'source <%= config.osx.path_osx %>'
            },

            z: {
                command: 'touch <%= config.zsh.path_z %>'
            },

            zsh: {
                command: 'chsh -s /bin/zsh'
            },

            theme_alfred: {
                command: 'open <%= config.themes.path_dracula %>/alfred/Dracula.alfredappearance'
            },

            theme_iterm: {
                command: 'open <%= config.themes.path_dracula %>/iterm/Dracula.itermcolors'
            },

            node_latest: {
                command: 'sudo n latest'
            },

            node_stable: {
                command: 'sudo n stable'
            },

            ruby_compass: {
                command: 'sudo gem install compass'
            },

            ruby_jekyll: {
                command: 'sudo gem install jekyll'
            },

            ruby_update: {
                command: 'sudo gem update --system'
            }

        }

    });

    grunt.task.registerTask('banner', function() {
        console.log(grunt.file.read('templates/.banner'));
    });

    grunt.loadNpmTasks('grunt-bump');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-git');
    grunt.loadNpmTasks('grunt-prompt');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-symlink');
    grunt.loadNpmTasks('grunt-template');

    grunt.registerTask('setup', ['banner', 'prompt', 'clean', 'template', 'gitclone', 'shell', 'symlink']);

};<commit_msg>Fix oh-my-zsh default theme repository<commit_after>/*
 * Copyright 2013, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/eduardolundgren/dotfiles/blob/master/LICENSE.md
 *
 * @author Eduardo Lundgren <eduardo.lundgren@gmail.com>
 */

'use strict';

var userhome = require('userhome');

module.exports = function(grunt) {

    grunt.initConfig({

        // -- Bump -------------------------------------------------------------

        bump: {
            options: {
                commit: true,
                commitFiles: ['package.json'],
                commitMessage: 'Release v%VERSION%',
                createTag: true,
                files: ['package.json'],
                push: true,
                pushTo: 'origin',
                tagMessage: '',
                tagName: 'v%VERSION%'
            }
        },

        // -- Config -----------------------------------------------------------

        config: {

            git: {
                path_gitconfig: userhome('.gitconfig'),
                path_gitignore: userhome('.gitignore_global')
            },

            osx: {
                path_osx: userhome('.osx')
            },

            ruby: {
                path_build: userhome('.rbenv/plugins/ruby-build'),
                path_rbenv: userhome('.rbenv')
            },

            themes: {
                path_dracula: userhome('.themes/dracula'),
            },

            zsh: {
                path_oh_my_zsh: userhome('.oh-my-zsh'),
                path_syntax_highlighting: userhome('.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'),
                path_theme_dracula: userhome('.oh-my-zsh/themes/dracula.zsh-theme'),
                path_z: userhome('.z'),
                path_zshrc: userhome('.zshrc')
            }

        },

        // -- Prompt -----------------------------------------------------------

        prompt: {
            config: {
                options: {
                    questions: [
                        {
                            config: 'config.osx.computername',
                            default: 'eduardo',
                            message: 'Which computer name would you like to use?'
                        },
                        {
                            config: 'config.osx.hostname',
                            default: 'eduardo',
                            message: 'Which hostname would you like to use?'
                        },
                        {
                            config: 'config.osx.localhostname',
                            default: 'eduardo',
                            message: 'Which local hostname would you like to use?'
                        },
                        {
                            config: 'config.osx.netbiosname',
                            default: 'eduardo',
                            message: 'Which netbios name would you like to use?'
                        },
                        {
                            config: 'config.git.name',
                            default: 'Eduardo Lundgren',
                            message: 'Which Git name would you like to use?'
                        },
                        {
                            config: 'config.git.email',
                            default: 'eduardo.lundgren@liferay.com',
                            message: 'Which Git email would you like to use?'
                        },
                        {
                            config: 'config.editor',
                            default: 'subl',
                            message: 'Which editor would you like to use?'
                        },
                        {
                            config: 'config.zsh.plugins',
                            default: 'ant git history-substring-search z zsh-syntax-highlighting',
                            message: 'Which Oh-my-zsh plugins would you like to use (https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins)?'
                        },
                        {
                            config: 'config.zsh.theme_oh_my_zsh',
                            default: 'dracula',
                            message: 'Which Oh-my-zsh theme would you like to use (https://github.com/zenorocha/dracula-theme)?'
                        }
                    ]
                }
            }
        },

        // -- Clean ------------------------------------------------------------

        clean: {

            all: {
                options: {
                    force: true
                },
                src: [
                    '<%= config.git.path_gitconfig %>',
                    '<%= config.git.path_gitignore %>',
                    '<%= config.osx.path_osx %>',
                    '<%= config.ruby.path_build %>',
                    '<%= config.ruby.path_rbenv %>',
                    '<%= config.themes.path_dracula %>',
                    '<%= config.zsh.path_oh_my_zsh %>',
                    '<%= config.zsh.path_syntax_highlighting %>',
                    '<%= config.zsh.path_theme_dracula %>',
                    '<%= config.zsh.path_zshrc %>'
                ]
            }

        },

        // -- Templates --------------------------------------------------------

        template: {

            git: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.git.path_gitconfig %>': ['templates/.gitconfig'],
                    '<%= config.git.path_gitignore %>': ['templates/.gitignore_global']
                }
            },

            osx: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.osx.path_osx %>': ['templates/.osx']
                }
            },

            zsh: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.zsh.path_zshrc %>': ['templates/.zshrc']
                }
            }

        },

        // -- Git --------------------------------------------------------------

        gitclone: {

            ruby_rbenv: {
                options: {
                    directory: '<%= config.ruby.path_rbenv %>',
                    repository: 'https://github.com/sstephenson/rbenv.git'
                }
            },

            ruby_build: {
                options: {
                    directory: '<%= config.ruby.path_build %>',
                    repository: 'https://github.com/sstephenson/ruby-build.git'
                }
            },

            oh_my_zsh: {
                options: {
                    directory: '<%= config.zsh.path_oh_my_zsh %>',
                    repository: 'https://github.com/robbyrussell/oh-my-zsh.git'
                }
            },

            theme_dracula: {
                options: {
                    directory: '<%= config.themes.path_dracula %>',
                    repository: 'https://github.com/zenorocha/dracula-theme.git'
                }
            },

            zsh_syntax_highlighting: {
                options: {
                    directory: '<%= config.zsh.path_syntax_highlighting %>',
                    repository: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
                }
            }

        },

        // -- Symbolic links ---------------------------------------------------

        symlink: {

            sublime: {
                dest: '/usr/local/bin/subl',
                relativeSrc: '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'
            },

            zsh_theme_dracula: {
                dest: '<%= config.zsh.path_theme_dracula %>',
                relativeSrc: '<%= config.themes.path_dracula %>/zsh/dracula.zsh-theme'
            }

        },

        // -- Exec -------------------------------------------------------------

        shell: {

            osx: {
                command: 'source <%= config.osx.path_osx %>'
            },

            z: {
                command: 'touch <%= config.zsh.path_z %>'
            },

            zsh: {
                command: 'chsh -s /bin/zsh'
            },

            theme_alfred: {
                command: 'open <%= config.themes.path_dracula %>/alfred/Dracula.alfredappearance'
            },

            theme_iterm: {
                command: 'open <%= config.themes.path_dracula %>/iterm/Dracula.itermcolors'
            },

            node_latest: {
                command: 'sudo n latest'
            },

            node_stable: {
                command: 'sudo n stable'
            },

            ruby_compass: {
                command: 'sudo gem install compass'
            },

            ruby_jekyll: {
                command: 'sudo gem install jekyll'
            },

            ruby_update: {
                command: 'sudo gem update --system'
            }

        }

    });

    grunt.task.registerTask('banner', function() {
        console.log(grunt.file.read('templates/.banner'));
    });

    grunt.loadNpmTasks('grunt-bump');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-git');
    grunt.loadNpmTasks('grunt-prompt');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-symlink');
    grunt.loadNpmTasks('grunt-template');

    grunt.registerTask('setup', ['banner', 'prompt', 'clean', 'template', 'gitclone', 'shell', 'symlink']);

};<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    clean: {
      build: {
        src: ["lib", ".cache", "tests.js.map", "tests.js"]
      }
    },
    copy: {
      main: {
        files: [
          {
            expand: true,
            cwd: 'src/',
            src: ['**/*.js'],
            dest: 'lib/'
          }
        ]
      }
    },
    newer: {
      options: {
        cache: '.cache'
      }
    },
    coffee: {
      options: {
        sourceMap: true
      },
      all: {
        src: ['**/*.coffee.md', '**/*.coffee'],
        dest: 'lib',
        cwd: 'src',
        expand: true,
        ext: '.js'
      }
    },
    mochaTest: {
      test: {
        options: {
          ui: 'bdd',
          quiet: false,
          require: 'coffee-script/register',
          reporter: 'dot',
          check: ['src/**/*.coffee', 'test/**/*.js', 'test/**/*.coffee']
        },
        src: ['test/**/*.coffee', 'test/**/*.js']
      }
    },
    watch: {
      options: {
        nospawn: true
      },
      all: {
        files: ['Gruntfile.coffee', 'tasks/*.coffee', 'src/**/*.coffee', 'src/**/*.coffee.md', 'src/**/*.nools', 'src/**/*.js', 'test/*.coffee']
      }
    }
  });
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-newer');
  grunt.registerTask('build', ['newer:coffee', 'newer:copy']);
  grunt.registerTask('rebuild', ['clean', 'build']);
  grunt.registerTask('test', ['build', 'mochaTest']);
  grunt.registerTask('watch', ['watch']);
  return grunt.registerTask('default', ['test']);
};
<commit_msg>build: remove grunt-release task<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    clean: {
      build: {
        src: ["lib", ".cache", "tests.js.map", "tests.js"]
      }
    },
    copy: {
      main: {
        files: [
          {
            expand: true,
            cwd: 'src/',
            src: ['**/*.js'],
            dest: 'lib/'
          }
        ]
      }
    },
    newer: {
      options: {
        cache: '.cache'
      }
    },
    coffee: {
      options: {
        sourceMap: true
      },
      all: {
        src: ['**/*.coffee.md', '**/*.coffee'],
        dest: 'lib',
        cwd: 'src',
        expand: true,
        ext: '.js'
      }
    },
    mochaTest: {
      test: {
        options: {
          ui: 'bdd',
          quiet: false,
          require: 'coffee-script/register',
          reporter: 'dot',
          check: ['src/**/*.coffee', 'test/**/*.js', 'test/**/*.coffee']
        },
        src: ['test/**/*.coffee', 'test/**/*.js']
      }
    },
    watch: {
      options: {
        nospawn: true
      },
      all: {
        files: ['Gruntfile.js', 'tasks/*.coffee', 'src/**/*.coffee', 'src/**/*.coffee.md', 'src/**/*.nools', 'src/**/*.js', 'test/*.coffee']
      }
    }
  });
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-newer');
  grunt.registerTask('build', ['newer:coffee', 'newer:copy']);
  grunt.registerTask('rebuild', ['clean', 'build']);
  grunt.registerTask('test', ['build', 'mochaTest']);
  grunt.registerTask('watch', ['watch']);
  return grunt.registerTask('default', ['test']);
};
<|endoftext|>


<commit_before>// Generated on 2014-10-21 using generator-angular 0.9.8
'use strict';

var shell = require('shelljs');

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  var pkg = grunt.file.readJSON('package.json');
  var archiveBaseName = pkg.name + '-' + pkg.version;

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist',
    archive: archiveBaseName
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/,*/*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/,*/*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/,*/*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729,
      },
      server: {
        proxies: [
          {
            context: '/d',
            host: process.env.GROONGA_HOST || 'localhost',
            port: 10041
          }
        ]
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              require('grunt-connect-proxy/lib/utils').proxyRequest,
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp',
      archive: '<%= yeoman.archive %>'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: './bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: ['*.js', '!oldieshim.js'],
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      },
      archive: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.dist %>',
          dest: '<%= yeoman.archive %>/html',
          src: [
            '**'
          ]
        }, {
          expand: true,
          dot: true,
          cwd: '.',
          dest: '<%= yeoman.archive %>',
          src: [
            'LICENSE',
            'README.md',
            'doc/**/*'
          ]
        }, {
          expand: true,
          dot: true,
          cwd: '.',
          dest: '<%= yeoman.archive %>/source',
          src: [
            '.bowerrc',
            '.jshintrc',
            'Gruntfile.js',
            'bower.json',
            'package.json',
            '<%= yeoman.app %>/**/*',
            '!<%= yeoman.app %>/styles/*.css',
            '!<%= yeoman.app %>/styles/.sass-cache/**/*'
          ]
        }]
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },

    // Release settings
    release: {
      options: {
        bump: false,
        add: false,
        commit: false,
        npm: false
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'configureProxies:server',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);

  grunt.registerTask('archive', 'Archive distributed files', function () {
    shell.exec('tar cvzf ' + archiveBaseName + '.tar.gz ' + archiveBaseName);
  });

  grunt.registerTask('archive:upload', 'Upload archive', function () {
    shell.exec('scp ' +
               archiveBaseName + '.tar.gz ' +
               'packages@packages.groonga.org:public/source/groonga-admin/');
    shell.exec('ssh ' +
               'packages@packages.groonga.org ' +
               'ln -fs ' + archiveBaseName + '.tar.gz ' +
               'public/source/groonga-admin/' + pkg.name + '.tar.gz');
  });

  grunt.registerTask('git:tag', 'Tag the current version', function () {
    var news = grunt.file.read('doc/text/news.md', encoding: 'utf8');
    var releaseNote = '## ' + news.split(/^## /m)[1];
    var releaseNoteFileName = 'release-note.md';
    grunt.file.write(releaseNoteFileName, releaseNote);
    shell.exec('git --annotate ' +
               '--file ' + releaseNoteFileName + ' ' +
               pkg.version);
    grunt.file.delete(releaseNoteFileName);
    shell.exec('git push --tags');
  });

  grunt.registerTask('release:package', 'Release archived package', [
    'build',
    'clean:archive',
    'copy:archive',
    'archive',
    'clean:archive',
    'archive:upload',
    'git:tag'
  ]);
};
<commit_msg>Fix syntax<commit_after>// Generated on 2014-10-21 using generator-angular 0.9.8
'use strict';

var shell = require('shelljs');

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  var pkg = grunt.file.readJSON('package.json');
  var archiveBaseName = pkg.name + '-' + pkg.version;

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist',
    archive: archiveBaseName
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/,*/*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/,*/*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/,*/*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729,
      },
      server: {
        proxies: [
          {
            context: '/d',
            host: process.env.GROONGA_HOST || 'localhost',
            port: 10041
          }
        ]
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              require('grunt-connect-proxy/lib/utils').proxyRequest,
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp',
      archive: '<%= yeoman.archive %>'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: './bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: ['*.js', '!oldieshim.js'],
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      },
      archive: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.dist %>',
          dest: '<%= yeoman.archive %>/html',
          src: [
            '**'
          ]
        }, {
          expand: true,
          dot: true,
          cwd: '.',
          dest: '<%= yeoman.archive %>',
          src: [
            'LICENSE',
            'README.md',
            'doc/**/*'
          ]
        }, {
          expand: true,
          dot: true,
          cwd: '.',
          dest: '<%= yeoman.archive %>/source',
          src: [
            '.bowerrc',
            '.jshintrc',
            'Gruntfile.js',
            'bower.json',
            'package.json',
            '<%= yeoman.app %>/**/*',
            '!<%= yeoman.app %>/styles/*.css',
            '!<%= yeoman.app %>/styles/.sass-cache/**/*'
          ]
        }]
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },

    // Release settings
    release: {
      options: {
        bump: false,
        add: false,
        commit: false,
        npm: false
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'configureProxies:server',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);

  grunt.registerTask('archive', 'Archive distributed files', function () {
    shell.exec('tar cvzf ' + archiveBaseName + '.tar.gz ' + archiveBaseName);
  });

  grunt.registerTask('archive:upload', 'Upload archive', function () {
    shell.exec('scp ' +
               archiveBaseName + '.tar.gz ' +
               'packages@packages.groonga.org:public/source/groonga-admin/');
    shell.exec('ssh ' +
               'packages@packages.groonga.org ' +
               'ln -fs ' + archiveBaseName + '.tar.gz ' +
               'public/source/groonga-admin/' + pkg.name + '.tar.gz');
  });

  grunt.registerTask('git:tag', 'Tag the current version', function () {
    var news = grunt.file.read('doc/text/news.md', {'encoding': 'utf8'});
    var releaseNote = '## ' + news.split(/^## /m)[1];
    var releaseNoteFileName = 'release-note.md';
    grunt.file.write(releaseNoteFileName, releaseNote);
    shell.exec('git --annotate ' +
               '--file ' + releaseNoteFileName + ' ' +
               pkg.version);
    grunt.file.delete(releaseNoteFileName);
    shell.exec('git push --tags');
  });

  grunt.registerTask('release:package', 'Release archived package', [
    'build',
    'clean:archive',
    'copy:archive',
    'archive',
    'clean:archive',
    'archive:upload',
    'git:tag'
  ]);
};
<|endoftext|>