jekyll-structurizr 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/jekyll-structurizr.rb +51 -0
- data/lib/version.rb +3 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 479860f428c10b0d195171f838260f2c4017e1e26dcf0316a3e525e6f6dae6c9
|
4
|
+
data.tar.gz: 7a21eac87f00ae7fc5e2e675bbbf7bc8d75773210d3c9982ed679063ae7d5e29
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c34dda1b78b0b78180899d3636823ae964bb31ea1649cb5402942e04dd16b0caca39c761424ddd24c5d4b766879119d85253cb2e6d3228017a5a99423c147d0a
|
7
|
+
data.tar.gz: a158d460701ee6f1eb6324bd9ce2e2ad86e65bdd375d0eb763e9ef89a84abb5944af64ff68869bb0b2b5f6d9655a3add898f16af1ccabeb5347cbda5a7d2ce09
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'digest'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Jekyll
|
5
|
+
class StructurizrBlock < Liquid::Block
|
6
|
+
def initialize(tag_name, markup, tokens)
|
7
|
+
super
|
8
|
+
@html = (markup or '').strip
|
9
|
+
end
|
10
|
+
|
11
|
+
def render(context)
|
12
|
+
site = context.registers[:site]
|
13
|
+
name = Digest::MD5.hexdigest(super)
|
14
|
+
if !File.exists?(File.join(site.dest, "c4/#{name}.svg"))
|
15
|
+
dsl = File.join(site.source, "c4/#{name}.dsl")
|
16
|
+
uml = File.join(site.source, "c4/#{name}.uml")
|
17
|
+
svg = File.join(site.source, "c4/#{name}.svg")
|
18
|
+
if File.exists?(svg)
|
19
|
+
puts "File #{svg} already exists (#{File.size(svg)} bytes)"
|
20
|
+
else
|
21
|
+
FileUtils.mkdir_p(File.dirname(dsl))
|
22
|
+
File.open(dsl, 'w') { |f|
|
23
|
+
@text = super
|
24
|
+
appendC4Beacon=true
|
25
|
+
if @text.include? "@starstructurizr"
|
26
|
+
appendC4Beacon = false
|
27
|
+
puts "stream already contains starstructurizr beacons"
|
28
|
+
end
|
29
|
+
if appendC4Beacon
|
30
|
+
f.write("@starstructurizr\n")
|
31
|
+
end
|
32
|
+
f.write(super)
|
33
|
+
if appendC4Beacon
|
34
|
+
f.write("\n@endstructurizr")
|
35
|
+
end
|
36
|
+
}
|
37
|
+
system("structurizr export -f plantuml/c4plantuml -o #{uml} -w #{dsl}")
|
38
|
+
puts "File #{uml} created (#{File.size(uml)} bytes)"
|
39
|
+
system("plantuml -tsvg #{uml}")
|
40
|
+
site.static_files << Jekyll::StaticFile.new(
|
41
|
+
site, site.source, 'c4', "#{name}.svg"
|
42
|
+
)
|
43
|
+
puts "File #{svg} created (#{File.size(svg)} bytes)"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
"<div class='plantuml' style='width:fit-content'><object class='plantuml' data='#{site.baseurl}/c4/#{name}.svg' type='image/svg+xml' #{@html}></object></div>"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Liquid::Template.register_tag('Structurizr', Jekyll::StructurizrBlock)
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-structurizr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sebastien Andreo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-03-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description: Generate SVG from Structurizr DSL
|
28
|
+
email: sebastien@andreo.eu
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/jekyll-structurizr.rb
|
34
|
+
- lib/version.rb
|
35
|
+
homepage: https://gitlab.com/SebastienAndreo/jekyll-structurizr
|
36
|
+
licenses:
|
37
|
+
- Nonstandard
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- "--charset=UTF-8"
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.9.3
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubygems_version: 3.0.3
|
56
|
+
signing_key:
|
57
|
+
specification_version: 2
|
58
|
+
summary: Jekyll Structurizr DSL to SVG
|
59
|
+
test_files: []
|