society 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +5 -5
- data/Gemfile +1 -1
- data/LICENSE.txt +19 -12
- data/lib/society.rb +5 -6
- data/lib/society/edge.rb +32 -6
- data/lib/society/formatter/report/html.rb +1 -0
- data/lib/society/formatter/report/templates/components/society-assets/society.js +16 -13
- data/lib/society/node.rb +86 -0
- data/lib/society/object_graph.rb +57 -5
- data/lib/society/parser.rb +454 -31
- data/lib/society/version.rb +1 -1
- data/society.gemspec +4 -5
- data/spec/cli_spec.rb +1 -1
- data/spec/object_graph_spec.rb +211 -17
- data/spec/parser_spec.rb +203 -12
- metadata +5 -37
- data/lib/society/association_processor.rb +0 -206
- data/lib/society/clusterer.rb +0 -188
- data/lib/society/formatter/graph/json.rb +0 -54
- data/lib/society/reference_processor.rb +0 -60
- data/society_graph.json +0 -1
- data/spec/association_processor_spec.rb +0 -174
- data/spec/clusterer_spec.rb +0 -37
- data/spec/fixtures/clustering/clusterer_fixtures.rb +0 -144
- data/spec/fixtures/clustering/edges_1.txt +0 -322
- data/spec/formatter/graph/json_spec.rb +0 -52
- data/spec/reference_processor_spec.rb +0 -18
@@ -1,322 +0,0 @@
|
|
1
|
-
0 38 1
|
2
|
-
2 53 1
|
3
|
-
3 53 1
|
4
|
-
3 53 1
|
5
|
-
3 13 1
|
6
|
-
3 47 1
|
7
|
-
7 53 1
|
8
|
-
8 58 1
|
9
|
-
8 44 1
|
10
|
-
8 16 1
|
11
|
-
8 53 1
|
12
|
-
9 19 1
|
13
|
-
9 50 1
|
14
|
-
10 58 1
|
15
|
-
13 8 1
|
16
|
-
13 58 1
|
17
|
-
13 3 1
|
18
|
-
13 3 1
|
19
|
-
13 14 1
|
20
|
-
14 13 1
|
21
|
-
15 31 1
|
22
|
-
15 16 1
|
23
|
-
15 27 1
|
24
|
-
15 14 1
|
25
|
-
15 50 1
|
26
|
-
15 43 1
|
27
|
-
16 15 1
|
28
|
-
16 8 1
|
29
|
-
17 58 1
|
30
|
-
17 57 1
|
31
|
-
17 55 1
|
32
|
-
17 56 1
|
33
|
-
19 58 1
|
34
|
-
19 9 1
|
35
|
-
24 58 1
|
36
|
-
24 25 1
|
37
|
-
24 28 1
|
38
|
-
24 27 1
|
39
|
-
25 58 1
|
40
|
-
25 24 1
|
41
|
-
25 26 1
|
42
|
-
25 29 1
|
43
|
-
26 25 1
|
44
|
-
27 24 1
|
45
|
-
27 15 1
|
46
|
-
28 24 1
|
47
|
-
28 29 1
|
48
|
-
29 58 1
|
49
|
-
29 28 1
|
50
|
-
29 25 1
|
51
|
-
30 58 1
|
52
|
-
30 58 1
|
53
|
-
31 15 1
|
54
|
-
31 58 1
|
55
|
-
38 0 1
|
56
|
-
41 44 1
|
57
|
-
41 42 1
|
58
|
-
41 43 1
|
59
|
-
41 14 1
|
60
|
-
42 41 1
|
61
|
-
42 58 1
|
62
|
-
43 41 1
|
63
|
-
43 15 1
|
64
|
-
44 41 1
|
65
|
-
44 8 1
|
66
|
-
47 3 1
|
67
|
-
47 53 1
|
68
|
-
49 58 1
|
69
|
-
49 11 1
|
70
|
-
50 15 1
|
71
|
-
50 9 1
|
72
|
-
52 58 1
|
73
|
-
53 8 1
|
74
|
-
53 47 1
|
75
|
-
53 2 1
|
76
|
-
53 7 1
|
77
|
-
55 56 1
|
78
|
-
55 17 1
|
79
|
-
55 9 1
|
80
|
-
56 57 1
|
81
|
-
56 55 1
|
82
|
-
56 17 1
|
83
|
-
57 56 1
|
84
|
-
57 17 1
|
85
|
-
57 58 1
|
86
|
-
58 13 1
|
87
|
-
58 8 1
|
88
|
-
58 42 1
|
89
|
-
58 25 1
|
90
|
-
58 29 1
|
91
|
-
58 24 1
|
92
|
-
58 52 1
|
93
|
-
58 31 1
|
94
|
-
58 19 1
|
95
|
-
58 30 1
|
96
|
-
58 30 1
|
97
|
-
58 10 1
|
98
|
-
58 49 1
|
99
|
-
14 15 1
|
100
|
-
14 41 1
|
101
|
-
8 41 1
|
102
|
-
8 15 1
|
103
|
-
9 58 1
|
104
|
-
13 53 1
|
105
|
-
13 15 1
|
106
|
-
13 41 1
|
107
|
-
15 8 1
|
108
|
-
15 24 1
|
109
|
-
15 13 1
|
110
|
-
15 58 1
|
111
|
-
15 41 1
|
112
|
-
24 58 1
|
113
|
-
25 15 1
|
114
|
-
25 28 1
|
115
|
-
28 58 1
|
116
|
-
28 25 1
|
117
|
-
41 8 1
|
118
|
-
41 58 1
|
119
|
-
41 15 1
|
120
|
-
41 13 1
|
121
|
-
57 55 1
|
122
|
-
58 8 1
|
123
|
-
58 24 1
|
124
|
-
58 15 1
|
125
|
-
58 9 1
|
126
|
-
58 58 1
|
127
|
-
58 58 1
|
128
|
-
0 0 1
|
129
|
-
0 4 1
|
130
|
-
0 125 1
|
131
|
-
0 38 1
|
132
|
-
0 11 1
|
133
|
-
3 126 1
|
134
|
-
3 23 1
|
135
|
-
3 47 1
|
136
|
-
8 58 1
|
137
|
-
8 53 1
|
138
|
-
12 31 1
|
139
|
-
12 31 1
|
140
|
-
12 91 1
|
141
|
-
12 96 1
|
142
|
-
13 53 1
|
143
|
-
13 58 1
|
144
|
-
13 120 1
|
145
|
-
13 115 1
|
146
|
-
15 8 1
|
147
|
-
15 15 1
|
148
|
-
15 58 1
|
149
|
-
17 58 1
|
150
|
-
32 31 1
|
151
|
-
32 31 1
|
152
|
-
32 31 1
|
153
|
-
39 58 1
|
154
|
-
39 39 1
|
155
|
-
41 112 1
|
156
|
-
41 58 1
|
157
|
-
41 8 1
|
158
|
-
42 13 1
|
159
|
-
42 3 1
|
160
|
-
46 46 1
|
161
|
-
46 46 1
|
162
|
-
46 132 1
|
163
|
-
46 46 1
|
164
|
-
46 46 1
|
165
|
-
46 46 1
|
166
|
-
46 46 1
|
167
|
-
47 46 1
|
168
|
-
50 140 1
|
169
|
-
52 52 1
|
170
|
-
52 52 1
|
171
|
-
52 58 1
|
172
|
-
53 54 1
|
173
|
-
53 82 1
|
174
|
-
55 9 1
|
175
|
-
56 57 1
|
176
|
-
57 58 1
|
177
|
-
58 49 1
|
178
|
-
58 58 1
|
179
|
-
59 0 1
|
180
|
-
59 52 1
|
181
|
-
59 0 1
|
182
|
-
59 11 1
|
183
|
-
59 0 1
|
184
|
-
60 0 1
|
185
|
-
61 1 1
|
186
|
-
61 1 1
|
187
|
-
61 11 1
|
188
|
-
61 11 1
|
189
|
-
61 58 1
|
190
|
-
61 58 1
|
191
|
-
61 0 1
|
192
|
-
61 58 1
|
193
|
-
61 11 1
|
194
|
-
61 0 1
|
195
|
-
61 0 1
|
196
|
-
65 17 1
|
197
|
-
66 93 1
|
198
|
-
67 31 1
|
199
|
-
68 58 1
|
200
|
-
68 58 1
|
201
|
-
68 9 1
|
202
|
-
68 19 1
|
203
|
-
69 57 1
|
204
|
-
70 105 1
|
205
|
-
71 52 1
|
206
|
-
71 0 1
|
207
|
-
71 52 1
|
208
|
-
73 143 1
|
209
|
-
77 116 1
|
210
|
-
78 53 1
|
211
|
-
79 12 1
|
212
|
-
79 12 1
|
213
|
-
81 188 1
|
214
|
-
81 184 1
|
215
|
-
81 121 1
|
216
|
-
81 185 1
|
217
|
-
83 33 1
|
218
|
-
83 33 1
|
219
|
-
84 2 1
|
220
|
-
85 94 1
|
221
|
-
85 93 1
|
222
|
-
86 105 1
|
223
|
-
87 106 1
|
224
|
-
88 117 1
|
225
|
-
88 116 1
|
226
|
-
90 118 1
|
227
|
-
90 99 1
|
228
|
-
91 31 1
|
229
|
-
92 66 1
|
230
|
-
93 8 1
|
231
|
-
93 33 1
|
232
|
-
93 15 1
|
233
|
-
93 41 1
|
234
|
-
93 58 1
|
235
|
-
93 13 1
|
236
|
-
93 33 1
|
237
|
-
95 67 1
|
238
|
-
96 15 1
|
239
|
-
96 83 1
|
240
|
-
96 119 1
|
241
|
-
96 108 1
|
242
|
-
97 98 1
|
243
|
-
98 16 1
|
244
|
-
99 15 1
|
245
|
-
99 83 1
|
246
|
-
100 101 1
|
247
|
-
102 17 1
|
248
|
-
102 68 1
|
249
|
-
103 17 1
|
250
|
-
103 20 1
|
251
|
-
103 69 1
|
252
|
-
103 58 1
|
253
|
-
104 70 1
|
254
|
-
105 15 1
|
255
|
-
105 58 1
|
256
|
-
106 105 1
|
257
|
-
107 108 1
|
258
|
-
109 58 1
|
259
|
-
110 109 1
|
260
|
-
110 109 1
|
261
|
-
110 58 1
|
262
|
-
110 58 1
|
263
|
-
110 109 1
|
264
|
-
110 109 1
|
265
|
-
110 109 1
|
266
|
-
110 109 1
|
267
|
-
110 148 1
|
268
|
-
111 8 1
|
269
|
-
112 41 1
|
270
|
-
113 41 1
|
271
|
-
113 83 1
|
272
|
-
114 77 1
|
273
|
-
115 13 1
|
274
|
-
118 43 1
|
275
|
-
118 119 1
|
276
|
-
119 83 1
|
277
|
-
120 13 1
|
278
|
-
121 121 1
|
279
|
-
122 8 1
|
280
|
-
122 81 1
|
281
|
-
124 31 1
|
282
|
-
124 12 1
|
283
|
-
124 12 1
|
284
|
-
130 46 1
|
285
|
-
131 46 1
|
286
|
-
130 46 1
|
287
|
-
133 46 1
|
288
|
-
130 132 1
|
289
|
-
134 46 1
|
290
|
-
135 46 1
|
291
|
-
134 46 1
|
292
|
-
136 46 1
|
293
|
-
137 46 1
|
294
|
-
138 46 1
|
295
|
-
137 46 1
|
296
|
-
139 46 1
|
297
|
-
143 143 1
|
298
|
-
144 109 1
|
299
|
-
145 109 1
|
300
|
-
146 58 1
|
301
|
-
146 58 1
|
302
|
-
146 109 1
|
303
|
-
147 109 1
|
304
|
-
148 109 1
|
305
|
-
149 109 1
|
306
|
-
173 193 1
|
307
|
-
175 193 1
|
308
|
-
173 143 1
|
309
|
-
176 143 1
|
310
|
-
182 182 1
|
311
|
-
182 182 1
|
312
|
-
183 183 1
|
313
|
-
183 183 1
|
314
|
-
186 183 1
|
315
|
-
186 183 1
|
316
|
-
189 19 1
|
317
|
-
190 15 1
|
318
|
-
190 190 1
|
319
|
-
198 58 1
|
320
|
-
198 39 1
|
321
|
-
200 58 1
|
322
|
-
200 39 1
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'analyst'
|
3
|
-
|
4
|
-
describe Society::Formatter::Graph::JSON do
|
5
|
-
|
6
|
-
let(:graph) { Struct.new(:nodes, :edges)}
|
7
|
-
let(:node) { Struct.new(:full_name) }
|
8
|
-
let(:edge) { Struct.new(:from, :to) }
|
9
|
-
|
10
|
-
let(:node_instance_1) { node.new("sample_node")}
|
11
|
-
let(:node_instance_2) { node.new("other_node")}
|
12
|
-
let(:edge_instance) { edge.new(node_instance_1, node_instance_2) }
|
13
|
-
|
14
|
-
let(:graph_instance) { graph.new(
|
15
|
-
[node_instance_1, node_instance_2],
|
16
|
-
[edge_instance]
|
17
|
-
)
|
18
|
-
}
|
19
|
-
|
20
|
-
let(:formatter) { Society::Formatter::Graph::JSON.new(graph_instance) }
|
21
|
-
|
22
|
-
describe "#to_hash" do
|
23
|
-
|
24
|
-
let(:hash) { formatter.to_hash }
|
25
|
-
|
26
|
-
context "returns a hash" do
|
27
|
-
it "with properly formatted nodes" do
|
28
|
-
expect(hash[:nodes]).to eq(
|
29
|
-
[
|
30
|
-
{name: "sample_node"},
|
31
|
-
{name: "other_node"}
|
32
|
-
]
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "with properly formatted edges" do
|
37
|
-
expect(hash[:edges]).to eq([{from: 0, to: 1}])
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "#to_json" do
|
43
|
-
|
44
|
-
let(:json) { formatter.to_json }
|
45
|
-
let(:hash) { formatter.to_hash }
|
46
|
-
|
47
|
-
it "returns json string for the result of #to_hash" do
|
48
|
-
expect(json).to eq hash.to_json
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Society::ReferenceProcessor do
|
4
|
-
|
5
|
-
describe "#references" do
|
6
|
-
|
7
|
-
let(:proxy) { Struct.new(:name, :full_name, :constants, :constant_assignments) }
|
8
|
-
let(:avatar_1) { proxy.new("AnimalMan", "Red::AnimalMan", [], []) }
|
9
|
-
let(:avatar_2) { proxy.new("Arcane", "Rot::Arcane", [], []) }
|
10
|
-
let(:avatar_3) { proxy.new("SwampThing", "Green::SwampThing", [avatar_1, avatar_2], []) }
|
11
|
-
let(:processor) { Society::ReferenceProcessor.new([avatar_1, avatar_2, avatar_3]) }
|
12
|
-
|
13
|
-
it "returns referenced classes" do
|
14
|
-
expect(processor.references.map(&:to)).to eq([avatar_1, avatar_2])
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|