예제 #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);
        }
예제 #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;
            }));
        }