Skip to content

Commit

Permalink
fix(module): update version to 5.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
abgox committed Dec 19, 2024
1 parent bc99416 commit ea572ac
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
4 changes: 4 additions & 0 deletions module/CHANGELOG-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<a href="./CHANGELOG-CN.md">简体中文</a>
</p>

## 5.2.4 (2024/12/19)

- 优化模块版本迁移

## 5.2.3 (2024/12/18)

- 对于语言为 `zh-CN` 或设置为 `zh-CN` 的用户,之前默认会使用 Gitee 源 `https://gitee.com/abgox/PSCompletions/raw/main`
Expand Down
13 changes: 13 additions & 0 deletions module/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
[
{
"version": "5.2.4",
"info": {
"zh-CN": [
"更新(2024/12/19)\n",
"- 优化模块版本迁移。\n"
],
"en-US": [
"Update(2024/12/19)\n",
"- Optimize module version migration.\n"
]
}
},
{
"version": "5.2.3",
"info": {
Expand Down
4 changes: 4 additions & 0 deletions module/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<a href="./CHANGELOG.md">English</a>
</p>

## 5.2.4 (2024/12/19)

- Optimize module version migration.

## 5.2.3 (2024/12/18)

- Use `https://abgox.github.io/PSCompletions` as the primary source for module and completion updates.
Expand Down
2 changes: 1 addition & 1 deletion module/PSCompletions/PSCompletions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{
RootModule = 'PSCompletions.psm1'

ModuleVersion = '5.2.3'
ModuleVersion = '5.2.4'

GUID = '00929632-527d-4dab-a5b3-21197faccd05'

Expand Down
23 changes: 11 additions & 12 deletions module/PSCompletions/core/init.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using namespace System.Management.Automation
$_ = Split-Path $PSScriptRoot -Parent
New-Variable -Name PSCompletions -Value @{
version = '5.2.3'
version = '5.2.4'
path = @{
root = $_
completions = Join-Path $_ 'completions'
Expand Down Expand Up @@ -1036,6 +1036,9 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod new_data {
foreach ($_ in $json.config) {
$data.config.comp_config.$name.$($_.name) = $_.value
}
if ($config.hooks -ne $null) {
$data.config.comp_config.$name.enable_hooks = [int]$config.hooks
}
}
$data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8
$PSCompletions.data = $data
Expand Down Expand Up @@ -1174,22 +1177,14 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod argc_completions
}

if (!(Test-Path $PSCompletions.path.temp)) {
$PSCompletions.ensure_dir($PSCompletions.path.temp)
$PSCompletions.ensure_dir($PSCompletions.path.order)
Add-Member -InputObject $PSCompletions -MemberType ScriptMethod move_old_version {
$version = (Get-ChildItem (Split-Path $PSCompletions.path.root -Parent) -ErrorAction SilentlyContinue).Name | Sort-Object { [Version]$_ } -ErrorAction SilentlyContinue | Where-Object { $_ -match '^\d+\.\d.*' }
if ($version -is [array]) {
$old_version = $version[-2]
if ($old_version -match '^\d+\.\d.*' -and $old_version -ge '4') {
$old_version_dir = Join-Path (Split-Path $PSCompletions.path.root -Parent) $old_version
$PSCompletions.ensure_dir($PSCompletions.path.completions)

if (Test-Path "$old_version_dir/data.json") {
foreach ($_ in Get-ChildItem "$old_version_dir/completions" -Directory -ErrorAction SilentlyContinue) {
if ($_.Name -ne 'psc') {
Move-Item $_.FullName $PSCompletions.path.completions -Force -ErrorAction SilentlyContinue
}
}
Move-Item "$old_version_dir/data.json" $PSCompletions.path.data -Force -ErrorAction SilentlyContinue
}
else {
Expand Down Expand Up @@ -1232,9 +1227,10 @@ if (!(Test-Path $PSCompletions.path.temp)) {
}
$data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8
}
Move-Item "$old_version_dir/temp/update.txt" $PSCompletions.path.update -Force -ErrorAction SilentlyContinue
Move-Item "$old_version_dir/temp/change.txt" $PSCompletions.path.change -Force -ErrorAction SilentlyContinue
Move-Item "$old_version_dir/temp/completions.json" $PSCompletions.path.completions_json -Force -ErrorAction SilentlyContinue

foreach ($f in @('temp', 'completions')) {
Move-Item "$old_version_dir/$f" $PSCompletions.path.root -Force -ErrorAction SilentlyContinue
}
}
}
else {
Expand All @@ -1257,6 +1253,7 @@ if (!(Test-Path $PSCompletions.path.temp)) {
$urls = @('https://github.com/abgox/PSCompletions/raw/main', 'https://gitee.com/abgox/PSCompletions/raw/main')
}

$PSCompletions.ensure_dir($PSCompletions.path.completions)
$PSCompletions.ensure_dir("$($PSCompletions.path.completions)/psc")
$PSCompletions.ensure_dir("$($PSCompletions.path.completions)/psc/language")

Expand Down Expand Up @@ -1284,6 +1281,8 @@ if (!(Test-Path $PSCompletions.path.temp)) {
$PSCompletions.info = $PSCompletions.ConvertFrom_JsonToHashtable($PSCompletions.get_raw_content("$($PSCompletions.path.completions)/psc/language/$language.json")).info
}
$PSCompletions.move_old_version()
$PSCompletions.ensure_dir($PSCompletions.path.temp)
$PSCompletions.ensure_dir($PSCompletions.path.order)
$PSCompletions.is_init = $true
}

Expand Down
2 changes: 1 addition & 1 deletion module/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.3
5.2.4

0 comments on commit ea572ac

Please sign in to comment.