vedeu 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -9
  3. data/docs/api.md +70 -42
  4. data/elements.txt +118 -0
  5. data/lib/vedeu.rb +14 -4
  6. data/lib/vedeu/api/api.rb +67 -24
  7. data/lib/vedeu/api/composition.rb +19 -0
  8. data/lib/vedeu/api/defined.rb +7 -0
  9. data/lib/vedeu/api/interface.rb +103 -75
  10. data/lib/vedeu/api/keymap.rb +62 -0
  11. data/lib/vedeu/api/menu.rb +3 -1
  12. data/lib/vedeu/configuration.rb +24 -6
  13. data/lib/vedeu/models/attributes/coercions.rb +18 -26
  14. data/lib/vedeu/models/attributes/colour_translator.rb +7 -7
  15. data/lib/vedeu/models/attributes/presentation.rb +12 -1
  16. data/lib/vedeu/models/geometry.rb +5 -1
  17. data/lib/vedeu/models/interface.rb +6 -47
  18. data/lib/vedeu/models/keymap.rb +66 -0
  19. data/lib/vedeu/models/line.rb +3 -1
  20. data/lib/vedeu/models/stream.rb +10 -1
  21. data/lib/vedeu/models/style.rb +10 -1
  22. data/lib/vedeu/output/compositor.rb +3 -0
  23. data/lib/vedeu/output/refresh.rb +16 -74
  24. data/lib/vedeu/output/render.rb +44 -17
  25. data/lib/vedeu/output/view.rb +3 -0
  26. data/lib/vedeu/repositories/buffers.rb +32 -42
  27. data/lib/vedeu/repositories/events.rb +8 -11
  28. data/lib/vedeu/repositories/focus.rb +15 -13
  29. data/lib/vedeu/repositories/groups.rb +20 -2
  30. data/lib/vedeu/repositories/interfaces.rb +22 -2
  31. data/lib/vedeu/repositories/keymap_validator.rb +104 -0
  32. data/lib/vedeu/repositories/keymaps.rb +239 -0
  33. data/lib/vedeu/repositories/menus.rb +12 -3
  34. data/lib/vedeu/support/common.rb +2 -2
  35. data/lib/vedeu/support/cursor.rb +3 -0
  36. data/lib/vedeu/support/event.rb +48 -7
  37. data/lib/vedeu/support/grid.rb +1 -1
  38. data/lib/vedeu/support/registrar.rb +66 -0
  39. data/lib/vedeu/support/trace.rb +71 -12
  40. data/test/lib/vedeu/api/api_test.rb +27 -9
  41. data/test/lib/vedeu/api/composition_test.rb +10 -0
  42. data/test/lib/vedeu/api/defined_test.rb +14 -0
  43. data/test/lib/vedeu/api/interface_test.rb +86 -85
  44. data/test/lib/vedeu/api/keymap_test.rb +61 -0
  45. data/test/lib/vedeu/configuration_test.rb +12 -0
  46. data/test/lib/vedeu/models/attributes/coercions_test.rb +3 -4
  47. data/test/lib/vedeu/models/interface_test.rb +0 -43
  48. data/test/lib/vedeu/models/keymap_test.rb +19 -0
  49. data/test/lib/vedeu/models/style_test.rb +10 -0
  50. data/test/lib/vedeu/output/refresh_test.rb +0 -12
  51. data/test/lib/vedeu/output/render_test.rb +51 -0
  52. data/test/lib/vedeu/repositories/buffers_test.rb +39 -12
  53. data/test/lib/vedeu/repositories/events_test.rb +6 -0
  54. data/test/lib/vedeu/repositories/focus_test.rb +12 -0
  55. data/test/lib/vedeu/repositories/keymap_validator_test.rb +81 -0
  56. data/test/lib/vedeu/repositories/keymaps_test.rb +254 -0
  57. data/test/lib/vedeu/support/common_test.rb +26 -0
  58. data/test/lib/vedeu/support/registrar_test.rb +68 -0
  59. data/vedeu.gemspec +1 -1
  60. metadata +18 -2
@@ -1,6 +1,32 @@
1
1
  require 'test_helper'
2
2
 
3
+ class VedeuCommonClass
4
+ include Vedeu::Common
5
+
6
+ def defined_value_test(variable)
7
+ defined_value?(variable)
8
+ end
9
+ end
10
+
3
11
  module Vedeu
4
12
  describe Common do
