var gulp = require("gulp");
var shell = require("gulp-shell");
var args = require('yargs').argv;
var fs = require("fs");
var debug = require('gulp-debug');

var project = JSON.parse(fs.readFileSync("./package.json"));

var config = {
  name: project.name,
  mode: args.mode || "Debug",
  commit: process.env.APPVEYOR_REPO_COMMIT || "0",
  buildNumber: process.env.APPVEYOR_BUILD_VERSION || "0",
  output: "./build/deploy"
}

gulp.task("default", [ "restore", "compile", "test", "pack" ]);

gulp.task('restore', function() {
  return gulp
    .src(config.name + '.sln', { read: false })
    .pipe(shell('dotnet restore'));
});

gulp.task('compile', [ "restore" ], shell.task([
  'dotnet build ./src/' + config.name + ' --configuration ' + config.mode,
  'dotnet build ./src/' + config.name + '.Tests --configuration ' + config.mode
]));

gulp.task('test', [ "compile" ], shell.task([
  'dotnet test ./src/' + config.name + '.Tests --configuration ' + config.mode
]));

gulp.task('pack', [ 'test' ], shell.task([
  'dotnet pack ./src/' + config.name + ' --configuration ' + config.mode + ' --output ./build/deploy'
]));

@@ -94,32 +94,8 @@
 gv;%0A
-var fs = require(%22fs%22);%0A
 var 
@@ -130,70 +130,8 @@
 );%0A%0A
-var project = JSON.parse(fs.readFileSync(%22./package.json%22));%0A%0A
 var 
@@ -153,20 +153,20 @@
 me: 
-project.name
+'NScientist'
 ,%0A  
@@ -197,117 +197,8 @@
 g%22,%0A
-  commit: process.env.APPVEYOR_REPO_COMMIT %7C%7C %220%22,%0A  buildNumber: process.env.APPVEYOR_BUILD_VERSION %7C%7C %220%22,%0A
   ou
@@ -313,99 +313,23 @@
 e', 
-function() %7B%0A  return gulp%0A    .src(config.name + '.sln', %7B read: false %7D)%0A    .pipe(shell(
+shell.task(%5B%0A  
 'dot
@@ -344,13 +344,11 @@
 ore'
-));%0A%7D
+%0A%5D)
 );%0A%0A
@@ -394,25 +394,25 @@
 ll.task(%5B%0A  
-'
+%60
 dotnet build
@@ -410,36 +410,34 @@
 net build ./src/
-' + 
+$%7B
 config.name + ' 
@@ -423,36 +423,33 @@
 rc/$%7Bconfig.name
- + '
+%7D
  --configuration
@@ -441,36 +441,34 @@
 --configuration 
-' + 
+$%7B
 config.mode,%0A  '
@@ -466,13 +466,15 @@
 mode
+%7D%60
 ,%0A  
-'
+%60
 dotn
@@ -484,28 +484,26 @@
 build ./src/
-' + 
+$%7B
 config.name 
@@ -493,36 +493,33 @@
 rc/$%7Bconfig.name
- + '
+%7D
 .Tests --configu
@@ -517,36 +517,34 @@
 --configuration 
-' + 
+$%7B
 config.mode%0A%5D));
@@ -530,32 +530,34 @@
 on $%7Bconfig.mode
+%7D%60
 %0A%5D));%0A%0Agulp.task
@@ -591,25 +591,25 @@
 ll.task(%5B%0A  
-'
+%60
 dotnet test 
@@ -610,28 +610,26 @@
  test ./src/
-' + 
+$%7B
 config.name 
@@ -627,20 +627,17 @@
 fig.name
- + '
+%7D
 .Tests -
@@ -643,36 +643,34 @@
 --configuration 
-' + 
+$%7B
 config.mode%0A%5D));
@@ -664,16 +664,18 @@
 fig.mode
+%7D%60
 %0A%5D));%0A%0Ag
@@ -714,25 +714,25 @@
 ll.task(%5B%0A  
-'
+%60
 dotnet pack 
@@ -737,20 +737,18 @@
 k ./src/
-' + 
+$%7B
 config.n
@@ -750,20 +750,17 @@
 fig.name
- + '
+%7D
  --confi
@@ -772,12 +772,10 @@
 ion 
-' + 
+$%7B
 conf
@@ -785,12 +785,9 @@
 mode
- + '
+%7D
  --o
@@ -796,23 +796,25 @@
 put 
-./build/deploy'
+$%7Bconfig.output%7D%60
 %0A%5D))

tidy gulpfile some more