vortex-cli 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. vortex_cli-3.0.0/LICENSE +21 -0
  2. vortex_cli-3.0.0/PKG-INFO +179 -0
  3. vortex_cli-3.0.0/README.md +156 -0
  4. vortex_cli-3.0.0/setup.cfg +60 -0
  5. vortex_cli-3.0.0/setup.py +5 -0
  6. vortex_cli-3.0.0/vortex/__init__.py +0 -0
  7. vortex_cli-3.0.0/vortex/__main__.py +6 -0
  8. vortex_cli-3.0.0/vortex/colour.py +18 -0
  9. vortex_cli-3.0.0/vortex/commands/__init__.py +0 -0
  10. vortex_cli-3.0.0/vortex/commands/clean.py +21 -0
  11. vortex_cli-3.0.0/vortex/commands/clone.py +219 -0
  12. vortex_cli-3.0.0/vortex/commands/code.py +22 -0
  13. vortex_cli-3.0.0/vortex/commands/config.py +34 -0
  14. vortex_cli-3.0.0/vortex/commands/copy.py +158 -0
  15. vortex_cli-3.0.0/vortex/commands/delete.py +84 -0
  16. vortex_cli-3.0.0/vortex/commands/find.py +46 -0
  17. vortex_cli-3.0.0/vortex/commands/grep.py +68 -0
  18. vortex_cli-3.0.0/vortex/commands/list.py +72 -0
  19. vortex_cli-3.0.0/vortex/commands/log.py +32 -0
  20. vortex_cli-3.0.0/vortex/commands/new.py +126 -0
  21. vortex_cli-3.0.0/vortex/commands/watch.py +339 -0
  22. vortex_cli-3.0.0/vortex/constants.py +6 -0
  23. vortex_cli-3.0.0/vortex/main.py +483 -0
  24. vortex_cli-3.0.0/vortex/models.py +529 -0
  25. vortex_cli-3.0.0/vortex/puakma/lib/XmlSchema-1.4.2.jar +0 -0
  26. vortex_cli-3.0.0/vortex/puakma/lib/activation-1.1.jar +0 -0
  27. vortex_cli-3.0.0/vortex/puakma/lib/annogen-0.1.0.jar +0 -0
  28. vortex_cli-3.0.0/vortex/puakma/lib/axiom-api-1.2.7.jar +0 -0
  29. vortex_cli-3.0.0/vortex/puakma/lib/axiom-dom-1.2.7.jar +0 -0
  30. vortex_cli-3.0.0/vortex/puakma/lib/axiom-impl-1.2.7.jar +0 -0
  31. vortex_cli-3.0.0/vortex/puakma/lib/axis2-adb-1.4.1.jar +0 -0
  32. vortex_cli-3.0.0/vortex/puakma/lib/axis2-adb-codegen-1.4.1.jar +0 -0
  33. vortex_cli-3.0.0/vortex/puakma/lib/axis2-ant-plugin-1.4.1.jar +0 -0
  34. vortex_cli-3.0.0/vortex/puakma/lib/axis2-clustering-1.4.1.jar +0 -0
  35. vortex_cli-3.0.0/vortex/puakma/lib/axis2-codegen-1.4.1.jar +0 -0
  36. vortex_cli-3.0.0/vortex/puakma/lib/axis2-corba-1.4.1.jar +0 -0
  37. vortex_cli-3.0.0/vortex/puakma/lib/axis2-fastinfoset-1.4.1.jar +0 -0
  38. vortex_cli-3.0.0/vortex/puakma/lib/axis2-java2wsdl-1.4.1.jar +0 -0
  39. vortex_cli-3.0.0/vortex/puakma/lib/axis2-jaxbri-1.4.1.jar +0 -0
  40. vortex_cli-3.0.0/vortex/puakma/lib/axis2-jaxws-1.4.1.jar +0 -0
  41. vortex_cli-3.0.0/vortex/puakma/lib/axis2-jaxws-api-1.4.1.jar +0 -0
  42. vortex_cli-3.0.0/vortex/puakma/lib/axis2-jibx-1.4.1.jar +0 -0
  43. vortex_cli-3.0.0/vortex/puakma/lib/axis2-json-1.4.1.jar +0 -0
  44. vortex_cli-3.0.0/vortex/puakma/lib/axis2-jws-api-1.4.1.jar +0 -0
  45. vortex_cli-3.0.0/vortex/puakma/lib/axis2-kernel-1.4.1.jar +0 -0
  46. vortex_cli-3.0.0/vortex/puakma/lib/axis2-metadata-1.4.1.jar +0 -0
  47. vortex_cli-3.0.0/vortex/puakma/lib/axis2-mtompolicy-1.4.1.jar +0 -0
  48. vortex_cli-3.0.0/vortex/puakma/lib/axis2-saaj-1.4.1.jar +0 -0
  49. vortex_cli-3.0.0/vortex/puakma/lib/axis2-saaj-api-1.4.1.jar +0 -0
  50. vortex_cli-3.0.0/vortex/puakma/lib/axis2-spring-1.4.1.jar +0 -0
  51. vortex_cli-3.0.0/vortex/puakma/lib/axis2-xmlbeans-1.4.1.jar +0 -0
  52. vortex_cli-3.0.0/vortex/puakma/lib/backport-util-concurrent-3.1.jar +0 -0
  53. vortex_cli-3.0.0/vortex/puakma/lib/bcprov-jdk14-131.jar +0 -0
  54. vortex_cli-3.0.0/vortex/puakma/lib/commons-codec-1.10.jar +0 -0
  55. vortex_cli-3.0.0/vortex/puakma/lib/commons-codec-1.3.jar +0 -0
  56. vortex_cli-3.0.0/vortex/puakma/lib/commons-collections4-4.1.jar +0 -0
  57. vortex_cli-3.0.0/vortex/puakma/lib/commons-fileupload-1.2.jar +0 -0
  58. vortex_cli-3.0.0/vortex/puakma/lib/commons-httpclient-3.1.jar +0 -0
  59. vortex_cli-3.0.0/vortex/puakma/lib/commons-io-1.4.jar +0 -0
  60. vortex_cli-3.0.0/vortex/puakma/lib/commons-logging-1.1.1.jar +0 -0
  61. vortex_cli-3.0.0/vortex/puakma/lib/commons-logging-1.2.jar +0 -0
  62. vortex_cli-3.0.0/vortex/puakma/lib/curvesapi-1.04.jar +0 -0
  63. vortex_cli-3.0.0/vortex/puakma/lib/dom4j-1.6.1.jar +0 -0
  64. vortex_cli-3.0.0/vortex/puakma/lib/geronimo-annotation_1.0_spec-1.1.jar +0 -0
  65. vortex_cli-3.0.0/vortex/puakma/lib/geronimo-stax-api_1.0_spec-1.0.1.jar +0 -0
  66. vortex_cli-3.0.0/vortex/puakma/lib/httpcore-4.0-beta1.jar +0 -0
  67. vortex_cli-3.0.0/vortex/puakma/lib/httpcore-nio-4.0-beta1.jar +0 -0
  68. vortex_cli-3.0.0/vortex/puakma/lib/iText-rtf-2.1.3.jar +0 -0
  69. vortex_cli-3.0.0/vortex/puakma/lib/itext-2.1.7.jar +0 -0
  70. vortex_cli-3.0.0/vortex/puakma/lib/itext-pdfa-5.5.1-javadoc.jar +0 -0
  71. vortex_cli-3.0.0/vortex/puakma/lib/itext-pdfa-5.5.1-sources.jar +0 -0
  72. vortex_cli-3.0.0/vortex/puakma/lib/itext-pdfa-5.5.1.jar +0 -0
  73. vortex_cli-3.0.0/vortex/puakma/lib/itext-xtra-5.5.1-javadoc.jar +0 -0
  74. vortex_cli-3.0.0/vortex/puakma/lib/itext-xtra-5.5.1-sources.jar +0 -0
  75. vortex_cli-3.0.0/vortex/puakma/lib/itext-xtra-5.5.1.jar +0 -0
  76. vortex_cli-3.0.0/vortex/puakma/lib/itextpdf-5.5.1-javadoc.jar +0 -0
  77. vortex_cli-3.0.0/vortex/puakma/lib/itextpdf-5.5.1-sources.jar +0 -0
  78. vortex_cli-3.0.0/vortex/puakma/lib/itextpdf-5.5.1.jar +0 -0
  79. vortex_cli-3.0.0/vortex/puakma/lib/jalopy-1.5rc3.jar +0 -0
  80. vortex_cli-3.0.0/vortex/puakma/lib/jaxb-api-2.1.jar +0 -0
  81. vortex_cli-3.0.0/vortex/puakma/lib/jaxb-impl-2.1.6.jar +0 -0
  82. vortex_cli-3.0.0/vortex/puakma/lib/jaxb-xjc-2.1.6.jar +0 -0
  83. vortex_cli-3.0.0/vortex/puakma/lib/jaxen-1.1.1.jar +0 -0
  84. vortex_cli-3.0.0/vortex/puakma/lib/jcifs-1.2.13.jar +0 -0
  85. vortex_cli-3.0.0/vortex/puakma/lib/jcifs-1.3.3.jar +0 -0
  86. vortex_cli-3.0.0/vortex/puakma/lib/jcifs-ext-0.9.4.jar +0 -0
  87. vortex_cli-3.0.0/vortex/puakma/lib/jcommon-1.0.12.jar +0 -0
  88. vortex_cli-3.0.0/vortex/puakma/lib/jettison-1.0-RC2.jar +0 -0
  89. vortex_cli-3.0.0/vortex/puakma/lib/jfreechart-1.0.13.jar +0 -0
  90. vortex_cli-3.0.0/vortex/puakma/lib/jfreechart-1.0.17.jar +0 -0
  91. vortex_cli-3.0.0/vortex/puakma/lib/jibx-bind-1.1.5.jar +0 -0
  92. vortex_cli-3.0.0/vortex/puakma/lib/jibx-run-1.1.5.jar +0 -0
  93. vortex_cli-3.0.0/vortex/puakma/lib/json-20101028.jar +0 -0
  94. vortex_cli-3.0.0/vortex/puakma/lib/json-20110712.jar +0 -0
  95. vortex_cli-3.0.0/vortex/puakma/lib/junit-4.12.jar +0 -0
  96. vortex_cli-3.0.0/vortex/puakma/lib/log4j-1.2.15.jar +0 -0
  97. vortex_cli-3.0.0/vortex/puakma/lib/log4j-1.2.17.jar +0 -0
  98. vortex_cli-3.0.0/vortex/puakma/lib/mail-1.4.jar +0 -0
  99. vortex_cli-3.0.0/vortex/puakma/lib/mex-1.4.1.jar +0 -0
  100. vortex_cli-3.0.0/vortex/puakma/lib/neethi-2.0.4.jar +0 -0
  101. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.10.1/poi-3.10.1-20140818.jar +0 -0
  102. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.10.1/poi-examples-3.10.1-20140818.jar +0 -0
  103. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.10.1/poi-excelant-3.10.1-20140818.jar +0 -0
  104. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.10.1/poi-ooxml-3.10.1-20140818.jar +0 -0
  105. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.10.1/poi-ooxml-schemas-3.10.1-20140818.jar +0 -0
  106. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.10.1/poi-scratchpad-3.10.1-20140818.jar +0 -0
  107. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.17/poi-3.17.jar +0 -0
  108. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.17/poi-examples-3.17.jar +0 -0
  109. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.17/poi-excelant-3.17.jar +0 -0
  110. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.17/poi-ooxml-3.17.jar +0 -0
  111. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.17/poi-ooxml-schemas-3.17.jar +0 -0
  112. vortex_cli-3.0.0/vortex/puakma/lib/poi_3.17/poi-scratchpad-3.17.jar +0 -0
  113. vortex_cli-3.0.0/vortex/puakma/lib/shaj-0.5.jar +0 -0
  114. vortex_cli-3.0.0/vortex/puakma/lib/soapmonitor-1.4.1.jar +0 -0
  115. vortex_cli-3.0.0/vortex/puakma/lib/stax-api-1.0.1.jar +0 -0
  116. vortex_cli-3.0.0/vortex/puakma/lib/woden-api-1.0M8.jar +0 -0
  117. vortex_cli-3.0.0/vortex/puakma/lib/woden-impl-dom-1.0M8.jar +0 -0
  118. vortex_cli-3.0.0/vortex/puakma/lib/wsdl4j-1.6.2.jar +0 -0
  119. vortex_cli-3.0.0/vortex/puakma/lib/wstx-asl-3.2.4.jar +0 -0
  120. vortex_cli-3.0.0/vortex/puakma/lib/xalan-2.7.0.jar +0 -0
  121. vortex_cli-3.0.0/vortex/puakma/lib/xercesImpl-2.8.1.jar +0 -0
  122. vortex_cli-3.0.0/vortex/puakma/lib/xml-apis-1.3.04.jar +0 -0
  123. vortex_cli-3.0.0/vortex/puakma/lib/xml-resolver-1.2.jar +0 -0
  124. vortex_cli-3.0.0/vortex/puakma/lib/xmlbeans-2.3.0.jar +0 -0
  125. vortex_cli-3.0.0/vortex/puakma/lib/xmlbeans-2.6.0.jar +0 -0
  126. vortex_cli-3.0.0/vortex/puakma/lib-int/puakma.jar +0 -0
  127. vortex_cli-3.0.0/vortex/puakma/lib-int/puakma.vortex.wst_1.1.0.jar +0 -0
  128. vortex_cli-3.0.0/vortex/puakma/lib-int/retroweaver-rt-1.2.4.jar +0 -0
  129. vortex_cli-3.0.0/vortex/puakma/lib-int/velocity-1.5.jar +0 -0
  130. vortex_cli-3.0.0/vortex/soap.py +332 -0
  131. vortex_cli-3.0.0/vortex/spinner.py +53 -0
  132. vortex_cli-3.0.0/vortex/util.py +192 -0
  133. vortex_cli-3.0.0/vortex/workspace.py +271 -0
  134. vortex_cli-3.0.0/vortex_cli.egg-info/PKG-INFO +179 -0
  135. vortex_cli-3.0.0/vortex_cli.egg-info/SOURCES.txt +138 -0
  136. vortex_cli-3.0.0/vortex_cli.egg-info/dependency_links.txt +1 -0
  137. vortex_cli-3.0.0/vortex_cli.egg-info/entry_points.txt +2 -0
  138. vortex_cli-3.0.0/vortex_cli.egg-info/requires.txt +3 -0
  139. vortex_cli-3.0.0/vortex_cli.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 jordanamos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.1
