A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Chocolatey support (#337)
Rafael Lópezf61e0b3429d2
diff --git a/README.md b/README.mdindex 179abb5d1..81308d00b 100644--- a/README.md+++ b/README.md@@ -81,7 +81,9 @@ Many tools are available.__Note:__ a Microsoft Store account is required for WinGet. We're trying to workaround it. See here https://github.com/microsoft/winget-pkgs/pull/43996### Chocolatey-Work in progress: [#183](https://github.com/veler/DevToys/issues/183)+- Make sure you already have [Chocolatey](https://chocolatey.org/) installed on your computer.+- Open a PowerShell command prompt.+- Type `choco install devtoys` or visit the [chocolatey community package](https://community.chocolatey.org/packages/devtoys/).## App Permissiondiff --git a/chocolatey/DevToys/devtoys.nuspec b/chocolatey/DevToys/devtoys.nuspecnew file mode 100644index 000000000..b145b5f86--- /dev/null+++ b/chocolatey/DevToys/devtoys.nuspec@@ -0,0 +1,25 @@+<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->+<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">+ <metadata>+ <id>DevToys</id>+ <version>1.0.2.0</version>+ <packageSourceUrl>https://github.com/rlm96/DevToys/tree/main/chocolatey/DevToys</packageSourceUrl>+ <owners>Rafael Lopez</owners>+ <title>DevToys</title>+ <authors>Etienne BAUDOUX</authors>+ <projectUrl>https://devtoys.app/</projectUrl>+ <iconUrl>https://devtoys.app/img/hero-logo.png</iconUrl>+ <licenseUrl>https://github.com/veler/DevToys/blob/main/LICENSE.md</licenseUrl>+ <requireLicenseAcceptance>true</requireLicenseAcceptance>+ <projectSourceUrl>https://github.com/veler/DevToys.git</projectSourceUrl>+ <docsUrl>https://github.com/veler/DevToys/blob/main/README.md</docsUrl>+ <mailingListUrl>https://github.com/veler/DevToys/discussions</mailingListUrl>+ <bugTrackerUrl>https://github.com/veler/DevToys/issues</bugTrackerUrl>+ <tags>devtoys</tags>+ <summary>A Swiss Army knife for developers.</summary>+ <description>DevToys helps in daily tasks like formatting JSON, comparing text, testing RegExp. No need to use many untruthful websites to do simple tasks with your data. With Smart Detection, DevToys is able to detect the best tool that can treat the data you copied in the clipboard of your Windows. Compact overlay lets you keep the app in small and on top of other windows. Multiple instances of the app can be used at once.</description>+ </metadata>+ <files>+ <file src="tools\**" target="tools" />+ </files>+</package>diff --git a/chocolatey/DevToys/tools/chocolateyinstall.ps1 b/chocolatey/DevToys/tools/chocolateyinstall.ps1new file mode 100644index 000000000..7e5c69c84--- /dev/null+++ b/chocolatey/DevToys/tools/chocolateyinstall.ps1@@ -0,0 +1,45 @@+$ErrorActionPreference = 'Stop';+$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"+$url64 = 'https://github.com/veler/DevToys/releases/download/v1.0.2.0/64360VelerSoftware.DevToys_1.0.2.0_neutral___j80j2txgjg9dj.Msixbundle'+$checksum64 = '287e0fe143b25069df2d43eb8fd7dedeff9abc6f3fe7799ccb218a180d2068a3'+$WindowsVersion = [Environment]::OSVersion.Version;+$InstallDir = Split-Path $MyInvocation.MyCommand.Definition;+$AppxPackageName = "64360VelerSoftware.DevToys"++if ($WindowsVersion.Major -lt "10") {+ throw "This package requires Windows 10.";+};++#The .msixbundle format is not supported on Windows 10 version 1709 and 1803. https://docs.microsoft.com/en-us/windows/msix/msix-1709-and-1803-support+$IsCorrectBuild=[Environment]::OSVersion.Version.Build;+if ($IsCorrectBuild -lt "18362") {+ throw "This package requires at least Windows 10 version 1903/OS build 18362.x.";+};++$PackageArgs = @{+ packageName = $env:ChocolateyPackageName+ unzipLocation = $toolsDir+ url64bit = $url64++ softwareName = 'DevToys'++ checksum64 = $checksum64+ checksumType64= 'sha256'++ fileFullPath = Join-Path $InstallDir $([IO.Path]::GetFileName($Url64))+}++Get-ChocolateyWebFile @PackageArgs++if ((Get-AppxPackage -name $AppxPackageName).Version -Match $Version) {+ if($env:ChocolateyForce) {+ #You can't install the same version of an appx package, you need to remove it first+ Write-Host Removing already installed version first. ;+ Get-AppxPackage -Name $AppxPackageName | Remove-AppxPackage;+ } else {+ Write-Host The $Version version of the package is already installed. If you want to reinstall use --force ;+ return;+ };+};++Add-AppxPackage -Path $PackageArgs.fileFullPathdiff --git a/chocolatey/DevToys/update.ps1 b/chocolatey/DevToys/update.ps1new file mode 100644index 000000000..aa06c87c5--- /dev/null+++ b/chocolatey/DevToys/update.ps1@@ -0,0 +1,24 @@+import-module au++$releases = 'https://github.com/veler/DevToys/releases'++function global:au_GetLatest {+ $download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing+ $regex = '.msixbundle$'+ $url = $download_page.links | ? href -match $regex | select -First 1 -expand href+ $url = 'https://github.com' + $url+ $version = $url -split '/' | select -Last 1 -Skip 1+ $version = $version -replace '[v]',''+ return @{ Version = $version; URL64 = $url }+}++function global:au_SearchReplace {+ @{+ "tools\chocolateyInstall.ps1" = @{+ "(^[$]url64\s*=\s*)('.*')" = "`$1'$($Latest.URL64)'"+ "(^[$]checksum64\s*=\s*)('.*')" = "`$1'$($Latest.Checksum64)'"+ }+ }+}++update -ChecksumFor 64 #-Force\ No newline at end of filediff --git a/chocolatey/README.md b/chocolatey/README.mdnew file mode 100644index 000000000..206d5ce84--- /dev/null+++ b/chocolatey/README.md@@ -0,0 +1,22 @@+# DevToys Chocolatey++First of all, ```update.ps1``` script uses [Automatic Package Updater Module](https://github.com/majkinetor/au) (AU) to deal with package generation taking the binaries from the GitHub repository (releases). You can install it using different ways (the Chocolatey method is recommended).++## Creating .nupkg++- After install Automatic Package Updater Module launch ```update.ps1```.+- A .nupkg package related to the latest version published as release in GitHub will be created.+- If you already have a .nupkg created for the latest version but you would like to recreate it, you should uncomment the ```-Force``` parameter present in ```update.ps1``` script (line ```update -ChecksumFor 64 #-Force```).+- Remove **.Msixbundle** file from inside .nupkg file (it will be placed in tools folder). Note: this could be automated (to do?)++## Pushing versions to Chocolatey++If you're already -or you would like to become one- a maintainer, use the following commands to push new generated version .nupkg file to Chocolatey repository (you should already have an API key from [Chocolatey Community](https://community.chocolatey.org/), if not, please create an account):++```choco apikey --key yourapikey --source https://push.chocolatey.org/```++```choco push .\DevToys.versiongenerated.nupkg --source https://push.chocolatey.org/```++## Become a maintainer++Please, contact [rlm96](https://github.com/rlm96) or [veler](https://github.com/veler/).\ No newline at end of file