13
+
14
+ describe '#defined_value?' do
15
+ it 'return true when the variable is not nil or empty' do
16
+ VedeuCommonClass.new.defined_value_test('not empty').must_equal(true)
17
+ end
18
+
19
+ it 'returns false when the variable is nil or empty' do
20
+ VedeuCommonClass.new.defined_value_test([]).must_equal(false)
21
+ end
22
+
23
+ it 'returns false when dealing with hash keys which may not exist or ' \
24
+ 'have a value' do
25
+ attributes = {}
26
+
27
+ VedeuCommonClass.new.defined_value_test(attributes[:misc]).must_equal(false)
28
+ end
29
+ end
30
+
5
31
  end
6
32
  end
@@ -0,0 +1,68 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ describe Registrar do
6
+
7
+ before do
8
+ Buffers.reset
9
+ Interfaces.reset
10
+ Groups.reset
11
+ Focus.reset
12
+ end
13
+
14
+ describe '.record' do
15
+ let(:attributes) {
16
+ {
17
+ name: 'mendelevium',
18
+ group: 'elements'
19
+ }
20
+ }
21
+
22
+ it 'raises an exception if the attributes does not have a :name key' do
23
+ attributes = { no_name_key: '' }
24
+
25
+ proc { Registrar.record(attributes) }.must_raise(MissingRequired)
26
+ end
27
+
28
+ it 'raises an exception if the value for :name is nil' do
29
+ attributes = { name: nil }
30
+
31
+ proc { Registrar.record(attributes) }.must_raise(MissingRequired)
32
+ end
33
+
34
+ it 'raises an exception if the value for :name is empty' do
35
+ attributes = { name: '' }
36
+
37
+ proc { Registrar.record(attributes) }.must_raise(MissingRequired)
38
+ end
39
+
40
+ it 'sends the attributes to the Buffers repository' do
41
+ Registrar.record(attributes)
42
+
43
+ Buffers.registered?('mendelevium').must_equal(true)
44
+ end
45
+
46
+ it 'sends the attributes to the Interfaces repository' do
47
+ Registrar.record(attributes)
48
+
49
+ Interfaces.registered?('mendelevium').must_equal(true)
50
+ end
51
+
52
+ it 'sends the attributes to the Groups repository' do
53
+ Registrar.record(attributes)
54
+
55
+ Groups.registered?('elements').must_equal(true)
56
+ end
57
+
58
+ it 'sends the attributes to the Focus repository' do
59
+ Registrar.record(attributes)
60
+
61
+ Focus.registered?('mendelevium').must_equal(true)
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
68
+ end
data/vedeu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.2.0'
7
+ spec.version = '0.2.1'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = %q{A terminal case of wonderland.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-07 00:00:00.000000000 Z
11
+ date: 2014-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -185,12 +185,14 @@ files:
185
185
  - bin/vedeu
186
186
  - docs/api.md
187
187
  - docs/events.md
188
+ - elements.txt
188
189
  - lib/vedeu.rb
189
190
  - lib/vedeu/api/api.rb
190
191
  - lib/vedeu/api/composition.rb
191
192
  - lib/vedeu/api/defined.rb
192
193
  - lib/vedeu/api/helpers.rb
193
194
  - lib/vedeu/api/interface.rb
195
+ - lib/vedeu/api/keymap.rb
194
196
  - lib/vedeu/api/line.rb
195
197
  - lib/vedeu/api/menu.rb
196
198
  - lib/vedeu/api/stream.rb
@@ -207,6 +209,7 @@ files:
207
209
  - lib/vedeu/models/composition.rb
208
210
  - lib/vedeu/models/geometry.rb
209
211
  - lib/vedeu/models/interface.rb
212
+ - lib/vedeu/models/keymap.rb
210
213
  - lib/vedeu/models/line.rb
211
214
  - lib/vedeu/models/stream.rb
212
215
  - lib/vedeu/models/style.rb
@@ -220,6 +223,8 @@ files:
220
223
  - lib/vedeu/repositories/focus.rb
221
224
  - lib/vedeu/repositories/groups.rb
222
225
  - lib/vedeu/repositories/interfaces.rb
226
+ - lib/vedeu/repositories/keymap_validator.rb
227
+ - lib/vedeu/repositories/keymaps.rb
223
228
  - lib/vedeu/repositories/menus.rb
224
229
  - lib/vedeu/support/common.rb
225
230
  - lib/vedeu/support/cursor.rb
@@ -229,6 +234,7 @@ files:
229
234
  - lib/vedeu/support/log.rb
230
235
  - lib/vedeu/support/menu.rb
231
236
  - lib/vedeu/support/position.rb
237
+ - lib/vedeu/support/registrar.rb
232
238
  - lib/vedeu/support/terminal.rb
233
239
  - lib/vedeu/support/trace.rb
234
240
  - logs/.gitkeep
@@ -240,6 +246,7 @@ files:
240
246
  - test/lib/vedeu/api/defined_test.rb
241
247
  - test/lib/vedeu/api/helpers_test.rb
242
248
  - test/lib/vedeu/api/interface_test.rb
249
+ - test/lib/vedeu/api/keymap_test.rb
243
250
  - test/lib/vedeu/api/line_test.rb
244
251
  - test/lib/vedeu/api/menu_test.rb
245
252
  - test/lib/vedeu/api/stream_test.rb
@@ -256,6 +263,7 @@ files:
256
263
  - test/lib/vedeu/models/composition_test.rb
257
264
  - test/lib/vedeu/models/geometry_test.rb
258
265
  - test/lib/vedeu/models/interface_test.rb
266
+ - test/lib/vedeu/models/keymap_test.rb
259
267
  - test/lib/vedeu/models/line_test.rb
260
268
  - test/lib/vedeu/models/stream_test.rb
261
269
  - test/lib/vedeu/models/style_test.rb
@@ -269,6 +277,8 @@ files:
269
277
  - test/lib/vedeu/repositories/focus_test.rb
270
278
  - test/lib/vedeu/repositories/groups_test.rb
271
279
  - test/lib/vedeu/repositories/interfaces_test.rb
280
+ - test/lib/vedeu/repositories/keymap_validator_test.rb
281
+ - test/lib/vedeu/repositories/keymaps_test.rb
272
282
  - test/lib/vedeu/repositories/menus_test.rb
273
283
  - test/lib/vedeu/support/common_test.rb
274
284
  - test/lib/vedeu/support/cursor_test.rb
@@ -278,6 +288,7 @@ files:
278
288
  - test/lib/vedeu/support/log_test.rb
279
289
  - test/lib/vedeu/support/menu_test.rb
280
290
  - test/lib/vedeu/support/position_test.rb
291
+ - test/lib/vedeu/support/registrar_test.rb
281
292
  - test/lib/vedeu/support/terminal_test.rb
282
293
  - test/lib/vedeu/support/trace_test.rb
283
294
  - test/support/colour_test.sh
@@ -318,6 +329,7 @@ test_files:
318
329
  - test/lib/vedeu/api/defined_test.rb
319
330
  - test/lib/vedeu/api/helpers_test.rb
320
331
  - test/lib/vedeu/api/interface_test.rb
332
+ - test/lib/vedeu/api/keymap_test.rb
321
333
  - test/lib/vedeu/api/line_test.rb
322
334
  - test/lib/vedeu/api/menu_test.rb
323
335
  - test/lib/vedeu/api/stream_test.rb
@@ -334,6 +346,7 @@ test_files:
334
346
  - test/lib/vedeu/models/composition_test.rb
335
347
  - test/lib/vedeu/models/geometry_test.rb
336
348
  - test/lib/vedeu/models/interface_test.rb
349
+ - test/lib/vedeu/models/keymap_test.rb
337
350
  - test/lib/vedeu/models/line_test.rb
338
351
  - test/lib/vedeu/models/stream_test.rb
339
352
  - test/lib/vedeu/models/style_test.rb
@@ -347,6 +360,8 @@ test_files:
347
360
  - test/lib/vedeu/repositories/focus_test.rb
348
361
  - test/lib/vedeu/repositories/groups_test.rb
349
362
  - test/lib/vedeu/repositories/interfaces_test.rb
363
+ - test/lib/vedeu/repositories/keymap_validator_test.rb
364
+ - test/lib/vedeu/repositories/keymaps_test.rb
350
365
  - test/lib/vedeu/repositories/menus_test.rb
351
366
  - test/lib/vedeu/support/common_test.rb
352
367
  - test/lib/vedeu/support/cursor_test.rb
@@ -356,6 +371,7 @@ test_files:
356
371
  - test/lib/vedeu/support/log_test.rb
357
372
  - test/lib/vedeu/support/menu_test.rb
358
373
  - test/lib/vedeu/support/position_test.rb
374
+ - test/lib/vedeu/support/registrar_test.rb
359
375
  - test/lib/vedeu/support/terminal_test.rb
360
376
  - test/lib/vedeu/support/trace_test.rb
361
377
  - test/support/colour_test.sh