make source field in nuget trigger optional. Use default feed if blank
authorEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 14 Jul 2011 14:27:38 +0000 (18:27 +0400)
committerEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 14 Jul 2011 14:27:38 +0000 (18:27 +0400)
nuget-extensions/nuget-commands/src/NuGetTeamCityListCommand.cs
nuget-extensions/nuget-commands/src/NuGetTeamCityListPackagesCommand.cs
nuget-server/resources/trigger/editSimpleTrigger.jsp
nuget-server/src/jetbrains/buildServer/nuget/server/exec/ListPackagesCommand.java
nuget-server/src/jetbrains/buildServer/nuget/server/trigger/NuGetSimpleTrigger.java

index bcef6a0e7adbcc3377e67bb1e8ee60a5ed971d21..2da75e3b017c784be65f6a71e19581f0f1121ff3 100644 (file)
@@ -19,6 +19,9 @@ namespace JetBrains.TeamCity.NuGet.ExtendedCommands
 \r
     public override void ExecuteCommand()\r
     {\r
 \r
     public override void ExecuteCommand()\r
     {\r
+      if (string.IsNullOrWhiteSpace(Source))\r
+        Source = NuGetConstants.DefaultFeedUrl;\r
+\r
       System.Console.Out.WriteLine("TeamCity NuGet List command.");\r
       System.Console.Out.WriteLine("Source: {0}", Source ?? "<null>");\r
       System.Console.Out.WriteLine("Package Id: {0}", Id ?? "<null>");\r
       System.Console.Out.WriteLine("TeamCity NuGet List command.");\r
       System.Console.Out.WriteLine("Source: {0}", Source ?? "<null>");\r
       System.Console.Out.WriteLine("Package Id: {0}", Id ?? "<null>");\r
index 359d9892032e44690a8284b864e7a51bf3d058fb..45fc713ad7c53708e54648795e53b7c8b7f3aafb 100644 (file)
@@ -17,6 +17,9 @@ namespace JetBrains.TeamCity.NuGet.ExtendedCommands
     {\r
       var req = LoadRequests();\r
 \r
     {\r
       var req = LoadRequests();\r
 \r
+      if (string.IsNullOrWhiteSpace(req.Source))\r
+        req.Source = NuGetConstants.DefaultFeedUrl;\r
+\r
       IEnumerable<IPackage> package = GetAllPackages(req.Source, req.Packages.Select(x => x.Id)).ToList();\r
       var hash = new Dictionary<string, Func<IPackage, bool>>(\r
         req\r
       IEnumerable<IPackage> package = GetAllPackages(req.Source, req.Packages.Select(x => x.Id)).ToList();\r
       var hash = new Dictionary<string, Func<IPackage, bool>>(\r
         req\r
index e4e5e99b1ef2ffef3797595d3208f94c693d11ce..8ee79cc6d0be112d485cc99ea52308e47bfc164f 100644 (file)
 </tr>\r
 \r
 <tr>\r
 </tr>\r
 \r
 <tr>\r
-  <td>NuGet package source:<l:star/></td>\r
+  <td>NuGet package source:</td>\r
   <td>\r
     <props:textProperty name="${ib.sourceKey}" style="width:20em;" />\r
   <td>\r
     <props:textProperty name="${ib.sourceKey}" style="width:20em;" />\r
-    <span class="smallNote">Specify NuGet packages repository to monitor packages changes</span>\r
+    <span class="smallNote">Specify NuGet packages repository to monitor packages changes. Leave blank to use default NuGet feed</span>\r
     <span class="error" id="error_${ib.sourceKey}"></span>\r
   </td>\r
 </tr>\r
     <span class="error" id="error_${ib.sourceKey}"></span>\r
   </td>\r
 </tr>\r
index ac434ce69a6ef99bdd05d4d78a624e5cdd1bb2d3..9d5d6ca53221755ebaae798f7b3a6645c2dd5b4a 100644 (file)
@@ -48,8 +48,10 @@ public class ListPackagesCommand {
     List<String> cmd = new ArrayList<String>();\r
 \r
     cmd.add("TeamCity.List");\r
     List<String> cmd = new ArrayList<String>();\r
 \r
     cmd.add("TeamCity.List");\r
-    cmd.add("-Source");\r
-    cmd.add(source);\r
+    if (!StringUtil.isEmptyOrSpaces(source)) {\r
+      cmd.add("-Source");\r
+      cmd.add(source);\r
+    }\r
     cmd.add("-Id");\r
     cmd.add(packageId);\r
 \r
     cmd.add("-Id");\r
     cmd.add(packageId);\r
 \r
index 1e29f13599fece3621040ffd44d215355c026a4c..ad91bb80b2faf85af0c768527989af6436e4e71a 100644 (file)
@@ -74,10 +74,6 @@ public class NuGetSimpleTrigger extends BuildTriggerService {
       public Collection<InvalidProperty> process(Map<String, String> properties) {\r
         Collection<InvalidProperty> err = new ArrayList<InvalidProperty>();\r
 \r
       public Collection<InvalidProperty> process(Map<String, String> properties) {\r
         Collection<InvalidProperty> err = new ArrayList<InvalidProperty>();\r
 \r
-        if (StringUtil.isEmptyOrSpaces(properties.get(TriggerConstants.SOURCE))) {\r
-          err.add(new InvalidProperty(TriggerConstants.SOURCE, "Source must be specified"));\r
-        }\r
-\r
         if (StringUtil.isEmptyOrSpaces(properties.get(TriggerConstants.NUGET_EXE))) {\r
           err.add(new InvalidProperty(TriggerConstants.NUGET_EXE, "NuGet.exe path must be specified"));\r
         }\r
         if (StringUtil.isEmptyOrSpaces(properties.get(TriggerConstants.NUGET_EXE))) {\r
           err.add(new InvalidProperty(TriggerConstants.NUGET_EXE, "NuGet.exe path must be specified"));\r
         }\r