flowchartviz 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cb9397f9af13f07389276b0ec5434324cccf353b
4
+ data.tar.gz: 20c4225d5a45ccb48bd80050ea785567b221d220
5
+ SHA512:
6
+ metadata.gz: 72a6298b2fda14146c61335f4f4cb91ca91de4e6f08e5ffe6d8d4e2eafdd9d38dbb0be51b16c89911122789a8373a9650a46d4eb9500c44a3cae2ad6852787c3
7
+ data.tar.gz: b9d067da73ac7f69fb6996f4d330ee820fe1a0939a8f4e36f85dd97259780f20f95d50a547c01ab0890353dde507945f9bf661a21a344d2b809042b7c375f691
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: flowchartviz.rb
4
+
5
+ require 'line-tree'
6
+ require 'pxgraphviz'
7
+
8
+
9
+
10
+ class Flowchartviz
11
+
12
+ def initialize(s)
13
+
14
+ plaintext = scan(LineTree.new(s).to_a).flatten.compact.join("\n")
15
+
16
+ raw_px=<<EOF
17
+ <?polyrex schema='items[direction]/item[label, connection, shape]' delimiter =' # '?>
18
+ direction: TB
19
+
20
+ EOF
21
+
22
+ @pxg = PxGraphViz.new(raw_px + plaintext)
23
+
24
+ end
25
+
26
+ def export(file='gvml.xml')
27
+ File.write file, @pxg.to_doc.xml(pretty: true)
28
+ end
29
+
30
+ alias export_as export
31
+
32
+ private
33
+
34
+ def scan(a, i=0, b=true)
35
+
36
+ k = 0
37
+
38
+ a.map.with_index do |x,j|
39
+
40
+ case x[0]
41
+ when /^if */
42
+ k+=1
43
+ b = true
44
+ x[0].gsub!(/(?:^if | then$)/,'') << ' # # diamond'
45
+ when /^else */
46
+ x[0] = nil
47
+ k -= 1
48
+ b = false
49
+ when /^end */
50
+ x[0] = nil
51
+ else
52
+ k = 1
53
+ x[0] << ' # ' + (b ? :yes : :no).to_s
54
+ end
55
+
56
+ scan x[1..-1],j+k, b if x.length > 1
57
+ x[0].prepend ' ' * (j + i) if x[0]
58
+ x
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+
65
+
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �`Mh���~u����A��ƲжuX�c�̷�����\���El%s�d��b�(.��'�,d��S�фZzW�>+��&�M�3�KԺ%�ьi\)死9zc���y��ze�r\B�� �?�X���{���� ���t�J$^Sg#�C�w�꼚kv�;v� �>u\���n<-D�,�˄V�g�+R�Ѧ 6��;�.���X�:w�䁍�r����M�H �������iv9���;�����D`ݒ�@�:�H�
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flowchartviz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MDkwMjIxMjk1MFoXDTE4MDkwMjIxMjk1MFowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAL4oVqdQCrOyXOzeJMDU/bCkOyZ8b39hnuQiF1aBEExMWLo4W0qMhBK4jB/0
19
+ gWlIvH4C2a4BxSiBCMlBEvCYsL+lAxV+9hh4ZqRznMSdeSSmz4PvKlC06qZroNtE
20
+ GRsqZR3cp/dW3loVZ4q3BVolE9nanVmxVgk/xLwd7ggbF0MCu6zR6fVyFRTFJiio
21
+ vBxO0+Wv+7Wxw0jp6I6Ne/ilf2f3r5f0GpOj/b99HruW/Tyh3ZvHak+VnUauVSDR
22
+ e5FAzODyhtlRbyvhu7Y2z9Q/5XOPY0uDj9EyL0q8eHrKejwp1ZaKkuJxv76XUT3c
23
+ tKfo7gX1iFulMfe97gcSLSgDoz8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQU84aOYhzldv+YbqqIU0S8XA4aRUswJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEArduzMWZt
27
+ 863X8DK5Wi2hsfwgQ+NO06QLdEIl+MYKnjS9W2ryZGYiLaaLYpKhvsSivasUNQSr
28
+ qrYnRtEiTXbMxWWaeawgRAtCpFjBudLuXRFsWatYzjzLwSx+iF/UaUJQOcWHOcEk
29
+ qGpcwa59849H7EU9WASEWtT0+pMJrMElByFVjIF3zJ5RKyBKXmEj8xUINcRujhrw
30
+ u2WjjF+imHCH83CH+FHcdHbubYNEgYyKDMCpDkF4kaRUFW1RasWTynDrVAVXxm0F
31
+ wBUpSB7cxnDj6hDWvWlX0qE+oJx9HIakTQlCefvxztlVFiWw0rX1bMMem9SXi5V2
32
+ x2zAnr43tx3chA==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-09-02 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: line-tree
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.5'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.5.8
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.5'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.5.8
56
+ - !ruby/object:Gem::Dependency
57
+ name: pxgraphviz
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.2'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.2.1
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.2'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.2.1
76
+ description:
77
+ email: james@jamesrobertson.eu
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/flowchartviz.rb
83
+ homepage: https://github.com/jrobertson/flowchartviz
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.6.8
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Creates a Polyrex Graphviz XML file from pseudocode of 1 or more nested if
107
+ statements
108
+ test_files: []
metadata.gz.sig ADDED
Binary file