Skip to content

Commit ed1986c

Browse files
Evgeny ShvarovEvgeny Shvarov
authored andcommitted
Initial commit
1 parent 5dfb60c commit ed1986c

10 files changed

Lines changed: 174 additions & 1 deletion

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/.DS_Store

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
.gff

.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "objectscript",
6+
"request": "launch",
7+
"name": "ObjectScript Debug Class",
8+
"program": "##class(Sample.Person).Test()",
9+
},
10+
{
11+
"type": "objectscript",
12+
"request": "attach",
13+
"name": "ObjectScript Attach",
14+
"processId": "${command:PickProcess}",
15+
"system": true
16+
}
17+
]
18+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"objectscript.conn.active": true,
3+
"objectscript.conn.version": 3,
4+
"objectscript.conn.ns": "DNA",
5+
"objectscript.conn.port": 57773,
6+
"objectscript.export.addCategory": true
7+
}

Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ARG IMAGE=intersystems/iris:2019.1.0S.111.0
2+
ARG IMAGE=store/intersystems/iris:2019.1.0.511.0-community
3+
ARG IMAGE=store/intersystems/iris:2019.2.0.107.0-community
4+
#ARG IMAGE=intersystems/iris:2019.3.0.302.0
5+
FROM $IMAGE
6+
7+
WORKDIR /opt/app
8+
9+
COPY ./Installer.cls ./
10+
COPY ./src/cls ./src/cls
11+
#COPY ./src/dfi ./src/dfi
12+
13+
14+
RUN iris start $ISC_PACKAGE_INSTANCENAME quietly EmergencyId=sys,sys && \
15+
/bin/echo -e "sys\nsys\n" \
16+
" Do ##class(Security.Users).UnExpireUserPasswords(\"*\")\n" \
17+
" Do ##class(Security.Users).AddRoles(\"admin\", \"%ALL\")\n" \
18+
" Do ##class(Security.System).Get(,.p)\n" \
19+
" Set p(\"AutheEnabled\")=\$zb(p(\"AutheEnabled\"),16,7)\n" \
20+
" Do ##class(Security.System).Modify(,.p)\n" \
21+
" Do \$system.OBJ.Load(\"/opt/app/Installer.cls\",\"ck\")\n" \
22+
" Set sc = ##class(App.Installer).setup(, 3)\n" \
23+
" If 'sc do \$zu(4, \$JOB, 1)\n" \
24+
" zn \"%sys\"" \
25+
" write \"Create web application ...\",!" \
26+
" set webName = \"/csp/dna\"" \
27+
" set webProperties(\"NameSpace\") = \"USER\"" \
28+
" set webProperties(\"Enabled\") = 1" \
29+
" set webProperties(\"IsNameSpaceDefault\") = 1" \
30+
" set webProperties(\"CSPZENEnabled\") = 1" \
31+
" set webProperties(\"AutheEnabled\") = 32" \
32+
" set webProperties(\"iKnowEnabled\") = 1" \
33+
" set webProperties(\"DeepSeeEnabled\") = 1" \
34+
" set status = ##class(Security.Applications).Create(webName, .webProperties)" \
35+
" write:'status \$system.Status.DisplayError(status)" \
36+
" write \"Web application \"\"\"_webName_\"\"\" was created!\",!" \
37+
" halt" \
38+
| iris session $ISC_PACKAGE_INSTANCENAME && \
39+
/bin/echo -e "sys\nsys\n" \
40+
| iris stop $ISC_PACKAGE_INSTANCENAME quietly
41+
42+
CMD [ "-l", "/usr/irissys/mgr/messages.log" ]

Installer.cls

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Class App.Installer
2+
{
3+
4+
XData MyInstall [ XMLNamespace = INSTALLER ]
5+
{
6+
<Manifest>
7+
<Default Name="NAMESPACE" Value="USER"/>
8+
<Default Name="DBNAME" Value="USER"/>
9+
<Default Name="APPPATH" Dir="/opt/app/" />
10+
<Default Name="SOURCESPATH" Dir="${APPPATH}src" />
11+
<Default Name="RESOURCE" Value="%DB_${DBNAME}" />
12+
13+
<Namespace Name="${NAMESPACE}" Code="${DBNAME}-CODE" Data="${DBNAME}-DATA" Create="yes" Ensemble="0">
14+
<Configuration>
15+
<Database Name="${DBNAME}-CODE" Dir="${APPPATH}${DBNAME}-CODE" Create="yes" Resource="${RESOURCE}"/>
16+
<Database Name="${DBNAME}-DATA" Dir="${APPPATH}${DBNAME}-DATA" Create="yes" Resource="${RESOURCE}"/>
17+
</Configuration>
18+
19+
<Import File="${SOURCESPATH}" Recurse="1"/>
20+
</Namespace>
21+
22+
</Manifest>
23+
}
24+
25+
ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 3, pInstaller As %Installer.Installer, pLogger As %Installer.AbstractLogger) As %Status [ CodeMode = objectgenerator, Internal ]
26+
{
27+
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "MyInstall")
28+
}
29+
30+
}

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
1-
# intersystems-objectscript-template
1+
## intersystems-objectscript-template
2+
This is a template for InterSystems ObjectScript Github repository.
3+
The template goes also with a few files which let you immedietly compile your ObjecScript files in InterSystems IRIS Community Edition in a docker container
4+
5+
## Prerequisites
6+
This needs to have git and docker installed.
7+
8+
## Installation
9+
10+
Clone/git pull the repo into any local directory
11+
12+
```
13+
$ git clone https://github.com/diashenrique/iris-history-monitor.git
14+
```
15+
16+
Open the terminal in this directory and run:
17+
18+
```
19+
$ docker-compose build
20+
```
21+
22+
3. Run the IRIS container with your project:
23+
24+
```
25+
$ docker-compose up -d
26+
```
27+
28+
## How to Test it
29+
30+
Open IRIS terminal:
31+
32+
```
33+
$ docker-compose exec iris iris session iris
34+
USER>write ##class(PackageSample.ObjectScript).Test()
35+
```
36+
## How to start coding
37+
This repository is ready to code in VSCode with ObjectScript plugin.
38+
Install [VSCode](https://code.visualstudio.com/) and [ObjectScript](https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript) plugin and open the folder in VSCode.
39+
Open /src/cls/PackageSample/ObjectScript.cls class and try to make changes - it will be compiled in running IRIS docker container.
40+
41+
Feel free to delete PackageSample folder and add your ObjectScript classes in a form
42+
/src/cls/Package/Classname.cls
43+
44+

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '2.4'
2+
services:
3+
iris:
4+
build: .
5+
restart: always
6+
ports:
7+
- 52773:52773
8+
volumes:
9+
- ~/iris.key:/usr/irissys/mgr/iris.key
10+
- ./:/iris/app
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Class PackageSample.ObjectScript
2+
{
3+
ClassMethod Test() As %Status
4+
{
5+
return "It works!"
6+
}
7+
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Class PackageSample.PersistentClass Extends %Persistent
2+
{
3+
property Test as %VarString;
4+
5+
ClassMethod CreateRecord() As %Status
6+
{
7+
s objPC=..%New()
8+
s objPC.Test="Test string"
9+
return objPC.%Save()
10+
}
11+
12+
}

0 commit comments

Comments
 (0)