• ZPM介绍(3)


    建立私服(Porxy-Registry)

    这张图解释了您的私服是怎么工作的, 整篇文章在这里: Proxy-Registry

    搭建私服

    您需要有一台自己的的服务器, 在上面安装IRIS, zpm, 然后用zpm去下载另一个软件包“zpm-registry"。象这样

    1. zpm:DEMO>search -r zpm-registry
    2. registry https://pm.community.intersystems.com:
    3. zpm-registry 1.1.11Repository: https://github.com/intersystems-community/zpm-registry/
    4. zpm:DEMO>install zpm-registry
    5. [DEMO|zpm-registry] Reload START (/usr/irissys/mgr/.modules/DEMO/zpm-registry/1.1.11/)
    6. [DEMO|zpm-registry] Reload SUCCESS
    7. [zpm-registry] Module object refreshed.
    8. [DEMO|zpm-registry] Validate START
    9. [DEMO|zpm-registry] Validate SUCCESS
    10. [DEMO|zpm-registry] Compile START
    11. [DEMO|zpm-registry] Compile SUCCESS
    12. [DEMO|zpm-registry] Activate START
    13. [DEMO|zpm-registry] Configure START
    14. [DEMO|zpm-registry] Configure SUCCESS
    15. [DEMO|zpm-registry] Activate SUCCESS
    16. zpm:DEMO>

    到github页面, https://github.com/intersystems-community/zpm-registry/, 你可以得到更详细的软件信息。

    配置私服连接公服, 需要在私服的IRIS的安装目录添加一个yaml文件, 定义uplink:

    1. uplinks:
    2. pm:
    3. url: https://pm.community.intersystems.com/
    4. allow_packages: dsw,zpm*,?u*

    几点说明:

    • uplinks的项目可以有多个,pm是intersystems的默认公共registry

    • allow_packages: - a comma-separated list of allowed packages, you can use the exact package name or mask: * - any sequence of characters, ? - any charac

    • registry 提供的rest 接口描述: https://pm.community.intersystems.com/_spec

    设置zpm client连接私服

    通过repo命令将您的zpm client切换到刚刚配置的私服。repo -n registry里面的 - user, - pass是你搭建的私服的账号密码。您也可以在私服上修改/registryWeb应用不做用户验证。

    1. zpm:DEMO>repo -list
    2. registry
    3. Source: https://pm.community.intersystems.com
    4. Enabled? Yes
    5. Available? Yes
    6. Use for Snapshots? Yes
    7. Use for Prereleases? Yes
    8. Is Read-Only? No
    9. Deployment Enabled? No
    10. zpm:DEMO>repo -n registry -r -url http://localhost:52773/registry/ -user superuser -pass demo
    11. registry
    12. Source: http://localhost:52773/registry/
    13. Enabled? Yes
    14. Available? Yes
    15. Use for Snapshots? Yes
    16. Use for Prereleases? Yes
    17. Is Read-Only? No
    18. Deployment Enabled? No
    19. Username: superuser
    20. Password: <set>
    21. zpm:DEMO>

    这时的私服时没有连接gongfuu

    发布软件包到私服

    发布一个 GitHub 的包

    先把软件存在github, 然后用curl命令把包发布在私服的地址。

    $ curl -i -X POST -H "Content-Type:application/json" -u superuser:1104 -d '{"repository":"https://github.com/psteiwer/ObjectScript-Math"}' 'http://localhost:52773/registry/package’

    使用zpm 客户端先在本地load,然后使用publish 命令

    大概像这个样子:

    1. zpm:USER>help load
    2. ...
    3. ■ Examples
    4. ∙ load C:\module\root\path\
    5. load C:\module\root\path\module-0.0.1.tgz
    6. Loads the module described in C:\module\root\path\module.xml
    7. ∙ load -dev -verbose C:\module\root\path\
    8. load -dev -verbose C:\module\root\path\module-0.0.1.tgz
    9. Loads the module described in C:\module\root\path\module.xml in developer mode and with verbose output.
    10. ∙ load https://github.com/user/repository.git
    11. load https://github.com/user/repository.git -b branch-name
    12. Loads the module described in C:\module\root\path\module.xml in developer mode and with verbose output.
    13. zpm:USER> load https://github.com/user/repository.git
    14. zpm: USER> publish

    这样还不是很方便,所以有人在

    其他的Feature

    在使用中您还会有各种各样的需求, 但我相信看到现在您应该对怎么寻找答案非常清楚了。这里简单的说两个feautre

    1. 发布为Delopyed模式

    如果您要隐藏自己的代码,只发布编译后的软件, 可以简单的修改Module.xml, 设置“ “, zpm会自动完成。

    2. 包的依赖

    因为有朋友问,所以说一些包依赖的功能。是的, zpm是设计了包依赖的功能的,在module.xml里添加Dependencies节点, 可以定被依赖的包的列表。 具体的写法请参见这个例子:module.xml example。

    虽然但是,对ObjectScript程序来说,定义包依赖的机会并不多。我能想到的应用场景就是, 当您的软件中想用社区其他包,比如上面的bitmap-adoption的包的话,您可以包"bitmap-adoption"打包到module.xml里面。

    我对当前发布的200多软件包随便挑了一些,还没有发现有哪个使用了包依赖, 象这样:

    1. zpm:USER>list-dependents yaml-utils
    2. zpm:USER>list-dependents terminal-multiline-editor
    3. zpm:USER>list-dependents bitmap-adoption
    4. zpm:USER>list-dependents global-dump-sql
    5. ...
  • 相关阅读:
    在Linux下,转换来自windos文本中的换行符\r\n为\n
    【Linux】常用指令
    2024最新软件测试【测试理论+ UI 自动化】面试题(内附答案)
    黄金眼PAAS化数据服务DIFF测试工具的建设实践
    vue2+若依框架plus交互 路由介绍
    CentOS8编译安装curl 7.84.0
    vue3(二)
    RVMedia VCL 8.0 for Delphi 10.1-10.4
    vite+Vue3+ts之框架搭建过程与踩坑记录(持续补充)
    echarts 中如何添加左右滚动条 数据如何进行堆叠如何配置那些数据使用那个数据轴
  • 原文地址:https://blog.csdn.net/InterSystems/article/details/128067420