-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from OctopusDeploy/bug-customExpressionFeed
Bug custom expression feed
- Loading branch information
Showing
6 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Octopus.Client.Model; | ||
using System; | ||
|
||
namespace Octopus.Cli.Util | ||
{ | ||
/// <summary> | ||
/// Helps with situations where feeds use custom expressions Eg. #{MyCustomFeedURL} | ||
/// </summary> | ||
public static class FeedCustomExpressionHelper | ||
{ | ||
public static string CustomExpressionFeedName = "Custom expression"; | ||
|
||
public static FeedResource CustomExpressionFeedWithId(string id) | ||
{ | ||
var feed = new FeedResource() | ||
{ | ||
Id = id, | ||
Name = FeedCustomExpressionHelper.CustomExpressionFeedName | ||
}; | ||
return feed; | ||
} | ||
|
||
/// <summary> | ||
/// Helps to check for a valid repository-based feed Id. | ||
/// | ||
/// Feeds may have custom expressions as their Id, which may contain Octostache variable syntax #{MyCustomFeedURL}. | ||
/// If you pass a custom expression Id like this to the API, it will resolve to /api/feeds/, return all the feeds, then | ||
/// attempt to cast that response to a FeedResource object and you'll end up getting an empty FeedResource object instead | ||
/// of null. This method helps you detect valid repository feed objects before running into this confusing API scenario. | ||
/// </summary> | ||
/// <param name="id"></param> | ||
/// <returns></returns> | ||
public static bool IsRealFeedId(string id) | ||
{ | ||
if (id.StartsWith("feeds-", StringComparison.OrdinalIgnoreCase)) | ||
return true; | ||
return false; | ||
} | ||
} | ||
} |