Skip to content

Commit

Permalink
Modified Travis instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
jkphl committed Dec 30, 2014
1 parent d4d4eb4 commit 4f1f9c7
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 95 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@ language: node_js
node_js:
- '0.8'
- '0.10'
before_install:
- npm update -g npm
after_script:
- npm run coveralls
after_failure:
- tar -cjf "grunt-svg-sprite_travis_${TRAVIS_BUILD_NUMBER}.tar.bz2" tmp && curl --ftp-create-dirs -T "grunt-svg-sprite_travis_${TRAVIS_BUILD_NUMBER}.tar.bz2" -u $FTP_USER:$FTP_PASSWORD "ftp://jkphl.is/${TRAVIS_REPO_SLUG}/grunt-svg-sprite_travis_${TRAVIS_BUILD_NUMBER}.tar.bz2"

44 changes: 22 additions & 22 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
'use strict';

/**
* gulp-svg-sprite is a Gulp plugin for creating SVG sprites
*
* @see https://github.com/jkphl/gulp-svg-sprite
*
* @author Joschi Kuphal <joschi@kuphal.net> (https://github.com/jkphl)
* @copyright © 2014 Joschi Kuphal
* @license MIT https://raw.github.com/jkphl/gulp-svg-sprite/master/LICENSE.txt
*/

var gulp = require('gulp'),
jshint = require('gulp-jshint');

gulp.task('lint', function () {
gulp.src(['test/*.js', 'index.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'))
});

'use strict';

/**
* gulp-svg-sprite is a Gulp plugin for creating SVG sprites
*
* @see https://github.com/jkphl/gulp-svg-sprite
*
* @author Joschi Kuphal <joschi@kuphal.net> (https://github.com/jkphl)
* @copyright © 2014 Joschi Kuphal
* @license MIT https://raw.github.com/jkphl/gulp-svg-sprite/master/LICENSE.txt
*/

var gulp = require('gulp'),
jshint = require('gulp-jshint');

gulp.task('lint', function () {
gulp.src(['test/*.js', 'index.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'))
});

gulp.task('default', ['lint']);
146 changes: 73 additions & 73 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
'use strict';

/**
* gulp-svg-sprite is a Gulp plugin for creating SVG sprites
*
* @see https://github.com/jkphl/gulp-svg-sprite
*
* @author Joschi Kuphal <joschi@kuphal.net> (https://github.com/jkphl)
* @copyright © 2014 Joschi Kuphal
* @license MIT https://raw.github.com/jkphl/gulp-svg-sprite/master/LICENSE.txt
*/

var through2 = require('through2'),
gutil = require('gulp-util'),
SVGSpriter = require('svg-sprite'),
PluginError = gutil.PluginError,

PLUGIN_NAME = 'gulp-svg-sprite';

/**
* Plugin level function
*
* @param {Object} config SVGSpriter main configuration
*/
function gulpSVGSprite(config) {

// Extend plugin error
function extendError(pError, error) {
if (error && (typeof error === 'object')) {
['name', 'errno'].forEach(function(property) {
if (property in error) {
this[property] = error[property];
}
}, pError);
}

return pError;
}

// Instanciate spriter instance
var spriter = new SVGSpriter(config);

// Intercept error log and convert to plugin errors
spriter.config.log.error = function(message, error) {
this.emit('error', extendError(new PluginError(PLUGIN_NAME, message), error));
};

return through2.obj(function (file, enc, cb) {
var error = null;
try {
spriter.add(file);
} catch(e) {
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
}
return cb(error);

}, function(cb) {
var stream = this;
spriter.compile(function(error, result /*, data*/){
if (error) {
stream.emit('error', new PluginError(PLUGIN_NAME, error));
} else {
for (var mode in result) {
for (var resource in result[mode]) {
stream.push(result[mode][resource]);
}
}
}
cb();
});
});
}

'use strict';

/**
* gulp-svg-sprite is a Gulp plugin for creating SVG sprites
*
* @see https://github.com/jkphl/gulp-svg-sprite
*
* @author Joschi Kuphal <joschi@kuphal.net> (https://github.com/jkphl)
* @copyright © 2014 Joschi Kuphal
* @license MIT https://raw.github.com/jkphl/gulp-svg-sprite/master/LICENSE.txt
*/

var through2 = require('through2'),
gutil = require('gulp-util'),
SVGSpriter = require('svg-sprite'),
PluginError = gutil.PluginError,

PLUGIN_NAME = 'gulp-svg-sprite';

/**
* Plugin level function
*
* @param {Object} config SVGSpriter main configuration
*/
function gulpSVGSprite(config) {

// Extend plugin error
function extendError(pError, error) {
if (error && (typeof error === 'object')) {
['name', 'errno'].forEach(function(property) {
if (property in error) {
this[property] = error[property];
}
}, pError);
}

return pError;
}

// Instanciate spriter instance
var spriter = new SVGSpriter(config);

// Intercept error log and convert to plugin errors
spriter.config.log.error = function(message, error) {
this.emit('error', extendError(new PluginError(PLUGIN_NAME, message), error));
};

return through2.obj(function (file, enc, cb) {
var error = null;
try {
spriter.add(file);
} catch(e) {
error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ? extendError(new PluginError(PLUGIN_NAME, e.message), e) : e;
}
return cb(error);

}, function(cb) {
var stream = this;
spriter.compile(function(error, result /*, data*/){
if (error) {
stream.emit('error', new PluginError(PLUGIN_NAME, error));
} else {
for (var mode in result) {
for (var resource in result[mode]) {
stream.push(result[mode][resource]);
}
}
}
cb();
});
});
}

module.exports = gulpSVGSprite;

0 comments on commit 4f1f9c7

Please sign in to comment.