vedeu 0.4.16 → 0.4.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu/api.rb +7 -21
  3. data/lib/vedeu/bindings.rb +2 -6
  4. data/lib/vedeu/buffers/buffer.rb +29 -34
  5. data/lib/vedeu/cursor/cursor.rb +5 -2
  6. data/lib/vedeu/distributed/all.rb +5 -5
  7. data/lib/vedeu/distributed/server.rb +1 -1
  8. data/lib/vedeu/dsl/components/border.rb +1 -2
  9. data/lib/vedeu/dsl/components/geometry.rb +0 -47
  10. data/lib/vedeu/dsl/interface.rb +4 -11
  11. data/lib/vedeu/dsl/line.rb +1 -2
  12. data/lib/vedeu/dsl/shared/all.rb +1 -2
  13. data/lib/vedeu/dsl/shared/{colour.rb → presentation.rb} +27 -4
  14. data/lib/vedeu/dsl/shared/use.rb +50 -29
  15. data/lib/vedeu/dsl/stream.rb +1 -2
  16. data/lib/vedeu/geometry/geometry.rb +22 -11
  17. data/lib/vedeu/geometry/index_position.rb +0 -19
  18. data/lib/vedeu/geometry/position_validator.rb +8 -8
  19. data/lib/vedeu/models/interface.rb +34 -76
  20. data/lib/vedeu/models/null_interface.rb +5 -0
  21. data/lib/vedeu/models/stream.rb +1 -1
  22. data/lib/vedeu/output/border.rb +25 -41
  23. data/lib/vedeu/output/clear.rb +1 -7
  24. data/lib/vedeu/output/esc.rb +10 -10
  25. data/lib/vedeu/output/presentation.rb +2 -0
  26. data/lib/vedeu/output/renderers/escape_sequence_renderer.rb +3 -0
  27. data/lib/vedeu/repositories/model.rb +6 -0
  28. data/lib/vedeu/repositories/repositories/groups.rb +12 -0
  29. data/lib/vedeu/repositories/repository.rb +11 -8
  30. data/lib/vedeu/storage/all.rb +4 -4
  31. data/lib/vedeu/support/visibility.rb +8 -0
  32. data/test/lib/vedeu/buffers/buffer_test.rb +0 -2
  33. data/test/lib/vedeu/cursor/cursor_test.rb +14 -0
  34. data/test/lib/vedeu/dsl/components/border_test.rb +2 -2
  35. data/test/lib/vedeu/dsl/components/geometry_test.rb +63 -82
  36. data/test/lib/vedeu/dsl/components/keymap_test.rb +3 -3
  37. data/test/lib/vedeu/dsl/components/menu_test.rb +8 -8
  38. data/test/lib/vedeu/dsl/interface_test.rb +14 -22
  39. data/test/lib/vedeu/dsl/line_test.rb +4 -4
  40. data/test/lib/vedeu/dsl/shared/{colour_test.rb → presentation_test.rb} +19 -11
  41. data/test/lib/vedeu/dsl/shared/text_test.rb +15 -15
  42. data/test/lib/vedeu/dsl/shared/use_test.rb +24 -7
  43. data/test/lib/vedeu/geometry/geometry_test.rb +22 -19
  44. data/test/lib/vedeu/geometry/grid_test.rb +3 -3
  45. data/test/lib/vedeu/geometry/index_position_test.rb +0 -45
  46. data/test/lib/vedeu/geometry/position_test.rb +5 -5
  47. data/test/lib/vedeu/models/cell_test.rb +3 -3
  48. data/test/lib/vedeu/models/char_test.rb +5 -5
  49. data/test/lib/vedeu/models/interface_test.rb +7 -53
  50. data/test/lib/vedeu/models/null_test.rb +2 -2
  51. data/test/lib/vedeu/models/stream_test.rb +5 -5
  52. data/test/lib/vedeu/output/border_test.rb +1 -0
  53. data/test/lib/vedeu/output/colour_test.rb +16 -16
  54. data/test/lib/vedeu/output/esc_test.rb +15 -1
  55. data/test/lib/vedeu/output/html_char_test.rb +4 -4
  56. data/test/lib/vedeu/output/style_test.rb +15 -13
  57. data/test/lib/vedeu/output/text_test.rb +3 -3
  58. data/test/lib/vedeu/repositories/collection_test.rb +2 -2
  59. data/test/lib/vedeu/repositories/model_test.rb +19 -0
  60. data/test/lib/vedeu/repositories/repositories/groups_test.rb +22 -0
  61. data/test/lib/vedeu/repositories/repository_test.rb +50 -16
  62. data/test/lib/vedeu/support/common_test.rb +5 -5
  63. data/test/lib/vedeu/support/terminal_test.rb +3 -3
  64. data/test/lib/vedeu/support/visibility_test.rb +8 -0
  65. data/test/support/helpers/model_test_class.rb +18 -0
  66. data/test/test_helper.rb +1 -1
  67. data/vedeu.gemspec +2 -2
  68. metadata +7 -20
  69. data/lib/vedeu/dsl/shared/style.rb +0 -39
  70. data/test/lib/vedeu/dsl/shared/style_test.rb +0 -25
  71. data/test/support/helpers/all.rb +0 -5
  72. data/test/support/helpers/dsl_model_test_class.rb +0 -25
  73. data/test/support/helpers/helpers.rb +0 -17
  74. data/test/support/helpers/repositories.rb +0 -26
  75. data/test/support/helpers/repository_test_module.rb +0 -21
