Skip to content

Commit

Permalink
First stab at gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Dec 30, 2013
1 parent 7e1e7ee commit a4d8186
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ language: node_js
node_js:
- '0.10'
- '0.8'
script: "npm run-script travis"
before_script:
- npm install -g bower mocha istanbul generator-angular
- npm install -g bower gulp
- export NODE_PATH="$NVM_PATH/../node_modules"
env:
- DEBUG="generators:*"
51 changes: 51 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var istanbul = require('gulp-istanbul');
var coveralls = require('coveralls');
var fs = require('fs');
var path = require('path');

gulp.task('test', function (cb) {
var coverage = gulp.src(['lib/**/*.js', 'main.js'])
.pipe(istanbul())
.on('end', function () {
gulp.src(['test/*.js'])
.pipe(mocha({ reporter: 'spec', timeout: 100000 }))
.pipe(istanbul.writeReports())
.on('end', cb);
});
});

gulp.task('default', function () {
gulp.src([
'test/*.js',
'lib/**/*.js',
'benchmark/**/*.js',
'main.js',
'doc.js',
'gulpfile.js'
]).pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jscs());

gulp.run('test', function () {
var fileContents = fs.readFileSync(path.join(__dirname, 'coverage/lcov.info'), 'utf8');
coveralls.getOptions(function (err, opt) {
if (err) throw err;
coveralls.convertLcovToCoveralls(fileContents, opt, function (err, data) {
if (err) throw err;
coveralls.sendToCoveralls(data, function (err, response, body) {
var status = JSON.parse(body);
if (!body.error) {
console.log('Coveralls: Success');
} else {
console.log('Coveralls: Error ' + status.message);
}
});
});
});
});
});
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"url": "git://github.com/yeoman/generator.git"
},
"scripts": {
"test": "istanbul cover _mocha --report lcovonly -- test/*.js --reporter list --timeout 100000 && cat ./coverage/lcov.info",
"travis": "istanbul cover _mocha --report lcovonly -- test/*.js --reporter list --timeout 100000 && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"test": "gulp",
"legacy": "mocha test/legacy.js --reporter dot --timeout 100000",
"test-generator": "mocha test/generators/*.js --reporter spec --timeout 100000"
},
Expand Down Expand Up @@ -51,13 +50,16 @@
"class-extend": "~0.1.0"
},
"devDependencies": {
"mocha": "~1.15.1",
"proxyquire": "~0.5.1",
"sinon": "~1.7.3",
"markdox": "~0.1.2",
"coveralls": "~2.6.0",
"mocha-lcov-reporter": "0.0.1",
"istanbul": "~0.1.44",
"benchmark": "~1.0.0"
"benchmark": "~1.0.0",
"gulp": "~3.2.1",
"gulp-mocha": "~0.1.1",
"gulp-jshint": "~1.3.2",
"jshint-stylish": "~0.1.4",
"gulp-jscs": "~0.1.1",
"gulp-istanbul": "~0.1.0"
}
}

0 comments on commit a4d8186

Please sign in to comment.