vedeu 0.0.39 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -30
  3. data/Rakefile +8 -9
  4. data/bin/log +13 -0
  5. data/deps.md +11 -95
  6. data/lib/vedeu.rb +14 -46
  7. data/lib/vedeu/application.rb +4 -8
  8. data/lib/vedeu/instrumentation.rb +111 -0
  9. data/lib/vedeu/launcher.rb +2 -2
  10. data/lib/vedeu/models/attributes/interface_collection.rb +2 -2
  11. data/lib/vedeu/models/attributes/line_collection.rb +2 -2
  12. data/lib/vedeu/models/attributes/stream_collection.rb +2 -2
  13. data/lib/vedeu/models/colour.rb +1 -1
  14. data/lib/vedeu/models/composition.rb +1 -1
  15. data/lib/vedeu/models/interface.rb +18 -10
  16. data/lib/vedeu/models/line.rb +3 -3
  17. data/lib/vedeu/models/presentation.rb +1 -1
  18. data/lib/vedeu/models/stream.rb +2 -2
  19. data/lib/vedeu/models/style.rb +1 -1
  20. data/lib/vedeu/output/render_interface.rb +1 -1
  21. data/lib/vedeu/{support → parsing}/compositor.rb +1 -1
  22. data/lib/vedeu/parsing/hash_parser.rb +1 -1
  23. data/lib/vedeu/parsing/parser.rb +6 -10
  24. data/lib/vedeu/{models/builders → support}/builder.rb +19 -9
  25. data/lib/vedeu/support/esc.rb +1 -1
  26. data/lib/vedeu/support/events.rb +15 -19
  27. data/lib/vedeu/support/geometry.rb +3 -3
  28. data/lib/vedeu/{input → support}/input.rb +6 -9
  29. data/lib/vedeu/support/menu.rb +3 -3
  30. data/lib/vedeu/support/persistence.rb +41 -0
  31. data/lib/vedeu/support/terminal.rb +1 -1
  32. data/test/example_app/lib/app.rb +85 -5
  33. data/test/lib/vedeu/application_test.rb +2 -2
  34. data/test/lib/vedeu/configuration_test.rb +2 -2
  35. data/test/lib/vedeu/launcher_test.rb +2 -2
  36. data/test/lib/vedeu/models/attributes/collection_test.rb +2 -2
  37. data/test/lib/vedeu/models/attributes/interface_collection_test.rb +4 -4
  38. data/test/lib/vedeu/models/attributes/line_collection_test.rb +3 -3
  39. data/test/lib/vedeu/models/attributes/stream_collection_test.rb +3 -3
  40. data/test/lib/vedeu/models/colour_test.rb +2 -2
  41. data/test/lib/vedeu/models/composition_test.rb +19 -19
  42. data/test/lib/vedeu/models/interface_test.rb +46 -34
  43. data/test/lib/vedeu/models/line_test.rb +2 -2
  44. data/test/lib/vedeu/models/presentation_test.rb +2 -2
  45. data/test/lib/vedeu/models/stream_test.rb +2 -2
  46. data/test/lib/vedeu/models/style_test.rb +31 -31
  47. data/test/lib/vedeu/output/clear_interface_test.rb +5 -5
  48. data/test/lib/vedeu/output/render_interface_test.rb +5 -6
  49. data/test/lib/vedeu/output/template.rb +2 -1
  50. data/test/lib/vedeu/{support → parsing}/compositor_test.rb +6 -4
  51. data/test/lib/vedeu/parsing/hash_parser_test.rb +2 -2
  52. data/test/lib/vedeu/parsing/json_parser_test.rb +2 -2
  53. data/test/lib/vedeu/parsing/parser_test.rb +6 -5
  54. data/test/lib/vedeu/parsing/text_adaptor_test.rb +2 -2
  55. data/test/lib/vedeu/{models/builders/interface_builder_test.rb → support/builder_test.rb} +10 -10
  56. data/test/lib/vedeu/support/esc_test.rb +2 -2
  57. data/test/lib/vedeu/support/events_test.rb +2 -2
  58. data/test/lib/vedeu/support/geometry_test.rb +2 -2
  59. data/test/lib/vedeu/{input → support}/input_test.rb +6 -7
  60. data/test/lib/vedeu/support/menu_test.rb +2 -2
  61. data/test/lib/vedeu/support/persistence_test.rb +55 -0
  62. data/test/lib/vedeu/support/queue_test.rb +2 -2
  63. data/test/lib/vedeu/support/terminal_test.rb +2 -2
  64. data/test/lib/vedeu/support/translator_test.rb +2 -2
  65. data/test/lib/vedeu/support/wordwrap_test.rb +2 -2
  66. data/test/lib/vedeu_test.rb +17 -2
  67. data/test/support/bench.rb +34 -0
  68. data/test/test_helper.rb +3 -11
  69. data/vedeu.gemspec +2 -2
  70. metadata +20 -44
  71. data/lib/vedeu/models/builders/command_builder.rb +0 -10
  72. data/lib/vedeu/models/builders/interface_builder.rb +0 -32
  73. data/lib/vedeu/models/command.rb +0 -23
  74. data/lib/vedeu/output/output.rb +0 -14
  75. data/lib/vedeu/process/process.rb +0 -51
  76. data/lib/vedeu/repository/command_repository.rb +0 -31
  77. data/lib/vedeu/repository/interface_repository.rb +0 -31
  78. data/lib/vedeu/repository/repository.rb +0 -41
  79. data/lib/vedeu/repository/storage.rb +0 -40
  80. data/lib/vedeu/support/exit.rb +0 -9
  81. data/test/lib/vedeu/models/builders/builder_test.rb +0 -11
  82. data/test/lib/vedeu/models/builders/command_builder_test.rb +0 -16
  83. data/test/lib/vedeu/models/command_test.rb +0 -40
  84. data/test/lib/vedeu/output/output_test.rb +0 -19
  85. data/test/lib/vedeu/process/process_test.rb +0 -71
  86. data/test/lib/vedeu/repository/command_repository_test.rb +0 -55
  87. data/test/lib/vedeu/repository/interface_repository_test.rb +0 -67
  88. data/test/lib/vedeu/repository/repository_test.rb +0 -81
  89. data/test/lib/vedeu/repository/storage_test.rb +0 -70
  90. data/test/lib/vedeu/support/exit_test.rb +0 -12
  91. data/test/support/dummy_command.rb +0 -9
