From d94dc72f7a8200d751079b1746ca5d2ae4641e67 Mon Sep 17 00:00:00 2001 From: Xeevis Date: Tue, 28 May 2019 23:12:36 +0200 Subject: [PATCH 1/3] Remove unused possibly duplicate localization key --- .../Localization/Resources/AbpAccount/Web/en.json | 1 - .../Localization/Resources/AbpAccount/Web/pt-BR.json | 1 - .../Localization/Resources/AbpAccount/Web/tr.json | 1 - .../Localization/Resources/AbpAccount/Web/zh-Hans.json | 1 - 4 files changed, 4 deletions(-) diff --git a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json index 1055309b22..892e60f89e 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json +++ b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json @@ -14,7 +14,6 @@ "Login": "Login", "Cancel": "Cancel", "Register": "Register", - "UseAnotherServiceToLogIn.": "Use another service to log in.", "InvalidLoginRequest": "Invalid login request", "ThereAreNoLoginSchemesConfiguredForThisClient": "There are no login schemes configured for this client.", "LogInUsingYourProviderAccount": "Log in using your {0} account" diff --git a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/pt-BR.json b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/pt-BR.json index fec54c0476..0513d99afd 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/pt-BR.json +++ b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/pt-BR.json @@ -14,7 +14,6 @@ "Login": "Entrar", "Cancel": "Cancelar", "Register": "Registrar-se", - "UseAnotherServiceToLogIn.": "Use outro serviço para entrar.", "InvalidLoginRequest": "Requisição de acesso inválida!", "ThereAreNoLoginSchemesConfiguredForThisClient": "Não existe um esquema de acesso para este usuário", "LogInUsingYourProviderAccount": "Acessse utilizando sua conta {0}" diff --git a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json index dfc1c9486a..3b78c3a55d 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json +++ b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json @@ -14,7 +14,6 @@ "Login": "Giriş yap", "Cancel": "İptal", "Register": "Kayıt ol", - "UseAnotherServiceToLogIn.": "Başka bir servisle giriş yap.", "InvalidLoginRequest": "Başarısız giriş isteği", "ThereAreNoLoginSchemesConfiguredForThisClient": "Bu client için konfigüre edilmiş giriş şeması bulunamadı.", "LogInUsingYourProviderAccount": "{0} hesabınızla giriş yapın." diff --git a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/zh-Hans.json index 01e0b6b57d..6aee740de6 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/zh-Hans.json +++ b/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/zh-Hans.json @@ -14,7 +14,6 @@ "Login": "登录", "Cancel": "取消", "Register": "注册", - "UseAnotherServiceToLogIn.": "使用其他服务登录.", "InvalidLoginRequest": "登录请求无效", "ThereAreNoLoginSchemesConfiguredForThisClient": "没有为此客户端配置登录方案.", "LogInUsingYourProviderAccount": "使用你的{0}帐户登录" From 748b0567e2957f84ea5608d64d758801180eb81c Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 29 May 2019 10:02:17 +0300 Subject: [PATCH 2/3] abp update command for CLI resolves https://github.com/abpframework/abp/issues/1112 --- .../Volo/Abp/Cli/AbpCliCoreModule.cs | 1 + .../Volo/Abp/Cli/Commands/UpdateCommand.cs | 93 +++++++++++++++++++ .../VoloPackagesVersionUpdater.cs | 76 +++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloPackagesVersionUpdater.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs index c1894b2e6b..eb22185b73 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs @@ -22,6 +22,7 @@ namespace Volo.Abp.Cli { options.Commands["help"] = typeof(HelpCommand); options.Commands["new"] = typeof(NewCommand); + options.Commands["update"] = typeof(UpdateCommand); options.Commands["add-package"] = typeof(AddPackageCommand); options.Commands["add-module"] = typeof(AddModuleCommand); options.Commands["login"] = typeof(LoginCommand); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs new file mode 100644 index 0000000000..b046c908e3 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Newtonsoft.Json; +using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.ProjectBuilding.Github; +using Volo.Abp.Cli.ProjectModification; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.Commands +{ + public class UpdateCommand : IConsoleCommand, ITransientDependency + { + public ILogger Logger { get; set; } + + private readonly VoloPackagesVersionUpdater _packagesVersionUpdater; + + public UpdateCommand(VoloPackagesVersionUpdater packagesVersionUpdater) + { + _packagesVersionUpdater = packagesVersionUpdater; + + Logger = NullLogger.Instance; + } + + public async Task ExecuteAsync(CommandLineArgs commandLineArgs) + { + var includePreviews = commandLineArgs.Options.GetOrNull(Options.IncludePreviews.Short, Options.IncludePreviews.Long) != null; + + var solution = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sln").FirstOrDefault(); + + if (solution != null) + { + var version = await GetLatestAbpVersion(includePreviews); + var solutionName = Path.GetFileName(solution).RemovePostFix(".sln"); + + _packagesVersionUpdater.UpdateSolution(solution, version); + + Logger.LogInformation($"Volo packages are updated to {version} in {solutionName} solution."); + return; + } + + var project = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.csproj").FirstOrDefault(); + + if (project != null) + { + var version = await GetLatestAbpVersion(includePreviews); + var projectName = Path.GetFileName(project).RemovePostFix(".csproj"); + + _packagesVersionUpdater.UpdateProject(project, version); + + Logger.LogInformation($"Volo packages are updated to {version} in {projectName} project."); + return; + } + + Logger.LogError("No solution or project found in this directory."); + } + + protected virtual async Task GetLatestAbpVersion(bool includePreviews) + { + var url = "https://api.github.com/repos/abpframework/abp/releases"; + + using (var client = new HttpClient()) + { + client.Timeout = TimeSpan.FromMinutes(30); + client.DefaultRequestHeaders.UserAgent.ParseAdd("MyAgent/1.0"); + var result = await client.GetStringAsync(url); + + var releases = JsonConvert.DeserializeObject>(result); + + if (!includePreviews) + { + releases.RemoveAll(v => v.IsPrerelease); + } + + return releases.First().Name.RemovePreFix("v"); + } + } + + public static class Options + { + public static class IncludePreviews + { + public const string Short = "p"; + public const string Long = "include-previews"; + } + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloPackagesVersionUpdater.cs new file mode 100644 index 0000000000..e97a901879 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloPackagesVersionUpdater.cs @@ -0,0 +1,76 @@ +using System; +using System.IO; +using System.Text; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.ProjectModification +{ + public class VoloPackagesVersionUpdater : ITransientDependency + { + public void UpdateSolution(string solutionPath, string newVersion) + { + var projectPaths = ProjectFinder.GetProjectFiles(solutionPath); + + foreach (var filePath in projectPaths) + { + UpdateInternal(filePath, newVersion); + } + } + + public void UpdateProject(string projectPath, string newVersion) + { + UpdateInternal(projectPath, newVersion); + } + + protected virtual void UpdateInternal(string projectPath, string newVersion) + { + var fileContent = File.ReadAllText(projectPath); + + var content = new StringBuilder(); + var index = 0; + + while (index >= 0) + { + fileContent = fileContent.Substring(index); + content.Append(ReplaceAPackage(fileContent, newVersion, out index)); + } + + File.WriteAllText(projectPath, content.ToString()); + } + + private string ReplaceAPackage(string content, string version, out int index) + { + var packageReferenceStartText = "nclude=\"Volo."; + var returningText = new StringBuilder(); + + var indexOfPackageReference = content.IndexOf(packageReferenceStartText, StringComparison.Ordinal); + + if (indexOfPackageReference < 0) + { + index = -1; + return content; + } + + returningText.Append(content.Substring(0, indexOfPackageReference + packageReferenceStartText.Length)); + content = content.Substring(indexOfPackageReference + packageReferenceStartText.Length); + + var indexAfterQuote = content.IndexOf("\"", StringComparison.Ordinal) + 1; + + returningText.Append(content.Substring(0, indexAfterQuote)); + content = content.Substring(indexAfterQuote); + + var indexAfterSecondQuote = content.IndexOf("\"", StringComparison.Ordinal) + 1; + + returningText.Append(content.Substring(0, indexAfterSecondQuote)); + content = content.Substring(indexAfterSecondQuote); + + var indexOfThirdQuote = content.IndexOf("\"", StringComparison.Ordinal); + + returningText.Append(version); + + index = indexOfPackageReference + packageReferenceStartText.Length + indexAfterQuote + indexAfterSecondQuote + indexOfThirdQuote; + + return returningText.ToString(); + } + } +} From 42f24d1391c3b1d06be0e010ae7c3b68d575041e Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 29 May 2019 10:08:47 +0300 Subject: [PATCH 3/3] BookStore: Upgraded abp version using CLi https://github.com/abpframework/abp/issues/1112 --- .../Acme.BookStore.Application.csproj | 10 +++++----- .../Acme.BookStore.Domain.csproj | 16 ++++++++-------- ...ore.EntityFrameworkCore.DbMigrations.csproj | 3 ++- .../Acme.BookStore.EntityFrameworkCore.csproj | 18 +++++++++--------- .../Acme.BookStore.Web.csproj | 14 +++++++------- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj index 9926530966..d7983e8b87 100644 --- a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj +++ b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj @@ -1,4 +1,4 @@ - + @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj index c358910b01..4c0984d3b9 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj +++ b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj @@ -1,4 +1,4 @@ - + @@ -8,13 +8,13 @@ - - - - - - - + + + + + + + diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj index da6638173c..d4c691c4e8 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ + diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj index c42ea44516..e65e2d5d89 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj @@ -1,4 +1,4 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + diff --git a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj index 46616b452a..7509a9c9bb 100644 --- a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj +++ b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj @@ -1,4 +1,4 @@ - + @@ -36,12 +36,12 @@ - - - - - - + + + + + +