archimate 1.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.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.projectile +18 -0
  4. data/.rubocop.yml +13 -0
  5. data/.travis.yml +4 -0
  6. data/.yardocs +15 -0
  7. data/Gemfile +5 -0
  8. data/Guardfile +27 -0
  9. data/LICENSE +201 -0
  10. data/README.md +94 -0
  11. data/Rakefile +29 -0
  12. data/TODOs.org +286 -0
  13. data/archimate.gemspec +51 -0
  14. data/bin/archimate +17 -0
  15. data/bin/console +13 -0
  16. data/bin/setup +8 -0
  17. data/exe/archidiff +7 -0
  18. data/exe/archidiff-summary +7 -0
  19. data/exe/archimate +7 -0
  20. data/exe/archimerge +7 -0
  21. data/exe/fmtxml +7 -0
  22. data/lib/archimate/cli/archi.rb +189 -0
  23. data/lib/archimate/cli/cleanup.rb +54 -0
  24. data/lib/archimate/cli/conflict_resolver.rb +39 -0
  25. data/lib/archimate/cli/convert.rb +39 -0
  26. data/lib/archimate/cli/diff.rb +31 -0
  27. data/lib/archimate/cli/diff_summary.rb +101 -0
  28. data/lib/archimate/cli/duper.rb +85 -0
  29. data/lib/archimate/cli/lint.rb +16 -0
  30. data/lib/archimate/cli/mapper.rb +82 -0
  31. data/lib/archimate/cli/merge.rb +49 -0
  32. data/lib/archimate/cli/merger.rb +109 -0
  33. data/lib/archimate/cli/stats.rb +42 -0
  34. data/lib/archimate/cli/svger.rb +40 -0
  35. data/lib/archimate/color.rb +53 -0
  36. data/lib/archimate/config.rb +35 -0
  37. data/lib/archimate/data_model/any_attribute.rb +13 -0
  38. data/lib/archimate/data_model/any_element.rb +15 -0
  39. data/lib/archimate/data_model/archimate_node.rb +181 -0
  40. data/lib/archimate/data_model/bounds.rb +72 -0
  41. data/lib/archimate/data_model/color.rb +47 -0
  42. data/lib/archimate/data_model/concept.rb +14 -0
  43. data/lib/archimate/data_model/concern.rb +17 -0
  44. data/lib/archimate/data_model/connection.rb +107 -0
  45. data/lib/archimate/data_model/constants.rb +82 -0
  46. data/lib/archimate/data_model/container.rb +17 -0
  47. data/lib/archimate/data_model/diagram.rb +40 -0
  48. data/lib/archimate/data_model/diffable_array.rb +213 -0
  49. data/lib/archimate/data_model/diffable_primitive.rb +83 -0
  50. data/lib/archimate/data_model/documentation.rb +14 -0
  51. data/lib/archimate/data_model/element.rb +87 -0
  52. data/lib/archimate/data_model/font.rb +54 -0
  53. data/lib/archimate/data_model/label.rb +19 -0
  54. data/lib/archimate/data_model/lang_string.rb +41 -0
  55. data/lib/archimate/data_model/location.rb +31 -0
  56. data/lib/archimate/data_model/metadata.rb +14 -0
  57. data/lib/archimate/data_model/model.rb +217 -0
  58. data/lib/archimate/data_model/modeling_note.rb +13 -0
  59. data/lib/archimate/data_model/named_referenceable.rb +14 -0
  60. data/lib/archimate/data_model/organization.rb +40 -0
  61. data/lib/archimate/data_model/property.rb +25 -0
  62. data/lib/archimate/data_model/property_definition.rb +16 -0
  63. data/lib/archimate/data_model/referenceable.rb +29 -0
  64. data/lib/archimate/data_model/relationship.rb +85 -0
  65. data/lib/archimate/data_model/schema_info.rb +18 -0
  66. data/lib/archimate/data_model/style.rb +32 -0
  67. data/lib/archimate/data_model/view.rb +12 -0
  68. data/lib/archimate/data_model/view_concept.rb +18 -0
  69. data/lib/archimate/data_model/view_node.rb +114 -0
  70. data/lib/archimate/data_model/viewpoint.rb +87 -0
  71. data/lib/archimate/data_model.rb +54 -0
  72. data/lib/archimate/diff/archimate_array_reference.rb +113 -0
  73. data/lib/archimate/diff/archimate_identified_node_reference.rb +41 -0
  74. data/lib/archimate/diff/archimate_node_attribute_reference.rb +70 -0
  75. data/lib/archimate/diff/archimate_node_reference.rb +80 -0
  76. data/lib/archimate/diff/change.rb +49 -0
  77. data/lib/archimate/diff/conflict.rb +31 -0
  78. data/lib/archimate/diff/conflicts/base_conflict.rb +53 -0
  79. data/lib/archimate/diff/conflicts/deleted_items_child_updated_conflict.rb +30 -0
  80. data/lib/archimate/diff/conflicts/deleted_items_referenced_conflict.rb +63 -0
  81. data/lib/archimate/diff/conflicts/path_conflict.rb +51 -0
  82. data/lib/archimate/diff/conflicts.rb +89 -0
  83. data/lib/archimate/diff/delete.rb +41 -0
  84. data/lib/archimate/diff/difference.rb +113 -0
  85. data/lib/archimate/diff/insert.rb +43 -0
  86. data/lib/archimate/diff/merge.rb +70 -0
  87. data/lib/archimate/diff/move.rb +51 -0
  88. data/lib/archimate/diff.rb +17 -0
  89. data/lib/archimate/export/csv_export.rb +32 -0
  90. data/lib/archimate/export/cypher.rb +171 -0
  91. data/lib/archimate/export/graph_ml.rb +131 -0
  92. data/lib/archimate/export/n_quads.rb +142 -0
  93. data/lib/archimate/file_format.rb +30 -0
  94. data/lib/archimate/file_formats/archi_file_format.rb +151 -0
  95. data/lib/archimate/file_formats/archi_file_reader.rb +252 -0
  96. data/lib/archimate/file_formats/archi_file_writer.rb +230 -0
  97. data/lib/archimate/file_formats/archimate_v2.rb +461 -0
  98. data/lib/archimate/file_formats/model_exchange_file/xml_lang_string.rb +35 -0
  99. data/lib/archimate/file_formats/model_exchange_file/xml_metadata.rb +115 -0
  100. data/lib/archimate/file_formats/model_exchange_file/xml_property_definitions.rb +28 -0
  101. data/lib/archimate/file_formats/model_exchange_file/xml_property_defs.rb +27 -0
  102. data/lib/archimate/file_formats/model_exchange_file_reader.rb +237 -0
  103. data/lib/archimate/file_formats/model_exchange_file_reader_21.rb +73 -0
  104. data/lib/archimate/file_formats/model_exchange_file_reader_30.rb +134 -0
  105. data/lib/archimate/file_formats/model_exchange_file_writer.rb +157 -0
  106. data/lib/archimate/file_formats/model_exchange_file_writer_21.rb +143 -0
  107. data/lib/archimate/file_formats/model_exchange_file_writer_30.rb +153 -0
  108. data/lib/archimate/file_formats/writer.rb +56 -0
  109. data/lib/archimate/lint/duplicate_entities.rb +121 -0
  110. data/lib/archimate/lint/linter.rb +146 -0
  111. data/lib/archimate/logging.rb +55 -0
  112. data/lib/archimate/maybe_io.rb +34 -0
  113. data/lib/archimate/progress_indicator.rb +29 -0
  114. data/lib/archimate/svg/archimate.css +232 -0
  115. data/lib/archimate/svg/child.rb +29 -0
  116. data/lib/archimate/svg/connection.rb +184 -0
  117. data/lib/archimate/svg/css_style.rb +31 -0
  118. data/lib/archimate/svg/diagram.rb +87 -0
  119. data/lib/archimate/svg/entity/and_junction.rb +14 -0
  120. data/lib/archimate/svg/entity/application_collaboration.rb +14 -0
  121. data/lib/archimate/svg/entity/application_component.rb +41 -0
  122. data/lib/archimate/svg/entity/application_event.rb +13 -0
  123. data/lib/archimate/svg/entity/application_function.rb +13 -0
  124. data/lib/archimate/svg/entity/application_interaction.rb +13 -0
  125. data/lib/archimate/svg/entity/application_interface.rb +13 -0
  126. data/lib/archimate/svg/entity/application_process.rb +13 -0
  127. data/lib/archimate/svg/entity/application_service.rb +13 -0
  128. data/lib/archimate/svg/entity/artifact.rb +39 -0
  129. data/lib/archimate/svg/entity/assessment.rb +14 -0
  130. data/lib/archimate/svg/entity/base_entity.rb +128 -0
  131. data/lib/archimate/svg/entity/business_actor.rb +14 -0
  132. data/lib/archimate/svg/entity/business_collaboration.rb +14 -0
  133. data/lib/archimate/svg/entity/business_event.rb +10 -0
  134. data/lib/archimate/svg/entity/business_function.rb +13 -0
  135. data/lib/archimate/svg/entity/business_interaction.rb +13 -0
  136. data/lib/archimate/svg/entity/business_interface.rb +13 -0
  137. data/lib/archimate/svg/entity/business_object.rb +13 -0
  138. data/lib/archimate/svg/entity/business_process.rb +13 -0
  139. data/lib/archimate/svg/entity/business_role.rb +14 -0
  140. data/lib/archimate/svg/entity/business_service.rb +13 -0
  141. data/lib/archimate/svg/entity/capability.rb +14 -0
  142. data/lib/archimate/svg/entity/communication_network.rb +14 -0
  143. data/lib/archimate/svg/entity/communication_path.rb +14 -0
  144. data/lib/archimate/svg/entity/constraint.rb +15 -0
  145. data/lib/archimate/svg/entity/contract.rb +13 -0
  146. data/lib/archimate/svg/entity/course_of_action.rb +14 -0
  147. data/lib/archimate/svg/entity/data_entity.rb +29 -0
  148. data/lib/archimate/svg/entity/data_object.rb +13 -0
  149. data/lib/archimate/svg/entity/deliverable.rb +13 -0
  150. data/lib/archimate/svg/entity/device.rb +48 -0
  151. data/lib/archimate/svg/entity/diagram_model_reference.rb +22 -0
  152. data/lib/archimate/svg/entity/diagram_object.rb +30 -0
  153. data/lib/archimate/svg/entity/distribution_network.rb +14 -0
  154. data/lib/archimate/svg/entity/driver.rb +14 -0
  155. data/lib/archimate/svg/entity/equipment.rb +16 -0
  156. data/lib/archimate/svg/entity/event_entity.rb +36 -0
  157. data/lib/archimate/svg/entity/facility.rb +16 -0
  158. data/lib/archimate/svg/entity/function_entity.rb +14 -0
  159. data/lib/archimate/svg/entity/gap.rb +21 -0
  160. data/lib/archimate/svg/entity/goal.rb +14 -0
  161. data/lib/archimate/svg/entity/group.rb +24 -0
  162. data/lib/archimate/svg/entity/implementation_event.rb +13 -0
  163. data/lib/archimate/svg/entity/infrastructure_function.rb +13 -0
  164. data/lib/archimate/svg/entity/infrastructure_interface.rb +13 -0
  165. data/lib/archimate/svg/entity/infrastructure_service.rb +13 -0
  166. data/lib/archimate/svg/entity/interaction_entity.rb +14 -0
  167. data/lib/archimate/svg/entity/interface_entity.rb +35 -0
  168. data/lib/archimate/svg/entity/junction.rb +19 -0
  169. data/lib/archimate/svg/entity/location.rb +14 -0
  170. data/lib/archimate/svg/entity/material.rb +14 -0
  171. data/lib/archimate/svg/entity/meaning.rb +40 -0
  172. data/lib/archimate/svg/entity/motivation_entity.rb +40 -0
  173. data/lib/archimate/svg/entity/network.rb +14 -0
  174. data/lib/archimate/svg/entity/node.rb +33 -0
  175. data/lib/archimate/svg/entity/node_shape.rb +64 -0
  176. data/lib/archimate/svg/entity/note.rb +30 -0
  177. data/lib/archimate/svg/entity/or_junction.rb +14 -0
  178. data/lib/archimate/svg/entity/outcome.rb +15 -0
  179. data/lib/archimate/svg/entity/path.rb +14 -0
  180. data/lib/archimate/svg/entity/plateau.rb +15 -0
  181. data/lib/archimate/svg/entity/principle.rb +15 -0
  182. data/lib/archimate/svg/entity/process_entity.rb +63 -0
  183. data/lib/archimate/svg/entity/product.rb +20 -0
  184. data/lib/archimate/svg/entity/rect.rb +13 -0
  185. data/lib/archimate/svg/entity/rect_entity.rb +25 -0
  186. data/lib/archimate/svg/entity/representation.rb +31 -0
  187. data/lib/archimate/svg/entity/requirement.rb +15 -0
  188. data/lib/archimate/svg/entity/resource.rb +14 -0
  189. data/lib/archimate/svg/entity/rounded_rect_entity.rb +23 -0
  190. data/lib/archimate/svg/entity/service_entity.rb +51 -0
  191. data/lib/archimate/svg/entity/sketch_model_sticky.rb +14 -0
  192. data/lib/archimate/svg/entity/stakeholder.rb +15 -0
  193. data/lib/archimate/svg/entity/system_software.rb +14 -0
  194. data/lib/archimate/svg/entity/technology_collaboration.rb +14 -0
  195. data/lib/archimate/svg/entity/technology_event.rb +13 -0
  196. data/lib/archimate/svg/entity/technology_function.rb +13 -0
  197. data/lib/archimate/svg/entity/technology_interaction.rb +13 -0
  198. data/lib/archimate/svg/entity/technology_interface.rb +13 -0
  199. data/lib/archimate/svg/entity/technology_process.rb +13 -0
  200. data/lib/archimate/svg/entity/technology_service.rb +13 -0
  201. data/lib/archimate/svg/entity/value.rb +27 -0
  202. data/lib/archimate/svg/entity/work_package.rb +14 -0
  203. data/lib/archimate/svg/entity.rb +93 -0
  204. data/lib/archimate/svg/entity_factory.rb +17 -0
  205. data/lib/archimate/svg/extents.rb +27 -0
  206. data/lib/archimate/svg/point.rb +7 -0
  207. data/lib/archimate/svg/svg_template.rb +27 -0
  208. data/lib/archimate/svg/svg_template.svg.erb +169 -0
  209. data/lib/archimate/version.rb +4 -0
  210. data/lib/archimate.rb +114 -0
  211. metadata +623 -0
