Daniele-rolli / Beaver-Bucket

🍦 The official Scoop Bucket for Beaver Notes
https://beavernotes.com/package-manager.html
MIT License
0 stars 0 forks source link

[Feature]: Add to Scoop "Extras" bucket? #1

Closed o-l-a-v closed 4 days ago

o-l-a-v commented 1 month ago

Prerequisites

Package Name

Beaver

Expected/Current Behaviour

Why not add Beaver Notes to one of the standard buckets, so people don't have to install additional buckets to find Beaver Notes?

Steps to Reproduce

Not relevant.

Possible Solution

Not relevant.

Scoop and Buckets Version

Not relevant.

Scoop Config

Not relevant.

PowerShell Version

Not relevant.

Additional Softwares

No response

o-l-a-v commented 1 month ago

I've started mocking, but this would work much better if Beaver Notes were released as portable ZIP package without the autoupdater built in, ref https://github.com/Beaver-Notes/Beaver-Notes/issues/219.

{
  "version": "3.4.0",
  "description": "Beaver Notes - A note-taking application",
  "homepage": "https://beavernotes.com/",
  "license": "MIT",
  "architecture": {
    "arm64": {
      "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/3.4.0/Beaver-notes.Setup.3.4.0.arm64.exe",
      "hash": "541b67e7766608b0b385d459f715e9f554cdf81eae5ebbfdc18290a7d00d0b31",
      "installer": {
        "script": [
          "Start-Process -FilePath \"$dir\\$fname\" -ArgumentList '/S' -NoNewWindow -Wait"
        ]
      }
    },
    "64bit": {
      "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/3.4.0/Beaver-notes.Setup.3.4.0.exe",
      "hash": "9d7fdffb052dc0aa699124adf607a13b0de5a0fc33bab2099cccc837af1a3963",
      "installer": {
        "script": [
          "Start-Process -FilePath \"$dir\\$fname\" -ArgumentList '/S' -NoNewWindow -Wait"
        ]
      }
    }
  },
  "pre_install": [
    "$processname = \"Beaver-notes.Setup.*\"",
    "$process = Get-Process $processname -ErrorAction SilentlyContinue",
    "if ($process) {",
    "   $process.CloseMainWindow()",
    "   Start-Sleep -Seconds 5",
    "   if (!$process.HasExited) {",
    "       Start-Sleep -Seconds 25",
    "       $process | Stop-Process -Force",
    "   }",
    "}"
  ],
  "post_install": [
    "$programname = \"Beaver-Notes\"",
    "$CommonDesktopPath = [Environment]::GetFolderPath(\"CommonDesktopDirectory\")",
    "if (Test-Path \"$CommonDesktopPath\\$programname.lnk\") {Remove-Item \"$CommonDesktopPath\\$programname.lnk\" -Force}"
  ],
  "pre_uninstall": "Stop-Process -Name 'beaver-notes*' -Force",
  "post_uninstall": [
    "if ($purge) {",
    "    $Directories = [string[]](",
    "        ('{0}\\Beaver-notes' -f $env:APPDATA),",
    "        ('{0}\\beaver-notes-updater' -f $env:LOCALAPPDATA),",
    "        ('{0}\\Programs\\Beaver-notes' -f $env:LOCALAPPDATA)",
    "    )",
    "    $Directories.ForEach{",
    "        if ([System.IO.Directory]::Exists($_)) {",
    "            $null = [System.IO.Directory]::Delete($_,$true)",
    "        }",
    "    }",
    "}"
  ],
  "uninstaller": {
    "script": [
      "$ErrorActionPreference = 'Stop'",
      "$UninstallCommand = [string](",
      "    $(",
      "        [array](",
      "            Get-ChildItem -Path 'Registry::HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall'",
      "        )",
      "    ).Where{",
      "        $_.GetValue('DisplayName') -in 'Beaver Notes', 'Beaver-Notes'",
      "    }.ForEach{",
      "        $_.GetValue('UninstallString')",
      "    }[0]",
      ")",
      "if ([string]::IsNullOrEmpty($UninstallCommand)) {",
      "    Throw 'Uninstaller not found.'",
      "}",
      "else {",
      "    Start-Process -FilePath $UninstallCommand.Split('/')[0].Trim() -ArgumentList '/S' -NoNewWindow -Wait",
      "}"
    ]
  },
  "checkver": {
    "github": "https://github.com/Beaver-Notes/Beaver-Notes"
  },
  "autoupdate": {
    "architecture": {
      "arm64": {
        "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/$version/Beaver-notes.Setup.$version.arm64.exe"
      },
      "64bit": {
        "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/$version/Beaver-notes.Setup.$version.exe"
      }
    }
  }
}
Daniele-rolli commented 1 month ago

Thanks for the suggestion! I'll work on getting Beaver Notes into the Scoop 'Extras' bucket. I won't be working on this immediately as I am focusing on other features for the next version. However, I'll ensure that version 3.5.0 is available in the Extras bucket instead of this repository.

o-l-a-v commented 1 month ago

Awesome!

I found that your current uninstall logic did not work @Daniele-rolli. I updated my previous comment with a lot of logic changes to install and uninstall. 😊

o-l-a-v commented 1 month ago

@Daniele-rolli I got a Scoop manifest using the portable .exe files working! I don't have arm64 so haven't tested that. Here:

{
  "version": "3.4.0",
  "description": "Beaver Notes - A note-taking application",
  "homepage": "https://beavernotes.com/",
  "license": "MIT",
  "architecture": {
    "arm64": {
      "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/3.4.0/Beaver-notes.3.4.0.portable.arm64.exe",
      "hash": "bce185ccc95896acd872fa654622cdcbdf38c94d97c18bb7d14e1fe85aea78ef"
    },
    "64bit": {
      "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/3.4.0/Beaver-notes.3.4.0.portable.exe",
      "hash": "1db43e5bf3aa22afea43cb404dca51418a01417a28ffba6e75417ae1464fae90"
    }
  },
  "bin": "beaver-notes.exe",
  "post_uninstall": [
    "if ($purge) {",
    "    $Directories = [string[]](",
    "        ('{0}\\Beaver-notes' -f $env:APPDATA)",
    "    )",
    "    $Directories.ForEach{",
    "        if ([System.IO.Directory]::Exists($_)) {",
    "            $null = [System.IO.Directory]::Delete($_,$true)",
    "        }",
    "    }",
    "}"
  ],
  "installer": {
    "script": "Rename-Item -Path \"$dir\\$fname\" -NewName \"beaver-notes.exe\""
  },
  "persist": "data",
  "checkver": {
    "github": "https://github.com/Beaver-Notes/Beaver-Notes"
  },
  "shortcuts": [
    [
      "beaver-notes.exe",
      "Beaver Notes"
    ]
  ],
  "autoupdate": {
    "architecture": {
      "arm64": {
        "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/$version/Beaver-notes.$version.portable.arm64.exe"
      },
      "64bit": {
        "url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/$version/Beaver-notes.$version.portable.exe"
      }
    }
  }
}

So, in short:

Seems to work from my brief testing. 😊 Kind of fixes https://github.com/Beaver-Notes/Beaver-Notes/issues/220 too.


I can PR it to ScoopInstaller Extras if you'd like. Or you could do it. Both works for me.

o-l-a-v commented 4 days ago

Closed by https://github.com/ScoopInstaller/Extras/pull/13661.