diff --git a/index.js b/index.js index 7cf888f..de26fa9 100644 --- a/index.js +++ b/index.js @@ -4,21 +4,28 @@ var through = require('through2'); var execFile = require('child_process').execFile; module.exports = function (options) { - + var nugetPath = __dirname + "./nuget.exe"; - var commandPrefix = ""; - + var monoPath = null; + var targetFile = nugetPath; + var cmdArgs = ["restore"] + if(options){ nugetPath = options.nugetPath || nugetPath; - commandPrefix = options.commandPrefix || commandPrefix; + monoPath = options.monoPath || monoPath } - + if(monoPath && monoPath.length > 0){ + targetFile = monoPath; + cmdArgs.unshift(nugetPath); + } + return through.obj(function (file, enc, cb) { if (!file || !file.path) { cb(null, file); return; } - execFile(nugetPath, ["restore", file.path], function(error, stdout, stderror){ + cmdArgs.push(file.path); + return execFile(targetFile, cmdArgs, function(error, stdout, stderror){ console.log(stdout); console.log(stderror); if (error) { diff --git a/readme.md b/readme.md index 358772c..7522b50 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # gulp-nuget-restore [![Build Status](https://travis-ci.org/tparnell8/gulp-nuget-restore.svg?branch=master)](https://travis-ci.org/tparnell8/gulp-nuget-restore) -> My dazzling gulp plugin +> This is simple gulp plugin to restore nuget packages ## Install @@ -17,9 +17,8 @@ var gulp = require('gulp'); var nugetRestore = require('gulp-nuget-restore'); gulp.task('default', function () { - return gulp.src('src/file.ext') - .pipe(nugetRestore()) - .pipe(gulp.dest('dist')); + return gulp.src('MySlnFile.sln') + .pipe(nugetRestore()); }); ``` @@ -30,12 +29,21 @@ gulp.task('default', function () { #### options -##### foo +##### nugetPath + +Type: `string` +Default: `__dir + ./nuget.exe` + +You can provide a custom path to the nuget executable. One is bundled in the module so this is optional if you want a specific version + +##### monoPath + +Type: `string` +Default: `null` + +You can provide a path to mono if you are on ubuntu (currently untested) -Type: `boolean` -Default: `false` -Lorem ipsum. ## License