Sometimes (well - oftentimes) when running SAS remotely, it is necessary to configure files (code, data, config) on the server filesystem.
In the absence of ssh or ftp this usually involves a manual process with a client tool or web app.
The purpose of this new command (sasjs fs compile) will be to generate a SAS program that contains the contents of a local directory. By simply running this program in SAS Studio (or wherever), the developer can create a remote copy of a local filesystem.
The generated program will have the following components:
Target Directory switch
Dependent SAS Macros
Directory creation section
Files creation section
In terms of implementation, all the necessary logic should be in the @sasjs/utils repo, so that the functionality may be re-used by SASjs Server and the SASjs VS Code Extension.
The syntax will be as follows:
sasjs fs compile {localFolder} {outputProgram}
"fs" is a new command. compile is the first action. In future we will also have fs create (to run a compiled FS), fs sync (to synchronise a local and remote), fs delete (to delete remote content) and fs move / fs copy (to move / copy remote content)
{localFolder} is the local directory in which all content should be added to a SAS program
{outputProgram} is the full or relative (to cwd) path to the generated SAS program
Target Directory Switch
The {outputProgram} will NOT contain details of the target folder - allowing a folder to be initially compiled, then subsequently deployed to one or more different target locations.
The implementation is simply to have the following code at the start of the program:
Sometimes (well - oftentimes) when running SAS remotely, it is necessary to configure files (code, data, config) on the server filesystem.
In the absence of ssh or ftp this usually involves a manual process with a client tool or web app.
The purpose of this new command (
sasjs fs compile
) will be to generate a SAS program that contains the contents of a local directory. By simply running this program in SAS Studio (or wherever), the developer can create a remote copy of a local filesystem.The generated program will have the following components:
In terms of implementation, all the necessary logic should be in the @sasjs/utils repo, so that the functionality may be re-used by SASjs Server and the SASjs VS Code Extension.
The syntax will be as follows:
compile
is the first action. In future we will also havefs create
(to run a compiled FS),fs sync
(to synchronise a local and remote),fs delete
(to delete remote content) andfs move
/fs copy
(to move / copy remote content)Target Directory Switch
The {outputProgram} will NOT contain details of the target folder - allowing a folder to be initially compiled, then subsequently deployed to one or more different target locations.
The implementation is simply to have the following code at the start of the program:
This will mean that a compiled FS will be deployed to the temporary SAS WORK folder if an
fsTarget
variable has not been supplied.Dependent SAS Macros
The following macros should be compiled into the start of the program:
Directory Creation
A unique set of subdirectories should be extracted, and the following code executed for each child:
${SUBDIR}
should be replaced with the relative child pathFiles Creation
Each file must be base64 encoded in a similar way that we do for
sasjs web
.The generated SAS for each input file will be as follows:
${COMPILED_CONTENT}
should be the base64 encoded version of the file, wrapped in put statements${SUBDIR}
should be replaced with the relative child path