Skip to content

Commit

Permalink
Adiciona comandos para exportar os diagramas
Browse files Browse the repository at this point in the history
  • Loading branch information
cassiobotaro committed Oct 3, 2023
1 parent 10da5e1 commit 4c3bac5
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Este repositório contém todos os diagramas contidos na apresentação do model

[PlantUML](https://plantuml.com/) foi utilizado em conjunto com [C4-PlantUML](https://github.com/plantuml-stdlib/C4-PlantUML) para gerar os diagramas.


## Gerando os diagramas

### Structurizr lite
Expand Down Expand Up @@ -39,6 +38,28 @@ Ela será invocada da seguinte maneira:
structurizr nome_do_arquivo_sem_extensão
```

Para exportar os arquivos em png ou svg, mantenha a instância do structurizr rodando e utilize a seguinte função descrita abaixo.

```sh
function export_c4(){
readonly format=${1:?"The format must be specified."}
[ ! -f export-diagram.js ] && wget https://github.com/cassiobotaro/modeloC4/raw/main/export-diagram.js
text=$(docker run -i --init --cap-add=SYS_ADMIN --net=host --name=exporter ghcr.io/puppeteer/puppeteer:latest node -e "$(cat export-diagrams.js)" "" "http://localhost:8080" "$format")
files=($(echo "$text" | grep -o "\S*\.$format"))
for file in "${files[@]}"
do
docker cp exporter:/home/pptruser/"$file" .
done
docker rm exporter
}
```

Ela será invocada da seguinte maneira:

```bash
export_c4 png
```

### PlantUML

O [VS Code](https://code.visualstudio.com/) possui um plugin para PlantUML que pode ser encontrado na marketplace: [PlantUML for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml).
Expand Down

0 comments on commit 4c3bac5

Please sign in to comment.