From 2c2847515c304a7f7245c6621fe2b05f0c165436 Mon Sep 17 00:00:00 2001 From: philo Date: Thu, 11 Aug 2016 15:11:45 +0100 Subject: [PATCH] removes gulp.js check - it screws with working directory setup --- src/Cake.Gulp.Tests/GulpLocalRunnerTests.cs | 13 +++++++------ src/Cake.Gulp/GulpLocalRunner.cs | 7 +------ src/Cake.Gulp/GulpLocalRunnerSettings.cs | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Cake.Gulp.Tests/GulpLocalRunnerTests.cs b/src/Cake.Gulp.Tests/GulpLocalRunnerTests.cs index 250ffc5..b95b964 100644 --- a/src/Cake.Gulp.Tests/GulpLocalRunnerTests.cs +++ b/src/Cake.Gulp.Tests/GulpLocalRunnerTests.cs @@ -11,11 +11,12 @@ public GulpLocalRunnerTests() { this._fixture = new GulpLocalRunnerFixture(); this._gulpFile = "gulpfile.js"; - const string pathToGulpJs = "/Working/node_modules/gulp/bin/gulp.js"; + const string pathToGulpJs = "node_modules/gulp/bin/gulp.js"; this._fixture.FileSystem.CreateFile(pathToGulpJs); - this._fixture.FileSystem.CreateFile("/abc"); + this._fixture.FileSystem.CreateFile("/Working/" +pathToGulpJs); + this._fixture.FileSystem.CreateFile("/abc"); this._fixture.FileSystem.CreateFile(this._gulpFile); - this._fixture.FileSystem.CreateFile("/Working/path-to-gulp/gulp.js"); + this._fixture.FileSystem.CreateFile("path-to-gulp/gulp.js"); } [Fact] @@ -25,7 +26,7 @@ public void Install_Settings_With_Gulp_File_Should_Add_Gulpfile_Argument() var result = this._fixture.Run(); - result.Args.ShouldBe("\"/Working/node_modules/gulp/bin/gulp.js\" --gulpfile \"gulpfile.js\""); + result.Args.ShouldBe("\"node_modules/gulp/bin/gulp.js\" --gulpfile \"gulpfile.js\""); } [Fact] @@ -35,7 +36,7 @@ public void No_Install_Settings_Specified_Should_Execute_Command_Without_Argumen var result = this._fixture.Run(); - result.Args.ShouldBe("\"/Working/node_modules/gulp/bin/gulp.js\""); + result.Args.ShouldBe("\"node_modules/gulp/bin/gulp.js\""); } [Fact] @@ -44,7 +45,7 @@ public void Custom_Gulp_Path() this._fixture.InstallSettings = s => s.SetPathToGulpJs("path-to-gulp/gulp.js"); var result = this._fixture.Run(); - result.Args.ShouldBe("\"/Working/path-to-gulp/gulp.js\""); + result.Args.ShouldBe("\"path-to-gulp/gulp.js\""); } } } \ No newline at end of file diff --git a/src/Cake.Gulp/GulpLocalRunner.cs b/src/Cake.Gulp/GulpLocalRunner.cs index ff97374..122d491 100644 --- a/src/Cake.Gulp/GulpLocalRunner.cs +++ b/src/Cake.Gulp/GulpLocalRunner.cs @@ -35,13 +35,8 @@ public override void Execute(Action configure = null) configure?.Invoke(settings); ValidateSettings(settings); - var workingDir = GetWorkingDirectory(settings); - - var gulpJsPath = FilePath.FromString(workingDir +"/" + settings.PathToGulpJs); - if (!_fileSystem.Exist(gulpJsPath)) throw new FileNotFoundException($"unable to find local gulp installation at specified path [{gulpJsPath}], have you run 'npm install gulp'?"); - var args = new ProcessArgumentBuilder(); - args.AppendQuoted(gulpJsPath.ToString()); + args.AppendQuoted(settings.PathToGulpJs.ToString()); settings.Evaluate(args); Run(settings, args); diff --git a/src/Cake.Gulp/GulpLocalRunnerSettings.cs b/src/Cake.Gulp/GulpLocalRunnerSettings.cs index 1359447..225452d 100644 --- a/src/Cake.Gulp/GulpLocalRunnerSettings.cs +++ b/src/Cake.Gulp/GulpLocalRunnerSettings.cs @@ -11,7 +11,7 @@ public class GulpLocalRunnerSettings : GulpRunnerSettings /// /// Path to node modules /// - public FilePath PathToGulpJs { get; private set; } = "./node_modules/gulp/bin/gulp.js"; + public FilePath PathToGulpJs { get; private set; } = "node_modules/gulp/bin/gulp.js"; /// /// Overrides the default path to gulp javascript, the current working directory will be prepended to this path