예제 #1
0
        internal string FindExecutable()
        {
            if (!string.IsNullOrEmpty(_exePath))
            {
                return(_exePath);
            }

            var tmp = _fileSystemHelper.Find("ILMerge.exe");

            if (tmp == null)
            {
                throw new FileNotFoundException("Could not automatically find ILMerge.exe. Please specify it manually using ILMerge.ExecutableLocatedAt");
            }

            return(tmp);
        }
예제 #2
0
        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();
        }
예제 #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");
            }
        }