Browse Source

Merge pull request #18 from abpframework/master

merge
pull/1172/head
Marcelo M 7 years ago
committed by GitHub
parent
commit
b66bf1baf9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
  2. 93
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs
  3. 76
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloPackagesVersionUpdater.cs
  4. 1
      modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json
  5. 1
      modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/pt-BR.json
  6. 1
      modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json
  7. 1
      modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/zh-Hans.json
  8. 10
      samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
  9. 16
      samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
  10. 3
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj
  11. 18
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
  12. 14
      samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj

1
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["help"] = typeof(HelpCommand);
options.Commands["new"] = typeof(NewCommand); options.Commands["new"] = typeof(NewCommand);
options.Commands["update"] = typeof(UpdateCommand);
options.Commands["add-package"] = typeof(AddPackageCommand); options.Commands["add-package"] = typeof(AddPackageCommand);
options.Commands["add-module"] = typeof(AddModuleCommand); options.Commands["add-module"] = typeof(AddModuleCommand);
options.Commands["login"] = typeof(LoginCommand); options.Commands["login"] = typeof(LoginCommand);

93
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<UpdateCommand> Logger { get; set; }
private readonly VoloPackagesVersionUpdater _packagesVersionUpdater;
public UpdateCommand(VoloPackagesVersionUpdater packagesVersionUpdater)
{
_packagesVersionUpdater = packagesVersionUpdater;
Logger = NullLogger<UpdateCommand>.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<string> 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<List<GithubRelease>>(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";
}
}
}
}

76
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();
}
}
}

1
modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json

@ -14,7 +14,6 @@
"Login": "Login", "Login": "Login",
"Cancel": "Cancel", "Cancel": "Cancel",
"Register": "Register", "Register": "Register",
"UseAnotherServiceToLogIn.": "Use another service to log in.",
"InvalidLoginRequest": "Invalid login request", "InvalidLoginRequest": "Invalid login request",
"ThereAreNoLoginSchemesConfiguredForThisClient": "There are no login schemes configured for this client.", "ThereAreNoLoginSchemesConfiguredForThisClient": "There are no login schemes configured for this client.",
"LogInUsingYourProviderAccount": "Log in using your {0} account" "LogInUsingYourProviderAccount": "Log in using your {0} account"

1
modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/pt-BR.json

@ -14,7 +14,6 @@
"Login": "Entrar", "Login": "Entrar",
"Cancel": "Cancelar", "Cancel": "Cancelar",
"Register": "Registrar-se", "Register": "Registrar-se",
"UseAnotherServiceToLogIn.": "Use outro serviço para entrar.",
"InvalidLoginRequest": "Requisição de acesso inválida!", "InvalidLoginRequest": "Requisição de acesso inválida!",
"ThereAreNoLoginSchemesConfiguredForThisClient": "Não existe um esquema de acesso para este usuário", "ThereAreNoLoginSchemesConfiguredForThisClient": "Não existe um esquema de acesso para este usuário",
"LogInUsingYourProviderAccount": "Acessse utilizando sua conta {0}" "LogInUsingYourProviderAccount": "Acessse utilizando sua conta {0}"

1
modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/tr.json

@ -14,7 +14,6 @@
"Login": "Giriş yap", "Login": "Giriş yap",
"Cancel": "İptal", "Cancel": "İptal",
"Register": "Kayıt ol", "Register": "Kayıt ol",
"UseAnotherServiceToLogIn.": "Başka bir servisle giriş yap.",
"InvalidLoginRequest": "Başarısız giriş isteği", "InvalidLoginRequest": "Başarısız giriş isteği",
"ThereAreNoLoginSchemesConfiguredForThisClient": "Bu client için konfigüre edilmiş giriş şeması bulunamadı.", "ThereAreNoLoginSchemesConfiguredForThisClient": "Bu client için konfigüre edilmiş giriş şeması bulunamadı.",
"LogInUsingYourProviderAccount": "{0} hesabınızla giriş yapın." "LogInUsingYourProviderAccount": "{0} hesabınızla giriş yapın."

1
modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/zh-Hans.json

@ -14,7 +14,6 @@
"Login": "登录", "Login": "登录",
"Cancel": "取消", "Cancel": "取消",
"Register": "注册", "Register": "注册",
"UseAnotherServiceToLogIn.": "使用其他服务登录.",
"InvalidLoginRequest": "登录请求无效", "InvalidLoginRequest": "登录请求无效",
"ThereAreNoLoginSchemesConfiguredForThisClient": "没有为此客户端配置登录方案.", "ThereAreNoLoginSchemesConfiguredForThisClient": "没有为此客户端配置登录方案.",
"LogInUsingYourProviderAccount": "使用你的{0}帐户登录" "LogInUsingYourProviderAccount": "使用你的{0}帐户登录"

10
samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
@ -9,10 +9,10 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" /> <ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="0.16.0" /> <PackageReference Include="Volo.Abp.Identity.Application" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="0.16.0" /> <PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="0.16.0" /> <PackageReference Include="Volo.Abp.TenantManagement.Application" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="0.16.0" /> <PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="0.17.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

16
samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
@ -8,13 +8,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Identity.Domain" Version="0.16.0" /> <PackageReference Include="Volo.Abp.Identity.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="0.16.0" /> <PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="0.16.0" /> <PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="0.16.0" /> <PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Domain" Version="0.16.0" /> <PackageReference Include="Volo.Abp.TenantManagement.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="0.16.0" /> <PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Auditing" Version="0.16.0" /> <PackageReference Include="Volo.Abp.Auditing" Version="0.17.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
</ItemGroup> </ItemGroup>

3
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<Compile Remove="Migrations\20190320072839_Initial.cs" /> <Compile Remove="Migrations\20190320072839_Initial.cs" />
<Compile Remove="Migrations\20190529070552_Upgraded_To_Abp_0.17.0.0.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

18
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
@ -9,14 +9,14 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" /> <ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.16.0" /> <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.16.0" /> <PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.16.0" /> <PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="0.16.0" /> <PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="0.16.0" /> <PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="0.16.0" /> <PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="0.16.0" /> <PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.16.0" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.17.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

14
samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
@ -36,12 +36,12 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Application\Acme.BookStore.Application.csproj" /> <ProjectReference Include="..\Acme.BookStore.Application\Acme.BookStore.Application.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" /> <ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.16.0" /> <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.16.0" /> <PackageReference Include="Volo.Abp.Autofac" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Identity.Web" Version="0.16.0" /> <PackageReference Include="Volo.Abp.Identity.Web" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.Account.Web" Version="0.16.0" /> <PackageReference Include="Volo.Abp.Account.Web" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.Web" Version="0.16.0" /> <PackageReference Include="Volo.Abp.TenantManagement.Web" Version="0.17.0.0" />
<PackageReference Include="Volo.Abp.FeatureManagement.Web" Version="0.16.0" /> <PackageReference Include="Volo.Abp.FeatureManagement.Web" Version="0.17.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Loading…
Cancel
Save