@@ -1,39 +0,0 @@
1
- module Vedeu
2
-
3
- module DSL
4
-
5
- # Provides a style helper for use in the {DSL::Interface}, {DSL::Line} and
6
- # {DSL::Stream} classes.
7
- #
8
- # @api public
9
- #
10
- module Style
11
-
12
- # Define a style or styles for an interface, line or a stream.
13
- #
14
- # @param value [Array<Symbol>|Array<String>|Symbol|String]
15
- #
16
- # @example
17
- # interface 'my_interface' do
18
- # style 'normal'
19
- # ...
20
- #
21
- # lines do
22
- # style ['bold', 'underline']
23
- # ...
24
- #
25
- # stream do
26
- # style 'blink'
27
- # ...
28
- #
29
- # @return [Vedeu::Style]
30
- def style(value)
31
- model.style = Vedeu::Style.coerce(value)
32
- end
33
- alias_method :styles, :style
34
-
35
- end # Style
36
-
37
- end # DSL
38
-
39
- end # Vedeu
@@ -1,25 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- module DSL
6
-
7
- describe Style do
8
-
9
- let(:described) { Vedeu::DSL::Style }
10
- let(:instance) { Vedeu::DSL::ModelTestClass.new(model) }
11
- let(:model) { Vedeu::ModelTestClass.new({}) }
12
-
13
- describe '#style' do
14
- let(:args) { :bold }
15
-
16
- subject { instance.style(args) }
17
-
18
- it { subject.must_be_instance_of(Vedeu::Style) }
19
- end
20
-
21
- end # Style
22
-
23
- end # DSL
24
-
25
- end # Vedeu
@@ -1,5 +0,0 @@
1
- require 'support/helpers/dsl_model_test_class'
2
- require 'support/helpers/helpers'
3
- require 'support/helpers/model_test_class'
4
- require 'support/helpers/repositories'
5
- require 'support/helpers/repository_test_module'
@@ -1,25 +0,0 @@
1
- require 'vedeu/dsl/shared/all'
2
-
3
- module Vedeu
4
-
5
- module DSL
6
-
7
- class ModelTestClass
8
-
9
- include Vedeu::DSL::Colour
10
- include Vedeu::DSL::Style
11
-
12
- def initialize(model, client = nil)
13
- @model = model
14
- @client = client
15
- end
16
-
17
- private
18
-
19
- attr_reader :model
20
-
21
- end # ModelTestClass
22
-
23
- end # DSL
24
-
25
- end # Vedeu
@@ -1,17 +0,0 @@
1
- module Vedeu
2
-
3
- module API
4
-
5
- class HelpersTestClass
6
-
7
- attr_accessor :attributes
8
-
9
- def initialize
10
- @attributes = { colour: {}, streams: [], style: [] }
11
- end
12
-
13
- end # HelpersTestClass
14
-
15
- end # API
16
-
17
- end # Vedeu
@@ -1,26 +0,0 @@
1
- require 'vedeu/repositories/repository'
2
-
3
- module Vedeu
4
-
5
- class RepositoriesTestClass < Repository
6
-
7
- attr_accessor :storage
8
- alias_method :in_memory, :storage
9
-
10
- def initialize(storage = {})
11
- @storage = storage
12
- end
13
-
14
- def add(model)
15
- if storage.is_a?(Hash)
16
- @storage = in_memory.merge!(model)
17
-
18
- else
19
- @storage << model
20
-
21
- end
22
- end
23
-
24
- end # RepositoriesTestClass
25
-
26
- end # Vedeu
@@ -1,21 +0,0 @@
1
- module Vedeu
2
-
3
- module RepositoryTestModule
4
-
5
- extend self
6
-
7
- # The real repository stores the model and returns it.
8
- def store(model)
9
- model
10
- end
11
-
12
- private
13
-
14
- # A storage solution that uses memory to persist models.
15
- def in_memory
16
- {}
17
- end
18
-
19
- end # RepositoryTestModule
20
-
21
- end # Vedeu