How to use grunt - 10 common examples

To help you get started, we’ve selected a few grunt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apigeecs / apigee-deploy-grunt-plugin / tests / forecastweather-grunt-plugin-api.js View on Github external
/*globals describe:true, it:true, expect:true, before:true, beforeEach:true, after:true, afterEach:true*/
/*jslint node: true */

var grunt = require('grunt');
var testDataFilename = grunt.template.process("<%= apigee_profiles[grunt.option('env')].apiproxy + '-' + grunt.option('env') + '-data' %>");
var async = require('async')
var chai = require('chai')
var assert = require('chai').assert
var expect = require('chai').expect
var request = require('request'), chaiHttp = require('chai-http');
var weatherData = require('./' + testDataFilename);

chai.use(chaiHttp);

describe('ForecastWeather Public API Test',function() {
  "use strict";
  before(function () {
    // get OAuth 2.0 token
    // console.log('initialize');
  });
  beforeEach(function () {
github pghalliday / grunt-mocha-test / test / scenarios / grunt.js View on Github external
for (var filename in src) {
      var sourceArray = data.sourceArrays[filename] = src[filename].source;
      var callCounts = data.callCounts[filename] = src[filename];
    }
    fs.writeFileSync('jscoverage.json', JSON.stringify(data));
  }
};

// override process.exit so that we can capture jscoverage data in grunt failure cases
var exit = process.exit;
process.exit = function(code) {
  writeCoverageData();
  exit(code);
};

grunt.cli(null, function() {
  writeCoverageData();
});
github shipitjs / grunt-shipit / test / unit / tasks / deploy / fetch.js View on Github external
grunt.shipit = shipit = new Shipit();
    shipit.stage = 'test';
    fetchFactory(grunt);
    gruntLog.silent();

    fetchFactory.__set__('mkdirp', mkdirpMock);

    // Shipit config
    shipit.initConfig({
      test: {
        workspace: '/tmp/workspace',
        repositoryUrl: 'git://website.com/user/repo'
      }
    });

    sinon.stub(grunt.shipit, 'local').yields();
  });
github shipitjs / grunt-shipit / test / unit / tasks / deploy / publish.js View on Github external
beforeEach(function () {
    grunt.shipit = shipit = new Shipit();
    shipit.stage = 'test';
    publishFactory(grunt);
    gruntLog.silent();

    // Shipit config
    shipit.initConfig({
      test: {
        deployTo: '/remote/deploy'
      }
    });

    shipit.releasePath = '/remote/deploy/releases/20141704123138';
    shipit.releaseDirname = '20141704123138';

    sinon.stub(shipit, 'remote').yields();
  });
github shipitjs / grunt-shipit / test / unit / tasks / deploy / update.js View on Github external
beforeEach(function () {
    grunt.shipit = shipit = new Shipit();
    shipit.stage = 'test';
    updateFactory(grunt);
    clock = sinon.useFakeTimers(1397730698075);
    gruntLog.silent();

    // Shipit config
    shipit.initConfig({
      test: {
        workspace: '/tmp/workspace',
        deployTo: '/remote/deploy'
      }
    });

    sinon.stub(shipit, 'remote').yields();
    sinon.stub(shipit, 'remoteCopy').yields();
  });
github shipitjs / grunt-shipit / test / unit / tasks / rollback / init.js View on Github external
beforeEach(function () {
    grunt.shipit = shipit = new Shipit();
    shipit.stage = 'test';
    initFactory(grunt);
    gruntLog.silent();

    // Shipit config
    shipit.initConfig({
      test: {
        workspace: '/tmp/workspace',
        deployTo: '/remote/deploy'
      }
    });
  });
github jaubourg / grunt-update-submodules / test / unit.js View on Github external
},
			withCustomParameters: {
				options: {
					params: "--force" // specifies your own command-line parameters
				}
			},
			withNoParameter: {
				options: {
					params: false // blanks command-line parameters
				}
			}
		}
	} );

	// Load tasks
	grunt.loadTasks( path.resolve( __dirname, "../tasks" ) );

	//grunt.registerTask( "default", "update_submodules" );
	//grunt.registerTask( "withCustomParameters", "update_submodules:withCustomParameters" );
	//grunt.registerTask( "withNoParameter", "update_submodules:withNoParameter" );

	return function( task, callback ) {
		var stdout = "";
		var oldWrite = process.stdout.write;
		process.stdout.write = function( string ) {
			stdout += string;
		};
		grunt.tasks( [ task ], {
			verbose: true,
			color: false
		}, function() {
			process.stdout.write = oldWrite;
github spmjs / spm / lib / sdk / grunt.js View on Github external
Object.keys(pkg.dependencies).forEach(function(depName) {
      // global task name should begin with grunt
      if (!/^grunt/.test(depName)) return;
      var filepath = path.join(rootdir, 'node_modules', depName);
      if (grunt.file.exists(filepath)) {
        // Load this task plugin recursively
        grunt.loadGlobalTasks(path.relative(NODE_PATH, filepath));
      }
    });
    // Load the tasks of itself
github popperjs / popper.js / Gruntfile.js View on Github external
var grunt = require('grunt');
var fs = require('fs');
var path = require('path');
var babel = require('rollup-plugin-babel');

var popperVersion = JSON.parse(fs.readFileSync('./package.json')).version;
var tooltipVersion = JSON.parse(fs.readFileSync('./src/tooltip/package.json')).version;

// comma separated list of browsers to run tests inside
var browsers = grunt.option('browsers') ? grunt.option('browsers').split(',') : ['ChromeDebug'];

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown')
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-rollup');
grunt.loadNpmTasks('gruntify-eslint');

module.exports = function Gruntfile(grunt) {
    // Project configuration.
    grunt.initConfig({
        rollup: {
            options: {
                format: 'umd',
                sourceMap: true,
                plugins: () => [
                    babel(),
                ],
                globals: {
                    'popper.js': 'Popper',
                },
github popperjs / popper.js / Gruntfile.js View on Github external
'use strict';

var grunt = require('grunt');
var fs = require('fs');
var path = require('path');
var babel = require('rollup-plugin-babel');

var popperVersion = JSON.parse(fs.readFileSync('./package.json')).version;
var tooltipVersion = JSON.parse(fs.readFileSync('./src/tooltip/package.json')).version;

// comma separated list of browsers to run tests inside
var browsers = grunt.option('browsers') ? grunt.option('browsers').split(',') : ['ChromeDebug'];

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown')
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-rollup');
grunt.loadNpmTasks('gruntify-eslint');

module.exports = function Gruntfile(grunt) {
    // Project configuration.
    grunt.initConfig({
        rollup: {
            options: {
                format: 'umd',
                sourceMap: true,
                plugins: () => [
                    babel(),
                ],