Browse Source

Added version option while creating a new solution

pull/1557/head
Halil İbrahim Kalkan 7 years ago
parent
commit
4a2cd6c661
  1. 14
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  2. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs
  3. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs
  4. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs
  5. 21
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Github/GithubRelease.cs
  6. 10
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
  7. 12
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs

14
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -46,6 +46,7 @@ namespace Volo.Abp.Cli.Commands
new ProjectBuildArgs( new ProjectBuildArgs(
SolutionName.Parse(commandLineArgs.Target), SolutionName.Parse(commandLineArgs.Target),
commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long), commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long),
commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long),
GetDatabaseProviderOrNull(commandLineArgs), GetDatabaseProviderOrNull(commandLineArgs),
commandLineArgs.Options commandLineArgs.Options
) )
@ -111,13 +112,14 @@ namespace Volo.Abp.Cli.Commands
sb.AppendLine(" abp new <project-name> [-t|--template] [-d|--database-provider] [-o|--output-folder]"); sb.AppendLine(" abp new <project-name> [-t|--template] [-d|--database-provider] [-o|--output-folder]");
sb.AppendLine(""); sb.AppendLine("");
sb.AppendLine("Options:"); sb.AppendLine("Options:");
sb.AppendLine("-t|--template <template-name>"); sb.AppendLine("-t|--template <template-name> (default: app)");
sb.AppendLine("-o|--output-folder <output-folder>"); sb.AppendLine("-o|--output-folder <output-folder> (default: current folder)");
sb.AppendLine("-v|--version <version> (default: latest version)");
sb.AppendLine("-d|--database-provider <database-provider> (if supported by the template)"); sb.AppendLine("-d|--database-provider <database-provider> (if supported by the template)");
sb.AppendLine("--tiered (if supported by the template)"); sb.AppendLine("--tiered (if supported by the template)");
sb.AppendLine("--no-ui (if supported by the template)"); sb.AppendLine("--no-ui (if supported by the template)");
sb.AppendLine(""); sb.AppendLine("");
sb.AppendLine("Some examples:"); sb.AppendLine("Examples:");
sb.AppendLine(" abp new Acme.BookStore"); sb.AppendLine(" abp new Acme.BookStore");
sb.AppendLine(" abp new Acme.BookStore --tiered"); sb.AppendLine(" abp new Acme.BookStore --tiered");
sb.AppendLine(" abp new Acme.BookStore -t mvc-module"); sb.AppendLine(" abp new Acme.BookStore -t mvc-module");
@ -169,6 +171,12 @@ namespace Volo.Abp.Cli.Commands
public const string Short = "o"; public const string Short = "o";
public const string Long = "output-folder"; public const string Long = "output-folder";
} }
public static class Version
{
public const string Short = "v";
public const string Long = "version";
}
} }
} }
} }

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs

@ -7,9 +7,9 @@ namespace Volo.Abp.Cli.Http
{ {
public class CliHttpClient : HttpClient public class CliHttpClient : HttpClient
{ {
public CliHttpClient() : base(new CliHttpClientHandler()) public CliHttpClient(TimeSpan? timeout = null) : base(new CliHttpClientHandler())
{ {
Timeout = TimeSpan.FromSeconds(30); Timeout = timeout ?? TimeSpan.FromMinutes(1);
AddAuthentication(this); AddAuthentication(this);
} }

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs

@ -102,7 +102,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
{ {
var postData = JsonSerializer.Serialize(input); var postData = JsonSerializer.Serialize(input);
using (var client = new CliHttpClient()) using (var client = new CliHttpClient(TimeSpan.FromMinutes(10)))
{ {
var responseMessage = await client.PostAsync( var responseMessage = await client.PostAsync(
$"{CliUrls.WwwAbpIo}api/download/template/", $"{CliUrls.WwwAbpIo}api/download/template/",

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs

@ -18,7 +18,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
string projectFolderPath = null) string projectFolderPath = null)
{ {
_projectName = projectName; _projectName = projectName;
_solutionFilePath = solutionFilePath ?? "/MyCompanyName.MyProjectName.sln"; _solutionFilePath = solutionFilePath ?? "/aspnet-core/MyCompanyName.MyProjectName.sln";
_projectFolderPath = projectFolderPath ?? ("/aspnet-core/src/" + projectName); _projectFolderPath = projectFolderPath ?? ("/aspnet-core/src/" + projectName);
} }

21
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Github/GithubRelease.cs

@ -1,21 +0,0 @@
using System;
using Newtonsoft.Json;
namespace Volo.Abp.Cli.ProjectBuilding.Github
{
[JsonObject]
public class GithubRelease
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("prerelease")]
public bool IsPrerelease { get; set; }
[JsonProperty("published_at")]
public DateTime PublishTime { get; set; }
}
}

10
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs

@ -12,6 +12,9 @@ namespace Volo.Abp.Cli.ProjectBuilding
[CanBeNull] [CanBeNull]
public string TemplateName { get; set; } public string TemplateName { get; set; }
[CanBeNull]
public string Version { get; set; }
public DatabaseProvider DatabaseProvider { get; set; } public DatabaseProvider DatabaseProvider { get; set; }
[NotNull] [NotNull]
@ -20,13 +23,14 @@ namespace Volo.Abp.Cli.ProjectBuilding
public ProjectBuildArgs( public ProjectBuildArgs(
[NotNull] SolutionName solutionName, [NotNull] SolutionName solutionName,
[CanBeNull] string templateName = null, [CanBeNull] string templateName = null,
[CanBeNull] string version = null,
DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified, DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified,
Dictionary<string, string> extraProperties = null) Dictionary<string, string> extraProperties = null)
{ {
DatabaseProvider = databaseProvider;
TemplateName = templateName;
SolutionName = Check.NotNull(solutionName, nameof(solutionName)); SolutionName = Check.NotNull(solutionName, nameof(solutionName));
TemplateName = templateName;
Version = version;
DatabaseProvider = databaseProvider;
ExtraProperties = extraProperties ?? new Dictionary<string, string>(); ExtraProperties = extraProperties ?? new Dictionary<string, string>();
} }
} }

12
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs

@ -1,9 +1,10 @@
using System; using Microsoft.Extensions.Logging;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Cli.ProjectBuilding.Analyticses; using Volo.Abp.Cli.ProjectBuilding.Analyticses;
using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -53,7 +54,8 @@ namespace Volo.Abp.Cli.ProjectBuilding
var templateFile = await TemplateStore.GetAsync( var templateFile = await TemplateStore.GetAsync(
args.TemplateName, args.TemplateName,
args.DatabaseProvider, args.DatabaseProvider,
args.SolutionName.FullName args.SolutionName.FullName,
args.Version
); );
var context = new ProjectBuildContext( var context = new ProjectBuildContext(

Loading…
Cancel
Save