first fully working version

This commit is contained in:
Tommy Parnell
2016-02-05 18:15:48 -05:00
parent 04386ddf32
commit 68c56cd6e5
2 changed files with 29 additions and 14 deletions

View File

@@ -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) {

View File

@@ -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