2
+ Name: vortex_cli
3
+ Version: 3.0.0
4
+ Summary: Vortex CLI
5
+ Home-page: https://github.com/jordanamos/vortex-cli
6
+ Author: Jordan Amos
7
+ Author-email: jordan.amos@gmail.com
8
+ License: MIT
9
+ Keywords: vortex cli
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: httpx==0.24.1
21
+ Requires-Dist: tabulate==0.9.0
22
+ Requires-Dist: watchfiles==0.19.0
23
+
24
+ # Vortex CLI
25
+
26
+ Vortex CLI is a command line alternative to the [Puakma Vortex IDE](https://github.com/brendonupson/PuakmaVortex) that simplifies the process of developing Puakma Applications on a [Puakma Tornado Server](https://github.com/brendonupson/Puakma) using Visual Studio Code. It allows you to clone applications from the server to a local workspace, edit the files using Visual Studio Code, and automatically upload changes to the server as you work.
27
+
28
+ Vortex CLI also comes pre-packaged with the necessary Puakma .jar files for development.
29
+
30
+ #### Visual Studio Code and Extensions
31
+
32
+ While it is possible to use without it, this software has been purposefully designed for use with [Visual Studio Code](https://github.com/microsoft/vscode) and the [Project Manager For Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency) or the [Extension Pack For Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) extension. This software leverages [Workspaces](https://code.visualstudio.com/docs/editor/workspaces) in Visual Studio Code and manages a `vortex.code-workspace` file within the workspace.
33
+
34
+ ## Installation
35
+
36
+ 1. Install the tool using pip.
37
+
38
+ ```
39
+ pip install git+https://github.com/jordanamos/vortex-cli.git
40
+ ```
41
+
42
+ 2. It is recommended to set the workspace you would like to work out of via the `VORTEX_WORKSPACE` environment variable.
43
+
44
+ On Unix:
45
+
46
+ ```
47
+ export VORTEX_WORKSPACE=/path/to/workspace
48
+ ```
49
+
50
+ Otherwise, Vortex CLI will use a default **'vortex-cli-workspace'** directory inside your home directory.
51
+
52
+ 3. Create a **vortex-server-config.ini** file in your workspace to define the server(s) you will be working with.
53
+
54
+ To create the config file and also your workspace directory (if they don't already exist) you can use the config command:
55
+
56
+ ```
57
+ vortex config --init
58
+ ```
59
+
60
+ Then run the config command without flags to conviniently check your workspace and server configuration:
61
+
62
+ ```
63
+ vortex config
64
+ ```
65
+
66
+ Further, you can print a sample config definition using the '--sample' flag:
67
+
68
+ ```
69
+ vortex config --sample
70
+ ```
71
+
72
+ In the vortex-server-config.ini file, you can define as many servers as you need, each with their own unique name. For example:
73
+
74
+ ```
75
+ [DEFAULT] ; This section is optional and only useful if you have multiple definitions
76
+ port = 80 ; Options provided under DEFAULT will be applied to all definitions if not provided
77
+ soap_path = system/SOAPDesigner.pma
78
+ default = server1 ; Useful when you have multiple definitions
79
+
80
+ [server1] ; This can be called whatever you want and can be specified when using the --server flag i.e. 'vortex --server server1 list'
81
+ host = example.com
82
+ port = 8080 ; we can overwrite the DEFAULT value
83
+ puakma_db_conn_id = 13
84
+ username = myuser ; Optional
85
+ password = mypassword ; Optional
86
+ ```
87
+
88
+ 4. Setup the [Visual Studio Code Workspace](https://code.visualstudio.com/docs/editor/workspaces) to use the same Java version as your server in /path/to/workspace/.vscode/vortex.code-workspace under "settings", for example:
89
+ ```
90
+ "java.configuration.runtimes": [
91
+ {
92
+ "default": true,
93
+ "name": "JavaSE-1.8",
94
+ "path": "/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home"
95
+ }
96
+ ]
97
+ ```
98
+
99
+ ## Usage
100
+
101
+ ### List Puakma Applications
102
+
103
+ To list the Puakma Applications available on the server, use the `list` command:
104
+
105
+ ```
106
+ vortex list
107
+ ```
108
+
109
+ This will display a table showing the ID, name, template, and inheritance of each Puakma Application.
110
+
111
+ ### Clone a Puakma Application
112
+
113
+ To clone a Puakma Application to the local workspace, use the `clone` command:
114
+
115
+ ```
116
+ vortex clone [<APP_ID>, ...]
117
+ ```
118
+
119
+ Replace `<APP_ID>` with the ID(s) of the Puakma Application(s) you want to clone. The tool will clone the application(s) into the local workspace.
120
+
121
+ ### Open the workspace in Visual Studio Code
122
+
123
+ To open the Vortex CLI workspace in Visual Studio Code, use the `code` command:
124
+
125
+ ```
126
+ vortex code
127
+ ```
128
+
129
+ ### Watch the workspace for changes
130
+
131
+ To watch the workspace containing cloned Puakma Applications and automatically upload changes to the server, use the `watch` command:
132
+
133
+ ```
134
+ vortex watch
135
+ ```
136
+
137
+ This will start watching the workspace for changes. As you make changes to the files in the directory, the tool will automatically upload the changes to the server.
138
+
139
+ ### Delete locally cloned Puakma Applications
140
+
141
+ To delete the locally cloned Puakma Application directories in the workspace, use the `clean` command:
142
+
143
+ ```
144
+ vortex clean
145
+ ```
146
+
147
+ ### Create Design Objects
148
+
149
+ To create new design objects, use the `new` command:
150
+
151
+ ```
152
+ vortex new [NAME, ...] --app-id <app_id> --type <design_type>
153
+ ```
154
+
155
+ Specify more than one name to create multiple design objects of the same type for the specified application
156
+
157
+ ### Delete Design Objects
158
+
159
+ To delete a design object, use the `delete` command:
160
+
161
+ ```
162
+ vortex delete [DESIGN_OBJECT_ID, ...]
163
+ ```
164
+
165
+ ### Find cloned Design Objects
166
+
167
+ To search for Design Objects by name use the `find` command:
168
+
169
+ ```
170
+ vortex find <name> [options]
171
+ ```
172
+
173
+ ### Search the contents of cloned Design Objects
174
+
175
+ To search for text patterns in Design Objects using a [Regular Expression](https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference) use the `grep` command:
176
+
177
+ ```
178
+ vortex grep <pattern> [options]
179
+ ```
@@ -0,0 +1,156 @@
1
+ # Vortex CLI
2
+
3
+ Vortex CLI is a command line alternative to the [Puakma Vortex IDE](https://github.com/brendonupson/PuakmaVortex) that simplifies the process of developing Puakma Applications on a [Puakma Tornado Server](https://github.com/brendonupson/Puakma) using Visual Studio Code. It allows you to clone applications from the server to a local workspace, edit the files using Visual Studio Code, and automatically upload changes to the server as you work.
4
+
5
+ Vortex CLI also comes pre-packaged with the necessary Puakma .jar files for development.
6
+
7
+ #### Visual Studio Code and Extensions
8
+
9
+ While it is possible to use without it, this software has been purposefully designed for use with [Visual Studio Code](https://github.com/microsoft/vscode) and the [Project Manager For Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency) or the [Extension Pack For Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) extension. This software leverages [Workspaces](https://code.visualstudio.com/docs/editor/workspaces) in Visual Studio Code and manages a `vortex.code-workspace` file within the workspace.
10
+
11
+ ## Installation
12
+
13
+ 1. Install the tool using pip.
14
+
15
+ ```
16
+ pip install git+https://github.com/jordanamos/vortex-cli.git
17
+ ```
18
+
19
+ 2. It is recommended to set the workspace you would like to work out of via the `VORTEX_WORKSPACE` environment variable.
20
+
21
+ On Unix:
22
+
23
+ ```
24
+ export VORTEX_WORKSPACE=/path/to/workspace
25
+ ```
26
+
27
+ Otherwise, Vortex CLI will use a default **'vortex-cli-workspace'** directory inside your home directory.
28
+
29
+ 3. Create a **vortex-server-config.ini** file in your workspace to define the server(s) you will be working with.
30
+
31
+ To create the config file and also your workspace directory (if they don't already exist) you can use the config command:
32
+
33
+ ```
34
+ vortex config --init
35
+ ```
36
+
37
+ Then run the config command without flags to conviniently check your workspace and server configuration:
38
+
39
+ ```
40
+ vortex config
41
+ ```
42
+
43
+ Further, you can print a sample config definition using the '--sample' flag:
44
+
45
+ ```
46
+ vortex config --sample
47
+ ```
48
+
49
+ In the vortex-server-config.ini file, you can define as many servers as you need, each with their own unique name. For example:
50
+
51
+ ```
52
+ [DEFAULT] ; This section is optional and only useful if you have multiple definitions
53
+ port = 80 ; Options provided under DEFAULT will be applied to all definitions if not provided
54
+ soap_path = system/SOAPDesigner.pma
55
+ default = server1 ; Useful when you have multiple definitions
56
+
57
+ [server1] ; This can be called whatever you want and can be specified when using the --server flag i.e. 'vortex --server server1 list'
58
+ host = example.com
59
+ port = 8080 ; we can overwrite the DEFAULT value
60
+ puakma_db_conn_id = 13
61
+ username = myuser ; Optional
62
+ password = mypassword ; Optional
63
+ ```
64
+
65
+ 4. Setup the [Visual Studio Code Workspace](https://code.visualstudio.com/docs/editor/workspaces) to use the same Java version as your server in /path/to/workspace/.vscode/vortex.code-workspace under "settings", for example:
66
+ ```
67
+ "java.configuration.runtimes": [
68
+ {
69
+ "default": true,
70
+ "name": "JavaSE-1.8",
71
+ "path": "/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home"
72
+ }
73
+ ]
74
+ ```
75
+
76
+ ## Usage
77
+
78
+ ### List Puakma Applications
79
+
80
+ To list the Puakma Applications available on the server, use the `list` command:
81
+
82
+ ```
83
+ vortex list
84
+ ```
85
+
86
+ This will display a table showing the ID, name, template, and inheritance of each Puakma Application.
87
+
88
+ ### Clone a Puakma Application
89
+
90
+ To clone a Puakma Application to the local workspace, use the `clone` command:
91
+
92
+ ```
93
+ vortex clone [<APP_ID>, ...]
94
+ ```
95
+
96
+ Replace `<APP_ID>` with the ID(s) of the Puakma Application(s) you want to clone. The tool will clone the application(s) into the local workspace.
97
+
98
+ ### Open the workspace in Visual Studio Code
99
+
100
+ To open the Vortex CLI workspace in Visual Studio Code, use the `code` command:
101
+
102
+ ```
103
+ vortex code
104
+ ```
105
+
106
+ ### Watch the workspace for changes
107
+
108
+ To watch the workspace containing cloned Puakma Applications and automatically upload changes to the server, use the `watch` command:
109
+
110
+ ```
111
+ vortex watch
112
+ ```
113
+
114
+ This will start watching the workspace for changes. As you make changes to the files in the directory, the tool will automatically upload the changes to the server.
115
+
116
+ ### Delete locally cloned Puakma Applications
117
+
118
+ To delete the locally cloned Puakma Application directories in the workspace, use the `clean` command:
119
+
120
+ ```
121
+ vortex clean
122
+ ```
123
+
124
+ ### Create Design Objects
125
+
126
+ To create new design objects, use the `new` command:
127
+
128
+ ```
129
+ vortex new [NAME, ...] --app-id <app_id> --type <design_type>
130
+ ```
131
+
132
+ Specify more than one name to create multiple design objects of the same type for the specified application
133
+
134
+ ### Delete Design Objects
135
+
136
+ To delete a design object, use the `delete` command:
137
+
138
+ ```
139
+ vortex delete [DESIGN_OBJECT_ID, ...]
140
+ ```
141
+
142
+ ### Find cloned Design Objects
143
+
144
+ To search for Design Objects by name use the `find` command:
145
+
146
+ ```
147
+ vortex find <name> [options]
148
+ ```
149
+
150
+ ### Search the contents of cloned Design Objects
151
+
152
+ To search for text patterns in Design Objects using a [Regular Expression](https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference) use the `grep` command:
153
+
154
+ ```
155
+ vortex grep <pattern> [options]
156
+ ```
@@ -0,0 +1,60 @@
1
+ [metadata]
2
+ name = vortex_cli
3
+ version = 3.0.0
4
+ description = Vortex CLI
5
+ long_description = file: README.md
6
+ long_description_content_type = text/markdown
7
+ url = https://github.com/jordanamos/vortex-cli
8
+ author = Jordan Amos
9
+ author_email = jordan.amos@gmail.com
10
+ license = MIT
11
+ license_files = LICENSE
12
+ classifiers =
13
+ Development Status :: 2 - Pre-Alpha
14
+ Intended Audience :: Developers
15
+ License :: OSI Approved :: MIT License
16
+ Natural Language :: English
17
+ Programming Language :: Python
18
+ Programming Language :: Python :: 3
19
+ Programming Language :: Python :: 3 :: Only
20
+ keywords = vortex cli
21
+
22
+ [options]
23
+ packages = find:
24
+ install_requires =
25
+ httpx==0.24.1
26
+ tabulate==0.9.0
27
+ watchfiles==0.19.0
28
+ python_requires = >=3.10
29
+
30
+ [options.packages.find]
31
+ exclude =
32
+ tests*
33
+ testing*
34
+
35
+ [options.entry_points]
36
+ console_scripts =
37
+ vortex = vortex.__main__:main
38
+
39
+ [options.package_data]
40
+ vortex =
41
+ puakma/**/*.jar
42
+
43
+ [flake8]
44
+ max-line-length = 88
45
+
46
+ [mypy]
47
+ check_untyped_defs = true
48
+ disallow_any_generics = true
49
+ disallow_incomplete_defs = true
50
+ disallow_untyped_defs = true
51
+ warn_redundant_casts = true
52
+ warn_unused_ignores = true
53
+
54
+ [mypy-tests.*]
55
+ disallow_untyped_defs = false
56
+
57
+ [egg_info]
58
+ tag_build =
59
+ tag_date = 0
60
+
@@ -0,0 +1,5 @@
1
+ from __future__ import annotations
2
+
3
+ from setuptools import setup
4
+
5
+ setup()
File without changes
@@ -0,0 +1,6 @@
1
+ from __future__ import annotations
2
+
3
+ from vortex.main import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,18 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+
6
+ class Colour(Enum):
7
+ NORMAL = "\033[m"
8
+ RED = "\033[41m"
9
+ BOLD = "\033[1m"
10
+ GREEN = "\033[42m"
11
+ YELLOW = "\033[43;30m"
12
+
13
+ @staticmethod
14
+ def highlight(text: str, colour: Colour, replace_in: str | None = None) -> str:
15
+ highlighted_txt = f"{colour.value}{text}{Colour.NORMAL.value}"
16
+ if replace_in:
17
+ highlighted_txt = replace_in.replace(text, highlighted_txt)
18
+ return highlighted_txt
File without changes
@@ -0,0 +1,21 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ import shutil
5
+
6
+ from vortex.workspace import Workspace
7
+
8
+
9
+ logger = logging.getLogger("vortex")
10
+
11
+
12
+ def clean(workspace: Workspace) -> int:
13
+ app_dirs = workspace.listdir(strict=False)
14
+ ret = 0
15
+ if app_dirs:
16
+ with workspace.exclusive_lock():
17
+ for app_dir in app_dirs:
18
+ shutil.rmtree(app_dir)
19
+ logger.info(f"Deleted directory '{app_dir}'")
20
+ ret = workspace.update_vscode_settings()
21
+ return ret
@@ -0,0 +1,219 @@
1
+ from __future__ import annotations
2
+
3
+ import asyncio
4
+ import binascii
5
+ import logging
6
+ import xml.etree.ElementTree as ET
7
+ import zlib
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ from vortex import util
12
+ from vortex.models import DesignObject
13
+ from vortex.models import DesignType
14
+ from vortex.models import JavaClassVersion
15
+ from vortex.models import PuakmaApplication
16
+ from vortex.models import PuakmaServer
17
+ from vortex.spinner import Spinner
18
+ from vortex.workspace import Workspace
19
+
20
+ logger = logging.getLogger("vortex")
21
+
22
+
23
+ def clone(
24
+ workspace: Workspace,
25
+ server: PuakmaServer,
26
+ app_ids: list[int],
27
+ *,
28
+ get_resources: bool = False,
29
+ open_urls: bool = False,
30
+ reclone: bool = False,
31
+ ) -> int:
32
+ if reclone:
33
+ app_ids.extend(app.id for app in workspace.listapps(server))
34
+
35
+ with (
36
+ workspace.exclusive_lock(),
37
+ Spinner(f"Cloning {app_ids}..."),
38
+ ):
39
+ return asyncio.run(
40
+ _aclone_apps(workspace, server, app_ids, get_resources, open_urls)
41
+ )
42
+
43
+
44
+ async def _aclone_apps(
45
+ workspace: Workspace,
46
+ server: PuakmaServer,
47
+ app_ids: list[int],
48
+ get_resources: bool,
49
+ open_urls: bool,
50
+ ) -> int:
51
+ tasks = []
52
+ async with server as s:
53
+ await s.server_designer.ainitiate_connection()
54
+ logger.info(f"Connected to {s.host}")
55
+
56
+ for app_id in app_ids:
57
+ task = asyncio.create_task(_aclone_app(workspace, s, app_id, get_resources))
58
+ tasks.append(task)
59
+
60
+ ret = 0
61
+ for done in asyncio.as_completed(tasks):
62
+ try:
63
+ app, _ret = await done
64
+ if open_urls and app:
65
+ util.open_app_urls(app)
66
+ ret |= _ret
67
+ except (KeyboardInterrupt, Exception) as e:
68
+ for task in tasks:
69
+ task.cancel()
70
+ raise e
71
+ except asyncio.CancelledError:
72
+ logger.error("Operation Cancelled")
73
+ for task in tasks:
74
+ task.cancel()
75
+ ret = 1
76
+ break
77
+ else:
78
+ ret |= workspace.update_vscode_settings()
79
+ return ret
80
+
81
+
82
+ async def _aclone_app(
83
+ workspace: Workspace,
84
+ server: PuakmaServer,
85
+ app_id: int,
86
+ get_resources: bool,
87
+ ) -> tuple[PuakmaApplication | None, int]:
88
+ """Clone a Puakma Application into a newly created directory"""
89
+
90
+ logger.info(f"Cloning [{app_id}] from {server.host}...")
91
+
92
+ app_xml, _obj_rows = await asyncio.gather(
93
+ server.app_designer.aget_application_xml(app_id),
94
+ PuakmaApplication.afetch_design_objects(server, app_id, get_resources),
95
+ )
96
+
97
+ try:
98
+ app, app_ele = _parse_app_xml(server, app_xml, app_id)
99
+ except (ValueError, KeyError) as e:
100
+ logger.error(e)
101
+ return None, 1
102
+
103
+ eles = app_ele.findall("designElement", namespaces=None)
104
+ objs = _aparse_design_objs(_obj_rows, app)
105
+ _match_and_validate_design_objs(objs, eles)
106
+
107
+ app.design_objects = objs
108
+ app_dir = workspace.mkdir(app, True)
109
+ try:
110
+ logger.info(f"Saving {len(objs)} ({len(eles)}) Design Objects [{app_id}]...")
111
+ await asyncio.to_thread(_save_objs, workspace, objs)
112
+ except asyncio.CancelledError:
113
+ util.rmtree(app_dir)
114
+ return None, 1
115
+
116
+ logger.info(f"Successfully cloned {app} into '{app_dir.name}'")
117
+
118
+ return app, 0
119
+
120
+
121
+ def _save_objs(workspace: Workspace, objs: list[DesignObject]) -> None:
122
+ for obj in objs:
123
+ obj.save(workspace)
124
+
125
+
126
+ def _aparse_design_objs(
127
+ objs: list[dict[str, Any]], app: PuakmaApplication
128
+ ) -> list[DesignObject]:
129
+ ret: list[DesignObject] = []
130
+ for obj in objs:
131
+ design_type_id = int(obj["type"])
132
+ name = obj["name"]
133
+ id_ = int(obj["id"])
134
+ try:
135
+ type_ = DesignType(design_type_id)
136
+ except ValueError:
137
+ logger.debug(
138
+ f"Skipped Design Object '{name}' [{obj['id']}]: "
139
+ f"Invalid Design Type [{design_type_id}]"
140
+ )
141
+ continue
142
+ ret.append(
143
+ DesignObject(
144
+ id_,
145
+ name,
146
+ app,
147
+ type_,
148
+ obj["ctype"],
149
+ obj["data"],
150
+ obj["src"],
151
+ )
152
+ )
153
+ return ret
154
+
155
+
156
+ def _parse_app_xml(
157
+ server: PuakmaServer, app_xml: ET.Element, app_id: int
158
+ ) -> tuple[PuakmaApplication, ET.Element]:
159
+ app_ele = app_xml.find("puakmaApplication", namespaces=None)
160
+ if not app_ele:
161
+ raise ValueError(f"Application [{app_id}] does not exist")
162
+
163
+ java_version_ele = app_xml.find('.//sysProp[@name="java.class.version"]')
164
+ if java_version_ele is None or java_version_ele.text is None:
165
+ raise ValueError("Java class version not specified")
166
+ major, minor = (int(v) for v in java_version_ele.text.split(".", maxsplit=1))
167
+ version: JavaClassVersion = (major, minor)
168
+ app = PuakmaApplication(
169
+ id=int(app_ele.attrib["id"]),
170
+ name=app_ele.attrib["name"],
171
+ group=app_ele.attrib["group"],
172
+ inherit_from=app_ele.attrib["inherit"],
173
+ template_name=app_ele.attrib["template"],
174
+ java_class_version=version,
175
+ host=server.host,
176
+ )
177
+ return app, app_ele
178
+
179
+
180
+ def _validate_crc32_checksum(obj: DesignObject, ele: dict[str, str]) -> bool:
181
+ data = obj.design_source if obj.do_save_source else obj.design_data
182
+ crc32_xml_key = "sourceCrc32" if obj.do_save_source else "dataCrc32"
183
+ crc32_checksum = int(ele.get(crc32_xml_key, 0))
184
+ try:
185
+ return crc32_checksum == zlib.crc32(data)
186
+ except (TypeError, binascii.Error):
187
+ return False
188
+
189
+
190
+ def _match_and_validate_design_objs(
191
+ design_objs: list[DesignObject],
192
+ design_elements: list[ET.Element],
193
+ ) -> None:
194
+ design_objs_eles = {int(ele.attrib["id"]): ele for ele in design_elements}
195
+ for obj in reversed(design_objs):
196
+ ele = design_objs_eles.get(obj.id)
197
+ if ele is not None:
198
+ obj.is_jar_library = ele.attrib.get("library", "false") == "true"
199
+
200
+ package = ele.attrib.get("package", None)
201
+ obj.package_dir = Path(*package.split(".")) if package else None
202
+
203
+ open_action_param_ele = ele.find('.//designParam[@name="OpenAction"]')
204
+ if open_action_param_ele is not None:
205
+ obj.open_action = open_action_param_ele.attrib["value"]
206
+
207
+ save_action_param_ele = ele.find('.//designParam[@name="SaveAction"]')
208
+ if save_action_param_ele is not None:
209
+ obj.save_action = save_action_param_ele.attrib["value"]
210
+
211
+ parent_page_param_ele = ele.find('.//designParam[@name="ParentPage"]')
212
+ if parent_page_param_ele is not None:
213
+ obj.parent_page = parent_page_param_ele.attrib["value"]
214
+
215
+ if ele is None or not _validate_crc32_checksum(obj, ele.attrib):
216
+ design_objs.remove(obj)
217
+ logger.warning(
218
+ f"Unable to validate Design Object {obj}. It will not be saved."
219
+ )