Skip to content

Commit

Permalink
Cleaning up the naming and updating the string method for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSiedle committed Mar 30, 2016
1 parent b156dec commit f9438cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions source/Octopus.Cli/Exporters/ProjectExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ protected override void Export(Dictionary<string, string> parameters)
{
Log.Debug("Finding NuGet feed for step " + step.Name);
FeedResource feed = null;
if (FeedResourceCustomExpressionHelper.IsValidRepositoryId(nugetFeedId.Value))
if (FeedCustomExpressionHelper.IsRealFeedId(nugetFeedId.Value))
feed = Repository.Feeds.Get(nugetFeedId.Value);
else
feed = FeedResourceCustomExpressionHelper.FeedResourceWithId(nugetFeedId.Value);
feed = FeedCustomExpressionHelper.CustomExpressionFeedWithId(nugetFeedId.Value);

if (feed == null)
throw new CouldNotFindException("NuGet feed for step", step.Name);
Expand Down
4 changes: 2 additions & 2 deletions source/Octopus.Cli/Importers/ProjectImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ protected CheckedReferences<FeedResource> CheckNuGetFeedsExist(List<ReferenceDat
foreach (var nugetFeed in nugetFeeds)
{
FeedResource feed = null;
if (FeedResourceCustomExpressionHelper.IsValidRepositoryId(nugetFeed.Id))
if (FeedCustomExpressionHelper.IsRealFeedId(nugetFeed.Id))
feed = Repository.Feeds.FindByName(nugetFeed.Name);
else
feed = FeedResourceCustomExpressionHelper.FeedResourceWithId(nugetFeed.Id);
feed = FeedCustomExpressionHelper.CustomExpressionFeedWithId(nugetFeed.Id);

dependencies.Register(nugetFeed.Name, nugetFeed.Id, feed);
}
Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.Cli/Octopus.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<Compile Include="Repositories\ActionTemplateRepository.cs" />
<Compile Include="Repositories\IActionTemplateRepository.cs" />
<Compile Include="Util\DeletionOptions.cs" />
<Compile Include="Util\FeedResourceCustomExpressionHelper.cs" />
<Compile Include="Util\FeedCustomExpressionHelper.cs" />
<Compile Include="Util\Humanize.cs" />
<Compile Include="Util\IOctopusFileSystem.cs" />
<Compile Include="Util\LineSplitter.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
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 FeedResourceCustomExpressionHelper
public static class FeedCustomExpressionHelper
{
public static string FeedName = "Custom expression";
public static string CustomExpressionFeedName = "Custom expression";

public static FeedResource FeedResourceWithId(string id)
public static FeedResource CustomExpressionFeedWithId(string id)
{
var feed = new FeedResource()
{
Id = id,
Name = FeedResourceCustomExpressionHelper.FeedName
Name = FeedCustomExpressionHelper.CustomExpressionFeedName
};
return feed;
}
Expand All @@ -29,9 +30,9 @@ public static FeedResource FeedResourceWithId(string id)
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static bool IsValidRepositoryId(string id)
public static bool IsRealFeedId(string id)
{
if (id.ToLowerInvariant().StartsWith("feeds-"))
if (id.StartsWith("feeds-", StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
Expand Down

0 comments on commit f9438cf

Please sign in to comment.