Trying to automate creation of Custom Data Feed app and provider with batch file

130
1
Jump to solution
4 weeks ago
DarrenSmith
New Contributor III

Hi,

I'm trying automate creation of the boiler plate app and provider for a Custom Data Feed with a batch file. However, once the call to the CLI command (cdf createapp <app name>) completes, the batch file exits, and so the rest of the script is not executed. Is it possible to stop this happening?

/Darren

Code snippet below:

@echooff
echo Start of create cdpk script
echo ---------------------------
set cdf-app-name=%1
set data-provider-name=%2
echo Supplied arguments cdf-app-name=%cdf-app-name%, data-provider-name=%data-provider-name%
echo Creating new cdf app (%cdf-app-name%)...
cdf createapp %cdf-app-name%
cd %cdf-app-name%
echo Creating new cdf provider (%data-provider-name%)...
cdf createprovider %data-provider-name%
cd providers\%data-provider-name%
echo Installing packages (ws, node-fetch, uuid)...
npm install ws@8.15.1
npm install node-fetch@2.7.0
npm install uuid@9.0.1
cd ..\..\..\
echo Copying source files (constructGeoJSON.js, model.js)...
 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DarrenSmith
New Contributor III

Turned out to be a simple fix, just adding CALL in front of the CLI commands:

@echo off
echo Start of create cdpk script
echo ---------------------------
set cdf-app-name=%~1
set data-provider-name=%~2
echo Supplied arguments cdf-app-name=%cdf-app-name%, data-provider-name=%data-provider-name%
echo Creating new cdf app (%cdf-app-name%)...
call cdf.cmd createapp %cdf-app-name%
cd %cdf-app-name%
echo Creating new cdf provider (%data-provider-name%)...
call cdf.cmd createprovider %data-provider-name%
cd providers\%data-provider-name%
echo Installing packages (ws, node-fetch, uuid)...
call npm.cmd install ws@8.15.1
call npm.cmd install node-fetch@2.7.0
call npm.cmd install uuid@9.0.1
cd ..\..\..\
echo Copying source files (constructGeoJSON.js, model.js)...

 

View solution in original post

0 Kudos
1 Reply
DarrenSmith
New Contributor III

Turned out to be a simple fix, just adding CALL in front of the CLI commands:

@echo off
echo Start of create cdpk script
echo ---------------------------
set cdf-app-name=%~1
set data-provider-name=%~2
echo Supplied arguments cdf-app-name=%cdf-app-name%, data-provider-name=%data-provider-name%
echo Creating new cdf app (%cdf-app-name%)...
call cdf.cmd createapp %cdf-app-name%
cd %cdf-app-name%
echo Creating new cdf provider (%data-provider-name%)...
call cdf.cmd createprovider %data-provider-name%
cd providers\%data-provider-name%
echo Installing packages (ws, node-fetch, uuid)...
call npm.cmd install ws@8.15.1
call npm.cmd install node-fetch@2.7.0
call npm.cmd install uuid@9.0.1
cd ..\..\..\
echo Copying source files (constructGeoJSON.js, model.js)...

 

0 Kudos