mermaid_html 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ require 'erb'
2
+
3
+ module MermaidHtml
4
+ # Reads main files for mermaidjs
5
+ module MermaidFiles
6
+
7
+ # @return [String] HTML for displaying MermaidJS diagram
8
+ def mermaid_html(schema)
9
+ @schema = schema
10
+ ERB.new(relative_file('mermaid_template.html.erb')).result(binding)
11
+ end
12
+
13
+ # Main css for Mermaidjs
14
+ def mermaid_css
15
+ relative_file 'mermaid.css'
16
+ end
17
+
18
+ # Font css for Mermaidjs
19
+ def mermaid_font
20
+ relative_file 'mermaid-font.css'
21
+ end
22
+
23
+ # Main js for Mermaidjs
24
+ def mermaid_js
25
+ relative_file 'mermaid.js'
26
+ end
27
+
28
+ # Read file relative to current directory
29
+ def relative_file(file)
30
+ File.read(File.join(File.dirname(__FILE__), file))
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <link rel="stylesheet" href="<%= "#{MermaidHtml.css_folder}/mermaid.css" %>">
6
+ <link rel="stylesheet" href="<%= "#{MermaidHtml.css_folder}/mermaid-font.css" %>">
7
+ </head>
8
+ <body>
9
+ <div class="mermaid">
10
+ <%= @schema %>
11
+ </div>
12
+ <script src="<%= "#{MermaidHtml.js_folder}/mermaid.js" %>"></script>
13
+ <script>mermaid.initialize({startOnLoad:true});</script>
14
+ </body>
15
+ </html>
@@ -0,0 +1,3 @@
1
+ module MermaidHtml
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,31 @@
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mermaid_html/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'mermaid_html'
8
+ spec.version = MermaidHtml::VERSION
9
+ spec.authors = ['Samuel Garratt']
10
+ spec.email = ['samuel.garratt@integrationqa.com']
11
+
12
+ spec.summary = %q{Helps to convert a Mermaid script into a html page showing the diagram}
13
+ spec.description = %q{Helps to convert a Mermaid script into a html page showing the diagram.}
14
+ spec.homepage = 'https://gitlab.com/samuel-garratt/mermaid_html'
15
+ spec.license = 'MIT'
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features)/}) }
21
+ end
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_dependency 'thor'
27
+ spec.add_development_dependency 'bundler', '~> 1.16'
28
+ spec.add_development_dependency 'page-object'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mermaid_html
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Garratt
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-09-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: page-object
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: Helps to convert a Mermaid script into a html page showing the diagram.
84
+ email:
85
+ - samuel.garratt@integrationqa.com
86
+ executables:
87
+ - mermaid_html
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".idea/markdown-navigator/profiles_settings.xml"
93
+ - ".idea/misc.xml"
94
+ - ".idea/modules.xml"
95
+ - ".rspec"
96
+ - CODE_OF_CONDUCT.md
97
+ - Gemfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - bin/console
102
+ - bin/setup
103
+ - exe/mermaid_html
104
+ - lib/mermaid_html.rb
105
+ - lib/mermaid_html/mermaid-font.css
106
+ - lib/mermaid_html/mermaid-theme.js
107
+ - lib/mermaid_html/mermaid.css
108
+ - lib/mermaid_html/mermaid.js
109
+ - lib/mermaid_html/mermaid_files.rb
110
+ - lib/mermaid_html/mermaid_template.html.erb
111
+ - lib/mermaid_html/version.rb
112
+ - mermaid_html.gemspec
113
+ homepage: https://gitlab.com/samuel-garratt/mermaid_html
114
+ licenses:
115
+ - MIT
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 2.6.14
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: Helps to convert a Mermaid script into a html page showing the diagram
137
+ test_files: []