Browse Source

issue #3601

pull/3607/head
Alper Ebicoglu 7 years ago
parent
commit
09d832753f
  1. 20
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs
  2. 16
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs

20
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs

@ -3,19 +3,27 @@
public static class CliUrls public static class CliUrls
{ {
#if DEBUG #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 #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 #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) public static string GetNuGetServiceIndexUrl(string apiKey)
{ {
return $"{NuGetRootPath}{apiKey}/v3/index.json"; return $"{NuGetRootPath}{apiKey}/v3/index.json";

16
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs

@ -58,7 +58,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
string latestVersion; string latestVersion;
#if DEBUG #if DEBUG
latestVersion = GetCurrentVersionFromAssembly(); latestVersion = await GetLatestSourceCodeVersionAsync(name, type, $"{CliUrls.WwwAbpIoProduction}api/download/{type}/get-version/");
#else #else
latestVersion = await GetLatestSourceCodeVersionAsync(name, type); latestVersion = await GetLatestSourceCodeVersionAsync(name, type);
#endif #endif
@ -133,16 +133,12 @@ namespace Volo.Abp.Cli.ProjectBuilding
return new TemplateFile(fileContent, version, latestVersion, nugetVersion); 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(); if (url == null)
var fullVersion = assembly.GetName().Version.ToString(); //eg: 2.6.0.0 {
return fullVersion.Substring(0, fullVersion.LastIndexOf('.')); //eg: 2.6.0 url = $"{CliUrls.WwwAbpIo}api/download/{type}/get-version/";
} }
private async Task<string> GetLatestSourceCodeVersionAsync(string name, string type)
{
var url = $"{CliUrls.WwwAbpIo}api/download/{type}/get-version/";
try try
{ {

Loading…
Cancel
Save