Comparing version 0.0.4 to 0.0.5
@@ -11,3 +11,3 @@ var es = require('event-stream'); | ||
if(file.isNull()) return cb(null, file); | ||
if(file.isStream()) return cb(new Error('gulp-stylus: streams not supported')); | ||
if(file.isStream()) return cb(new Error('gulp-bump: streams not supported')); | ||
@@ -27,2 +27,2 @@ var regex = /([\'|\"]?version[\'|\"]?[ ]*:[ ]*[\'|\"]?)([\d||A-a|.|-]*)([\'|\"]?)/i; | ||
return es.map(modifyContents); | ||
}; | ||
}; |
{ | ||
"name": "gulp-bump", | ||
"description": "Bump npm versions with Gulp (gulpjs.com)", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "http://github.com/stevelacy/gulp-bump", | ||
@@ -10,4 +10,4 @@ "repository": "git://github.com/stevelacy/gulp-bump.git", | ||
"dependencies": { | ||
"semver":"~2.2.1", | ||
"event-stream":"~3.0.20" | ||
"semver": "~2.2.1", | ||
"event-stream": "~3.0.20" | ||
}, | ||
@@ -17,3 +17,3 @@ "devDependencies": { | ||
"should": "*", | ||
"gulp":"*" | ||
"gulp-util": "~2.2.5" | ||
}, | ||
@@ -26,5 +26,6 @@ "scripts": { | ||
}, | ||
"keywords": [ | ||
"keywords": [ | ||
"gulp", | ||
"bump", | ||
"semver", | ||
"gulpplugin", | ||
@@ -31,0 +32,0 @@ "gulp-plugin" |
109
test/main.js
var fs = require('fs'); | ||
var gulp = require('gulp'); | ||
var gutil = require('gulp-util'); | ||
var es = require('event-stream'); | ||
var fs = require('fs'); | ||
var should = require('should'); | ||
var bump = require('../'); | ||
require('mocha'); | ||
describe('gulp-bump', function() { | ||
it('should bump minor', function(done) { | ||
gulp.task('bump', function(){ | ||
gulp.src('test/package.json') | ||
.pipe(bump()) | ||
.pipe(es.map(function(file){ | ||
String(file.contents.toString()).should.equal(fs.readFileSync('test/expected/default.json').toString()); | ||
done(); | ||
})); | ||
it('should bump minor by default', function(done) { | ||
var fakeFile = new gutil.File({ | ||
base: "test/", | ||
cwd: "test/", | ||
path: "test/package.json", | ||
contents: fs.readFileSync('test/package.json') | ||
}); | ||
gulp.run('bump'); | ||
var bumpS = bump(); | ||
bumpS.once('data', function(newFile){ | ||
should.exist(newFile); | ||
should.exist(newFile.path); | ||
should.exist(newFile.contents); | ||
String(newFile.contents).should.equal(fs.readFileSync('test/expected/default.json', 'utf8')); | ||
done(); | ||
}); | ||
bumpS.write(fakeFile); | ||
}); | ||
it('should bump major if options.bump = major', function(done) { | ||
gulp.task('bump', function(){ | ||
var options = { | ||
bump: 'major' | ||
}; | ||
gulp.src('test/package.json') | ||
.pipe(bump(options)) | ||
.pipe(es.map(function(file){ | ||
String(file.contents.toString()).should.equal(fs.readFileSync('test/expected/major.json').toString()); | ||
done(); | ||
})); | ||
var fakeFile = new gutil.File({ | ||
base: "test/", | ||
cwd: "test/", | ||
path: "test/package.json", | ||
contents: fs.readFileSync('test/package.json') | ||
}); | ||
var bumpS = bump({bump: 'major'}); | ||
bumpS.once('data', function(newFile){ | ||
should.exist(newFile); | ||
should.exist(newFile.path); | ||
should.exist(newFile.contents); | ||
String(newFile.contents).should.equal(fs.readFileSync('test/expected/major.json', 'utf8')); | ||
done(); | ||
}); | ||
gulp.run('bump'); | ||
bumpS.write(fakeFile); | ||
}); | ||
it('should bump minor if options.bump = minor', function(done) { | ||
gulp.task('bump', function(){ | ||
var options = { | ||
bump: 'minor' | ||
}; | ||
gulp.src('test/package.json') | ||
.pipe(bump(options)) | ||
.pipe(es.map(function(file){ | ||
String(file.contents.toString()).should.equal(fs.readFileSync('test/expected/minor.json').toString()); | ||
done(); | ||
})); | ||
var fakeFile = new gutil.File({ | ||
base: "test/", | ||
cwd: "test/", | ||
path: "test/package.json", | ||
contents: fs.readFileSync('test/package.json') | ||
}); | ||
var bumpS = bump({bump: 'minor'}); | ||
bumpS.once('data', function(newFile){ | ||
should.exist(newFile); | ||
should.exist(newFile.path); | ||
should.exist(newFile.contents); | ||
String(newFile.contents).should.equal(fs.readFileSync('test/expected/minor.json', 'utf8')); | ||
done(); | ||
}); | ||
gulp.run('bump'); | ||
bumpS.write(fakeFile); | ||
}); | ||
it('should ignore and pass "patch" if options.bump is not Semantic', function(done) { | ||
gulp.task('bump', function(){ | ||
var options = { | ||
bump: 'invalid' | ||
}; | ||
gulp.src('test/package.json') | ||
.pipe(bump(options)) | ||
.pipe(es.map(function(file){ | ||
String(file.contents.toString()).should.equal(fs.readFileSync('test/expected/default.json').toString()); | ||
done(); | ||
})); | ||
var fakeFile = new gutil.File({ | ||
base: "test/", | ||
cwd: "test/", | ||
path: "test/package.json", | ||
contents: fs.readFileSync('test/package.json') | ||
}); | ||
gulp.run('bump'); | ||
var bumpS = bump({bump: 'invalid'}); | ||
bumpS.once('data', function(newFile){ | ||
should.exist(newFile); | ||
should.exist(newFile.path); | ||
should.exist(newFile.contents); | ||
String(newFile.contents).should.equal(fs.readFileSync('test/expected/default.json', 'utf8')); | ||
done(); | ||
}); | ||
bumpS.write(fakeFile); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11839
205
3