public override int Run(string fileOrDirectory) { if (_packageNameArgument.Values.Count != 1 || string.IsNullOrWhiteSpace(_packageNameArgument.Value) || RemainingArguments.Count > 0) { throw new GracefulException(LocalizableStrings.SpecifyExactlyOnePackageReference); } var projectFilePath = string.Empty; if (!File.Exists(fileOrDirectory)) { projectFilePath = MsbuildProject.GetProjectFileFromDirectory(fileOrDirectory).FullName; } else { projectFilePath = fileOrDirectory; } var tempDgFilePath = string.Empty; if (!_noRestoreOption.HasValue()) { // Create a Dependency Graph file for the project tempDgFilePath = Path.GetTempFileName(); GetProjectDependencyGraph(projectFilePath, tempDgFilePath); } var result = NuGetCommand.Run(TransformArgs(_packageNameArgument.Value, tempDgFilePath, projectFilePath)); DisposeTemporaryFile(tempDgFilePath); return(result); }
public override void Write(ICommand command) { var helpArgs = new string[] { "--help" }; if (command.Equals(RootCommand)) { Console.Out.WriteLine(HelpUsageText.UsageText); } else if (command.Name.Equals(NuGetCommandParser.GetCommand().Name)) { NuGetCommand.Run(helpArgs); } else if (command.Name.Equals(MSBuildCommandParser.GetCommand().Name)) { new MSBuildForwardingApp(helpArgs).Execute(); } else if (command.Name.Equals(NewCommandParser.GetCommand().Name)) { NewCommandShim.Run(helpArgs); } else if (command.Name.Equals(VSTestCommandParser.GetCommand().Name)) { new VSTestForwardingApp(helpArgs).Execute(); } else { if (command.Name.Equals(ListProjectToProjectReferencesCommandParser.GetCommand().Name)) { ListCommandParser.SlnOrProjectArgument.Name = CommonLocalizableStrings.ProjectArgumentName; ListCommandParser.SlnOrProjectArgument.Description = CommonLocalizableStrings.ProjectArgumentDescription; } base.Write(command); } }
public override int Execute() { var projectFilePath = string.Empty; if (!File.Exists(_fileOrDirectory)) { projectFilePath = MsbuildProject.GetProjectFileFromDirectory(_fileOrDirectory).FullName; } else { projectFilePath = _fileOrDirectory; } var tempDgFilePath = string.Empty; if (!_appliedCommand.HasOption("no-restore")) { // Create a Dependency Graph file for the project tempDgFilePath = Path.GetTempFileName(); GetProjectDependencyGraph(projectFilePath, tempDgFilePath); } var result = NuGetCommand.Run( TransformArgs( _packageId, tempDgFilePath, projectFilePath)); DisposeTemporaryFile(tempDgFilePath); return(result); }
public async Task RunAsync(CancellationToken token) { var photonVars = Context.ServerVariables["photon"]; if (photonVars == null) { throw new ApplicationException("Photon Variables were not found!"); } nugetPackageDir = Path.Combine(Context.WorkDirectory, "Packages"); var nugetApiKey = Context.ServerVariables["global"]["nuget/apiKey"]; apiUrl = photonVars["apiUrl"]; ftpUrl = photonVars["ftp/url"]; ftpUser = photonVars["ftp/user"]; ftpPass = photonVars["ftp/pass"]; msbuild = new MSBuildCommand(Context) { Exe = Context.AgentVariables["global"]["msbuild_exe"], WorkingDirectory = Context.ContentDirectory, }; await BuildSolution(token); nugetCore = new NuGetCore(Context) { ApiKey = nugetApiKey, }; nugetCore.Initialize(); nugetCmd = new NuGetCommand(Context) { Exe = Path.Combine(Context.ContentDirectory, "bin", "NuGet.exe"), //Context.AgentVariables["global"]["nuget_exe"]; WorkingDirectory = Context.ContentDirectory, }; await Task.WhenAll( PublishServer(token), PublishAgent(token), PublishCLI(token)); PathEx.CreatePath(nugetPackageDir); var projectPath = Path.Combine(Context.ContentDirectory, "Photon.Framework"); var assemblyFilename = Path.Combine(projectPath, "bin", "Release", "Photon.Framework.dll"); frameworkVersion = AssemblyTools.GetVersion(assemblyFilename); await PublishFrameworkPackage(token); await PublishPluginPackage("Photon.MSBuild", token); await PublishPluginPackage("Photon.WindowsServices", token); await PublishPluginPackage("Photon.Config", token); await PublishPluginPackage("Photon.NuGet", token); await PublishPluginPackage("Photon.NuGet.Core", token); await PublishPluginPackage("Photon.IIS", token); await PublishPluginPackage("Photon.NUnit", token); await PublishPluginPackage("Photon.DotNet", token); }
public override void Write(HelpContext context) { var command = context.Command; var helpArgs = new string[] { "--help" }; if (command.Equals(RootCommand)) { Console.Out.WriteLine(HelpUsageText.UsageText); } else if (command.Name.Equals(NuGetCommandParser.GetCommand().Name)) { NuGetCommand.Run(helpArgs); } else if (command.Name.Equals(MSBuildCommandParser.GetCommand().Name)) { new MSBuildForwardingApp(helpArgs).Execute(); } else if (command.Name.Equals(VSTestCommandParser.GetCommand().Name)) { new VSTestForwardingApp(helpArgs).Execute(); } else if (command is Microsoft.TemplateEngine.Cli.Commands.ICustomHelp helpCommand) { var blocks = helpCommand.CustomHelpLayout(); foreach (var block in blocks) { block(context); } } else if (command.Name.Equals(FormatCommandParser.GetCommand().Name)) { new DotnetFormatForwardingApp(helpArgs).Execute(); } else { if (command.Name.Equals(ListProjectToProjectReferencesCommandParser.GetCommand().Name)) { ListCommandParser.SlnOrProjectArgument.Name = CommonLocalizableStrings.ProjectArgumentName; ListCommandParser.SlnOrProjectArgument.Description = CommonLocalizableStrings.ProjectArgumentDescription; } else if (command.Name.Equals(AddPackageParser.GetCommand().Name) || command.Name.Equals(AddCommandParser.GetCommand().Name)) { // Don't show package completions in help AddPackageParser.CmdPackageArgument.Completions.Clear(); } base.Write(context); } }
public void ItPassesCommandIfSupported(string[] inputArgs, int result) { // Arrange string[] receivedArgs = null; var testCommandRunner = new Mock <ICommandRunner>(); testCommandRunner .Setup(x => x.Run(It.IsAny <string[]>())) .Callback <string[]>(s => receivedArgs = s) .Returns(0); // Act var returned = NuGetCommand.Run(inputArgs, testCommandRunner.Object); // Assert receivedArgs.Should().BeEquivalentTo(inputArgs); returned.Should().Be(result); }
public override int Execute() { var projectFilePath = string.Empty; if (!File.Exists(_fileOrDirectory)) { projectFilePath = MsbuildProject.GetProjectFileFromDirectory(_fileOrDirectory).FullName; } else { projectFilePath = _fileOrDirectory; } var packageToRemove = _appliedCommand.Arguments.Single(); var result = NuGetCommand.Run(TransformArgs(packageToRemove, projectFilePath)); return(result); }
public override int Execute() { var projectFilePath = string.Empty; if (!File.Exists(_fileOrDirectory)) { projectFilePath = MsbuildProject.GetProjectFileFromDirectory(_fileOrDirectory).FullName; } else { projectFilePath = _fileOrDirectory; } var tempDgFilePath = string.Empty; if (!_appliedCommand.HasOption("no-restore")) { try { // Create a Dependency Graph file for the project tempDgFilePath = Path.GetTempFileName(); } catch (IOException ioex) { // Catch IOException from Path.GetTempFileName() and throw a graceful exception to the user. throw new GracefulException(string.Format(LocalizableStrings.CmdDGFileIOException, projectFilePath), ioex); } GetProjectDependencyGraph(projectFilePath, tempDgFilePath); } var result = NuGetCommand.Run( TransformArgs( _packageId, tempDgFilePath, projectFilePath)); DisposeTemporaryFile(tempDgFilePath); return(result); }
public override void Write(HelpContext context) { var command = context.Command; var helpArgs = new string[] { "--help" }; if (command.Equals(RootCommand)) { Console.Out.WriteLine(HelpUsageText.UsageText); } else if (command.Name.Equals(NuGetCommandParser.GetCommand().Name)) { NuGetCommand.Run(helpArgs); } else if (command.Name.Equals(MSBuildCommandParser.GetCommand().Name)) { new MSBuildForwardingApp(helpArgs).Execute(); } else if (command.Name.Equals(NewCommandParser.GetCommand().Name)) { NewCommandShim.Run(helpArgs); } else if (command.Name.Equals(VSTestCommandParser.GetCommand().Name)) { new VSTestForwardingApp(helpArgs).Execute(); } else { if (command.Name.Equals(ListProjectToProjectReferencesCommandParser.GetCommand().Name)) { ListCommandParser.SlnOrProjectArgument.Name = CommonLocalizableStrings.ProjectArgumentName; ListCommandParser.SlnOrProjectArgument.Description = CommonLocalizableStrings.ProjectArgumentDescription; } else if (command.Name.Equals(AddPackageParser.GetCommand().Name) || command.Name.Equals(AddCommandParser.GetCommand().Name)) { // Don't show package suggestions in help AddPackageParser.CmdPackageArgument.Suggestions.Clear(); } base.Write(context); } }
public override int Run(string fileOrDirectory) { if (RemainingArguments.Count != 1) { throw new GracefulException(LocalizableStrings.SpecifyExactlyOnePackageReference); } var projectFilePath = string.Empty; if (!File.Exists(fileOrDirectory)) { projectFilePath = MsbuildProject.GetProjectFileFromDirectory(fileOrDirectory).FullName; } else { projectFilePath = fileOrDirectory; } var packageToRemove = RemainingArguments.First(); var result = NuGetCommand.Run(TransformArgs(packageToRemove, projectFilePath)); return(result); }
public override int Execute() { var result = NuGetCommand.Run(TransformArgs()); return(result); }
public override int Execute() { return(NuGetCommand.Run(TransformArgs())); }