-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b927d0a
commit 15a75f4
Showing
3 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>timetravel</id> | ||
<version>{{ .Version }}</version> | ||
<title>Time Travel CLI</title> | ||
<authors>marianina8</authors> | ||
<owners>marianina8</owners> | ||
<projectUrl>https://github.com/marianina8/timetravel</projectUrl> | ||
<description>A CLI tool for time travel</description> | ||
<tags>cli golang timetravel</tags> | ||
</metadata> | ||
<files> | ||
<file src="tools\**" target="tools" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
$ErrorActionPreference = 'Stop' | ||
|
||
$packageName = 'timetravel' | ||
$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" | ||
$binRoot = Get-ToolsLocation | ||
|
||
# Use the package version from Chocolatey's environment variable | ||
$packageVersion = $env:chocolateyPackageVersion | ||
|
||
# Define the URL for the binary package dynamically | ||
$url = "https://github.com/marianina8/timetravel/releases/download/v$packageVersion/timetravel-windows-amd64.zip" | ||
|
||
# Define the file paths | ||
$zipPath = Join-Path $toolsDir 'timetravel-windows-amd64.zip' | ||
$exePath = Join-Path $toolsDir 'timetravel.exe' | ||
|
||
# Download the zip file | ||
Write-Host "Downloading $url to $zipPath" | ||
Invoke-WebRequest -Uri $url -OutFile $zipPath | ||
|
||
# Unzip the file | ||
Write-Host "Unzipping $zipPath to $toolsDir" | ||
Get-ChocolateyUnzip -FileFullPath $zipPath -Destination $toolsDir | ||
|
||
# Move the binary to the tools directory | ||
Write-Host "Moving timetravel.exe to $toolsDir" | ||
Move-Item -Path (Join-Path $toolsDir 'timetravel-windows-amd64\timetravel.exe') -Destination $exePath | ||
|
||
# Remove the zip file | ||
Write-Host "Removing $zipPath" | ||
Remove-Item -Path $zipPath | ||
|
||
# Add to PATH | ||
Install-BinFile -Name 'timetravel' -Path $exePath | ||
|
||
Write-Host "$packageName has been installed." |