depvizdoc 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b542d7b3a1009d7a6a6d08b5161e915b3cb1daf24d5c32e897858534d0c58ba
4
- data.tar.gz: b0441bdfa472285acfe7a24ea3f57a6210cf986870941b523f6e47929a7199c9
3
+ metadata.gz: 4dc6ae3ba14a9abc5173d8d00f564528f2e3235b5886b6234174bbef1520fa9a
4
+ data.tar.gz: f38caf309d9ddade65864215a3fd3c5fe2e0ff4636d8f30e4cf1fb830b97d99e
5
5
  SHA512:
6
- metadata.gz: 5597ee2d3f94e0d4c4b51edc335abbe1d4cb183fe265da6c36dd1e0a6e1506154007fffec80adb0f53ade1a3a9c680dfdbc6238ea16eeecf2683b0ae0ec6de27
7
- data.tar.gz: 55aa40e1f3c02638cdb741b32b35d70fc038967253750d8175bd45f23e69226f6565b10af172b64b8f500a2abf99b2d0cc2013dfa7569d0f6ad205b19ef79a22
6
+ metadata.gz: 87e1876d1f6984ab6b362d267ff9b13c1ce815beadd9a919553e6eb635d4d375ae5ffae7f695b6553a04a7f896cda4eaa462fef34d71dfe298514a8d9fcd12fa
7
+ data.tar.gz: 856dcababc08303c4c020481ec02cd30d4a6104486aad3966ba922eb784b38bc1ff48d7b5859c7d3f5a741f486253dac962430ce4001040b8e4e92f6cca0c114
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- 3�%J�뼯R�⪉�+D���[ZA��owh�-�d>���GHR��,+�<c�� ����v�*3�=$`��� :ۈ�m�
2
- � �`.tT|�Yz�����
3
- }J��֬�]6\^c{DNZ eeh )�R�DZ�t�^���uӥ��.jW��
1
+ �O�����E�`U���(&�-�6q,�Y���No��1W�'nk��y���y���l*�%�wsm�h��fE��s�+����+�p�L�=:�j���34��4 �E9Sn+Է�x�{�"`ċ���&��� ���R/Ԭ^��:�J��m����m��L��܃�}�dBܑѬ2HiUDd��O�$Ϳ�2&WI��Q�e�r��N���U+c��w�����8�
2
+ q��(��]3��w�� ���
data/lib/depvizdoc.rb CHANGED
@@ -8,22 +8,44 @@ require 'martile'
8
8
  require 'rdiscount'
9
9
 
10
10
 
11
+ module RegGem
12
+
13
+ def self.register()
14
+ '
15
+ hkey_gems
16
+ doctype
17
+ depvizdoc
18
+ require depvizdoc
19
+ class DepVizDoc
20
+ media_type html
21
+ '
22
+ end
23
+ end
24
+
25
+
11
26
  class DepVizDoc < DepViz
12
27
 
13
28
  def initialize(s='', root: 'platform',
14
29
  style: default_stylesheet(), path: '.', debug: false)
15
30
 
16
- @style, @root, @debug = style, root, debug
31
+ @style, @root, @debug, @path = style, root, debug, path
17
32
  @header = "
18
33
  <?polyrex schema='items[type]/item[label, url]' delimiter =' # '?>
19
34
  type: digraph
20
35
 
21
36
  "
37
+ build(s)
38
+ end
39
+
40
+ def build(s)
41
+
42
+ return if s.empty?
22
43
 
23
- return if s.empty?
44
+ lines = s.lines
45
+ lines.shift if lines.first =~ /^<\?depvizdoc\b/
24
46
 
25
47
  puts 'DepVizDoc::initialize before DependencyBuilder' if @debug
26
- @s = tree = DependencyBuilder.new(s).to_s
48
+ @s = tree = DependencyBuilder.new(lines.join).to_s
27
49
  puts 'master @s: ' + @s.inspect if @debug
28
50
  puts 'DepVizDoc::initialize after DependencyBuilder' if @debug
29
51
 
@@ -33,14 +55,19 @@ type: digraph
33
55
  end.join("\n")
34
56
 
35
57
 
36
- s = root ? (root + "\n" + s2.lines.map {|x| ' ' + x}.join) : s2
58
+ s = @root ? (@root + "\n" + s2.lines.map {|x| ' ' + x}.join) : s2
37
59
 
38
60
  puts 'DepVizDoc::initialize before PxGraphViz' if @debug
39
- @pxg = PxGraphViz.new(@header + s, style: style)
61
+ @pxg = PxGraphViz.new(@header + s, style: @style)
40
62
  puts 'DepVizDoc::initialize after PxGraphViz' if @debug
41
63
 
64
+
65
+
66
+ end
67
+
68
+ def render(path=@path)
42
69
  # generate each HTML file
43
- items = tree.lines.flatten.map {|x| x.chomp.lstrip }.uniq
70
+ items = @s.lines.flatten.map {|x| x.chomp.lstrip }.uniq
44
71
 
45
72
  FileUtils.mkdir_p File.join(path, 'svg')
46
73
 
@@ -74,10 +101,15 @@ type: digraph
74
101
  end
75
102
 
76
103
  html = RDiscount.new(Martile.new(md).to_s).to_html
77
- File.write File.join(name + '.html'), html
104
+ File.write File.join(path, name + '.html'), html
78
105
 
79
- end
80
-
81
- end
106
+ end
107
+
108
+ filepath = File.join(path, 'chart.svg')
109
+ File.write filepath, self.to_svg
82
110
 
111
+ 'saved to ' + filepath
112
+ end
113
+
114
+
83
115
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depvizdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  AsyxqBwDyOo67W9OJZPTaZD/g0i6Ibl1nxiQmadwlpMPiW7PpPOtOAidFz7aRiOO
31
31
  Ifw=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-08-18 00:00:00.000000000 Z
33
+ date: 2018-10-15 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: depviz
@@ -38,20 +38,20 @@ dependencies:
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.3'
41
+ version: '0.4'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.3.2
44
+ version: 0.4.0
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - "~>"
50
50
  - !ruby/object:Gem::Version
51
- version: '0.3'
51
+ version: '0.4'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.3.2
54
+ version: 0.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: martile
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '0.9'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 0.9.1
64
+ version: 0.9.4
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ dependencies:
71
71
  version: '0.9'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 0.9.1
74
+ version: 0.9.4
75
75
  description:
76
76
  email: james@jamesrobertson.eu
77
77
  executables: []
metadata.gz.sig CHANGED
Binary file