Home Applications objectscript-package-template

objectscript-package-template

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
1 reviews
0
Awards
402
Views
31
IPM installs
3
3
Details
Releases
Reviews
Issues
Pull requests
Articles
Template for InterSystems ObjectScript classes published to Package Manager ZPM

What's new in this version

Dockerfile minification, clean up, module version bump automation

objectscript-package-template

This is a template for InterSystems ObjectScript class package which is planned to be published into ZPM registry.
Learn more on Community Package Manager (ZPM)

repo structure

  1. put ObjectScript classes under /src folder in form
    /cls - classes
    /inc - includes
    /mac - mac routines
    /int - int routines
    /gbl - globals

  2. Place module.xml file in the root of the repo. Learn more about module.xml format

Naming convention

Each folder under /cls corresponds to Class package.
first folder/package is the organisatoin or developer name.
second level is the project name
third is class or sub-package
E.g. this repo contains a simple example of ObjectScript class for the repository published in Developers Community github
The organisation is intersystems-community, and the corresponding package name is ‘community’.
The repo is objectscript-package-template and the subpackage name for this repo is ‘objectscript’

Installation

Clone/git pull the repo into any local directory

$ git clone https://github.com/your-repository.git

Open the terminal in this directory and run:

$ docker-compose up -d

How to Test it

Open IRIS terminal:

$ docker-compose exec iris iris session iris
USER>zn "IRISAPP"
IRISAPP>write ##class(community.objectscript.ClassExample).Test()

How to start coding

This repository is ready to code in VSCode with ObjectScript plugin.
Install VSCode and ObjectScript plugin and open the folder in VSCode.
Open /src/cls/PackageSample/ObjectScript.cls class and try to make changes - it will be compiled in running IRIS docker container.

Feel free to delete PackageSample folder and place your ObjectScript classes in a form
/src/cls/Package/Classname.cls

The script in Installer.cls will import everything you place under /src/cls into IRIS.

What’s insde the repo

Dockerfile

The simplest dockerfile which starts IRIS and imports Installer.cls and then runs the Installer.setup method, which creates IRISAPP Namespace and imports ObjectScript code from /src folder into it.
Use the related docker-compose.yml to easily setup additional parametes like port number and where you map keys and host folders.
Use .env/ file to adjust the dockerfile being used in docker-compose.
It also installs ZPM - ObjectScript Package Manager client

module.xml

This file describes project to be installed as package in ObjectScript Package Manager. You can test your module.xml with following commands:
// load the source code of the package as it is described in module.xml
IRISAPP:zpm>load /irisdev/app
// run the package installer test
IRISAPP:zpm>objectscript-package-template package -v

.vscode/settings.json

Settings file to let you immedietly code in VSCode with VSCode ObjectScript plugin)

.vscode/launch.json

Config file if you want to debug with VSCode ObjectScript

Read more
Made with
Install
zpm install objectscript-package-template download archive
Version
1.0.615 Aug, 2022
Category
Technology Example
Works with
InterSystems IRIS
First published
12 Nov, 2019
Last checked by moderator
27 Jun, 2023Works