Skip to content

Commit

Permalink
Distribute scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhas committed Jul 29, 2018
1 parent d05e55d commit ecf85cb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions psm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ cleanAll: Remove-Item -Recurse ./Publish/; Remove-Item -Recurse ./build/
fresh: psm configure; psm build
copy: Copy-Item ".\build\x64\magickmeter.dll" "$env:APPDATA\Rainmeter\Plugins"
killrm: Stop-Process -name rainmeter
# Specify 3 parameters `major minor patch`. Example: psm bump 1 5 0
bump: . ./task.ps1; bumpVersion
dist: . ./task.ps1; dist
29 changes: 29 additions & 0 deletions task.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,32 @@ function build() {
#Build x86
&$msbuild /p:Platform=Win32
}

function dist() {
$version = "0.5.0"
Get-ChildItem -Recurse -File -Path ".\build" |
Where-Object {$_.Extension -notmatch ".dll" } |
Foreach-Object { Remove-Item $_.FullName }

Compress-Archive -Path ".\build\*" ".\build\magickmeter-$($version)-dll-x64-x86.zip"
}

function bumpVersion() {
param (
[Parameter(Mandatory = $true)][int16]$major,
[Parameter(Mandatory = $true)][int16]$minor,
[Parameter(Mandatory = $true)][int16]$patch
)

$ver = "$($major).$($minor).$($patch)"

(Get-Content ".\src\version.h") -replace "PLUGIN_VERSION `"[\d\.]*`"", "PLUGIN_VERSION `"$($ver).0`"" |
Set-Content ".\src\version.h"

(Get-Content ".\task.ps1") -replace "version = `"[\d\.]*`"", "version = `"$($ver)`"" |
Set-Content ".\task.ps1"

$ver2 = "$($major),$($minor),$($patch)"
(Get-Content ".\src\Magickmeter.rc") -replace "FILEVERSION [\d,]*", "FILEVERSION $($ver2),0" |
Set-Content ".\src\Magickmeter.rc"
}

0 comments on commit ecf85cb

Please sign in to comment.