data/TODOs.org ADDED
@@ -0,0 +1,286 @@
1
+ * ArchiMate Tools TODO
2
+
3
+ ** SVG Rendering
4
+
5
+ *** DONE skip bendpoints inside source or target
6
+ CLOSED: [2017-02-01 Wed 12:41]
7
+ *** DONE badges for device, node, service (cosmetic)
8
+ CLOSED: [2017-02-01 Wed 12:41]
9
+ *** DONE trim space around diagram names (cosmetic)
10
+ CLOSED: [2017-02-01 Wed 12:42]
11
+ *** DONE badge position updates (cosmetic, legibility)
12
+ CLOSED: [2017-02-01 Wed 12:42]
13
+ *** DONE badge updates (cosmetic)
14
+ CLOSED: [2017-02-01 Wed 12:42]
15
+ *** DONE verify junctions
16
+ CLOSED: [2017-02-01 Wed 12:42]
17
+ *** DONE alternate figures (curved vs box & badge) selected by type="1" on Child (legibility)
18
+ CLOSED: [2017-02-01 Wed 12:42]
19
+ *** DONE text bounds in entities (cosmetic, legibility)
20
+ CLOSED: [2017-02-01 Wed 12:42]
21
+ *** DONE badge spacer settings (cosmetic, legibility) - artifact needs work.
22
+ CLOSED: [2017-02-01 Wed 12:42]
23
+ *** TODO text on lines (cosmetic, legibility)
24
+ *** TODO bendpoint curves (cosmetic)
25
+ *** TODO line crossing hops (cosmetic)
26
+ *** DONE refactor
27
+ CLOSED: [2017-02-01 Wed 12:42]
28
+
29
+ ** Performance
30
+
31
+ *** TODO Look into using Celluloid and/or jruby to improve performance
32
+ Thinking about concurrency for performance improvements
33
+
34
+ read base
35
+ read local
36
+ read remote
37
+
38
+ base + local -> diff l
39
+ base + remote -> diff b
40
+
41
+ diff l + diff b -> conflict detection
42
+
43
+ cd -> each conflict type
44
+
45
+ conflicts -> conflict resolution
46
+
47
+ cr (user response)
48
+
49
+ serialize result (single)
50
+
51
+
52
+ ** Diff/Merge
53
+
54
+ *** Conflicts can happen on the same diff 2x. How to handle this?
55
+ *** DONE In `Change.to_s` - deref args that point to other elements (like archimate_element)
56
+ CLOSED: [2017-02-01 Wed 12:48]
57
+ *** In Diagram children diffs - make to_s reference the parent diagram
58
+ *** DONE Array diffs on non-id'd diffable elements should detect changes rather than delete/insert
59
+ CLOSED: [2017-02-01 Wed 12:48]
60
+ *** Archi file could have ids that conflict (i.e. 2 relationships with same id - this is bad!!! Was it a bad merge or something worse)
61
+ *** Implement check for de-duplicated merges
62
+ *** DONE Add a summary diff - elements added/changed/deleted, diagrams
63
+ CLOSED: [2017-02-01 Wed 12:48]
64
+
65
+ ** Lint
66
+
67
+ *** DONE Basic Lint features (matching Archi)
68
+ CLOSED: [2017-02-01 Wed 12:49]
69
+ *** TODO Scorecard lint
70
+
71
+ ** File Formats & Exports
72
+
73
+ *** TODO Convert support for
74
+ **** TODO Rdf
75
+ **** TODO Gremlin
76
+ **** DONE Neo4j CSV
77
+ CLOSED: [2017-02-01 Wed 13:04]
78
+ **** DONE Cypher
79
+ CLOSED: [2017-02-01 Wed 13:04]
80
+ **** DONE N-Quad
81
+ CLOSED: [2017-02-01 Wed 13:04]
82
+ **** DONE GraphML
83
+ CLOSED: [2017-02-01 Wed 13:04]
84
+
85
+ ** DSL
86
+
87
+ *** TODO CLI DSL
88
+ *** TODO DSL for relationships
89
+ # type from to
90
+ "AssociationRelationship", "associated_with", "associated_with"
91
+ "AccessRelationship", "accesses", "accessed_by"
92
+ "UsedByRelationship", "used_by", "uses"
93
+ "RealisationRelationship", "realizes", "realized_by"
94
+ "AssignmentRelationship", ""
95
+ "AggregationRelationship"
96
+ "CompositionRelationship"
97
+ "FlowRelationship"
98
+ "TriggeringRelationship"
99
+ "GroupingRelationship"
100
+ "SpecialisationRelationship"
101
+ "InfluenceRelationship"
102
+
103
+ # attributes that are references to other nodes in the model
104
+
105
+ For any of these inserted or changed...
106
+
107
+ * Property.key (only after PropertyDefs is introduced)
108
+ - Property referenced deleted key
109
+ * Child.target_connections -> Array of Connection ids
110
+ - Connection.id deleted
111
+ * Child.archimate_element -> Element.id
112
+ - Element.id deleted
113
+ * Folder.items -> Array of IdentifiedNode
114
+ - *.id deleted
115
+ * Relationship.source -> Element.id
116
+ - Element.id deleted
117
+ * Relationship.target -> Element.id
118
+ - Element.id deleted
119
+ * Connection.source -> Child.id
120
+ - Child.id deleted
121
+ * Connection.target -> Child.id
122
+ - Child.id deleted
123
+ * Connection.relationship -> Relationship.id
124
+ - Relationship.id deleted
125
+
126
+
127
+ ** Additional Features
128
+
129
+ *** TODO Add Split file feature (extract say a diagram or set of elements)
130
+ *** TODO Merge unrelated files (this is the intent of Merger)
131
+ *** TODO Add a super strict mode to note when reader finds unexpected content
132
+ *** DONE Stats (elements, relationships, diagrams)
133
+ CLOSED: [2017-02-01 Wed 12:45]
134
+ *** TODO Tool to query for dependencies
135
+ *** TODO Tool to assign/validate/enforce metadata
136
+
137
+ ** Code Quality/Refactoring
138
+
139
+ *** TODO Consider breaking this into a number of gems (for example: base lib, diff/merge, other cmdline tools)
140
+ *** TODO Consider making classes for each element and relationship type?
141
+ *** DONE Figure out how to make rmagick optional and/or remove rmagick dependency
142
+ CLOSED: [2017-02-01 Wed 12:45]
143
+ *** TODO Data model items that reference something else by id should have the actual object available - not just the id
144
+ *** DONE Convert all CLIs to use AIO - merge with OutputIO and MaybeIO (maybe)
145
+ CLOSED: [2017-02-01 Wed 12:45]
146
+ *** DONE figure out a better parent mechanism - it's really not fully cooked
147
+ CLOSED: [2017-02-01 Wed 12:45]
148
+ *** DONE remove parent_id from dry::struct objects - then can use class schema instead of comparison attributes
149
+ CLOSED: [2017-02-01 Wed 12:45]
150
+ *** TODO Not handling sketch diagram model in archi
151
+ *** DONE Use one color method - currently using HighLine and Colorize
152
+ CLOSED: [2017-02-01 Wed 12:45]
153
+ *** TODO Refactor merge to pull conflict detection out
154
+ *** DONE Clean up the way that the describe is done on data model
155
+ CLOSED: [2017-02-01 Wed 12:45]
156
+ *** DONE Permit model items to link back to their parent
157
+ CLOSED: [2017-02-01 Wed 12:45]
158
+ *** DONE Should be a master hash index of id to object in Model
159
+ CLOSED: [2017-02-01 Wed 12:45]
160
+ *** DONE Improve description of diffs for conflict display
161
+ CLOSED: [2017-02-01 Wed 12:45]
162
+ *** DONE Eliminate use of Document in favor of Model
163
+ CLOSED: [2017-02-01 Wed 12:45]
164
+ - [X] cli/archi.rb
165
+ - [X] cli/cleanup.rb
166
+ - [X] cli/convert.rb
167
+ - [X] cli/svger.rb
168
+ *** TODO Experiment with Ox, Oga, Sax-Machine for better performance on convert
169
+ *** TODO Map conversion between archi and archimate diagram formats
170
+ *** DONE Write a common clone for dry-struct classes
171
+ CLOSED: [2017-02-01 Wed 12:45]
172
+ *** DONE Make a format agnostic file reader (which delegates to appropriate file type readers)
173
+ CLOSED: [2017-02-01 Wed 12:45]
174
+ *** DONE Decide between ox and nokogiri and eliminate the alternate
175
+ CLOSED: [2017-02-01 Wed 12:45]
176
+ *** DONE See what can be done about performance
177
+ CLOSED: [2017-02-01 Wed 12:46]
178
+ - Reading file 11-12 secs
179
+ - deleted relationships referenced in diagrams is slow
180
+ *** DONE Refactor to better OO design where necessary (see all about names below)
181
+ CLOSED: [2017-02-01 Wed 12:46]
182
+ *** DONE Refactor merge to pull apply diffs out
183
+ CLOSED: [2017-02-01 Wed 12:46]
184
+ *** TODO Refactor Bendpoint to use a point (rather than Archi start/end points).
185
+ *** TODO Refactor DataModel classes to use enumeration classes for appropriate values
186
+ *** TODO Add a test to produce SVG output for the "everything.archimate" file
187
+ *** TODO Add a test to produce a badges diagram
188
+
189
+
190
+ * Refactor of data model for diff/merge purposes
191
+
192
+ ** Validation
193
+ *** Identifiable objects exist one place in model
194
+ ***
195
+ ** Join:
196
+ - Organizable Id (An Organizable is an Identifiable that can be contained in a Folder
197
+ - Folder
198
+ - Position in Folder - index isn't good here ... should that position really be a linked list?
199
+ * Introduce the idea of archimate modules
200
+ - Allow creation of a focused model by including archimate modules - which are self-contained packages of elements and relationships
201
+ - Allow inheritance of a module to permit showing changes to an existing model.
202
+ ** How to implement?
203
+ - Break things down automatically?
204
+ - By Layer?
205
+ - How to Deal with relationships across module boundaries?
206
+ * Need to have model merge capability
207
+ * TODO Refactor to use a Decorator approach using SimpleDelegator
208
+ * TODO Remove Dry-Types dependency
209
+ * TODO Scan git history and inject metadata for concepts created by git author
210
+ * Changes for v3 have borked the model
211
+ ** TODO Push through fixes focusing on the issues from factories to see if that works
212
+ ** TODO Refactor model to eliminate a lot of cruft by removing things like in_model= and populating model with objects instead of ID refs
213
+ ** TODO Refactor model to improve the diffing of arrays and by writing explicit diff decorators rather than domain model magic
214
+ Both of the last two options risk breaking diffing/merging by making and becoming a long slog
215
+
216
+ * TODO In mergetool - show diagrams that reference elements and relationships in diff conflicts
217
+
218
+ * Notes
219
+
220
+ Generic type - not used directly
221
+ ReferenceType <xs:attribute name="ref" type="xs:IDREF
222
+
223
+ ElementRefGroup <xs:attribute name="elementRef" type="xs:IDREF
224
+ RelationshipRefGroup <xs:attribute name="relationshipRef" type="xs:IDREF
225
+ ConceptRefGroup <xs:attribute name="ConceptRef" type="xs:IDREF
226
+ PropertyDefinitionRefGroup <xs:attribute name="propertyDefinitionRef" type="xs:IDREF
227
+ StereotypeRefGroup <xs:attribute name="stereotypeRef" type="xs:IDREF
228
+ PropertyDefinitionRefAttributeGroup <xs:attribute name="propertyDefinitionRef" type="xs:IDREF
229
+
230
+ RelationshipType <xs:attribute name="source" type="xs:IDREF
231
+ RelationshipType <xs:attribute name="target" type="xs:IDREF
232
+
233
+ OrganizationType <xs:attribute name="identifierRef" type="xs:IDREF
234
+
235
+
236
+ RelationshipType.source -> ConceptType?
237
+ RelationshipType.target -> ConceptType?
238
+ ViewType.viewpointRef -> Viewpoint
239
+
240
+ Label.conceptRef -> ConceptType
241
+ Element (Diagram).elementRef -> ElementType
242
+ ConnectionType.source -> ConceptType
243
+ ConnectionType.target -> ConceptType
244
+ Relationship (Diagram).relationshipRef -> RelationshipType
245
+
246
+
247
+ ModelType
248
+ PropertyDefinitionType
249
+ ConceptType > [RelationshipType > Access, Influence], ElementType > RealElementType, RelationshipConnectorType, CompositeType
250
+ ViewType > Diagram
251
+
252
+
253
+ ViewConceptType > [ViewNodeType > Label, Container], [ConnectionType > Line, SourcedConnectionType > Relationship > NestingRelationship]
254
+ Child is a ViewNodeType
255
+
256
+
257
+
258
+ ViewpointType
259
+
260
+ * More Notes
261
+
262
+ background_class -> used by entity_shape
263
+ badge -> entity_badge -> to_svg
264
+ entity_shape
265
+
266
+
267
+ text_bounds (I think this is only set in entity_shape)
268
+ DiagramModelReference assigns the entity from the child.model_element
269
+ badge_bounds in Gap, MotivationEntity, RectEntity, RoundedRectEntity
270
+ text_align in Note
271
+
272
+ some shapes are dependent on child.child_type
273
+
274
+ badge should be controlled by the entity_shape method
275
+ check that badge_bounds is set by shape (I think it is)
276
+
277
+ text_bounds is controlled by entity_shape
278
+
279
+ background_class : string (default: layer_background_class)
280
+ badge : string option
281
+ entity_shape : (child -> element_name_type -> bounds -> Svg.elt wrap)
282
+ effective_entity : (child -> element_name_type)
283
+
284
+ get effective entity
285
+
286
+ that's used to match the rest:
data/archimate.gemspec ADDED
@@ -0,0 +1,51 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'archimate/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "archimate"
9
+ spec.version = Archimate::VERSION
10
+ spec.authors = ["Mark Morga"]
11
+ spec.email = ["markmorga@gmail.com", "mmorga@rackspace.com"]
12
+
13
+ spec.summary = "Archi Tools"
14
+ spec.description = "A collection of tools for working with ArchiMate files from Archi"
15
+ spec.homepage = "http://markmorga.com/archi-tools-rb"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+ spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
22
+ spec.required_ruby_version = '>= 2.3.0'
23
+
24
+ spec.add_runtime_dependency "dry-struct", "~> 0.3.0"
25
+ spec.add_runtime_dependency "nokogiri", "~> 1.6"
26
+ spec.add_runtime_dependency "thor", "~> 0.19"
27
+ spec.add_runtime_dependency "highline", "~> 1.7"
28
+ spec.add_runtime_dependency "ruby-progressbar", "~>1.8.1"
29
+ spec.add_runtime_dependency "parallel", "~> 1.11"
30
+
31
+ spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "rake"
33
+ spec.add_development_dependency "minitest"
34
+ spec.add_development_dependency "minitest-matchers"
35
+ spec.add_development_dependency "minitest-color"
36
+ spec.add_development_dependency "minitest-profile"
37
+ spec.add_development_dependency "pry"
38
+ spec.add_development_dependency "pry-byebug"
39
+ spec.add_development_dependency "guard"
40
+ spec.add_development_dependency "guard-minitest"
41
+ spec.add_development_dependency "guard-bundler"
42
+ spec.add_development_dependency "ruby-prof"
43
+ spec.add_development_dependency "simplecov"
44
+ spec.add_development_dependency "simplecov-json"
45
+ spec.add_development_dependency "kramdown"
46
+ spec.add_development_dependency "yard"
47
+ spec.add_development_dependency "guard-ctags-bundler"
48
+ spec.add_development_dependency "faker"
49
+ spec.add_development_dependency "rsense"
50
+ spec.add_development_dependency "awesome_print"
51
+ end
data/bin/archimate ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'archimate' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("archimate", "archimate")
data/bin/console ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "nokogiri"
6
+ require "archimate"
7
+ require "faker"
8
+ require "awesome_print"
9
+ require_relative "../test/examples/factories"
10
+ include Archimate::Examples::Factories
11
+
12
+ require "pry"
13
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/archidiff ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby -w
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "archimate"
6
+
7
+ Archimate::Cli::Diff.diff(ARGV[0], ARGV[1], Archimate::AIO.new)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby -w
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "archimate"
6
+
7
+ Archimate::Cli::DiffSummary.diff(ARGV[0], ARGV[1])
data/exe/archimate ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "archimate"
6
+
7
+ Archimate::Cli::Archi.start(ARGV)
data/exe/archimerge ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby -w
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "archimate"
6
+
7
+ Archimate::Cli::Merge.merge(ARGV[0], ARGV[1], ARGV[2], ARGV[3])
data/exe/fmtxml ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "archimate"
6
+
7
+ Archimate::Cli::XmlTextconv.new(ARGV[0])
@@ -0,0 +1,189 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Archimate
4
+ module Cli
5
+ require "thor"
6
+
7
+ def self.output_io(output_io, force)
8
+ if output_io.is_a?(String)
9
+ if !force && File.exist?(output_io)
10
+ # TODO: This needs to be handled with more grace
11
+ return nil unless @hl.agree("File #{output_io} exists. Overwrite?")
12
+ end
13
+ output_io = File.open(output_io, "w")
14
+ end
15
+ output_io
16
+ end
17
+
18
+ class Archi < Thor
19
+ desc "stats ARCHIFILE", "Show some statistics about the model"
20
+ option :noninteractive,
21
+ aliases: :n,
22
+ type: :boolean,
23
+ default: false,
24
+ desc: "Don't provide interactive feedback"
25
+ def stats(archifile)
26
+ Config.instance.interactive = !options.fetch("noninteractive", false)
27
+ Archimate::Cli::Stats.new(
28
+ Archimate.read(archifile),
29
+ $stdout
30
+ ).statistics
31
+ end
32
+
33
+ desc "map ARCHIFILE", "Produce a map of diagram links to a diagram"
34
+ option :output,
35
+ aliases: :o,
36
+ desc: "Write output to FILE instead of stdout."
37
+ option :noninteractive,
38
+ aliases: :n,
39
+ type: :boolean,
40
+ default: false,
41
+ desc: "Don't provide interactive feedback"
42
+ def map(archifile)
43
+ Config.instance.interactive = !options.fetch("noninteractive", false)
44
+ Archimate::Cli::Mapper.new(
45
+ Archimate.read(archifile),
46
+ Cli.output_io(options.fetch("output", $stdout), false)
47
+ ).map
48
+ end
49
+
50
+ desc "merge ARCHIFILE1 ARCHIFILE2", "EXPERIMENTAL: Merge two archimate files"
51
+ option :output,
52
+ aliases: :o,
53
+ desc: "Write output to FILE instead of stdout."
54
+ def merge(archifile1, archifile2)
55
+ Archimate::Cli::Merger.new.merge_files(archifile1, archifile2)
56
+ end
57
+
58
+ desc "svg -o OUTPUTDIR ARCHIFILE", "IN DEVELOPMENT: Produce semantically meaningful SVG files from an Archi file"
59
+ option :output,
60
+ aliases: :o,
61
+ required: true,
62
+ desc: "Write output to OUTPUTDIR"
63
+ option :noninteractive,
64
+ aliases: :n,
65
+ type: :boolean,
66
+ default: false,
67
+ desc: "Don't provide interactive feedback"
68
+ def svg(archifile)
69
+ Config.instance.interactive = !options.fetch("noninteractive", false)
70
+ Archimate::Cli::Svger.export_svgs(
71
+ archifile,
72
+ options.fetch("output", Dir.pwd)
73
+ )
74
+ end
75
+
76
+ desc "clean ARCHIFILE", "Clean up unreferenced elements and relations"
77
+ option :output,
78
+ aliases: :o,
79
+ desc: "Write output to FILE instead of replacing ARCHIFILE"
80
+ option :saveremoved,
81
+ aliases: :r,
82
+ desc: "Write removed elements into FILE"
83
+ option :noninteractive,
84
+ aliases: :n,
85
+ type: :boolean,
86
+ default: false,
87
+ desc: "Don't provide interactive feedback"
88
+ def clean(archifile)
89
+ Config.instance.interactive = !options.fetch("noninteractive", false)
90
+ outfile = options.key?(:output) ? options[:output] : archifile
91
+ Archimate::MaybeIO.new(options.fetch(:saveremoved, nil)) do |removed_element_io|
92
+ Archimate::Cli::Cleanup.new(Archimate.read(archifile), outfile, removed_element_io)
93
+ end
94
+ end
95
+
96
+ desc "dupes ARCHIFILE", "List (potential) duplicate elements in Archi file"
97
+ def dupes(archifile)
98
+ Archimate::Cli::Duper.new(
99
+ archimate.read(archifile),
100
+ STDOUT
101
+ ).list
102
+ end
103
+
104
+ desc "dedupe ARCHIFILE", "de-duplicate elements in Archi file"
105
+ option :mergeall,
106
+ aliases: :m,
107
+ type: :boolean,
108
+ default: false,
109
+ desc: "Merges all duplicates without asking"
110
+ option :output,
111
+ aliases: :o,
112
+ desc: "Write output to FILE instead of replacing ARCHIFILE"
113
+ option :force,
114
+ aliases: :f,
115
+ type: :boolean,
116
+ default: false,
117
+ desc: "Force overwriting of existing output file"
118
+ option :noninteractive,
119
+ aliases: :n,
120
+ type: :boolean,
121
+ default: false,
122
+ desc: "Don't provide interactive feedback"
123
+ def dedupe(archifile)
124
+ Config.instance.interactive = !options.fetch("noninteractive", false)
125
+ Archimate::Cli::Duper.new(
126
+ Archimate.read(archifile),
127
+ Cli.output_io(
128
+ options.fetch("output", archifile),
129
+ options[:force]
130
+ ),
131
+ options[:mergeall]
132
+ ).merge
133
+ end
134
+
135
+ desc "convert ARCHIFILE", "Convert the incoming file to the desired type"
136
+ option :to,
137
+ aliases: :t,
138
+ default: Archimate::Cli::Convert::SUPPORTED_FORMATS.first,
139
+ desc: "File type to convert to. Options are: " \
140
+ "'meff2.1' for Open Group Model Exchange File Format for ArchiMate 2.1 " \
141
+ "'archi' for Archi http://archimatetool.com/ file format " \
142
+ "'nquads' for RDF 1.1 N-Quads format https://www.w3.org/TR/n-quads/" \
143
+ "'graphml' for GraphML" \
144
+ "'csv' for CSV files (one file per element/relationship type",
145
+ enum: Archimate::Cli::Convert::SUPPORTED_FORMATS
146
+ option :output,
147
+ aliases: :o,
148
+ desc: "Write output to FILE instead of stdout."
149
+ option :outputdir,
150
+ aliases: :d,
151
+ desc: "Write output to DIRECTORY."
152
+ option :force,
153
+ aliases: :f,
154
+ type: :boolean,
155
+ desc: "Force overwriting of existing output file"
156
+ option :noninteractive,
157
+ aliases: :n,
158
+ type: :boolean,
159
+ default: false,
160
+ desc: "Don't provide interactive feedback"
161
+ def convert(archifile)
162
+ output_dir = options.fetch("outputdir", Dir.pwd)
163
+ output_io = Cli.output_io(
164
+ options.fetch("output", $stdout),
165
+ options.fetch("force", false)
166
+ )
167
+ Config.instance.interactive = !options.fetch("noninteractive", false)
168
+ Archimate::Cli::Convert.new(
169
+ Archimate.read(archifile)
170
+ ).convert(options[:to], output_io, output_dir)
171
+ end
172
+
173
+ desc "lint ARCHIFILE", "Examine the ArchiMate file for potential problems"
174
+ option :output,
175
+ aliases: :o,
176
+ desc: "Write output to FILE instead of STDOUT"
177
+ def lint(archifile)
178
+ output_io = Cli.output_io(
179
+ options.fetch("output", $stdout),
180
+ options.fetch("force", false)
181
+ )
182
+ Archimate::Cli::Lint.new(
183
+ Archimate.read(archifile),
184
+ output_io
185
+ ).lint
186
+ end
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # The point of this script is to identify elements that aren't a part of any
4
+ # relationship and not referenced on any diagrams.
5
+
6
+ module Archimate
7
+ module Cli
8
+ class Cleanup
9
+ attr_reader :model
10
+
11
+ def self.cleanup(input, output, options)
12
+ cleaner = new(Archimate.read(input), output, options)
13
+ cleaner.clean
14
+ end
15
+
16
+ def initialize(model, output, options)
17
+ @model = model
18
+ @output = output
19
+ @options = options
20
+ @trash = Nokogiri::XML::Document.new("<deleted></deleted>")
21
+ @model_set = nil
22
+ @progressbar = ProgressIndicator.new(total: model.unreferenced_nodes.size, title: "Elements")
23
+ end
24
+
25
+ def remove_unreferenced_nodes
26
+ model.unreferenced_nodes.each do |id|
27
+ ns = model.lookup(id)
28
+ puts "Found duplicate ids: #{ns}" if ns.size > 1
29
+ unreferenced_node = ns[0]
30
+ trash.root.add_child unreferenced_node.dup
31
+ prev_sib = unreferenced_node.previous_sibling
32
+ if prev_sib.instance_of?(Nokogiri::XML::Text) && prev_sib.content.strip.empty?
33
+ ns << prev_sib
34
+ end
35
+ ns.remove
36
+ @progressbar.increment
37
+ end
38
+ end
39
+
40
+ def write_trash
41
+ options[:saveremoved].write(trash)
42
+ end
43
+
44
+ def clean
45
+ return unless model
46
+
47
+ remove_unreferenced_nodes
48
+ puts "Found #{unref_set.size} model items unreferenced by diagram or relationships"
49
+ Archimate::ArchiFileWriter.write(model, output)
50
+ write_trash
51
+ end
52
+ end
53
+ end
54
+ end