Skip to content

Commit

Permalink
issue #3601
Browse files Browse the repository at this point in the history
  • Loading branch information
ebicoglu committed Apr 14, 2020
1 parent 259c104 commit 09d8327
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
20 changes: 14 additions & 6 deletions framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@
public static class CliUrls
{
#if DEBUG
public const string WwwAbpIo = "https://localhost:44328/";
public const string WwwAbpIo = WwwAbpIoDevelopment;

public const string AccountAbpIo = "https://localhost:44333/";
public const string AccountAbpIo = AccountAbpIoDevelopment;

public const string NuGetRootPath = "https://localhost:44373/";
public const string NuGetRootPath = NuGetRootPathDevelopment;
#else
public const string WwwAbpIo = "https://abp.io/";
public const string WwwAbpIo = WwwAbpIoProduction;

public const string AccountAbpIo = "https://account.abp.io/";
public const string AccountAbpIo = AccountAbpIoProduction;

public const string NuGetRootPath = "https://nuget.abp.io/";
public const string NuGetRootPath = NuGetRootPathProduction;
#endif

public const string WwwAbpIoProduction = "https://abp.io/";
public const string AccountAbpIoProduction = "https://account.abp.io/";
public const string NuGetRootPathProduction = "https://nuget.abp.io/";

public const string WwwAbpIoDevelopment = "https://localhost:44328/";
public const string AccountAbpIoDevelopment = "https://localhost:44333/";
public const string NuGetRootPathDevelopment = "https://localhost:44373/";

public static string GetNuGetServiceIndexUrl(string apiKey)
{
return $"{NuGetRootPath}{apiKey}/v3/index.json";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task<TemplateFile> GetAsync(
string latestVersion;

#if DEBUG
latestVersion = GetCurrentVersionFromAssembly();
latestVersion = await GetLatestSourceCodeVersionAsync(name, type, $"{CliUrls.WwwAbpIoProduction}api/download/{type}/get-version/");
#else
latestVersion = await GetLatestSourceCodeVersionAsync(name, type);
#endif
Expand Down Expand Up @@ -133,16 +133,12 @@ public async Task<TemplateFile> GetAsync(
return new TemplateFile(fileContent, version, latestVersion, nugetVersion);
}

private static string GetCurrentVersionFromAssembly()
private async Task<string> GetLatestSourceCodeVersionAsync(string name, string type, string url)
{
var assembly = Assembly.GetExecutingAssembly();
var fullVersion = assembly.GetName().Version.ToString(); //eg: 2.6.0.0
return fullVersion.Substring(0, fullVersion.LastIndexOf('.')); //eg: 2.6.0
}

private async Task<string> GetLatestSourceCodeVersionAsync(string name, string type)
{
var url = $"{CliUrls.WwwAbpIo}api/download/{type}/get-version/";
if (url == null)
{
url = $"{CliUrls.WwwAbpIo}api/download/{type}/get-version/";
}

try
{
Expand Down

0 comments on commit 09d8327

Please sign in to comment.