Skip to content

Commit

Permalink
fix write pick command
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyMi37 committed Nov 13, 2023
1 parent 0a7c055 commit dcf2af0
Show file tree
Hide file tree
Showing 6 changed files with 7,110 additions and 329 deletions.
10 changes: 1 addition & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ARG IMAGE=intersystemsdc/irishealth-community:latest
ARG IMAGE=intersystemsdc/irishealth-ml-community
FROM $IMAGE as builder
FROM $IMAGE

USER root

Expand All @@ -17,11 +17,3 @@ COPY iris.script /tmp/iris.script
RUN iris start IRIS \
&& iris session IRIS < /tmp/iris.script \
&& iris stop IRIS quietly

FROM $IMAGE as final

ADD --chown=${ISC_PACKAGE_MGRUSER}:${ISC_PACKAGE_IRISGROUP} https://github.com/grongierisc/iris-docker-multi-stage-script/releases/latest/download/copy-data.py /irisdev/app/copy-data.py

RUN --mount=type=bind,source=/,target=/builder/root,from=builder \
cp -f /builder/root/usr/irissys/iris.cpf /usr/irissys/iris.cpf && \
python3 /irisdev/app/copy-data.py -c /usr/irissys/iris.cpf -d /builder/root/
14 changes: 9 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
version: '3.8'
services:
iris:
build:
build:
context: .
dockerfile: Dockerfile
#restart: always
command: --check-caps false --ISCAgent false
ports:
# restart: always
# command: --check-caps false --ISCAgent false
ports:
- 51663:1972
- 52663:52773
- 53773
#network_mode: "host"
command:
- -a
- iris session iris -U%SYS '##class(Security.Users).UnExpireUserPasswords("*")'
- --check-caps false
# network_mode: "host"
volumes:
# - ~/iris.key:/usr/irissys/mgr/iris.key
- ./:/irisdev/app
7 changes: 6 additions & 1 deletion iris.script
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;do $System.OBJ.LoadDir("/opt/irisapp/src","ck",,1)

zn "%SYS"
Do ##class(Security.Users).UnExpireUserPasswords("*")
;Do ##class(Security.Users).UnExpireUserPasswords("*")

Set db=##Class(SYS.Database).%OpenId("irislib")
set db.ReadOnly=0
Expand All @@ -17,6 +17,11 @@ zn "USER"
zpm "load https://github.com/intersystems-community/webterminal.git"

zn "%sys"

if $zf(-1,"echo ':d 1^%SS' >> ~/.iris_history")
if $zf(-1,"echo ':zapm' >> ~/.iris_history")
if $zf(-1,"echo ':zapm ""pick -a""' >> ~/.iris_history")

zpm "load /opt/irisapp/ -v":1
zpm "load https://github.com/SergeyMi37/isc-passwordless.git"

