-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Update release workflow
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Mendix Model Exporter | ||
|
||
Mendix models are stored in a binary file with `.mpr` extension. This project aims to export Mendix models to a human readable format, such as Yaml. This enables developers to use traditional code analysis tools on Mendix models. Think of quality checks like linting, code formatting, etc. | ||
|
||
 | ||
|
||
See each Mendix document/object as a separate file in the output directory. And see the differences between versions in a version control system. Here we changed the `Documentation` of an entity and added a new `Entity` with one `Attribute`. | ||
|
||
## Usage | ||
|
||
### Download | ||
|
||
First download the exporter program. | ||
|
||
- Download the latest release from the [releases page](https://github.com/cinaq/mendix-model-exporter/releases) | ||
- Run the executable with the following command line arguments: | ||
- `--input` or `-i` to specify the input file or directory. Default is `./` which means the current directory. It will look for `.mpr` files in the current directory. | ||
- `--output` or `-o` to specify the output directory. Default is `modelsource` | ||
|
||
## pre-commit hook setup | ||
|
||
> As of this writing, Mendix Studio Pro does not support Git hooks. You can use the following workaround to automatically export your Mendix model to Yaml before each commit. Make sure you have git-bash installed on your system. Download it from [here](https://git-scm.com/download/win). | ||
After you open your `git` project in Mendix Studio Pro, navigate to the root of the project. Create a new file named `.git/hooks/pre-commit` and add the following content: | ||
|
||
```bash | ||
#!/bin/sh | ||
|
||
# Program name and download URL | ||
PROGRAM_NAME="mendix-model-exporter" | ||
DOWNLOAD_URL="https://example.com/myprogram" | ||
|
||
# Path to the program in the hooks directory | ||
PROGRAM_PATH="$(dirname $0)/$PROGRAM_NAME" | ||
|
||
# Check if the program exists, download it if it does not | ||
if [ ! -f "$PROGRAM_PATH" ]; then | ||
echo "Program not found, downloading..." | ||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')" | ||
ARCH="$(uname -m)" | ||
curl -L "$DOWNLOAD_URL-$OS-$ARCH" -o "$PROGRAM_PATH" | ||
chmod +x "$PROGRAM_PATH" | ||
fi | ||
|
||
# Execute the program | ||
"$PROGRAM_PATH" | ||
|
||
# Check program execution result | ||
if [ $? -ne 0 ]; then | ||
echo "Program failed, aborting commit." | ||
exit 1 | ||
fi | ||
|
||
# Automatically stage changes made by your program | ||
git add modelsource | ||
|
||
# Exit with 0 to continue the commit process | ||
exit 0 | ||
``` | ||
|
||
Set the executable bit on the file: | ||
|
||
```bash | ||
chmod +x .git/hooks/pre-commit | ||
``` | ||
|
||
Now whenever you commit using git-bash, the Mendix model will be exported to Yaml before the commit. The changes will be staged automatically. | ||
|
||
## Contribute | ||
|
||
Create a PR with your changes. We will review and merge it. | ||
|
||
## Features | ||
|
||
- Export Mendix model to Yaml | ||
- Incremental changes | ||
- Human readable output | ||
|
||
## TODO | ||
|
||
- [x] Export Mendix model to Yaml | ||
- [ ] Expand test coverage | ||
- [ ] Support incremental changes | ||
- [ ] Improve performance for large models | ||
- [ ] Improve error handling | ||
- [ ] Improve output human readability |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.