Skip to content

Commit 88fee1c

Browse files
authored
Bug fix when doing pack -> push (#15)
This fix should resolve #10 and resolve #13 by recreating missing file before push. The version is bumped to v1.0.2 according to semver.
1 parent aca5fde commit 88fee1c

File tree

4 files changed

+117
-42
lines changed

4 files changed

+117
-42
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ results
1313

1414
npm-debug.log
1515
node_modules
16+
17+
NuGetScratch

lib/push.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
var fs = require('fs-extra');
34
var through = require('through2');
45
var cproc = require('child_process');
56
var gutil = require('gulp-util');
@@ -15,15 +16,28 @@ module.exports = function(options) {
1516
return done(null, file);
1617
}
1718

18-
var args = argsFor.push(file.path, options);
19-
var self = this;
19+
fs.exists(file.path, function(exists) {
20+
if(exists) {
21+
return pushToSource(options, file, done);
22+
}
2023

21-
cproc.execFile(options.nuget, args, function(err, stdout) {
22-
if(err) throw new gutil.PluginError('gulp-nuget', err);
23-
24-
gutil.log(stdout.trim());
25-
done(null, file);
24+
fs.outputFile(file.path, file.contents, function(err) {
25+
pushToSource(options, file, function() {
26+
fs.remove('./.gulp-nuget', done);
27+
});
28+
});
2629
});
2730

2831
});
2932
};
33+
34+
function pushToSource(options, file, done) {
35+
var args = argsFor.push(file.path, options);
36+
37+
cproc.execFile(options.nuget, args, function(err, stdout) {
38+
if(err) throw new gutil.PluginError('gulp-nuget', err);
39+
40+
gutil.log(stdout.trim());
41+
done(null, file);
42+
});
43+
}

npm-shrinkwrap.json

Lines changed: 90 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-nuget",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "gulp nuget support to pack, push and restore nuget packages",
55
"main": "index.js",
66
"scripts": {
@@ -21,11 +21,12 @@
2121
},
2222
"homepage": "https://github.com/mckn/gulp-nuget",
2323
"dependencies": {
24-
"fs-extra": "^0.26.5",
24+
"fs-extra": "^0.26.7",
25+
"fs-extra-promise": "^0.4.1",
2526
"gulp-util": "^3.0.7",
2627
"stream-browserify": "^2.0.1",
2728
"through2": "^2.0.1",
28-
"vinyl": "^1.1.1"
29+
"vinyl": "^1.2.0"
2930
},
3031
"devDependencies": {
3132
"chai": "^3.5.0",

0 commit comments

Comments
 (0)