Expand Down
2 changes: 1 addition & 1 deletion src/cls/%ZAPM/ext/code.cls
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ ClassMethod filename(code)
s relpath = dirs _ "/" _ $piece( code, ".", *-1, * ) ;
s filename = ##class(%File).NormalizeFilename( relpath, wd )
}
;if filename["%",(ext'="inc") set filename=$tr(filename,"%","_") ;zpm bug ? (ext'="inc")
if filename["%",(ext="gbl") set filename=$tr(filename,"%","_") ;zpm bug ? (ext'="inc")
Q filename
}

Expand Down
76 changes: 47 additions & 29 deletions src/cls/%ZAPM/ext/zpm.cls
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ ClassMethod InstallPy(lib)
/// do ##class(%ZAPM.ext.zpm).pickupd(gn) ; -u - update everything
ClassMethod pickupd(gn, gno) As %Status
{
if $d(@gn) quit $$$OK
set currday=$zd(+$h,3), @gn=currday
;if $d(@gn) quit $$$OK
set currday=$zd(+$h,3), @gn = currday_"; "_$g(@gn)
write "...Updating OEX repos ..."_gn_" "_@gn
set urloex="https://openexchange.intersystems.com/mpapi/packages/find_pagination?term=&cats=&ww=&ind=&sorting=t.asc&pageSize=1000"
set urloexget="https://openexchange.intersystems.com/mpapi/packages/get/" ;appmsw-sql2xlsx"
Expand Down Expand Up @@ -250,6 +250,7 @@ ClassMethod pickupd(gn, gno) As %Status
write Version_" "_ApprovalDate_" "_Github
;set st=##class(%ZAPM.ext.zpm).GetDataURL(urloexget_name,.data)
;if 0,st { set res = {}.%FromJSON(data) w res.Version_" "_res.Github

set @gn@(name)=$lb(1,Version,Github,Description,PublishPM,ApprovalDate,ProductURL,FirstApprovalDate,DownloadsCount,DownloadsCount,Stars,Rating)

}
Expand Down Expand Up @@ -297,30 +298,16 @@ ClassMethod pickupnew(gnr, num, days = "") As %Status
/// do ##class(%ZAPM.ext.zpm).pick("soa")
ClassMethod pick(context = "") As %Status
{
set gn=..#GN,name="",num=0
set gn=..#GN
set gnr=$na(@gn@("+")) ;,+$h)) ;todo prev kill
if context["-u" KILL @gnr do ..pickupd(gnr,gn) quit $$$OK
if context["-u" do ..pickupd(gnr,gn) quit $$$OK
if context["-a" set all=1,context=""
if context["-p" set file=$p(context,"-p ",2) do ##class(%ZAPM.ext.zpm).ShowLog(file,1,gnr) quit $$$OK
if context["-ro" set file=$p(context,"-ro ",2) do ##class(%ZAPM.ext.zpm).ShowLog(file,2,gnr) quit $$$OK
if context["-n" do ..pickupnew(gnr,.num,$p(context,"-n ",2)) do ..pickLoad(.num,gn,gnr,1) quit $$$OK ;get new repo
if context'="" write !,"Pick *"_context_"* in "
for { set name=$o(@gn@(name)) quit:name="" if $g(all) quit
set ver=$lg($g(@gn@(name,"registry")),1)
set desc=$lg($g(@gn@(name,"registry")),2)
set repo=$p($g(@gn@(name,"url")),"'",4)
if repo="",name="zpm" set repo="https://github.com/intersystems/ipm.git"
if $d(@gnr@(name),data), $lg(data,1) , $lg(data,5){
set ver=$lg(data,2)
set desc=$lg(data,4)
set repo=$lg(data,3)
}
if '(name[context || (desc[context) || (repo[context)) continue
set num=num+1
set err=##class(%ZAPM.ext.zpm).GetErrorLog(name)
set num(num)=$lb(name,repo,ver,desc,err,"glo")
set num(0,name)=num
}
set name=""
; Current latest cast from OEX
set name="",num=0
for { set name=$o(@gnr@(name),1,data) quit:name=""
if '$g(all), '$lg(data,5) continue
set ver=$lg(data,2)
Expand All @@ -335,6 +322,27 @@ ClassMethod pick(context = "") As %Status
set num(0,name)=num

}
; Archival cast from OEX
if '$g(all) {
set name=""
for { set name=$o(@gn@(name)) quit:name=""
if $D(num(0,name)) continue
set ver=$lg($g(@gn@(name,"registry")),1)
set desc=$lg($g(@gn@(name,"registry")),2)
set repo=$p($g(@gn@(name,"url")),"'",4)
if repo="",name="zpm" set repo="https://github.com/intersystems/ipm.git"
if $d(@gnr@(name),data), $lg(data,1) , $lg(data,5){
set ver=$lg(data,2)
set desc=$lg(data,4)
set repo=$lg(data,3)
}
if '(name[context || (desc[context) || (repo[context)) continue
set num=num+1
set err=##class(%ZAPM.ext.zpm).GetErrorLog(name)
set num(num)=$lb(name,repo,ver,desc,err,"glo")
set num(0,name)=num
}
}
;do ..PickOexMap(context, .num)
;do ..PickApp(context,.num)
do ..pickLoad(.num,gn,gnr)
Expand All @@ -347,12 +355,12 @@ ClassMethod pickLoad(num, gn, gnr, sort = 0) As %Status
write !,"Pick in ",gn_" Updated "_$g(@gnr)
if 'sort {
set name=""
for n=1:1 { set name=$o(num(0,name),1,nn) quit:name="" d show
for n=1:1 { set name=$o(num(0,name),1,nn) quit:name="" d show(name,nn)
}
}
else { ;OEX so
else { ;OEX sorting
set nn="0"
for { set nn=$o(num(nn)) quit:nn="" set name=$lg(num(nn),1) d show
for { set nn=$o(num(nn)) quit:nn="" set name=$lg(num(nn),1) d show(name,nn)
}
}
write !,$$$escMagenta($namespace),"> Load module (number or name): " read n:15 write !
Expand All @@ -370,14 +378,15 @@ ClassMethod pickLoad(num, gn, gnr, sort = 0) As %Status
}
}
quit $$$OK
show
show(name,nn)
if $i(nnn)
set store=$lg(num(nn),6) ;$s($lg(num(nn),6)="oex":".",$lg(num(nn),6)="glo":":",1:";")
write !,nn,". ",$$$escGreen(name)," "_$lg(num(nn),3)_" "_$$$escCyan($lg(num(nn),7))_" "_$$$escYellow($lg(num(nn),4))
write !,nnn,". ",$$$escGreen(name)," "_$lg(num(nn),3)_" "_$$$escCyan($lg(num(nn),7))_" "_$$$escYellow($lg(num(nn),4))
write $$$FormattedLine($s($lg(num(nn),8):$$$Green,1:$$$Red)," IPM:"_$s($lg(num(nn),8):"Yes",1:"No"))
write " "_$$$escMagenta(store)
write !," ",($lg(num(nn),2))
if $lg(num(nn),5)'="" write !," ",$$$escRed($e($lg(num(nn),5),1,70)_"...")
set nnn(nn)=num(nn)
set nnn(nnn)=num(nn)
quit
}

Expand All @@ -398,11 +407,17 @@ ClassMethod ShowLog(fn = "", All = 0, gn = "") As %Status
set name=""
if fn'="" if ##class(apptools.core.files).OpenFile(fn)
for num=1:1 { set name=$o(@gn@(name)) quit:name=""
if All=1 {
if All=1 {
if fn'="" use fn write !,!,num_": "_name,!,$$url(),! use 0 continue
write !,num,".",$$$escGreen(name)_" ",!,$$url(),!
continue
}
if All=2 { //repo only output
set repo=$$url(2) if repo="" continue
if fn'="" use fn write repo,! use 0 continue
write repo,!
continue
}
if '$d(@gn@(name,"install")) {
if fn'="" use fn write !,!,num_": "_name,!," Инсталляции не завершена успешно ",!,$$url(),! use 0 continue
write !,$$$escGreen(name)_" Инсталляции не завершена успешно ",!,$$url(),!
Expand All @@ -424,13 +439,16 @@ ClassMethod ShowLog(fn = "", All = 0, gn = "") As %Status
}
if fn'="" close fn
quit $$$OK
url()
url(mode="")
if gn["+" {
set data=@gn@(name)
set ver=$lg(data,2)
set desc=$lg(data,4)
set zpm=$lg(data,5)
set repo=$lg(data,3)
if mode=2 {
quit repo
}
set d="",txt=""
for { set d=$o(@..#GN@(name,"oex",d),1,dd) quit:d=""
set:repo'=$lg(dd,3) txt=txt_$lg(dd,3)_" "_$lg(dd,2)_" "_d_$$$NL
Expand Down
Loading

0 comments on commit dcf2af0

Please sign in to comment.