Skip to content

Commit 5fd3b1c

Browse files
committed
Add Powershell equivalent to boostrap.sh
Directly port boostrap.sh to Powershell to make things slightly nicer for Windows devs.
1 parent c5fa2eb commit 5fd3b1c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

bootstrap.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
2+
$DataDir = "$ScriptDir/fireplace/cards/data"
3+
$HsdataDir = "$ScriptDir/hs-data"
4+
$HsdataUrl = "https://github.com/HearthSim/hs-data.git"
5+
6+
# check python version
7+
$PyMajor = $(python -c 'import sys; print(sys.version_info[0])')
8+
$PyMinor = $(python -c 'import sys; print(sys.version_info[1])')
9+
10+
if ($PyMajor -lt 3) {
11+
Throw "ERROR: Python 3 and above is required to run Fireplace."
12+
}
13+
14+
if ($PyMinor -lt 4) {
15+
Write-Error "WARNING: Python versions older than 3.4 are known to have issues."
16+
}
17+
18+
Write-Output "Fetching data files from $HsdataUrl"
19+
if (!(Test-Path $HsdataDir)) {
20+
git clone --depth=1 $HsdataUrl $HsdataDir
21+
} else {
22+
git -C $HsdataDir fetch | Write-Output
23+
if ($?) {
24+
git -C $HsdataDir reset --hard origin/master | Write-Output
25+
}
26+
}
27+
28+
python "$DataDir/__init__.py" $HsdataDir "$DataDir/CardDefs.xml"

0 commit comments

Comments
 (0)