Permalink
Browse files

Add Powershell equivalent to boostrap.sh

Directly port boostrap.sh to Powershell to make things slightly nicer
for Windows devs.
  • Loading branch information...
liujimj committed Oct 6, 2015
1 parent c5fa2eb commit 5fd3b1c149247c98bf8dd9423f34b26f8940e591
Showing with 28 additions and 0 deletions.
  1. +28 −0 bootstrap.ps1
@@ -0,0 +1,28 @@
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$DataDir = "$ScriptDir/fireplace/cards/data"
$HsdataDir = "$ScriptDir/hs-data"
$HsdataUrl = "https://github.com/HearthSim/hs-data.git"

# check python version
$PyMajor = $(python -c 'import sys; print(sys.version_info[0])')
$PyMinor = $(python -c 'import sys; print(sys.version_info[1])')

if ($PyMajor -lt 3) {
Throw "ERROR: Python 3 and above is required to run Fireplace."
}

if ($PyMinor -lt 4) {
Write-Error "WARNING: Python versions older than 3.4 are known to have issues."
}

Write-Output "Fetching data files from $HsdataUrl"
if (!(Test-Path $HsdataDir)) {
git clone --depth=1 $HsdataUrl $HsdataDir
} else {
git -C $HsdataDir fetch | Write-Output
if ($?) {
git -C $HsdataDir reset --hard origin/master | Write-Output
}
}

python "$DataDir/__init__.py" $HsdataDir "$DataDir/CardDefs.xml"

0 comments on commit 5fd3b1c

Please sign in to comment.