mxrb 0.1.1 → 0.1.3
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.
- checksums.yaml +4 -4
- data/README.de-DE.md +4 -0
- data/README.md +4 -0
- data/README.pt-BR.md +4 -0
- data/bin/mxrb +38 -2
- data/docs/de-DE/oql-sql.md +18 -0
- data/docs/de-DE/scaffolds.md +23 -0
- data/docs/en-US/oql-sql.md +18 -0
- data/docs/en-US/scaffolds.md +22 -0
- data/docs/pt-BR/entity-dsl.md +8 -0
- data/docs/pt-BR/oql-sql.md +18 -0
- data/docs/pt-BR/scaffolds.md +22 -0
- data/docs/pt-BR/writing.md +28 -0
- data/lib/mxrb/compare.rb +7 -0
- data/lib/mxrb/compiler/packager.rb +27 -13
- data/lib/mxrb/compiler/portable_packager.rb +16 -11
- data/lib/mxrb/dsl/builder.rb +100 -2
- data/lib/mxrb/exporter.rb +184 -32
- data/lib/mxrb/initializer.rb +1 -0
- data/lib/mxrb/integrity/validator.rb +18 -7
- data/lib/mxrb/model/entity.rb +17 -1
- data/lib/mxrb/model/module.rb +71 -0
- data/lib/mxrb/official_marketplace/module_package_importer.rb +23 -12
- data/lib/mxrb/official_marketplace/widget_package_installer.rb +15 -11
- data/lib/mxrb/official_marketplace.rb +9 -3
- data/lib/mxrb/oql.rb +9 -3
- data/lib/mxrb/progress.rb +242 -0
- data/lib/mxrb/runtime/clipboard.rb +62 -0
- data/lib/mxrb/runtime/database_workspace.rb +28 -0
- data/lib/mxrb/scaffold/cli.rb +20 -1
- data/lib/mxrb/scaffold/generator.rb +125 -3
- data/lib/mxrb/scaffold/help.rb +16 -2
- data/lib/mxrb/scaffold/recipes.rb +27 -0
- data/lib/mxrb/scaffold/templates.rb +11 -0
- data/lib/mxrb/scaffold/transaction.rb +2 -2
- data/lib/mxrb/team_server.rb +10 -7
- data/lib/mxrb/version.rb +1 -1
- data/lib/mxrb/writer.rb +94 -19
- data/lib/mxrb.rb +13 -7
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a734dae7c32bec492facdf80e775897c3b31af47fc595f4d4096f2cd27f091ee
|
|
4
|
+
data.tar.gz: db3a5207301da5c8f384515adf334c5739fba69379aec3c69175a653e68beff2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4aedde89b67e5d52e438b38e2f2c9835a9ca2407950a6c7ee04f10aa74fb0d1e9fae0fc380b50e3c3155fc7509eb0d513e90461c8058949849f9c4146df162c7
|
|
7
|
+
data.tar.gz: ed923449e412dc172462c951373408558244983db0d84b38d2a550791219190146064d900e2b6eb459fc8e6aa250def2c62614854e1e8b25d13192a6b437bd6e
|
data/README.de-DE.md
CHANGED
|
@@ -19,6 +19,7 @@ und Testen von Mendix-Projekten (`.mpr`) ohne MDL oder `mxcli`.
|
|
|
19
19
|
- Lint und ausführbare Modellbewertungen;
|
|
20
20
|
- Erkennung von nativem OQL und logische SQL-Ansicht nur bei vorhandenem OQL;
|
|
21
21
|
- isolierte, durch das Runtime synchronisierte PostgreSQL für direkte SQL-Abfragen;
|
|
22
|
+
- Demo-Benutzer mit lokalen `.env`-Geheimnissen und sichere Runtime-Zugangsdaten;
|
|
22
23
|
- Analyse von PostgreSQL-/SQL-Server-Plänen und kumulativem PostgreSQL-Workload;
|
|
23
24
|
- funktionale Microflow-Tests lokal oder in Docker.
|
|
24
25
|
- Suche und Installation wiederverwendbarer Ruby-Module mit SHA-256-Lock.
|
|
@@ -35,6 +36,7 @@ wird kompatibles Java benötigt; Docker stellt JDK und Runtime bereit.
|
|
|
35
36
|
|
|
36
37
|
```sh
|
|
37
38
|
bundle install
|
|
39
|
+
bundle exec mxrb --version
|
|
38
40
|
bundle exec mxrb validate App.mpr
|
|
39
41
|
bundle exec mxrb export App.mpr app-ruby
|
|
40
42
|
bundle exec mxrb compare original.mpr rebuilt.mpr
|
|
@@ -45,7 +47,9 @@ bundle exec mxrb cache warm App.mpr
|
|
|
45
47
|
bundle exec mxrb cache clear App.mpr
|
|
46
48
|
bundle exec mxrb oql App.mpr --dialect postgresql
|
|
47
49
|
bundle exec mxrb db up App.mpr
|
|
50
|
+
bundle exec mxrb db credentials App.mpr --copy
|
|
48
51
|
bundle exec mxrb db sql App.mpr 'SELECT * FROM "sales$order" LIMIT 20'
|
|
52
|
+
bundle exec mxrb demo-user new manager --entity System.User --role User
|
|
49
53
|
```
|
|
50
54
|
|
|
51
55
|
Die MPR speichert das Modell, nicht die Anwendungsdaten. `db up` baut das
|
data/README.md
CHANGED
|
@@ -23,6 +23,7 @@ remain optional external gates for compatibility and functional execution.
|
|
|
23
23
|
- inventory design tokens, check contrast and preview atomic literal migration;
|
|
24
24
|
- discover native OQL and render safe logical SQL views only when OQL exists;
|
|
25
25
|
- materialize an isolated, Runtime-synchronized PostgreSQL for direct SQL inspection;
|
|
26
|
+
- scaffold demo users with local `.env` secrets and safely inspect Runtime credentials;
|
|
26
27
|
- analyze PostgreSQL/SQL Server plans and rank cumulative PostgreSQL workload pressure;
|
|
27
28
|
- move standalone units between folders in the same module with a preview;
|
|
28
29
|
- remove standalone units only after reference and child-unit safety checks;
|
|
@@ -57,6 +58,7 @@ Install dependencies:
|
|
|
57
58
|
|
|
58
59
|
```sh
|
|
59
60
|
bundle install
|
|
61
|
+
bundle exec mxrb --version
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
## Ruby DSL
|
|
@@ -92,7 +94,9 @@ bundle exec mxrb cache warm Shop.mpr
|
|
|
92
94
|
bundle exec mxrb cache clear Shop.mpr
|
|
93
95
|
bundle exec mxrb oql Shop.mpr --dialect postgresql
|
|
94
96
|
bundle exec mxrb db up Shop.mpr
|
|
97
|
+
bundle exec mxrb db credentials Shop.mpr --copy
|
|
95
98
|
bundle exec mxrb db sql Shop.mpr 'SELECT * FROM "sales$order" LIMIT 20'
|
|
99
|
+
bundle exec mxrb demo-user new manager --entity System.User --role User
|
|
96
100
|
bundle exec mxrb pack Shop.mpr --output build/Shop.mda
|
|
97
101
|
bundle exec mxrb portable Shop.mpr --output build/runtime.zip
|
|
98
102
|
bundle exec mxrb team-server clone APP_ID ./shop --pat-file /secure/team-server.env
|
data/README.pt-BR.md
CHANGED
|
@@ -19,6 +19,7 @@ projetos Mendix (`.mpr`) sem MDL ou `mxcli`.
|
|
|
19
19
|
- lint e avaliações executáveis de modelo;
|
|
20
20
|
- descoberta de OQL nativo e visão SQL lógica somente quando o projeto contém OQL;
|
|
21
21
|
- PostgreSQL isolado e sincronizado pelo Runtime para consultas SQL diretas;
|
|
22
|
+
- scaffold de demo users com segredos locais no `.env` e consulta segura de credenciais;
|
|
22
23
|
- análise de planos PostgreSQL/SQL Server e workload cumulativo PostgreSQL;
|
|
23
24
|
- testes funcionais de microflows localmente ou em Docker.
|
|
24
25
|
- busca e instalação de módulos Ruby reutilizáveis com SHA-256 travado.
|
|
@@ -34,6 +35,7 @@ local precisa do Java compatível; o modo Docker fornece JDK e Runtime.
|
|
|
34
35
|
|
|
35
36
|
```sh
|
|
36
37
|
bundle install
|
|
38
|
+
bundle exec mxrb --version
|
|
37
39
|
bundle exec mxrb init vet_clinic
|
|
38
40
|
bundle exec mxrb validate App.mpr
|
|
39
41
|
bundle exec mxrb export App.mpr app-ruby
|
|
@@ -45,7 +47,9 @@ bundle exec mxrb cache warm App.mpr
|
|
|
45
47
|
bundle exec mxrb cache clear App.mpr
|
|
46
48
|
bundle exec mxrb oql App.mpr --dialect postgresql
|
|
47
49
|
bundle exec mxrb db up App.mpr
|
|
50
|
+
bundle exec mxrb db credentials App.mpr --copy
|
|
48
51
|
bundle exec mxrb db sql App.mpr 'SELECT * FROM "sales$order" LIMIT 20'
|
|
52
|
+
bundle exec mxrb demo-user new manager --entity System.User --role User
|
|
49
53
|
```
|
|
50
54
|
|
|
51
55
|
O MPR armazena o modelo, não os dados da aplicação. `db up` compila o Runtime
|
data/bin/mxrb
CHANGED
|
@@ -64,9 +64,14 @@ end
|
|
|
64
64
|
|
|
65
65
|
SCAFFOLD_COMMANDS = (Mxrb::Scaffold::Help::COMMANDS.keys - ["design"]).freeze
|
|
66
66
|
|
|
67
|
+
progress_disabled = ARGV.delete("--no-progress")
|
|
67
68
|
command = ARGV.shift
|
|
69
|
+
Mxrb::Progress.configure(enabled: false) if progress_disabled || ARGV.include?("--json")
|
|
68
70
|
|
|
69
71
|
case command
|
|
72
|
+
when '--version', '-v'
|
|
73
|
+
puts "mxrb #{Mxrb::VERSION}"
|
|
74
|
+
|
|
70
75
|
when 'doctor'
|
|
71
76
|
json = ARGV.delete('--json')
|
|
72
77
|
root = ARGV.shift || Dir.pwd
|
|
@@ -742,7 +747,7 @@ when "design"
|
|
|
742
747
|
|
|
743
748
|
when "db"
|
|
744
749
|
action = ARGV.shift or
|
|
745
|
-
abort "Usage: mxrb db <up|sync|down|destroy|status|url|sql|explain|workload|indexes|shell> <file.mpr>"
|
|
750
|
+
abort "Usage: mxrb db <up|sync|down|destroy|status|credentials|url|sql|explain|workload|indexes|shell> <file.mpr>"
|
|
746
751
|
path = ARGV.shift or abort "Usage: mxrb db #{action} <file.mpr>"
|
|
747
752
|
option = lambda do |name, fallback = nil|
|
|
748
753
|
index = ARGV.index(name)
|
|
@@ -795,6 +800,30 @@ when "db"
|
|
|
795
800
|
puts "Database : #{info.database_container}"
|
|
796
801
|
puts "Runtime : #{info.runtime_container}"
|
|
797
802
|
puts "State : #{info.state_dir}"
|
|
803
|
+
when "credentials"
|
|
804
|
+
copy = !ARGV.delete("--copy").nil?
|
|
805
|
+
show_password = !ARGV.delete("--show-password").nil?
|
|
806
|
+
json = !ARGV.delete("--json").nil?
|
|
807
|
+
abort '--copy and --show-password are mutually exclusive' if copy && show_password
|
|
808
|
+
abort "Unknown arguments: #{ARGV.join(' ')}" unless ARGV.empty?
|
|
809
|
+
|
|
810
|
+
credentials = workspace.admin_credentials
|
|
811
|
+
visible_password = nil
|
|
812
|
+
visible_password = credentials.password if show_password
|
|
813
|
+
if copy
|
|
814
|
+
command = Mxrb::Runtime::Clipboard.new.copy(credentials.password)
|
|
815
|
+
puts "[mxrb] Password for #{credentials.username} copied with #{command}"
|
|
816
|
+
elsif json
|
|
817
|
+
puts JSON.pretty_generate(
|
|
818
|
+
username: credentials.username, password: visible_password,
|
|
819
|
+
state: credentials.state_dir, credentials_file: credentials.path
|
|
820
|
+
)
|
|
821
|
+
else
|
|
822
|
+
visible_password ||= '<hidden; use --copy or --show-password>'
|
|
823
|
+
puts "User name : #{credentials.username}"
|
|
824
|
+
puts "Password : #{visible_password}"
|
|
825
|
+
puts "State : #{credentials.state_dir}"
|
|
826
|
+
end
|
|
798
827
|
when "url"
|
|
799
828
|
puts workspace.connection_url
|
|
800
829
|
when "sql"
|
|
@@ -833,7 +862,7 @@ when "db"
|
|
|
833
862
|
exec(*workspace.shell_command(write:))
|
|
834
863
|
else
|
|
835
864
|
abort "Unknown db action #{action.inspect}; " \
|
|
836
|
-
"use up, sync, down, destroy, status, url, sql, explain, workload, indexes or shell"
|
|
865
|
+
"use up, sync, down, destroy, status, credentials, url, sql, explain, workload, indexes or shell"
|
|
837
866
|
end
|
|
838
867
|
|
|
839
868
|
when "serve"
|
|
@@ -1479,6 +1508,8 @@ else
|
|
|
1479
1508
|
mxrb — Pure-Ruby Mendix .mpr toolkit
|
|
1480
1509
|
|
|
1481
1510
|
Commands:
|
|
1511
|
+
--no-progress Disable interactive progress rendering
|
|
1512
|
+
--version, -v Show the installed MXRB version
|
|
1482
1513
|
doctor [DIR] [--json] Check project files and local toolchain
|
|
1483
1514
|
benchmark <file.mpr> Measure open, index and validation time
|
|
1484
1515
|
--iterations N --json Configure repetitions or emit JSON
|
|
@@ -1537,6 +1568,8 @@ else
|
|
|
1537
1568
|
down <file.mpr> Stop containers while preserving all data
|
|
1538
1569
|
destroy <file.mpr> --yes Remove isolated containers, data, and state
|
|
1539
1570
|
status <file.mpr> Show isolated database/runtime status
|
|
1571
|
+
credentials <file.mpr> [--copy] Show the admin user or copy its password
|
|
1572
|
+
--show-password Explicitly print the Runtime admin password
|
|
1540
1573
|
url <file.mpr> [--port PORT] Print the read-only PostgreSQL connection URL
|
|
1541
1574
|
sql <file.mpr> "SELECT …" Execute SQL as the read-only analyst role
|
|
1542
1575
|
--write Explicitly use the Runtime owner role
|
|
@@ -1595,6 +1628,9 @@ else
|
|
|
1595
1628
|
nanoflow new Module.Name Scaffold a client nanoflow
|
|
1596
1629
|
repository new Module.Name Scaffold a repository port and adapter
|
|
1597
1630
|
security init Module Scaffold module roles
|
|
1631
|
+
demo-user [new] NAME Scaffold a local Mendix demo user
|
|
1632
|
+
[--entity ENTITY] Default: System.User
|
|
1633
|
+
[--role ROLE] Repeatable; default: User
|
|
1598
1634
|
scheduled-event new Module.Name Scaffold an event and handler
|
|
1599
1635
|
constant new Module.Name Scaffold a module constant
|
|
1600
1636
|
integration new Module.Name Scaffold an integration adapter
|
data/docs/de-DE/oql-sql.md
CHANGED
|
@@ -142,6 +142,24 @@ bundle exec mxrb db sql Shop.mpr \
|
|
|
142
142
|
bundle exec mxrb db shell Shop.mpr
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
Die Zugangsdaten des vorhandenen Runtime-Administrators lassen sich prüfen,
|
|
146
|
+
ohne das Passwort standardmäßig auszugeben:
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
bundle exec mxrb db credentials Shop.mpr
|
|
150
|
+
bundle exec mxrb db credentials Shop.mpr --copy
|
|
151
|
+
bundle exec mxrb db credentials Shop.mpr --json
|
|
152
|
+
bundle exec mxrb db credentials Shop.mpr --show-password
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`--copy` übergibt das Passwort per stdin an die Zwischenablage und nie als
|
|
156
|
+
Prozessargument. Nur `--show-password` gibt es aus; im JSON bleibt `password`
|
|
157
|
+
ohne diese Option `null`. `--copy` und `--show-password` schließen einander
|
|
158
|
+
aus. Der Befehl liest nur einen vorhandenen Workspace: Er erzeugt oder rotiert
|
|
159
|
+
keine Zugangsdaten und verweist auf `db up`, falls noch kein Zustand existiert.
|
|
160
|
+
Dies sind die Zugangsdaten des Mendix-Anwendungsadministrators, getrennt von
|
|
161
|
+
den PostgreSQL-Rollen `mxrb_reader` und Runtime-Eigentümer.
|
|
162
|
+
|
|
145
163
|
Nach einer Änderung der MPR wird unter Beibehaltung der Daten neu gebaut und
|
|
146
164
|
synchronisiert:
|
|
147
165
|
|
data/docs/de-DE/scaffolds.md
CHANGED
|
@@ -30,6 +30,29 @@ Data Source. Ketten, die mit einem Microflow enden, erzeugen zusätzlich
|
|
|
30
30
|
Jede erzeugte Kette wird als gültiges MPR materialisiert und durch den
|
|
31
31
|
Compiler-Preflight geprüft.
|
|
32
32
|
|
|
33
|
+
## Demo-Benutzer
|
|
34
|
+
|
|
35
|
+
Nach der Initialisierung der Sicherheit wird jeder Demo-Benutzer als eigene
|
|
36
|
+
Ruby-Datei erzeugt:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
mxrb security init App
|
|
40
|
+
mxrb demo-user new manager --entity System.User --role User
|
|
41
|
+
mxrb demo-user operator --entity App.Account --role User --role Administrator
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`new` ist optional. `--entity` verwendet standardmäßig `System.User`, und
|
|
45
|
+
`--role` kann wiederholt werden; ohne Angabe wird die Rolle `User` gewählt. Das
|
|
46
|
+
Scaffold prüft sofort, ob Entität und Anwendungsrollen vorhanden sind,
|
|
47
|
+
verbindet `app/security/demo_users` mit dem `security`-Block und aktiviert
|
|
48
|
+
Demo-Benutzer in der MPR.
|
|
49
|
+
|
|
50
|
+
Das zufällige Passwort liegt nur in der ignorierten `.env`, die beim Erstellen
|
|
51
|
+
den Modus `0600` erhält. Der erzeugte Ruby-Code nutzt `ENV.fetch`, während
|
|
52
|
+
`.env.example` nur eine leere Variable enthält. Danach wird die MPR wie gewohnt
|
|
53
|
+
generiert und validiert. Demo-Benutzer sind für Entwicklung und Vorführungen
|
|
54
|
+
gedacht, nicht für Produktionsbenutzer.
|
|
55
|
+
|
|
33
56
|
## Seitenvorlagen
|
|
34
57
|
|
|
35
58
|
In Mendix sind Page Templates Ausgangspunkte, deren Struktur zu einer normalen,
|
data/docs/en-US/oql-sql.md
CHANGED
|
@@ -137,6 +137,24 @@ bundle exec mxrb db sql Shop.mpr \
|
|
|
137
137
|
bundle exec mxrb db shell Shop.mpr
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
You can inspect the existing Runtime administrator credentials without
|
|
141
|
+
printing the password by default:
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
bundle exec mxrb db credentials Shop.mpr
|
|
145
|
+
bundle exec mxrb db credentials Shop.mpr --copy
|
|
146
|
+
bundle exec mxrb db credentials Shop.mpr --json
|
|
147
|
+
bundle exec mxrb db credentials Shop.mpr --show-password
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`--copy` sends the password to the clipboard through stdin, never in process
|
|
151
|
+
arguments. `--show-password` is the only mode that prints it; JSON keeps
|
|
152
|
+
`password` as `null` without that option. `--copy` and `--show-password` are
|
|
153
|
+
mutually exclusive. The command only reads an existing workspace: it neither
|
|
154
|
+
creates nor rotates credentials and tells you to run `db up` when no state
|
|
155
|
+
exists. These are Mendix application-administrator credentials, separate from
|
|
156
|
+
the PostgreSQL `mxrb_reader` and Runtime-owner roles.
|
|
157
|
+
|
|
140
158
|
After changing the MPR, rebuild and synchronize while retaining the data:
|
|
141
159
|
|
|
142
160
|
```sh
|
data/docs/en-US/scaffolds.md
CHANGED
|
@@ -29,6 +29,28 @@ end in a microflow also create `ACT_RefreshOrder`. `page generate` and `page g`
|
|
|
29
29
|
are aliases of `page new`. Every generated chain is materialized as a valid MPR
|
|
30
30
|
and checked by compiler preflight.
|
|
31
31
|
|
|
32
|
+
## Demo users
|
|
33
|
+
|
|
34
|
+
After initializing security, scaffold each demo user as an independent Ruby
|
|
35
|
+
file:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
mxrb security init App
|
|
39
|
+
mxrb demo-user new manager --entity System.User --role User
|
|
40
|
+
mxrb demo-user operator --entity App.Account --role User --role Administrator
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`new` is optional. `--entity` defaults to `System.User`, and `--role` is
|
|
44
|
+
repeatable; without it, the `User` role is selected. The scaffold immediately
|
|
45
|
+
validates that the entity and application roles exist, connects
|
|
46
|
+
`app/security/demo_users` to the `security` block, and enables demo users in
|
|
47
|
+
the MPR.
|
|
48
|
+
|
|
49
|
+
The random password exists only in the ignored `.env`, created with mode
|
|
50
|
+
`0600`. Generated Ruby uses `ENV.fetch`, while `.env.example` receives only an
|
|
51
|
+
empty variable. Generate and validate the MPR normally after scaffolding. Demo
|
|
52
|
+
users are intended for development and demonstrations, not production users.
|
|
53
|
+
|
|
32
54
|
## Page templates
|
|
33
55
|
|
|
34
56
|
In Mendix, page templates are starting points whose structure becomes a normal,
|
data/docs/pt-BR/entity-dsl.md
CHANGED
|
@@ -94,6 +94,12 @@ entity :AnimalSearchResult do
|
|
|
94
94
|
string :Name
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
+
entity :AnimalSummaryView do
|
|
98
|
+
oql_view source: "VetClinic.AnimalSummarySource"
|
|
99
|
+
string :Name
|
|
100
|
+
integer :Total
|
|
101
|
+
end
|
|
102
|
+
|
|
97
103
|
entity :Animal do
|
|
98
104
|
before_commit microflow: "VetClinic.VAL_Animal"
|
|
99
105
|
after_commit microflow: "VetClinic.ACT_AfterAnimalCommit"
|
|
@@ -111,6 +117,8 @@ end
|
|
|
111
117
|
|
|
112
118
|
Em `access_rule`, `read:` e `write:` aceitam `:all`, `:none` ou uma lista de
|
|
113
119
|
atributos. Declare um ou mais papéis qualificados como primeiros argumentos.
|
|
120
|
+
`oql_view` liga a entidade ao `ViewEntitySourceDocument`; ao exportar um projeto
|
|
121
|
+
existente, a consulta OQL aparece junto da entidade em `domain/oql_views`.
|
|
114
122
|
|
|
115
123
|
Use `mxrb entity --help` para o comando e `mxrb generate project.rb` seguido de
|
|
116
124
|
`mxrb validate App.mpr` para validar o resultado.
|
data/docs/pt-BR/oql-sql.md
CHANGED
|
@@ -144,6 +144,24 @@ bundle exec mxrb db sql Shop.mpr \
|
|
|
144
144
|
bundle exec mxrb db shell Shop.mpr
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
+
As credenciais do administrador do Runtime já criado podem ser consultadas sem
|
|
148
|
+
imprimir a senha por padrão:
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
bundle exec mxrb db credentials Shop.mpr
|
|
152
|
+
bundle exec mxrb db credentials Shop.mpr --copy
|
|
153
|
+
bundle exec mxrb db credentials Shop.mpr --json
|
|
154
|
+
bundle exec mxrb db credentials Shop.mpr --show-password
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`--copy` envia a senha ao clipboard por stdin, sem colocá-la nos argumentos do
|
|
158
|
+
processo. `--show-password` é a única forma de imprimi-la; no JSON, `password`
|
|
159
|
+
permanece `null` sem essa opção. `--copy` e `--show-password` são mutuamente
|
|
160
|
+
exclusivos. O comando apenas lê o workspace existente: não cria nem gira
|
|
161
|
+
credenciais e orienta executar `db up` quando o estado ainda não existe. Essas
|
|
162
|
+
são as credenciais do administrador da aplicação Mendix, distintas dos papéis
|
|
163
|
+
PostgreSQL `mxrb_reader` e proprietário do Runtime.
|
|
164
|
+
|
|
147
165
|
Depois de alterar o MPR, recompile e sincronize preservando os dados:
|
|
148
166
|
|
|
149
167
|
```sh
|
data/docs/pt-BR/scaffolds.md
CHANGED
|
@@ -30,6 +30,7 @@ o hash criado pelo gerador, protegendo edições posteriores.
|
|
|
30
30
|
| `mxrb page new App.Order --chain page:nanoflow:microflow` | Fatia vertical executável |
|
|
31
31
|
| `mxrb nanoflow new App.NAN_OpenCustomer` | Nanoflow cliente |
|
|
32
32
|
| `mxrb security init App` | Papéis, `CheckEverything` no projeto e orientação de acesso |
|
|
33
|
+
| `mxrb demo-user new manager --role User` | Demo user com segredo local em `.env` |
|
|
33
34
|
| `mxrb integration new App.PetApi` | Adaptador de integração |
|
|
34
35
|
| `mxrb published-rest new App.CustomersApi` | Handler editável para REST publicado |
|
|
35
36
|
| `mxrb consumed-rest new App.ExternalPets` | Adaptador REST consumido |
|
|
@@ -71,6 +72,27 @@ são aliases de `page new`. Cada cadeia é materializada em um MPR válido, serv
|
|
|
71
72
|
como ponto de partida removível e exercita o preflight do compilador; arquivos
|
|
72
73
|
existentes nunca são sobrescritos.
|
|
73
74
|
|
|
75
|
+
## Demo users
|
|
76
|
+
|
|
77
|
+
Depois de inicializar a segurança, um demo user pode ser declarado como um
|
|
78
|
+
arquivo Ruby independente:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
mxrb security init App
|
|
82
|
+
mxrb demo-user new manager --entity System.User --role User
|
|
83
|
+
mxrb demo-user operator --entity App.Account --role User --role Administrator
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`new` é opcional. `--entity` usa `System.User` por padrão e `--role` pode ser
|
|
87
|
+
repetido; sem ele, o papel `User` é usado. O scaffold valida imediatamente se
|
|
88
|
+
a entidade e os papéis existem, conecta `app/security/demo_users` ao bloco
|
|
89
|
+
`security` e habilita demo users no MPR.
|
|
90
|
+
|
|
91
|
+
A senha aleatória fica apenas no `.env` ignorado, com modo `0600` quando o
|
|
92
|
+
arquivo é criado. O Ruby gerado usa `ENV.fetch` e `.env.example` recebe somente
|
|
93
|
+
a variável vazia. Gere e valide o MPR normalmente depois do scaffold. Demo
|
|
94
|
+
users destinam-se a desenvolvimento e demonstração, não a usuários de produção.
|
|
95
|
+
|
|
74
96
|
## Modelos de página
|
|
75
97
|
|
|
76
98
|
No Mendix, page templates são pontos de partida: sua estrutura é copiada para
|
data/docs/pt-BR/writing.md
CHANGED
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
`mxrb generate` avalia uma definição Ruby e cria ou atualiza o MPR. Nomes
|
|
6
6
|
Mendix são chaves estáveis, portanto reaplicar a definição não duplica units.
|
|
7
7
|
|
|
8
|
+
Operações demoradas exibem progresso em `stderr` quando executadas em um
|
|
9
|
+
terminal interativo. Quando o total é conhecido, o MXRB mostra barra e
|
|
10
|
+
porcentagem; operações externas sem total confiável mostram spinner e tempo
|
|
11
|
+
decorrido. Pipes, redirecionamentos e saídas `--json` permanecem limpos. Use
|
|
12
|
+
`--no-progress` ou `MXRB_PROGRESS=0` para desativar explicitamente.
|
|
13
|
+
|
|
8
14
|
Para iniciar em uma pasta vazia:
|
|
9
15
|
|
|
10
16
|
```sh
|
|
@@ -122,6 +128,28 @@ usam `bson_binary`. Alterações nesse Ruby sobrepõem o baseline antes das escr
|
|
|
122
128
|
tipadas. Corpos de flow possuem `body_fingerprint`: o grafo nativo é reutilizado
|
|
123
129
|
quando o Ruby não mudou e regenerado após uma edição.
|
|
124
130
|
|
|
131
|
+
Export mappings, import mappings e JSON structures são materializados por
|
|
132
|
+
módulo em `infrastructure/mappings/{exports,imports,json_structures}`. Esses
|
|
133
|
+
arquivos mantêm `UnitID` e container/pasta originais, podem editar toda a
|
|
134
|
+
estrutura profunda em Ruby e têm precedência sobre o baseline durante o
|
|
135
|
+
`generate`.
|
|
136
|
+
|
|
137
|
+
Serviços REST, OData e web services publicados são exportados para
|
|
138
|
+
`infrastructure/endpoints`; recursos, operações, métodos HTTP, paths,
|
|
139
|
+
parâmetros e referências a microflows permanecem no mesmo arquivo Ruby.
|
|
140
|
+
Serviços consumidos são roteados para `infrastructure/integrations`, enquanto
|
|
141
|
+
message definitions e XML schemas ficam em `infrastructure/mappings`.
|
|
142
|
+
|
|
143
|
+
O Domain Model exportado separa entidades persistentes em `domain/entities`,
|
|
144
|
+
DTOs/non-persistent em `domain/dtos` e entidades de OQL View em
|
|
145
|
+
`domain/oql_views`. O arquivo da OQL View também contém seu
|
|
146
|
+
`DomainModels$ViewEntitySourceDocument`, portanto a consulta `Oql` pode ser
|
|
147
|
+
editada no mesmo Ruby sem perder a referência da entidade. Datasets OQL ficam
|
|
148
|
+
em `application/queries/datasets`; enumerations e constants ficam em
|
|
149
|
+
`domain/enumerations` e `domain/constants`. Scheduled events ficam em
|
|
150
|
+
`application/jobs/scheduled_events`. O `domain/model.rb` e o
|
|
151
|
+
`application/application.rb` carregam automaticamente todas essas categorias.
|
|
152
|
+
|
|
125
153
|
A DSL cobre criação/alteração/retrieve/commit/delete, chamadas de microflow,
|
|
126
154
|
Java, JavaScript, nanoflow e app service, páginas, REST, listas, decisões,
|
|
127
155
|
loops, eventos de erro e rescue.
|
data/lib/mxrb/compare.rb
CHANGED
|
@@ -72,6 +72,13 @@ module Mxrb
|
|
|
72
72
|
admin_user_name: doc["AdminUserName"],
|
|
73
73
|
admin_user_role: doc["AdminUserRole"],
|
|
74
74
|
demo_users_enabled: doc["EnableDemoUsers"],
|
|
75
|
+
demo_users: IO::BsonCodec.parse_array(doc["DemoUsers"]).fetch(:items).map do |user|
|
|
76
|
+
{
|
|
77
|
+
name: user["UserName"], entity: user["Entity"],
|
|
78
|
+
roles: IO::BsonCodec.parse_array(user["UserRoles"]).fetch(:items).sort,
|
|
79
|
+
password_sha256: Digest::SHA256.hexdigest(user["Password"].to_s)
|
|
80
|
+
}
|
|
81
|
+
end.sort_by { _1[:name].to_s },
|
|
75
82
|
guest_access_enabled: doc["EnableGuestAccess"],
|
|
76
83
|
guest_user_role: doc["GuestUserRole"],
|
|
77
84
|
sign_in_microflow: doc["SignInMicroflow"],
|
|
@@ -19,16 +19,24 @@ module Mxrb
|
|
|
19
19
|
@deployment = File.expand_path(deployment || File.join(@project_root, 'deployment'))
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def pack(output:, force: false)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
def pack(output:, force: false) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
23
|
+
Progress.with("Packing #{File.basename(@mpr_path)}") do |progress|
|
|
24
|
+
output_path = File.expand_path(output)
|
|
25
|
+
validate_input!(output_path, force:)
|
|
26
|
+
version = Mxrb.open(@mpr_path, &:mendix_version)
|
|
27
|
+
adapter = Adapter.for(version)
|
|
28
|
+
metadata = adapter.validate_deployment!(@deployment)
|
|
29
|
+
adapter.validate_freshness!(@mpr_path, @deployment)
|
|
30
|
+
files, directories = inventory
|
|
31
|
+
progress.update(
|
|
32
|
+
current: 3, total: files.size + directories.size + 4,
|
|
33
|
+
detail: "#{files.size} files"
|
|
34
|
+
)
|
|
35
|
+
write_atomically(output_path, files, directories, progress)
|
|
36
|
+
package_result(output_path, version, metadata).tap do
|
|
37
|
+
progress.advance(detail: 'package checksum')
|
|
38
|
+
end
|
|
39
|
+
end
|
|
32
40
|
end
|
|
33
41
|
|
|
34
42
|
private
|
|
@@ -69,13 +77,19 @@ module Mxrb
|
|
|
69
77
|
path.delete_prefix("#{@deployment}/").tr('\\', '/')
|
|
70
78
|
end
|
|
71
79
|
|
|
72
|
-
def write_atomically(output, files, directories)
|
|
80
|
+
def write_atomically(output, files, directories, progress) # rubocop:disable Metrics/MethodLength
|
|
73
81
|
FileUtils.mkdir_p(File.dirname(output))
|
|
74
82
|
Dir.mktmpdir('mxrb-mda-', File.dirname(output)) do |tmpdir|
|
|
75
83
|
temporary = File.join(tmpdir, 'package.mda')
|
|
76
84
|
Zip::File.open(temporary, create: true) do |archive|
|
|
77
|
-
directories.each
|
|
78
|
-
|
|
85
|
+
directories.each do |directory|
|
|
86
|
+
add_directory(archive, directory)
|
|
87
|
+
progress.advance(detail: relative(directory))
|
|
88
|
+
end
|
|
89
|
+
files.each do |file|
|
|
90
|
+
add_file(archive, file)
|
|
91
|
+
progress.advance(detail: relative(file))
|
|
92
|
+
end
|
|
79
93
|
end
|
|
80
94
|
FileUtils.mv(temporary, output, force: true)
|
|
81
95
|
end
|
|
@@ -309,17 +309,22 @@ module Mxrb
|
|
|
309
309
|
@mendix_home = mendix_home && File.expand_path(mendix_home)
|
|
310
310
|
end
|
|
311
311
|
|
|
312
|
-
def pack(output:, force: false)
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
312
|
+
def pack(output:, force: false) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
313
|
+
Progress.with("Packing portable Runtime for #{File.basename(@mpr_path)}") do |progress|
|
|
314
|
+
output_path = File.expand_path(output)
|
|
315
|
+
validate_output!(output_path, force:)
|
|
316
|
+
progress.update(detail: 'validating deployment')
|
|
317
|
+
version = Mxrb.open(@mpr_path, &:mendix_version)
|
|
318
|
+
adapter = Adapter.for(version)
|
|
319
|
+
metadata = adapter.validate_deployment!(@deployment)
|
|
320
|
+
adapter.validate_freshness!(@mpr_path, @deployment)
|
|
321
|
+
runtime = runtime_root(version)
|
|
322
|
+
validate_runtime!(runtime)
|
|
323
|
+
progress.update(detail: 'writing Runtime archive')
|
|
324
|
+
PortableArchiveWriter.new(@deployment, runtime, metadata).write(output_path)
|
|
325
|
+
progress.update(detail: 'calculating checksum')
|
|
326
|
+
result(output_path, version, metadata)
|
|
327
|
+
end
|
|
323
328
|
end
|
|
324
329
|
|
|
325
330
|
private
|