Skip to content
/ zapm Public template

zapm is a shell - extends the zpm shell and adds any other commands. #MSW

License

Notifications You must be signed in to change notification settings

SergeyMi37/zapm

Repository files navigation

Repo-GitHub OEX-zapm

Docker-ports

zapm

Gitter Demo Habr

GitHub last commit Quality Gate Status

ZAPM is a shell - extends the ZPM shell and adds any other commands.

Working in the terminal I got tired of going from my shell to the zpm shell and back. My shell was supplied with additional specific commands and I decided to merge the two shells.

The ZAPM checks if the command entered is a ZPM command, then sends the execution to the ZPM shell. Then I wanted to improve the color commands and expand the functionality. And now ZAPM has survived to the first version and can add any command that I need and remember it so that I can re-execute it.

What's new

Added command: pick

This is an analogue of the find and install command for viewing and loading packages from alternative sources directly from the repositories

ZAPM commands extention:


pick <context>

  • Pick modules by name or context and load from repository.
  • Pick -u Upgrade load from repository.
  • Pick -a Output all information from the OEX repository.
  • Pick -n Displaying all OEX repo information reverse sorted by publication date.
  • Pick -n 15 Displaying all repo information from OEX older than 15 days.
  • Pick -p </dir/filename.log> Output all information from the OEX repository to a file.

Installation with ZPM

If the current ZPM instance is not installed, then in one line you can install the latest version of ZPM even with a proxy.

s r=##class(%Net.HttpRequest).%New(),proxy=$System.Util.GetEnviron("https_proxy") Do ##class(%Net.URLParser).Parse(proxy,.pr) s:$G(pr("host"))'="" r.ProxyHTTPS=1,r.ProxyTunnel=1,r.ProxyPort=pr("port"),r.ProxyServer=pr("host") s:$G(pr("username"))'=""&&($G(pr("password"))'="") r.ProxyAuthorization="Basic "_$system.Encryption.Base64Encode(pr("username")_":"_pr("password")) set r.Server="pm.community.intersystems.com",r.SSLConfiguration="ISC.FeatureTracker.SSL.Config" d r.Get("/packages/zpm/latest/installer"),$system.OBJ.LoadStream(r.HttpResponse.Data,"c") zn "%SYS" zpm "install zapm"

Or install native from repo latest betta version

s r=##class(%Net.HttpRequest).%New(),proxy=$System.Util.GetEnviron("https_proxy") Do ##class(%Net.URLParser).Parse(proxy,.pr) s:$G(pr("host"))'="" r.ProxyHTTPS=1,r.ProxyTunnel=1,r.ProxyPort=pr("port"),r.ProxyServer=pr("host") s:$G(pr("username"))'=""&&($G(pr("password"))'="") r.ProxyAuthorization="Basic "_$system.Encryption.Base64Encode(pr("username")_":"_pr("password")) set r.Server="github.com",r.SSLConfiguration="ISC.FeatureTracker.SSL.Config" d r.Get("/intersystems-community/zpm/releases/download/v0.4.1-beta.9/zpm-0.4.1-beta.9.xml"),$system.OBJ.LoadStream(r.HttpResponse.Data,"c")

If ZPM is installed, then ZAPM can be set with the command

zpm:USER>install zapm

or install native fpom repo with latest version

zpm:USER>install https://github.com/SergeyMi37/zapm

Installation with Docker

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

Clone/git pull the repo into any local directory

$ git clone https://github.com/SergeyMi37/zapm.git

Open the terminal in this directory and run:

$ docker-compose build

Run the IRIS container with your project:

$ docker-compose up -d

How to Test it

Open IRIS terminal:

$ docker-compose exec iris iris session iris
USER>
USER>zapm "cmd"

Command extensions zpm.

help - coloring command description

load <https...git-repo> - loading the module directly from the git-repository

show modules with context by repository URL

Additional commands.

Commands for working with databases and namespaces:

dbcreate - create a database with %DB resources ans namespace and interoperability mapping.

USER>zapm "dbcreate testdb3 -p d:/!/database/durable"

dbdelete - delete a database with %DB resources ans namespace.

USER>zapm "dbdelete testdb3"

cmd - list of possible additional commands

hist - list of executed commands

newdb -creating a database with a scope and installing the module there

To add a new command to the zapm shell, use the ##class(%ZAPM.ext.zapp).addcmd For example, let's execute sequentially

  • create a database with the area and install the zpmshow module there
hp-msw>IRISZPM>USER> newdb zpmshow

Creating Database zpmshow... done!
Creating Namespace zpmshow... done!
Creating Interoperability mappings ... done!
Adding Interoperability SQL privileges ... done!
Creating CSP Application ... done!
 
zpm "install zpmshow"
[zpmshow]       Reload START
[zpmshow]       Reload SUCCESS
[zpmshow]       Module object refreshed.
[zpmshow]       Validate START
[zpmshow]       Validate SUCCESS
[zpmshow]       Compile START
[zpmshow]       Compile SUCCESS
[zpmshow]       Activate START
[zpmshow]       Configure START
[zpmshow]       Configure SUCCESS
[zpmshow]       Activate SUCCESS

  • add a new command named zshow, which should be executed immediately.
do ##class(%ZAPM.ext.zapp).addcmd("new $namespace zn ""zpmshow"" do ^zpmshow", "zpm", "i", "zshow", "Show a zpm modules with extention description")
added

  • check the execution of the new command from the system shell USER>zapm "zshow"
  • or from the zapm shell

Added commands: Working with Products and Tasks, start and stop in all namespaces.

 interoperability
    Alias: prod
 Group work with all Products, info status, start and stop.

 prod list
  Show all namespaces and productions.

 prod only
  Show only productions.

 prod save
  Save the current status for subsequent recovery after the start. Those products that worked will work, and those that did not work will not.

 prod stop
  Remember the current state of all products, and then stop everything

 prod start
  start all products
 prod recover
  Recover all products
 task
 Group work with all custom tasks, info status, suspend and resume.

 task list
  View all tasks and their statuses.

 task save
  Save the current status for subsequent recovery after the start. Those tasks that worked will work, and those that did not work will not.

 task stop
  Suspend all users tasks.

 task start
  Resume all users tasks.

This solution can replace not only the zpm shell but also the main terminal shell. For me it almost happened ;-)

About

zapm is a shell - extends the zpm shell and adds any other commands. #MSW

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •