diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 3f2456e81b..33c86bb367 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -46,6 +46,7 @@ namespace Volo.Abp.Cli.Commands new ProjectBuildArgs( SolutionName.Parse(commandLineArgs.Target), commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long), + commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long), GetDatabaseProviderOrNull(commandLineArgs), commandLineArgs.Options ) @@ -111,13 +112,14 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" abp new [-t|--template] [-d|--database-provider] [-o|--output-folder]"); sb.AppendLine(""); sb.AppendLine("Options:"); - sb.AppendLine("-t|--template "); - sb.AppendLine("-o|--output-folder "); + sb.AppendLine("-t|--template (default: app)"); + sb.AppendLine("-o|--output-folder (default: current folder)"); + sb.AppendLine("-v|--version (default: latest version)"); sb.AppendLine("-d|--database-provider (if supported by the template)"); sb.AppendLine("--tiered (if supported by the template)"); sb.AppendLine("--no-ui (if supported by the template)"); sb.AppendLine(""); - sb.AppendLine("Some examples:"); + sb.AppendLine("Examples:"); sb.AppendLine(" abp new Acme.BookStore"); sb.AppendLine(" abp new Acme.BookStore --tiered"); 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 Long = "output-folder"; } + + public static class Version + { + public const string Short = "v"; + public const string Long = "version"; + } } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs index c065d83200..d6983a5db1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs +++ b/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 CliHttpClient() : base(new CliHttpClientHandler()) + public CliHttpClient(TimeSpan? timeout = null) : base(new CliHttpClientHandler()) { - Timeout = TimeSpan.FromSeconds(30); + Timeout = timeout ?? TimeSpan.FromMinutes(1); AddAuthentication(this); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs index f3c873b4d0..1fd53705eb 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs +++ b/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); - using (var client = new CliHttpClient()) + using (var client = new CliHttpClient(TimeSpan.FromMinutes(10))) { var responseMessage = await client.PostAsync( $"{CliUrls.WwwAbpIo}api/download/template/", diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs index cc5fc53d08..fe1de0d72d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs +++ b/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) { _projectName = projectName; - _solutionFilePath = solutionFilePath ?? "/MyCompanyName.MyProjectName.sln"; + _solutionFilePath = solutionFilePath ?? "/aspnet-core/MyCompanyName.MyProjectName.sln"; _projectFolderPath = projectFolderPath ?? ("/aspnet-core/src/" + projectName); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Github/GithubRelease.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Github/GithubRelease.cs deleted file mode 100644 index 9d37befbc2..0000000000 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Github/GithubRelease.cs +++ /dev/null @@ -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; } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs index ca106c1f6e..42307d55cc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs @@ -12,6 +12,9 @@ namespace Volo.Abp.Cli.ProjectBuilding [CanBeNull] public string TemplateName { get; set; } + [CanBeNull] + public string Version { get; set; } + public DatabaseProvider DatabaseProvider { get; set; } [NotNull] @@ -20,13 +23,14 @@ namespace Volo.Abp.Cli.ProjectBuilding public ProjectBuildArgs( [NotNull] SolutionName solutionName, [CanBeNull] string templateName = null, + [CanBeNull] string version = null, DatabaseProvider databaseProvider = DatabaseProvider.NotSpecified, Dictionary extraProperties = null) { - DatabaseProvider = databaseProvider; - TemplateName = templateName; SolutionName = Check.NotNull(solutionName, nameof(solutionName)); - + TemplateName = templateName; + Version = version; + DatabaseProvider = databaseProvider; ExtraProperties = extraProperties ?? new Dictionary(); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs index 49d7648e22..9251b98ecb 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs @@ -1,9 +1,10 @@ -using System; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; 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.Building; using Volo.Abp.DependencyInjection; @@ -53,7 +54,8 @@ namespace Volo.Abp.Cli.ProjectBuilding var templateFile = await TemplateStore.GetAsync( args.TemplateName, args.DatabaseProvider, - args.SolutionName.FullName + args.SolutionName.FullName, + args.Version ); var context = new ProjectBuildContext(