Skip to content

Commit

Permalink
Add parameter for fallback install script path
Browse files Browse the repository at this point in the history
  • Loading branch information
laina-mater committed Feb 26, 2018
1 parent b072aaa commit ff142f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions jsreport/jsreport.Embedded/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,25 @@ if (-Not (Test-Path $jsreport)) {
$jsreportPath = join-path $projectDirectory jsreport
$installPath = join-path $projectDirectory jsreport/install.cmd
$installToolsPath = join-path $toolsPath jsreport/install.cmd
$installModulePath = join-path $toolsPath /install.js

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

Push-Location $jsreportPath
write-Host "Running " $installPath
& $installPath
& $installPath $installModulePath

if ($lastexitcode) {
throw 'Failed to install jsreport from npm, check install-log.txt for details'
write-Host "ERROR Exit code: " $lastexitcode
if ($lastexitcode -eq 87) {
throw 'Empty installModulePath parameter.'
}
if ($lastexitcode -eq 2) {
throw 'installModulePath not found.'
}
throw 'Failed to install jsreport from npm, check install-log.txt for details'
}
}

Expand Down
14 changes: 11 additions & 3 deletions jsreport/jsreport.Embedded/jsreport/install.cmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
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
set installScriptPath=%~1

if exist "install.js" (
"../.bin/node.cmd" install.js
) else (
"../.bin/node.cmd" "../../packages/jsreport.Embedded.1.0.3/tools/install.js"
"../.bin/node.cmd" install.js
exit /b
)

if "%installScriptPath%" == "" (
exit /b 87
)

if not exist "%installScriptPath%" (
exit /b 2
)

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

0 comments on commit ff142f3

Please sign in to comment.