Exemple #1
0
        internal override void InternalExecute()
        {
            if (String.IsNullOrEmpty(pathToConsoleRunner))
            {
                throw new FileNotFoundException("Could not automatically find mstest.exe. Please specify it manually using PathToConsoleRunner");
            }

            BuildArgs();
            IExecutable executable = _executable.ExecutablePath(pathToConsoleRunner).UseArgumentBuilder(_argumentBuilder);

            if (!String.IsNullOrEmpty(workingDirectory))
            {
                executable = executable.InWorkingDirectory(workingDirectory);
            }

            //don't throw any errors
            //.WithMessageProcessor()
            int returnCode = executable.Execute();

            //if it returned non-zero then just exit (as a test failed)
            if (returnCode != 0 && base.OnError == OnError.Fail)
            {
                BuildFile.SetErrorState();
                Defaults.Logger.WriteError("ERROR", "MSTest returned non-zero error code");
            }
        }
        internal override void InternalExecute()
        {
            if (string.IsNullOrEmpty(_pathToNuGetExecutable))
            {
                _pathToNuGetExecutable = _fileSystemHelper.Find("nuget.exe");
            }

            if (string.IsNullOrEmpty(_pathToNuGetExecutable))
            {
                throw new FileNotFoundException("Could not locate nuget.exe. Please specify it manually using PathToNuGetExecutable()");
            }

            var stream = _fileSystemHelper.CreateFile(_deployFolder.File(_projectId + ".nuspec").ToString());

            using (var fs = new StreamWriter(stream))
            {
                fs.Write(CreateSchema());
            }

            //ensure latest version of nuget
            Defaults.Logger.WriteDebugMessage("Updating NuGet to the latest version");
            var ab = new ArgumentBuilder {
                StartOfEntireArgumentString = "Update -self"
            };

            _executable.ExecutablePath(_pathToNuGetExecutable).UseArgumentBuilder(ab).Execute();

            //configure the API key
            Defaults.Logger.WriteDebugMessage("Configuring the API Key");
            ab.StartOfEntireArgumentString = "setApiKey " + _apiKey;
            _executable.ExecutablePath(_pathToNuGetExecutable).UseArgumentBuilder(ab).Execute();

            //package it
            Defaults.Logger.WriteDebugMessage("Creating the package");
            ab.StartOfEntireArgumentString = "Pack " + _projectId + ".nuspec";
            var inWorkingDirectory = _executable.ExecutablePath(_pathToNuGetExecutable).UseArgumentBuilder(ab).InWorkingDirectory(_deployFolder);

            inWorkingDirectory.Execute();

            //NuGet Push YourPackage.nupkg
            Defaults.Logger.WriteDebugMessage("publishing the package");
            ab.StartOfEntireArgumentString = "Push " + _projectId + "." + _version + ".nupkg";
            _executable.ExecutablePath(_pathToNuGetExecutable).UseArgumentBuilder(ab).InWorkingDirectory(_deployFolder).Execute();
        }
Exemple #3
0
        internal override void InternalExecute()
        {
            if (String.IsNullOrEmpty(_pathToConsoleRunner))
            {
                _pathToConsoleRunner = _fileSystemHelper.Find("nunit-console.exe");
                if (_pathToConsoleRunner == null)
                {
                    throw new FileNotFoundException("Could not automatically find nunit-console.exe. Please specify it manually using NunitRunner.PathToNunitConsoleRunner");
                }
            }

            var executable = _executable.ExecutablePath(_pathToConsoleRunner);

            BuildArgs();
            executable = executable.UseArgumentBuilder(_argumentBuilder);
            executable = executable.SucceedOnNonZeroErrorCodes();

            //var executable = executablePath.SucceedOnNonZeroErrorCodes();
            //if (OnError == OnError.Fail)
            //    executable = executable.FailOnError;
            //else if (OnError == OnError.Continue)
            //    executable = executable.ContinueOnError;

            if (!String.IsNullOrEmpty(_workingDirectory))
            {
                executable = executable.InWorkingDirectory(_workingDirectory);
            }

            //don't throw an errors
            var returnCode = executable.WithMessageProcessor(new NunitMessageProcessor()).Execute();

            //if it returned non-zero then just exit (as a test failed)
            if (returnCode != 0 && base.OnError == OnError.Fail)
            {
                BuildFile.SetErrorState();
                Defaults.Logger.WriteError("ERROR", "Nunit returned non-zero error code");
            }
        }