Skip to content

giosava94/json2ioc

Repository files navigation

JSON2IOC

Python package codecov Contributor Covenant License: GPL v3

This project uses JSON configuration files to create substitutions and start command files. It can optionally compile the project for you. It is based on the files generated by the makeBaseApp.pl command and strongly relies on the comments inside them.

ENVIRONMENT SETUP

Considering you are configuring an IOC, once you wrote your .template or .db files, in order to use json2ioc, you have to add a few additional files.

Configuration files

By default the application will look for a json_config folder, containing all the target configurations, in the main directory of the ioc. You can also give a different name to this folder but you must specify this name through the -c param. If you have a unique configuration file you can skip the creation of this folder and directly pass to the -c param the path to that file. See Parameters.

Templates

The application requires 2 templates.

  • substitutions template: By default the app will search for a file named template.substitutions in your <ioc_name>App/Db folder. Users have to create this file. This is the substitutions file that will be instantiate for each provided configuration. This file is specific for your usage. Users can specify a custom substitutions file through the -t param. See Parameters.
  • start command template: By default the application will look for the st.cmd file in the iocBoot/ioc<ioc_name> folder in the specified workspace. Users can specify a custom start command template through the -T param. See Parameters.

USAGE

Run inside main folder of the target IOC

json2ioc

The command can be execute outside the target folder specifying the correct parameters.

PARAMETERS

Users can customize both input and output paths. Here we presents the main arguments users can pass to the app:

  • -c, --config: path to the folder with the configurations. By default the app will search in the working directory the json_config folder and will consider each .json file as a configuration file. For each one of them the app will create a substitutions and a start command file. Users can specify a different folder from where to load the configurations. This folder can be inside or outside the current directory. With the same instruction they can load a specific configuration instead of a entire folder.
  • m, --make: flag to compile the IOC once the substitutions and start command creation ended.
  • -o, --subs-out: path to the folder where to generate the .substitutions files and with the Makefile to update in order to add the new substitutions file. By default it is the *App/Db/ directory. In order to edit the Makefile the app expects it to be the same generate from the makeBaseApp.pl command. Users can specify a different target folder. This folder must contain a Makefile copied from the one mentioned before.
  • -O, --st-cmd-out: path to the folder where to generate the .cmd files. By default it is the iocBoot/ioc*/ directory. This folder must contain a Makefile copied from the one mentioned before.
  • -t, --subs-template: .substitutions template. By default the app will search the template.substitutions file inside the *App/Db/ directory. Users can specify a custom template file. The path to that file must be given with respect to the current directory.
  • -T, --st-cmd-template: .cmd template. By default the app will search for the st.cmd file inside the iocBoot/ioc*/ directory. This file is expected to be the st.cmd file generated by the makeBaseApp.pl command. Users can specify a custom start command template. The path to that file must be given with respect to the current directory.
  • -w, --workspace: path to the working directory. By default it is the folder where the script is executed. The target folder must be a folder containing an EPICS IOC. This is essential to correctly update the Makefile. All default values defining file destination folders will use as reference the given working directory (if not given it is the directory where the command was executed).

POSSIBLE USE CASES

Execute the app

  • Inside the target IOC.
  • Outside the target IOC specifying the target IOC.
  • Inside/Outside the target IOC with the user specifying custom paths for one or more input files.
  • Inside/Outside the target IOC with the user specifying custom paths for one or more output files.
  • Inside/Outside the target IOC with the user specifying custom paths for all or a subset of input and output files.

About

Use json configuration files to create EPICS IOC

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published