Skip to content

Commit cb2bc81

Browse files
authored
Merge pull request #28 from laina-mater/flexible-install-path
Add parameter for fallback install script path
2 parents b072aaa + ff142f3 commit cb2bc81

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

jsreport/jsreport.Embedded/install.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,25 @@ if (-Not (Test-Path $jsreport)) {
128128
$jsreportPath = join-path $projectDirectory jsreport
129129
$installPath = join-path $projectDirectory jsreport/install.cmd
130130
$installToolsPath = join-path $toolsPath jsreport/install.cmd
131+
$installModulePath = join-path $toolsPath /install.js
131132

132133
if (Test-Path $installPath) {
133134
write-Host "Copy " $installToolsPath " to " $jsreportPath
134135
Copy-Item $installToolsPath -destination $jsreportPath -Force
135136

136137
Push-Location $jsreportPath
137138
write-Host "Running " $installPath
138-
& $installPath
139+
& $installPath $installModulePath
139140

140141
if ($lastexitcode) {
141-
throw 'Failed to install jsreport from npm, check install-log.txt for details'
142+
write-Host "ERROR Exit code: " $lastexitcode
143+
if ($lastexitcode -eq 87) {
144+
throw 'Empty installModulePath parameter.'
145+
}
146+
if ($lastexitcode -eq 2) {
147+
throw 'installModulePath not found.'
148+
}
149+
throw 'Failed to install jsreport from npm, check install-log.txt for details'
142150
}
143151
}
144152

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
REM This is being run by the nuget install and also if you run update.cmd, there should be no need to run it manually otherwise
2+
set installScriptPath=%~1
23

34
if exist "install.js" (
4-
"../.bin/node.cmd" install.js
5-
) else (
6-
"../.bin/node.cmd" "../../packages/jsreport.Embedded.1.0.3/tools/install.js"
5+
"../.bin/node.cmd" install.js
6+
exit /b
77
)
88

9+
if "%installScriptPath%" == "" (
10+
exit /b 87
11+
)
12+
13+
if not exist "%installScriptPath%" (
14+
exit /b 2
15+
)
916

17+
"../.bin/node.cmd" "%installScriptPath%"

0 commit comments

Comments
 (0)