Giter Site home page Giter Site logo

oversizedhat / plantuml-watcher Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 2.0 32 KB

Small productivity util that watches for changes in plantuml files and (re)draws diagrams

Home Page: https://oscarberg.com/blog/plantuml-docker/

License: MIT License

Dockerfile 26.50% Shell 6.56% JavaScript 66.94%
docker plantuml

plantuml-watcher's Introduction

plantuml-watcher

Why

PlantUML is neat but comes with some pre-reqs on the environment with the install of GraphViz (and Java). Also the ideal workflow when desiging locally with PlantUML is a bit unclear. This image is meant to be started in a local dev environment and it uses a file watcher to render/re-render diagrams when they are modified. It could also be used in a CI chain.

Usage

Initialize a file watcher from any directory.

$ docker run --rm -ti -v ${PWD}:/ws -w /ws oscarberg/plantuml-watcher
******************************************************************
plantuml-watcher watching for changes in .puml and .plantuml files
plantuml args: []
******************************************************************
watching: /ws/example.puml

It will wait for changes in plantuml files (.puml or .plantuml). Any change will trigger (re)draw of diagram to desired format.

change: /ws/example.puml
 > draw: /ws/example.puml

Fancy diagram

Advanced usage

Supports passing along additional flags to the plantuml jar.

Useful ones like for example:
-tsvg : Generate images using SVG format instead of the default PNG.
-progress : Print the duration of complete diagrams processing.
-verbose : Have log information.
-duration : Print the duration of complete diagrams processing.
-h[help] : Will give you the full list. Note that some of them wont work because off headless.

And you can add:
--draw-on-add to draw all watched on launch
--recursive include subfolders

Advanced usage example
$ docker run --rm -ti -v ${PWD}:/ws -w /ws oscarberg/plantuml-watcher -duration -tsvg --draw-on-add --recursive

Important note! In some environments (at least Windows) docker volume mounts and file watching is not a perfect match. So if the file watching does not appear to be working it is possible to enable the file watcher (chokidar) to use polling.

# Windows CMD
$ docker run --rm -ti -v %cd%:/ws -e CHOKIDAR_USEPOLLING=true -w /ws oscarberg/plantuml-watcher

# Windows Powershell
$ docker run --rm -ti -v ${PWD}:/ws -e CHOKIDAR_USEPOLLING=true -w /ws oscarberg/plantuml-watcher
Why not go all the way and make an alias in your shell rc file?
#.zshrc
alias plantuml-watcher='docker run --rm -ti -v ${PWD}:/ws -w /ws oscarberg/plantuml-watcher'

Note the single quote. If you use double quote the PWD substition will happen at the time of the alias declaration.

And now finally..

$ plantuml-watcher
******************************************************************
plantuml-watcher watching for changes in .puml and .plantuml files
plantuml args: []
******************************************************************
watching: /ws/example.puml

Ahh.. serenity

plantuml-watcher's People

Contributors

oversizedhat avatar dukex avatar

Stargazers

Sergio Valverde avatar Marvin Dore Jr avatar  avatar Pylyp Radionov avatar

Watchers

 avatar

Forkers

dukex thisishuey

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.