Exemplo n.º 1
0
        private TaskResult Execute(NuGetInstallParameters data)
        {
            StringBuilder arguments = new StringBuilder("install ");
            string        tool      = data.Path.Resolve();

            if (data.Package != null)
            {
                arguments.Append(data.Package.Id);
                arguments.Append(" ");
            }

            if (data.Output != null)
            {
                arguments.Append("-o ");
                arguments.Append(data.Output.Execute().Single().Quote());
                arguments.Append(" ");
            }

            ProcessStartInfo info = new ProcessStartInfo
            {
                FileName         = tool,
                WorkingDirectory = Container.Storage.Local.Path,
                Arguments        = arguments.ToString().TrimEnd()
            };

            if (Container.Shell.Start(info) != 0)
            {
                return(TaskResult.Unsuccessful);
            }

            return(TaskResult.Successful);
        }
Exemplo n.º 2
0
        public ITask Execute(Action <NuGetInstallParameters> parameters)
        {
            return(new NuGetInstallTask(() =>
            {
                NuGetInstallParameters instance = new NuGetInstallParameters
                {
                    Path = NuGetConfiguration.Instance.Path,
                    Output = Bob.FileSystem.Directories.Relative("packages")
                };

                parameters(instance);
                return instance;
            }));
        }