diff --git a/CHANGELOG.md b/CHANGELOG.md index e7f4535..429c83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Atlassian Downloader - Changelog -* `1.0.0.9` - switched to `dontet7.0`, updated deps. +* `1.0.1.0` - added support of `Atlassian Bitbucket (Mesh)` product, updated deps, fixed `Chocolatey` support and start logic. +* `1.0.0.9` - updated deps. * `1.0.0.8` - switched to `dontet6.0`, updated deps. * `1.0.0.7` - added `unofficial support` of `sourcetree` via automatic mirror [from github](https://github.com/EpicMorg/atlassian-json). fixed `logger` output, code improvments. * `1.0.0.6` - added support of `clover`. fixed broken json parsing. added new `logger`. diff --git a/README.md b/README.md index c9c6e35..b0ad8de 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ The following built-in themes are available, provided by `Serilog.Sinks.Console` |-------------|:-------------:|:-------------:|:-------------:| | [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Bamboo&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/bamboo) | :white_check_mark: | :white_check_mark: | :white_check_mark: | | [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Bitbucket%20(Stash)&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/bitbucket) | :white_check_mark: | :white_check_mark: | :interrobang: | +| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Bitbucket%20(Mesh)&color=bright%20green&style=for-the-badge)](https://confluence.atlassian.com/bitbucketserver/bitbucket-mesh-compatibility-matrix-1127254859.html) | :white_check_mark: | :white_check_mark: | :interrobang: | | [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Clover&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/clover) | :white_check_mark: | :white_check_mark: | :x: | | [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Confluence&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/confluence) | :white_check_mark: | :white_check_mark: | :x: | | [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Crowd&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/crowd) | :white_check_mark: | :white_check_mark: | :x: | diff --git a/docs/products.png b/docs/products.png index b9c17e8..9843ec7 100644 Binary files a/docs/products.png and b/docs/products.png differ diff --git a/src/DonloaderService.cs b/src/DonloaderService.cs index 828bd59..962d164 100644 --- a/src/DonloaderService.cs +++ b/src/DonloaderService.cs @@ -103,7 +103,7 @@ namespace EpicMorg.Atlassian.Downloader public async Task StartAsync(CancellationToken cancellationToken) { SetConsoleTitle(); - if (options.Version) + if (options.Version || string.IsNullOrWhiteSpace(options.OutputDir)) { ShowVersionInfo(); } @@ -119,7 +119,7 @@ namespace EpicMorg.Atlassian.Downloader { return; } - var (json, versions) = await this.GetJson(feedUrl, cancellationToken).ConfigureAwait(false); + var (json, versions) = await this.GetJson(feedUrl, options.ProductVersion, cancellationToken).ConfigureAwait(false); switch (options.Action) { @@ -182,7 +182,7 @@ namespace EpicMorg.Atlassian.Downloader Console.ResetColor(); } - private async Task<(string json, IDictionary versions)> GetJson(string feedUrl, CancellationToken cancellationToken) + private async Task<(string json, IDictionary versions)> GetJson(string feedUrl, string? productVersion = null, CancellationToken cancellationToken = default) { var atlassianJson = await client.GetStringAsync(feedUrl, cancellationToken).ConfigureAwait(false); var json = atlassianJson.Trim()["downloads(".Length..^1]; @@ -192,7 +192,10 @@ namespace EpicMorg.Atlassian.Downloader PropertyNameCaseInsensitive = true }); logger.LogDebug("Found {0} releases", parsed.Length); - var versions = parsed.GroupBy(a => a.Version).ToDictionary(a => a.Key, a => a.ToArray()); + var versions = parsed + .GroupBy(a => a.Version) + .Where(a => productVersion is null || a.Key == productVersion) + .ToDictionary(a => a.Key, a => a.ToArray()); logger.LogDebug("Found {0} releases", versions.Count); return (json, versions); } @@ -211,6 +214,7 @@ namespace EpicMorg.Atlassian.Downloader "https://my.atlassian.com/download/feeds/archived/jira-software.json", "https://my.atlassian.com/download/feeds/archived/jira.json", "https://my.atlassian.com/download/feeds/archived/stash.json", + "https://my.atlassian.com/download/feeds/archived/mesh.json", "https://my.atlassian.com/download/feeds/current/bamboo.json", "https://my.atlassian.com/download/feeds/current/clover.json", @@ -222,12 +226,14 @@ namespace EpicMorg.Atlassian.Downloader "https://my.atlassian.com/download/feeds/current/jira-servicedesk.json", "https://my.atlassian.com/download/feeds/current/jira-software.json", "https://my.atlassian.com/download/feeds/current/stash.json", + "https://my.atlassian.com/download/feeds/current/mesh.json", "https://my.atlassian.com/download/feeds/eap/bamboo.json", "https://my.atlassian.com/download/feeds/eap/confluence.json", "https://my.atlassian.com/download/feeds/eap/jira.json", "https://my.atlassian.com/download/feeds/eap/jira-servicedesk.json", "https://my.atlassian.com/download/feeds/eap/stash.json", + "https://my.atlassian.com/download/feeds/eap/mesh.json", //https://raw.githubusercontent.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json "https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json", diff --git a/src/Models/DownloaderOptions.cs b/src/Models/DownloaderOptions.cs index aca9cb8..616423d 100644 --- a/src/Models/DownloaderOptions.cs +++ b/src/Models/DownloaderOptions.cs @@ -2,5 +2,5 @@ namespace EpicMorg.Atlassian.Downloader { - public record DownloaderOptions(string OutputDir, Uri[] CustomFeed, DownloadAction Action,bool Version) { } + public record DownloaderOptions(string OutputDir, Uri[] CustomFeed, DownloadAction Action,bool Version, string ProductVersion) { } } \ No newline at end of file diff --git a/src/Program.cs b/src/Program.cs index 85994ad..32cb34c 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -6,6 +6,8 @@ using Microsoft.Extensions.Logging; using Serilog; using System; +using System.IO; +using System.Reflection; using System.Threading.Tasks; namespace EpicMorg.Atlassian.Downloader @@ -19,13 +21,14 @@ namespace EpicMorg.Atlassian.Downloader /// Override output directory to download /// Override URIs to import /// Show credits banner - static async Task Main(string OutputDir = "atlassian", Uri[] customFeed = null, DownloadAction Action = DownloadAction.Download, bool Version = false) => await + /// Override target version to download some product. Advice: Use it with "customFeed". + static async Task Main(string OutputDir, Uri[] customFeed = null, DownloadAction Action = DownloadAction.Download, bool Version = false, string productVersion = null) => await Host .CreateDefaultBuilder() .ConfigureHostConfiguration(configHost => configHost.AddEnvironmentVariables()) .ConfigureAppConfiguration((ctx, configuration) => configuration - .SetBasePath(Environment.CurrentDirectory) + .SetBasePath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables()) @@ -41,7 +44,7 @@ namespace EpicMorg.Atlassian.Downloader .AddSerilog(dispose: true); }) .AddHostedService() - .AddSingleton(new DownloaderOptions(OutputDir, customFeed, Action, Version)) + .AddSingleton(new DownloaderOptions(OutputDir, customFeed, Action, Version, productVersion)) .AddHttpClient()) .RunConsoleAsync() .ConfigureAwait(false); diff --git a/src/atlassian-downloader.csproj b/src/atlassian-downloader.csproj index 627c5ec..105e69e 100644 --- a/src/atlassian-downloader.csproj +++ b/src/atlassian-downloader.csproj @@ -17,9 +17,9 @@ git https://github.com/EpicMorg/atlassian-downloader atlassian, donwloader, epicmorg - 1.0.0.9 - 1.0.0.9 - 1.0.0.9 + 1.0.1.0 + 1.0.1.0 + 1.0.1.0 EpicMorg 2023 Atlassian Downloader true