Skip to content

Commit 114ea49

Browse files
committed
clean up
1 parent 870e349 commit 114ea49

File tree

9 files changed

+95
-25
lines changed

9 files changed

+95
-25
lines changed

Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ ARG IMAGE=intersystemsdc/irishealth-community
22
ARG IMAGE=intersystemsdc/iris-community
33
FROM $IMAGE
44

5-
USER root
6-
## add git
7-
RUN apt update && apt-get -y install git
8-
9-
USER ${ISC_PACKAGE_MGRUSER}
5+
WORKDIR /home/irisowner/irisbuild
106

117
ARG TESTS=0
128
ARG MODULE="objectscript-template"

dev.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ docker rm -f $(docker ps -qa)
1111

1212
## build container with no cache
1313
```
14-
docker-compose build --no-cache
14+
docker-compose build --no-cache --progress=plain
1515
```
1616
## start iris container
1717
```
@@ -20,9 +20,20 @@ docker-compose up -d
2020

2121
## open iris terminal in docker
2222
```
23-
docker-compose exec iris iris session iris -U IRISAPP
23+
docker-compose exec iris iris session iris -U USER
2424
```
2525

26+
## map iris key from Mac home directory to IRIS in container
27+
- ~/iris.key:/usr/irissys/mgr/iris.key
28+
29+
## install git in the docker image
30+
## add git in dockerfile
31+
USER root
32+
RUN apt update && apt-get -y install git
33+
34+
USER ${ISC_PACKAGE_MGRUSER}
35+
36+
2637
## install docker-compose
2738
```
2839
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
@@ -61,5 +72,27 @@ zn "%SYS" \
6172
write "Web application "_webName_" has been created!",!
6273
```
6374

64-
zw ##class(community.csvgen).GenerateFromURL("https://github.com/h2oai/h2o-tutorials/raw/master/h2o-world-2017/automl/data/product_backorders.csv")
6575

76+
77+
```
78+
do $SYSTEM.OBJ.ImportDir("/opt/irisbuild/src",, "ck")
79+
```
80+
81+
82+
### run tests described in the module
83+
84+
IRISAPP>zpm
85+
IRISAPP:zpm>load /irisrun/repo
86+
IRISAPP:zpm>test package-name
87+
88+
### install ZPM with one line
89+
// Install ZPM
90+
set $namespace="%SYS", name="DefaultSSL" do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name) set url="https://pm.community.intersystems.com/packages/zpm/latest/installer" Do ##class(%Net.URLParser).Parse(url,.comp) set ht = ##class(%Net.HttpRequest).%New(), ht.Server = comp("host"), ht.Port = 443, ht.Https=1, ht.SSLConfiguration=name, st=ht.Get(comp("path")) quit:'st $System.Status.GetErrorText(st) set xml=##class(%File).TempFilename("xml"), tFile = ##class(%Stream.FileBinary).%New(), tFile.Filename = xml do tFile.CopyFromAndSave(ht.HttpResponse.Data) do ht.%Close(), $system.OBJ.Load(xml,"ck") do ##class(%File).Delete(xml)
91+
92+
93+
## add git
94+
USER root
95+
96+
RUN apt update && apt-get -y install git
97+
98+
USER ${ISC_PACKAGE_MGRUSER}

iris.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
Do ##class(Security.Users).UnExpireUserPasswords("*")
55

66
zn "USER"
7-
zpm "load /opt/irisbuild/ -v":1:1
7+
zpm "load /home/irisowner/irisbuild/ -v":1:1
88
halt

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Version>1.1.2</Version>
77
<Packaging>module</Packaging>
88
<SourcesRoot>src</SourcesRoot>
9-
<Resource Name="dc.PackageSample.PKG"/>
9+
<Resource Name="dc.sample.PKG"/>
1010
</Module>
1111
</Document>
1212
</Export>

src/dc/PackageSample/ObjectScript.cls

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/dc/sample/ObjectScript.cls

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Class dc.sample.ObjectScript
2+
{
3+
4+
ClassMethod Test() As %Status
5+
{
6+
set a=42
7+
write "It works!",!
8+
return a
9+
}
10+
11+
}

src/dc/PackageSample/PersistentClass.cls renamed to src/dc/sample/PersistentClass.cls

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
Class dc.PackageSample.PersistentClass Extends %Persistent
1+
Class dc.sample.PersistentClass Extends %Persistent
22
{
33

44
Property Test As %VarString;
55

6-
ClassMethod CreateRecord() As %Status
6+
ClassMethod CreateRecord(ByRef id As %Integer) As %Status
77
{
8-
s objPC=..%New()
9-
s objPC.Test="Test string"
10-
return objPC.%Save()
8+
set sc=$$$OK
9+
set objPC=..%New()
10+
set objPC.Test="Test string"
11+
set sc=objPC.%Save()
12+
set id=objPC.%Id()
13+
return sc
14+
}
15+
16+
/// opens the record by id and reads its property
17+
ClassMethod ReadProperty(id As %Integer) As %Status
18+
{
19+
Set sc = $$$OK
20+
#dim obj as dc.sample.PersistentClass
21+
set obj=..%OpenId(id,,.sc)
22+
if $ISOBJECT(obj) write obj.Test
23+
Return sc
1124
}
1225

1326
Storage Default
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Class dc.sample.unittests.TestObjectScript Extends %UnitTest.TestCase
2+
{
3+
4+
Method Test42()
5+
{
6+
Set tExpected=42
7+
set tResults= ##class(dc.sample.ObjectScript).Test()
8+
Do $$$AssertEquals(tResults,tExpected,tExpected_" = "_tResults)
9+
}
10+
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Class dc.sample.unittests.TestCreateRecord Extends %UnitTest.TestCase
2+
{
3+
4+
Method TestCreateRecord()
5+
{
6+
Set tExpected="Test string"
7+
set status=##class(dc.sample.PersistentClass).CreateRecord(.id)
8+
do $$$AssertStatusOK(status,"CreateRecord")
9+
set obj=##class(dc.sample.PersistentClass).%OpenId(id)
10+
if $IsObject(obj) {
11+
set tResults=obj.Test}
12+
else {set tResults="There is no such record with id="_id}
13+
Do $$$AssertEquals(tResults,tExpected,tExpected_" = "_tResults)
14+
}
15+
16+
}

0 commit comments

Comments
 (0)