Added minimized dockerfile
aliases support introduced.
add your aliases (documentation) in .iris_init file and have your terminal in docker enabled with your favorite aliases. Some popular are included:
This is a basic template for a development environment to work with ObjectScript in InterSystems IRIS. It helps you edit, compile, commit/push, debug and test your ObjectScript code. It also aids in packaging your application as a module installable with IPM.
The template is embedded python compatible.
This repository provides a ready-to-go development environment for coding productively with InterSystems ObjectScript. This template:
Start a new dev repository with InterSystems IRIS using this one as a template.
Once you clone the new repo to your laptop and open VSCode (with the InterSystems ObjectScript Extension Pack installed) you’ll be able to start development immediately.
Make sure you have git and Docker desktop installed.
Clone/git pull the repo into any local directory
$ git clone https://github.com/intersystems-community/intersystems-iris-dev-template.git
Open the terminal in this directory and call the command to build and run InterSystems IRIS in container:
Note: Users running containers on a Linux CLI, should use “docker compose” instead of “docker-compose”
See Install the Compose plugin
$ docker-compose up -d
To open IRIS Terminal do:
$ docker-compose exec iris iris session iris -U IRISAPP
IRISAPP>
To exit the terminal, do any of the following:
Enter HALT or H (not case-sensitive)
THe sample repository contains two simplest examples of ObjectScript classes: ObjectScript method that returns value and method that creates a persistent record.
$ docker-compose exec iris iris session iris -U IRISAPP
IRISAPP>write ##class(dc.sample.ObjectScript).Test()
It works!
42
dc.sample.PersistentClass
contains a method CreateRecord
that creates an object with one property, Test
, and returns its id.Open IRIS terminal and run:
IRISAPP>write ##class(dc.sample.PersistentClass).CreateRecord(.id)
1
IRISAPP>write id
1
In your case the value of id could be different. And it will be different with every call of the method.
You can check whether the record exists and try to right the property of the object by its id.
IRISAPP>write ##class(dc.sample.PersistentClass).ReadProperty(id)
Test string
This repository is ready to code in VSCode with the ObjectScript plugin.
Install VSCode, Docker and the InterSystems ObjectScript Extension Pack plugin and open the folder in VSCode.
Open the /src/cls/PackageSample/ObjectScript.cls
class and make changes - it will be compiled in the running IRIS docker container.
Feel free to delete the PackageSample folder and place your ObjectScript classes in the form
/src/organisation/package/Classname.cls
Read more about folder setup for InterSystems ObjectScript and here on the naming convention
The template contains two test classes: TestObjectScript.cls
and TestPersistentClass.cls
To run the unit tests we can use the Package Manager environment.
IRISAPP>zpm
=============================================================================
|| Welcome to the Package Manager Shell (ZPM). ||
|| Enter q/quit to exit the shell. Enter ?/help to view available commands ||zpm:IRISAPP>load /home/irisowner/dev
[IRISAPP|dc-sample] Reload START (/home/irisowner/dev/)
[IRISAPP|dc-sample] requirements.txt START
[IRISAPP|dc-sample] requirements.txt SUCCESS
[IRISAPP|dc-sample] Reload SUCCESS
[dc-sample] Module object refreshed.
[IRISAPP|dc-sample] Validate START
[IRISAPP|dc-sample] Validate SUCCESS
[IRISAPP|dc-sample] Compile START
[IRISAPP|dc-sample] Compile SUCCESS
[IRISAPP|dc-sample] Activate START
[IRISAPP|dc-sample] Configure START
[IRISAPP|dc-sample] Configure SUCCESS
[IRISAPP|dc-sample] Activate SUCCESS
zpm:IRISAPP>test dc-sample[IRISAPP|dc-sample] Reload START (/home/irisowner/dev/)
[IRISAPP|dc-sample] Reload SUCCESS
[dc-sample] Module object refreshed.
[IRISAPP|dc-sample] Validate START
[IRISAPP|dc-sample] Validate SUCCESS
[IRISAPP|dc-sample] Compile START
[IRISAPP|dc-sample] Compile SUCCESS
[IRISAPP|dc-sample] Activate START
[IRISAPP|dc-sample] Configure START
[IRISAPP|dc-sample] Configure SUCCESS
[IRISAPP|dc-sample] Activate SUCCESS
[IRISAPP|dc-sample] Test STARTHello World!
This is InterSystems IRIS with version IRIS for UNIX (Ubuntu Server LTS for ARM64 Containers) 2023.2 (Build 221U) Fri Jul 21 2023 15:12:42 EDT
Current time is: 16 Aug 2023 14:32:10
Use the following URL to view the result:
http://172.31.0.2:52773/csp/sys/%25UnitTest.Portal.Indices.cls?Index=2&$NAMESPACE=IRISAPP
All PASSED
[IRISAPP|dc-sample] Test SUCCESS
zpm:IRISAPP>
In case of test errors, you can find more details back in the UnitTest portal, which can be easily opened via ObjectScript menu in VSCode:
If you have installed the InterSystems Testing Manager for VS Code extension
you can also run unit tests directly from VSCode :
Contains two GitHub actions workflows:
github-registry.yml
objectscript-qaulity.yml
Both workflows are repo agnostic: so they work with any repository where they exist.
Contains two files to setup vscode environment:
Settings file to let you immediately code in VSCode with VSCode ObjectScript plugin)
Config file if you want to debug with VSCode ObjectScript
Contains source files.
src/iris contains InterSystems IRIS Objectscript code
Contains unit tests for the ObjectScript classes
Contains a set of useful commands that will help during the development
A docker engine helper file to manage images building and rule ports mapping an the host to container folders(volumes) mapping
The simplest dockerfile which starts IRIS and imports 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.
Contains objectscript commands that are feeded to iris during the image building
IPM Module’s description of the code in the repository.
It describes what is loaded with the method, how it is being tested and what apps neeed to be created, what files need to be copied.
Read about all the files in this artilce
If you have issues with docker image building here are some recipes that could help.
docker system prune -f