@@ -1,81 +0,0 @@
1
- require_relative '../../../test_helper'
2
- require_relative '../../../../lib/vedeu/repository/repository'
3
-
4
- module Vedeu
5
- class Dummy
6
- attr_reader :name
7
-
8
- def initialize(attributes = {})
9
- @name = attributes.fetch(:name, '')
10
- end
11
- end
12
-
13
- module DummyRepository
14
- extend Repository
15
- extend self
16
-
17
- def entity
18
- Dummy
19
- end
20
- end
21
-
22
- describe Repository do
23
- before { DummyRepository.reset }
24
-
25
- describe '#create' do
26
- it 'returns a Dummy' do
27
- DummyRepository.create({ name: 'dummy' })
28
- .must_be_instance_of(Dummy)
29
- end
30
-
31
- it 'raises an exception if called directly' do
32
- proc { Repository.create({ name: 'test' }) }
33
- .must_raise(StandardError)
34
- end
35
- end
36
-
37
- describe '#all' do
38
- it 'returns all the stored items' do
39
- DummyRepository.all.must_equal([])
40
- end
41
-
42
- it 'raises an exception if called directly' do
43
- proc { Repository.all }.must_raise(StandardError)
44
- end
45
- end
46
-
47
- describe '#query' do
48
- it 'finds an entity by attribute' do
49
- dumb = DummyRepository.create({ name: 'dummy' })
50
- result = DummyRepository.query(:name, 'dummy')
51
- result.must_equal(dumb)
52
- end
53
-
54
- it 'raises an exception when the entity cannot be found' do
55
- proc { DummyRepository.query(:name, 'dumber') }
56
- .must_raise(EntityNotFound)
57
- end
58
-
59
- it 'raises an exception if called directly' do
60
- proc { Repository.query(:name, 'test') }
61
- .must_raise(StandardError)
62
- end
63
- end
64
-
65
- describe '#reset' do
66
- it 'removes all stored entities' do
67
- DummyRepository.reset.must_equal({})
68
- end
69
-
70
- it 'raises an exception if called directly' do
71
- proc { Repository.reset }.must_raise(StandardError)
72
- end
73
- end
74
-
75
- describe '#entity' do
76
- it 'raises an exception if called directly' do
77
- proc { Repository.entity }.must_raise(StandardError)
78
- end
79
- end
80
- end
81
- end
@@ -1,70 +0,0 @@
1
- require_relative '../../../test_helper'
2
- require_relative '../../../support/dummy_command'
3
- require_relative '../../../../lib/vedeu/repository/storage'
4
-
5
- module Vedeu
6
- class DummyRecord
7
- attr_reader :name
8
-
9
- def initialize(attributes = {})
10
- @name = attributes.fetch(:name, '')
11
- end
12
- end
13
-
14
- describe Storage do
15
- describe '#create' do
16
- it 'returns the stored record' do
17
- storage = Storage.new
18
- storage.create(DummyRecord, {})
19
- .must_be_instance_of(DummyRecord)
20
- end
21
- end
22
-
23
- describe '#reset' do
24
- it 'deletes all records for this entity' do
25
- storage = Storage.new
26
- storage.create(DummyRecord, { name: 'dumb' })
27
- storage.create(DummyRecord, { name: 'dumber' })
28
- storage.all(DummyRecord).size.must_equal(2)
29
-
30
- storage.reset(DummyRecord).must_equal({})
31
- end
32
- end
33
-
34
- describe '#all' do
35
- it 'returns all entity records if an entity is provided' do
36
-
37
- end
38
-
39
- it 'returns all records if no entity provided' do
40
-
41
- end
42
-
43
-
44
- it 'returns an empty collection when no records were found' do
45
- storage = Storage.new
46
- storage.all(DummyRecord).must_equal([])
47
- end
48
- end
49
-
50
- describe '#query' do
51
- it 'returns the record if found' do
52
- storage = Storage.new
53
- hydrogen = storage.create(DummyRecord, { name: 'hydrogen' })
54
-
55
- storage.query(DummyRecord, :name, 'hydrogen')
56
- .must_be_instance_of(DummyRecord)
57
- storage.query(DummyRecord, :name, 'hydrogen')
58
- .name.must_equal('hydrogen')
59
- end
60
-
61
- it 'returns false if the record is not found' do
62
- storage = Storage.new
63
- hydrogen = storage.create(DummyRecord, { name: 'hydrogen' })
64
-
65
- storage.query(DummyRecord, :name, nil).must_equal(false)
66
- storage.query(DummyRecord, :name, 'lithium').must_equal(false)
67
- end
68
- end
69
- end
70
- end
@@ -1,12 +0,0 @@
1
- require_relative '../../../test_helper'
2
- require_relative '../../../../lib/vedeu/support/exit'
3
-
4
- module Vedeu
5
- describe Exit do
6
- describe '.dispatch' do
7
- it 'halts execution' do
8
- proc { Exit.dispatch }.must_raise(StopIteration)
9
- end
10
- end
11
- end
12
- end
@@ -1,9 +0,0 @@
1
- module Vedeu
2
- class DummyCommand
3
- attr_accessor :name
4
-
5
- def self.dispatch(value = :dummy)
6
- value || :dummy
7
- end
8
- end
9
- end