0.0
Low commit activity in last 3 years
parse single-tier hierarchy and simplex direction graph from YAML, and generate PlantUML with rectangle and object
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

SimpleHdGraph

parse single-tier hierarchy, simplex direction graph from YAML DSL, render PlantUML.

Installation

Add this line to your application's Gemfile:

gem 'simple-hd-graph'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple-hd-graph

Usage

$ simple-hd-graph -f FILE

or

$ simple-hd-graph -d DIR

Format

SimpleHdGraph was designed primarily to describe systems, its constituent resources, and their dependencies.

The two components are as follows:

  • Context
  • Resource

A single YAML document corresponds to a single context as below:

id: name1
resources:
  resource1:
    note: memo
    has: resource2
  resource2:
    note: very important
depends:
 - name2

features:

  • Context can contain mutiple Resources
  • Resource can use the has keyword to indicate that it owns other Resources
  • Context can use the depends keyword to indicate its dependency on other Contexts

Example

input ( streams )

id: example1
resources:
  web:
    hosting: Heroku
    runtime: Ruby 2.5
    has:
      - admin
      - storage
  admin:
    hosting: Google Spreadsheet
    runtime: Google Apps Script
  storage:
    hosting: AWS S3
    region: ap-north-east1
---
id: example 2
resources:
  web:
    hosting: Google AppEngines
    runtime: Ruby 2.6
depends:
  - example1

output

rectangle "example1" as example1 {
  object "web" as example1Web {
    hosting: Heroku
    runtime: Ruby 2.5
  }
  object "admin" as example1Admin {
    hosting: Google Spreadsheet
    runtime: Google Apps Script
  }
  object "storage" as example1Storage {
    hosting: AWS S3
    region: ap-north-east1
  }

  example1Web -d-|> example1Admin
  example1Web -d-|> example1Storage
}
rectangle "example 2" as example2 {
  object "web" as example2Web {
    hosting: Google AppEngines
    runtime: Ruby 2.6
  }
}
example2 -|> example1

after plantuml converted

example output converted by plantuml

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/wtnabe/simple-hd-graph.