jekyll-plantuml 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7d735ef236cc747fdc15aca38e4da489eed9ecf7
4
+ data.tar.gz: f39a9fa9aac066dcb7164e8760b662cd72188040
5
+ SHA512:
6
+ metadata.gz: 9946f59ec4c359967c7397c77c6c4213666f3b30b9c7a6ab9a38d2a33f1b955082ad23541b5f85d69f827b9c873a3d6ec9d8269a7f1f9e396e89a48bf7cb132f
7
+ data.tar.gz: e9fa55e2ef892af34233f649d5b045469401d08297f8b035adf01b2b27691968e0b442124b43f5c6bae42efc26bf3aaf037fb73540483b173ffe0e9e0155b5ed
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ Gemfile.lock
2
+ *.gem
3
+ .bundle/
4
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2014 Yegor Bugayenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the 'Software'), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ Install it first:
2
+
3
+ ```
4
+ gem install jekyll-plantuml
5
+ ```
6
+
7
+ With Jekyll 2, simply add the gem to your `_config.yml` gems list:
8
+
9
+ ```yaml
10
+ gems: ['jekyll-plantuml', ... your other plugins]
11
+ ```
12
+
13
+ Or for previous versions,
14
+ create a plugin file within your Jekyll project's `_plugins` directory:
15
+
16
+ ```ruby
17
+ # _plugins/plantuml-plugin.rb
18
+ require "jekyll-plantuml"
19
+ ```
20
+
21
+ Highly recommend to use Bundler. If you're using it, add this line
22
+ to your `Gemfile`:
23
+
24
+ ```
25
+ gem "jekyll-plantuml"
26
+ ```
27
+
28
+ Then, make sure [PlantUML](http://plantuml.sourceforge.net/download.html)
29
+ is installed on your build machine, and can
30
+ be executed with a simple `plantuml` command.
31
+
32
+ Now, it's time to create a diagram, in your Jekyll blog page:
33
+
34
+ ```
35
+ {% plantuml %}
36
+ [First] - [Second]
37
+ {% endplantuml %}
38
+ ```
39
+
40
+ Check [this blog post](http://www.yegor256.com/2014/06/01/aop-aspectj-java-method-logging.html).
41
+ UML sequence diagram in this page is generated with this plugin.
42
+ Blog sources are available in [Github](https://github.com/yegor256/blog).
43
+
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ Gem::Specification.new do |s|
3
+ s.specification_version = 2 if s.respond_to? :specification_version=
4
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
5
+ s.rubygems_version = '2.2.2'
6
+ s.required_ruby_version = '>= 1.9.3'
7
+ s.name = 'jekyll-plantuml'
8
+ s.version = '1.0'
9
+ s.license = 'MIT'
10
+ s.summary = "Jekyll PlantUML Automation"
11
+ s.description = "PlantUML diagrams in Jekyll pages"
12
+ s.authors = ["Yegor Bugayenko"]
13
+ s.email = 'yegor@tpc2.com'
14
+ s.homepage = 'http://github.com/yegor256/jekyll-plantuml'
15
+ s.files = `git ls-files`.split($/)
16
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+ s.rdoc_options = ["--charset=UTF-8"]
19
+ s.extra_rdoc_files = %w[README.md LICENSE.txt]
20
+ s.add_runtime_dependency('jekyll', '1.5.1')
21
+ end
data/lib/plantuml.rb ADDED
@@ -0,0 +1,53 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2014 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require 'digest'
24
+ require 'fileutils'
25
+
26
+ module Jekyll
27
+ class PlantumlBlock < Liquid::Block
28
+ def initialize(tag_name, markup, tokens)
29
+ super
30
+ end
31
+
32
+ def render(context)
33
+ site = context.registers[:site]
34
+ name = Digest::MD5.hexdigest(super)
35
+ if !File.exists?(File.join(site.dest, "uml/#{name}.svg"))
36
+ uml = File.join(site.source, "uml/#{name}.uml")
37
+ FileUtils.mkdir_p(File.dirname(uml))
38
+ File.open(uml, 'w') { |f|
39
+ f.write("@startuml\n")
40
+ f.write(super)
41
+ f.write("\n@enduml")
42
+ }
43
+ system("plantuml -tsvg #{uml}")
44
+ site.static_files << Jekyll::StaticFile.new(
45
+ site, site.source, 'uml', "#{name}.svg"
46
+ )
47
+ end
48
+ "<p><img src='/uml/#{name}.svg' alt='UML' style='width:100%;'/></p>"
49
+ end
50
+ end
51
+ end
52
+
53
+ Liquid::Template.register_tag('plantuml', Jekyll::PlantumlBlock)
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-plantuml
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Yegor Bugayenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-24 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: 1.5.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.1
27
+ description: PlantUML diagrams in Jekyll pages
28
+ email: yegor@tpc2.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files:
32
+ - README.md
33
+ - LICENSE.txt
34
+ files:
35
+ - .gitignore
36
+ - Gemfile
37
+ - LICENSE.txt
38
+ - README.md
39
+ - jekyll-plantuml.gemspec
40
+ - lib/plantuml.rb
41
+ homepage: http://github.com/yegor256/jekyll-plantuml
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options:
47
+ - --charset=UTF-8
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.9.3
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.0.14
63
+ signing_key:
64
+ specification_version: 2
65
+ summary: Jekyll PlantUML Automation
66
+ test_files: []