From 1f88270db13713693eebe2b2f3856fa3edeb79a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Fri, 18 Nov 2022 18:42:38 +0100 Subject: [PATCH] feat(manager/asdf): Support gohugo plugin including extended The asdf plugin for hugo[^1] supports the name hugo & gohugo. Additionally the version can be prefixed with `extended_` to install a version with Sass support. This change mirrors that functionality in the asdf manager. [^1]: https://github.com/nklmilojevic/asdf-hugo --- lib/modules/manager/asdf/extract.spec.ts | 9 +++++ .../manager/asdf/upgradeable-tooling.ts | 36 ++++++++++++------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/lib/modules/manager/asdf/extract.spec.ts b/lib/modules/manager/asdf/extract.spec.ts index f15346f1f4bfc1..fe6bb0b98e9c31 100644 --- a/lib/modules/manager/asdf/extract.spec.ts +++ b/lib/modules/manager/asdf/extract.spec.ts @@ -58,6 +58,7 @@ elixir 1.14.1 elm 0.19.1 erlang 25.1.2 gauche 0.9.12 +gohugo extended_0.104.3 golang 1.19.2 haskell 9.4.2 helm 3.10.1 @@ -180,6 +181,14 @@ dummy 1.2.3 versioning: 'semver', depName: 'gauche', }, + { + currentValue: '0.104.3', + datasource: 'github-releases', + packageName: 'gohugoio/hugo', + versioning: 'semver', + depName: 'gohugo', + extractVersion: '^v(?\\S+)', + }, { currentValue: '1.19.2', datasource: 'github-tags', diff --git a/lib/modules/manager/asdf/upgradeable-tooling.ts b/lib/modules/manager/asdf/upgradeable-tooling.ts index 038de84f671c6b..bbf8597c471676 100644 --- a/lib/modules/manager/asdf/upgradeable-tooling.ts +++ b/lib/modules/manager/asdf/upgradeable-tooling.ts @@ -16,10 +16,27 @@ export type StaticTooling = Partial & export type DynamicTooling = (version: string) => StaticTooling | undefined; -export const upgradeableTooling: Record< - string, - { config: StaticTooling | DynamicTooling; asdfPluginUrl: string } -> = { +export type ToolingConfig = StaticTooling | DynamicTooling; +export interface ToolingDefinition { + config: ToolingConfig; + asdfPluginUrl: string; +} + +const hugoDefinition: ToolingDefinition = { + // This plugin supports the names `hugo` & `gohugo` + asdfPluginUrl: 'https://github.com/NeoHsu/asdf-hugo', + config: (version) => ({ + datasource: GithubReleasesDatasource.id, + packageName: 'gohugoio/hugo', + versioning: semverVersioning.id, + extractVersion: '^v(?\\S+)', + // The asdf hugo plugin supports prefixing the version with + // `extended_`. Extended versions feature Sass support. + currentValue: version.replace(/^extended_/, ''), + }), +}; + +export const upgradeableTooling: Record = { awscli: { asdfPluginUrl: 'https://github.com/MetricMike/asdf-awscli', config: { @@ -121,6 +138,7 @@ export const upgradeableTooling: Record< versioning: semverVersioning.id, }, }, + gohugo: hugoDefinition, golang: { asdfPluginUrl: 'https://github.com/kennyp/asdf-golang', config: { @@ -157,15 +175,7 @@ export const upgradeableTooling: Record< extractVersion: '^v(?\\S+)', }, }, - hugo: { - asdfPluginUrl: 'https://github.com/NeoHsu/asdf-hugo', - config: { - datasource: GithubReleasesDatasource.id, - packageName: 'gohugoio/hugo', - versioning: semverVersioning.id, - extractVersion: '^v(?\\S+)', - }, - }, + hugo: hugoDefinition, idris: { asdfPluginUrl: 'https://github.com/asdf-community/asdf-idris', config: {