7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby | Gviz で GitLab / GitLab CI / Kandan / Hubot の構成図を作成する

Posted at

Ruby | Gviz で GitLab / GitLab CI / Kandan / Hubot の構成図を作成する

概要

Gviz で GitLab / GitLab CI/ Kandan / Hubot の構成図を作成します。

コード

require "gviz"

Graph do
  nodes fontname:'MS UI GOTHIC', fontsize:20
  user_nodes = {shape: :none, fontsize:10, label: ''}
  server_nodes = {width: 3, height: 2, shape: :none, fontsize:10, label: ''}
  edges fontsize: 20

  node :User1, {image: "./actor.jpg"}.merge(user_nodes)
  node :User2, {image: "./actor.jpg"}.merge(user_nodes)
  node :Kandan, {image: "./kandan.png"}.merge(server_nodes)
  node :Hubot, {image: "./hubot.jpg"}.merge(server_nodes)
  node :GitLab, {image: "./gitlab.png"}.merge(server_nodes)
  node :GitLabCI, server_nodes.merge({image: "./gitlab_ci.png", width: 3, height: 1})
  node :GitLabCIRunner, server_nodes.merge({label: 'GitLab CI Runner', width: 3, height: 1, shape: :box3d, fontsize: 30 })

  edge :"User1_Kandan", {label: <<-EOS
Send chat message to User1
Ex: User1 @User2 hello
  EOS
  }

  edge :"User2_Kandan", {label: <<-EOS
Send chat message to Hubot
Ex: @hubot PING
  EOS
  }

  edge :"Kandan_Hubot", {label: 'Send message to Hubot'}
  edge :"Kandan_User1", {label: <<-EOS
Send chat message
Ex: GitLab push!
Ex: GitLab CI build success!
  EOS
  }

  edge :"Kandan_User2", {label: <<-EOS
Send chat message
Ex: User1 @User2 hello
Ex: PONG
Ex: GitLab push!
Ex: GitLab CI build success!
  EOS
  }

  edge :"Hubot_Kandan", {len: 3, label: <<-EOS
* Send chat message from Hubot.
  Ex: PONG
* Send chat message from GitLab.
  Ex: GitLab push!
* Send chat message from GitLab CI.
  Ex: GitLab CI build success!
  EOS
  }

  edge :"User1_GitLab", {label: 'GilLab push' }
  edge :"GitLab_Hubot", {label: <<-EOS
Send pull-event-json 
to Hubot by WebHooks
  EOS
  }
  edge :"GitLab_GitLabCI", {label: 'Call GitLab CI Server'}
  edge :"GitLabCI_GitLab", {label: 'Send CI result'}
  edge :"GitLabCI_Hubot", {label: <<-EOS
Send ci-result-json 
to Hubot by WebHooks2
  EOS
  }
  edge :"GitLabCI_GitLabCIRunner", {label: 'Call GitLab CI Runner'}
  edge :"GitLabCIRunner_GitLabCI", {label: 'Send CI Run result'}
  edge :"User1_User2", {label: 'I love you'}
  edge :"User2_User1", {label: 'I hate you'}

  rank :min, [:User1, :User2]
  rank :same, [:GitLab, :Kandan]
  rank :max, [:Hubot, :GitLabCI]

  save :"gitlab_hubot_kandan", :png
end

出力

gitlab_hubot_kandan.png

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?