diff --git a/.gitignore b/.gitignore index 289ee18..6d8c5ff 100755 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ test/results .git +.coveralls.yml diff --git a/.npmignore b/.npmignore index 31f2e87..96347ba 100755 --- a/.npmignore +++ b/.npmignore @@ -2,4 +2,5 @@ *.swp node_modules/ .git +.coveralls.yml tests/results diff --git a/README.md b/README.md index 01fc4fb..2ac155d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# gulp-svgicons2svgfont [![NPM version](https://badge.fury.io/js/gulp-svgicons2svgfont.png)](https://npmjs.org/package/gulp-svgicons2svgfont) [![Build status](https://api.travis-ci.org/nfroidure/gulp-svgiconstosvgfont.png)](https://travis-ci.org/nfroidure/gulp-svgicons2svgfont) +# gulp-svgicons2svgfont > Create an SVG font from several SVG icons with [Gulp](http://gulpjs.com/). +[![NPM version](https://badge.fury.io/js/gulp-svgicons2svgfont.png)](https://npmjs.org/package/gulp-svgicons2svgfont) [![Build status](https://secure.travis-ci.org/nfroidure/gulp-svgicons2svgfont.png)](https://travis-ci.org/nfroidure/gulp-svgicons2svgfont) [![Dependency Status](https://david-dm.org/nfroidure/gulp-svgicons2svgfont.png)](https://david-dm.org/nfroidure/gulp-svgicons2svgfont) [![devDependency Status](https://david-dm.org/nfroidure/gulp-svgicons2svgfont/dev-status.png)](https://david-dm.org/nfroidure/gulp-svgicons2svgfont#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/nfroidure/gulp-svgicons2svgfont/badge.png?branch=master)](https://coveralls.io/r/nfroidure/gulp-svgicons2svgfont?branch=master) + ## Usage First, install `gulp-svgicons2svgfont` as a development dependency: diff --git a/package.json b/package.json index a201bc7..cb23586 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "Create a SVG font from several SVG icons", "main": "src/index.js", "scripts": { - "test": "node_modules/mocha/bin/mocha tests/*.mocha.js" + "test": "./node_modules/mocha/bin/mocha tests/*.mocha.js", + "coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- tests/*.mocha.js -R spec -t 5000 && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", + "cover": "istanbul cover ./node_modules/mocha/bin/_mocha --report html -- tests/*.mocha.js -R spec -t 5000" }, "keywords": [ "gulpplugin", @@ -32,13 +34,16 @@ } ], "dependencies": { - "gulp-util": "~2.2.0", + "gulp-util": "~2.2.14", "svgicons2svgfont": "0.0.5" }, "devDependencies": { - "event-stream": "~3.0.20", - "mocha": "~1.16.2", - "gulp": "~3.2.1", - "rimraf": "~2.2.5" + "mocha": "~1.17.1", + "event-stream": "~3.1.0", + "mocha-lcov-reporter": "0.0.1", + "coveralls": "~2.7.1", + "istanbul": "~0.2.4", + "gulp": "*", + "rimraf": "*" } } diff --git a/src/index.js b/src/index.js index 07daa03..b716f83 100644 --- a/src/index.js +++ b/src/index.js @@ -18,6 +18,7 @@ module.exports = function(options) { if (!options.fontName) { throw new gutil.PluginError('svgicons2svgfont', 'Missing options.fontName'); } + options.log = function() { gutil.log.apply(gutil, ['gulp-svgicons2svgfont: '].concat( [].slice.call(arguments, 0).concat())); @@ -25,6 +26,11 @@ module.exports = function(options) { var stream = new Stream.Transform({objectMode: true}); + options.error = function() { + stream.emit('error', new PluginError('svgicons2svgfont', + [].slice.call(arguments, 0).concat())); + }; + // Collecting icons stream._transform = function bufferContents(file, unused, done) { // When null just pass through @@ -50,12 +56,6 @@ module.exports = function(options) { // No icons, exit if (files.length === 0) return done(); - // Wrap error function - options.error = function() { - stream.emit('error', new PluginError('svgicons2svgfont', - [].slice.call(arguments, 0).concat())); - }; - // Map each icons to their corresponding glyphs var glyphs = files.map(function(file) { // Creating an object for each icon diff --git a/tests/tests.mocha.js b/tests/tests.mocha.js index 7ced573..7b40ea1 100755 --- a/tests/tests.mocha.js +++ b/tests/tests.mocha.js @@ -354,4 +354,13 @@ describe('gulp-svgicons2svgfont', function() { }); + describe('must throw error when not fontname', function() { + + assert.throws(function() { + svgicons2svgfont(); + }); + + }); + + });