Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
loop-ping / gulpfile.js
Size: Mime:
var Gulp = require("gulp"),
    Mocha = require("gulp-mocha"),
    Shell = require("gulp-shell"),
    Del = require("del"),
    VinylPaths = require("vinyl-paths"),
    Print = require("gulp-print"),
    Bump = require("gulp-bump"),
    FS = require("fs");

Gulp.task("test", function(){
    return Gulp
        .src(["./test/**/*.js"], {read: false})
        .pipe(Mocha({reporter: "spec" }));
});

var versionNumber = function(){
    var pkg = JSON.parse(FS.readFileSync("./package.json", "utf8"));
   return pkg.version;
}

Gulp.task("bump", function(){
    Gulp.src("./package.json")
        .pipe(Bump())
        .pipe(Gulp.dest("./"));
});

Gulp.task("pack", ["clean", "bump"], Shell.task(["npm pack"]));

Gulp.task("move", ["pack"], function(){
    return Gulp
        .src("*.tgz")
        .pipe(VinylPaths(Del))
        .pipe(Gulp.dest("build/Release"));
});

Gulp.task("npmpush", ["test", "move"], function(){
    return Gulp
        .src("build/Release/*.tgz")
        //.pipe(Print());
        .pipe(Shell([
            "curl -F package=@<%= file.path %> https://P2NoU4CksQg5WPReyUxy@push.fury.io/xogroupinc/"
        ]));
});

Gulp.task("gitpush", ["npmpush"], Shell.task([
   "git add -A .",
   "git commit -m 'updating for build " + versionNumber() + "'",
   "git push"
]));

Gulp.task("clean", function(callback){
    Del(["build/Release/*.tgz"], callback);
});

Gulp.task("build", ["test", "npmpush", "gitpush"], function(){
    process.nextTick(function(){
        process.exit(0);
    });
});