matthewjberger / scoop-nerd-fonts

A scoop bucket for installing nerd fonts
The Unlicense
360 stars 34 forks source link

Please update Cascadia Code for 2005.15 #74

Closed gntzh closed 4 years ago

gntzh commented 4 years ago

Cascadia Code(Code, Mono, PL, MonoPL) is on version 2005.15 now. https://github.com/microsoft/cascadia-code/releases

ueberBrot commented 4 years ago

They are not separate files anymore but one zipfile. The downloadable .zip file contains

@matthewjberger Maybe it would be best to combine those in one script for installation the same way as e.g. Fira Code ?

I'm not sure if the following script works, because I've only corrected the links a little bit so far for my PRs of the Fira Code font. I used the Fira Code script as base for this:

{
    "version": "2005.15",
    "license": "OFL-1.1",
    "homepage": "https://github.com/microsoft/cascadia-code",
    "url": "https://github.com/microsoft/cascadia-code/releases/download/v2005.15/CascadiaCode_2005.15.zip",
    "hash": "b3d8495e9cdee90d0dbaf60b7db018413e130265dc27e2be7a8db04cf98fddce",
    "checkver": "github",
    "autoupdate": {
        "url": "https://github.com/microsoft/cascadia-code/releases/download/v$version/CascadiaCode_$version.zip"
    },
    "installer": {
        "script": [
            "Get-ChildItem $dir -Filter '*.ttf' -Recurse | ForEach-Object {",
            "  New-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts' -Name $_.Name.Replace($_.Extension, ' (TrueType)') -Value $_.Name -Force | Out-Null",
            "  Copy-Item $_.FullName -destination \"$env:windir\\Fonts\"",
            "}"
        ]
    },
    "uninstaller": {
        "script": [
            "if(!(is_admin)) { error \"Admin rights are required, please run 'sudo scoop uninstall $app'\"; exit 1 }",
            "Get-ChildItem $dir -filter '*.ttf' | ForEach-Object {",
            "    Remove-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts' -Name $_.Name.Replace($_.Extension, ' (TrueType)') -Force -ErrorAction SilentlyContinue",
            "    Remove-Item \"$env:windir\\Fonts\\$($_.Name)\" -Force -ErrorAction SilentlyContinue",
            "}",
            "Write-Host \"The '$app' font family has been uninstalled and will not be present after restarting your computer.\" -Foreground Magenta"
        ]
    }
}

Does this work for installing the new fonts and uninstalling the old ones? Maybe you have to uninstall with the old scripts first and install with the then newly suggested script?

And is there a way to test the installation prior to submitting a newly script that was not used in that way before?

matthewjberger commented 4 years ago

@ueberBrot I liked your suggestion! I went ahead and consolidated the CascadiaCode font manifests the same way that the official releases did. Now they will all update together.

As for installing the new fonts and uninstalling the old ones, scoop should be able to just scoop uninstall fontName where fontName is any of the existing installed fonts. Should work properly even if the manifest was removed from this bucket

matthewjberger commented 4 years ago

I've added a note to the readme about this change as well