vedeu 0.4.54 → 0.4.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu.rb +1 -1
  3. data/lib/vedeu/all.rb +5 -1
  4. data/lib/vedeu/api.rb +7 -3
  5. data/lib/vedeu/application/all.rb +6 -6
  6. data/lib/vedeu/application/application_controller.rb +1 -1
  7. data/lib/vedeu/application/application_helper.rb +1 -1
  8. data/lib/vedeu/application/application_view.rb +1 -1
  9. data/lib/vedeu/application/view.rb +10 -0
  10. data/lib/vedeu/bindings/all.rb +13 -5
  11. data/lib/vedeu/bootstrap.rb +0 -2
  12. data/lib/vedeu/buffers/all.rb +3 -2
  13. data/lib/vedeu/{repositories/repositories → buffers}/buffers.rb +1 -1
  14. data/lib/vedeu/cli/all.rb +1 -1
  15. data/lib/vedeu/cli/generator/helpers.rb +2 -2
  16. data/lib/vedeu/colours/all.rb +7 -0
  17. data/lib/vedeu/{output → colours}/background.rb +0 -0
  18. data/lib/vedeu/{repositories/repositories → colours}/backgrounds.rb +0 -0
  19. data/lib/vedeu/{output → colours}/colour.rb +0 -0
  20. data/lib/vedeu/{output → colours}/colour_translator.rb +0 -0
  21. data/lib/vedeu/{repositories/repositories → colours}/colours.rb +0 -0
  22. data/lib/vedeu/{output → colours}/foreground.rb +0 -0
  23. data/lib/vedeu/{repositories/repositories → colours}/foregrounds.rb +0 -0
  24. data/lib/vedeu/{support/common.rb → common.rb} +0 -0
  25. data/lib/vedeu/configuration/all.rb +3 -3
  26. data/lib/vedeu/cursor/all.rb +5 -4
  27. data/lib/vedeu/cursor/cursor.rb +1 -1
  28. data/lib/vedeu/{repositories/repositories → cursor}/cursors.rb +2 -19
  29. data/lib/vedeu/distributed/all.rb +5 -5
  30. data/lib/vedeu/distributed/test_application.rb +1 -1
  31. data/lib/vedeu/dsl/all.rb +1 -1
  32. data/lib/vedeu/dsl/composition.rb +1 -1
  33. data/lib/vedeu/dsl/use.rb +1 -1
  34. data/lib/vedeu/events/all.rb +4 -3
  35. data/lib/vedeu/{repositories/repositories → events}/events.rb +0 -0
  36. data/lib/vedeu/geometry/all.rb +14 -9
  37. data/lib/vedeu/{repositories/repositories → geometry}/geometries.rb +0 -0
  38. data/lib/vedeu/input/all.rb +5 -4
  39. data/lib/vedeu/{repositories/repositories → input}/keymaps.rb +0 -0
  40. data/lib/vedeu/{support/log.rb → log.rb} +0 -0
  41. data/lib/vedeu/models/all.rb +14 -10
  42. data/lib/vedeu/models/group.rb +3 -3
  43. data/lib/vedeu/{repositories/repositories → models}/groups.rb +2 -16
  44. data/lib/vedeu/models/interface.rb +1 -1
  45. data/lib/vedeu/{repositories/repositories → models}/interfaces.rb +1 -1
  46. data/lib/vedeu/{repositories/repositories → models}/menus.rb +0 -0
  47. data/lib/vedeu/{support → models}/toggleable.rb +4 -4
  48. data/lib/vedeu/null/all.rb +5 -5
  49. data/lib/vedeu/null/border.rb +5 -3
  50. data/lib/vedeu/null/buffer.rb +5 -3
  51. data/lib/vedeu/null/generic.rb +6 -1
  52. data/lib/vedeu/null/geometry.rb +6 -4
  53. data/lib/vedeu/null/interface.rb +9 -10
  54. data/lib/vedeu/output/all.rb +21 -21
  55. data/lib/vedeu/{repositories/repositories → output}/borders.rb +0 -0
  56. data/lib/vedeu/output/clear/all.rb +2 -2
  57. data/lib/vedeu/output/html_char.rb +1 -1
  58. data/lib/vedeu/output/presentation.rb +25 -0
  59. data/lib/vedeu/output/refresh.rb +1 -1
  60. data/lib/vedeu/output/refresh_group.rb +5 -3
  61. data/lib/vedeu/output/renderers/all.rb +8 -8
  62. data/lib/vedeu/output/renderers/html.rb +2 -2
  63. data/lib/vedeu/repositories/all.rb +5 -7
  64. data/lib/vedeu/repositories/collection.rb +42 -0
  65. data/lib/vedeu/repositories/model.rb +2 -2
  66. data/lib/vedeu/repositories/repository.rb +11 -2
  67. data/lib/vedeu/templating/all.rb +4 -3
  68. data/lib/vedeu/templating/template.rb +75 -0
  69. data/lib/vedeu/{support/terminal.rb → terminal.rb} +0 -0
  70. data/lib/vedeu/{support/timer.rb → timer.rb} +0 -0
  71. data/lib/vedeu/version.rb +1 -1
  72. data/test/lib/vedeu/application/view_test.rb +11 -1
  73. data/test/lib/vedeu/bootstrap_test.rb +5 -5
  74. data/test/lib/vedeu/{repositories/repositories → buffers}/buffers_test.rb +0 -0
  75. data/test/lib/vedeu/cli/generator/helpers_test.rb +1 -1
  76. data/test/lib/vedeu/{output → colours}/background_test.rb +0 -0
  77. data/test/lib/vedeu/{repositories/repositories → colours}/backgrounds_test.rb +0 -0
  78. data/test/lib/vedeu/{output → colours}/colour_test.rb +0 -0
  79. data/test/lib/vedeu/{output → colours}/colour_translator_test.rb +0 -0
  80. data/test/lib/vedeu/{repositories/repositories → colours}/colours_test.rb +0 -0
  81. data/test/lib/vedeu/{output → colours}/foreground_test.rb +0 -0
  82. data/test/lib/vedeu/{repositories/repositories → colours}/foregrounds_test.rb +0 -0
  83. data/test/lib/vedeu/{support/common_test.rb → common_test.rb} +0 -0
  84. data/test/lib/vedeu/{repositories/repositories → cursor}/cursors_test.rb +0 -21
  85. data/test/lib/vedeu/dsl/composition_test.rb +1 -1
  86. data/test/lib/vedeu/dsl/use_test.rb +9 -0
  87. data/test/lib/vedeu/{repositories/repositories → events}/events_test.rb +0 -0
  88. data/test/lib/vedeu/{repositories/repositories → geometry}/geometries_test.rb +0 -0
  89. data/test/lib/vedeu/{repositories/repositories → input}/keymaps_test.rb +0 -0
  90. data/test/lib/vedeu/{support/log_test.rb → log_test.rb} +0 -0
  91. data/test/lib/vedeu/models/groups_test.rb +21 -0
  92. data/test/lib/vedeu/{repositories/repositories → models}/interfaces_test.rb +0 -0
  93. data/test/lib/vedeu/{repositories/repositories → models}/menus_test.rb +0 -0
  94. data/test/lib/vedeu/{support → models}/toggleable_test.rb +0 -0
  95. data/test/lib/vedeu/null/border_test.rb +9 -1
  96. data/test/lib/vedeu/null/buffer_test.rb +9 -1
  97. data/test/lib/vedeu/null/generic_test.rb +10 -1
  98. data/test/lib/vedeu/null/geometry_test.rb +9 -1
  99. data/test/lib/vedeu/null/interface_test.rb +11 -8
  100. data/test/lib/vedeu/{repositories/repositories → output}/borders_test.rb +0 -0
  101. data/test/lib/vedeu/output/compressor_test.rb +47 -2
  102. data/test/lib/vedeu/output/refresh_group_test.rb +5 -5
  103. data/test/lib/vedeu/output/refresh_test.rb +1 -1
  104. data/test/lib/vedeu/repositories/collection_test.rb +78 -0
  105. data/test/lib/vedeu/repositories/repository_test.rb +8 -3
  106. data/test/lib/vedeu/templating/template_test.rb +46 -0
  107. data/test/lib/vedeu/{support/terminal_test.rb → terminal_test.rb} +0 -0
  108. data/test/lib/vedeu/{support/timer_test.rb → timer_test.rb} +0 -0
  109. data/test/support/all_seeds.sh +9 -0
  110. data/test/support/templates/inline.erb +1 -0
  111. data/test/test_helper.rb +7 -1
  112. metadata +74 -78
  113. data/lib/vedeu/output/view_helpers/all.rb +0 -5
  114. data/lib/vedeu/output/view_helpers/view_helpers.rb +0 -21
  115. data/lib/vedeu/repositories/collections/all.rb +0 -47
  116. data/lib/vedeu/repositories/repositories/all.rb +0 -14
  117. data/lib/vedeu/support/all.rb +0 -5
  118. data/lib/vedeu/support/template.rb +0 -73
  119. data/test/lib/vedeu/output/view_helpers/view_helpers_test.rb +0 -30
  120. data/test/lib/vedeu/repositories/collections/all_test.rb +0 -83
  121. data/test/lib/vedeu/repositories/repositories/groups_test.rb +0 -35
  122. data/test/lib/vedeu/support/template_test.rb +0 -44
@@ -2,7 +2,7 @@ require 'vedeu/models/char'
2
2
  require 'vedeu/models/stream'
3
3
  require 'vedeu/models/line'
4
4
  require 'vedeu/buffers/display_buffer'
5
- require 'vedeu/support/toggleable'
5
+ require 'vedeu/models/toggleable'
6
6
 
7
7
  module Vedeu
8
8
 
@@ -34,6 +34,6 @@ module Vedeu
34
34
 
35
35
  repo Vedeu::Interfaces.repository
36
36
 
37
- end
37
+ end # Interface
38
38
 
39
39
  end # Vedeu
@@ -43,7 +43,7 @@ module Vedeu
43
43
  # @param name [String]
44
44
  # @return [void]
45
45
  def hide(name = nil)
46
- model_by_name(name, self.repository).hide
46
+ model_by_name(name, repository).hide
47
47
  end
48
48
  alias_method :hide_cursor, :hide
49
49
  alias_method :hide_group, :hide
@@ -52,7 +52,7 @@ module Vedeu
52
52
  # @param name [String]
53
53
  # @return [void]
54
54
  def show(name = nil)
55
- model_by_name(name, self.repository).show
55
+ model_by_name(name, repository).show
56
56
  end
57
57
  alias_method :show_cursor, :show
58
58
  alias_method :show_group, :show
@@ -61,7 +61,7 @@ module Vedeu
61
61
  # @param name [String]
62
62
  # @return [void]
63
63
  def toggle(name = nil)
64
- model_by_name(name, self.repository).toggle
64
+ model_by_name(name, repository).toggle
65
65
  end
66
66
  alias_method :toggle_cursor, :toggle
67
67
  alias_method :toggle_group, :toggle
@@ -79,7 +79,7 @@ module Vedeu
79
79
  # @param name [String]
80
80
  # @return [void]
81
81
  def model_name(name = nil)
82
- return name || Vedeu.focus
82
+ name || Vedeu.focus
83
83
  end
84
84
 
85
85
  end # ClassMethods
@@ -11,8 +11,8 @@ module Vedeu
11
11
 
12
12
  end
13
13
 
14
- require_relative 'border'
15
- require_relative 'buffer'
16
- require_relative 'generic'
17
- require_relative 'geometry'
18
- require_relative 'interface'
14
+ require 'vedeu/null/border'
15
+ require 'vedeu/null/buffer'
16
+ require 'vedeu/null/generic'
17
+ require 'vedeu/null/geometry'
18
+ require 'vedeu/null/interface'
@@ -14,10 +14,12 @@ module Vedeu
14
14
 
15
15
  # Returns a new instance of Vedeu::Null::Border.
16
16
  #
17
- # @param name [String|NilClass]
17
+ # @param attributes [Hash<Symbol => void>]
18
+ # @option attributes name [String|NilClass]
18
19
  # @return [Vedeu::Null::Border]
19
- def initialize(name = nil)
20
- @name = name
20
+ def initialize(attributes = {})
21
+ @attributes = attributes
22
+ @name = @attributes[:name]
21
23
  end
22
24
 
23
25
  # @return [Fixnum]
@@ -14,10 +14,12 @@ module Vedeu
14
14
 
15
15
  # Returns a new instance of Vedeu::Null::Buffer.
16
16
  #
17
- # @param name [String]
17
+ # @param attributes [Hash<Symbol => void>]
18
+ # @option attributes name [String|NilClass]
18
19
  # @return [Vedeu::Null::Buffer]
19
- def initialize(name)
20
- @name = name
20
+ def initialize(attributes = {})
21
+ @attributes = attributes
22
+ @name = @attributes[:name]
21
23
  end
22
24
 
23
25
  # @return [NilClass]
@@ -9,8 +9,13 @@ module Vedeu
9
9
 
10
10
  # Returns an instance of the Vedeu::Null::Generic class.
11
11
  #
12
+ # @param attributes [Hash<Symbol => void>]
13
+ # @option attributes name [String|NilClass]
12
14
  # @return [Vedeu::Null::Generic]
13
- def initialize; end
15
+ def initialize(attributes = {})
16
+ @attributes = attributes
17
+ @name = @attributes[:name]
18
+ end
14
19
 
15
20
  # @return [NilClass]
16
21
  def add(*)
@@ -35,11 +35,13 @@ module Vedeu
35
35
 
36
36
  # Returns a new instance of Vedeu::Null::Geometry.
37
37
  #
38
- # @param name [String|NilClass]
38
+ # @param attributes [Hash<Symbol => void>]
39
+ # @option attributes name [String|NilClass]
39
40
  # @return [Vedeu::Null::Geometry]
40
- def initialize(name = nil)
41
- @name = name
42
- @maximised = false
41
+ def initialize(attributes = {})
42
+ @attributes = attributes
43
+ @name = @attributes[:name]
44
+ @maximised = @attributes.fetch(:maximised, false)
43
45
  end
44
46
 
45
47
  # @return [FalseClass]
@@ -15,19 +15,18 @@ module Vedeu
15
15
  # @return [String]
16
16
  attr_reader :name
17
17
 
18
+ # @!attribute [r] attributes
19
+ # @return [String]
20
+ attr_reader :attributes
21
+
18
22
  # Returns a new instance of Vedeu::Null::Interface.
19
23
  #
20
- # @param name [String]
24
+ # @param attributes [Hash<Symbol => void>]
25
+ # @option attributes name [String]
21
26
  # @return [Vedeu::Null::Interface]
22
- def initialize(name = nil)
23
- @name = name
24
- end
25
-
26
- # @return [Hash<Symbol => String>]
27
- def attributes
28
- {
29
- name: name,
30
- }
27
+ def initialize(attributes = {})
28
+ @attributes = attributes
29
+ @name = @attributes[:name]
31
30
  end
32
31
 
33
32
  # @return [NilClass]
@@ -1,21 +1,21 @@
1
- require_relative 'esc'
2
- require_relative 'colour_translator'
3
- require_relative 'background'
4
- require_relative 'foreground'
5
- require_relative 'presentation'
6
- require_relative 'border'
7
- require_relative 'colour'
8
- require_relative 'compressor'
9
- require_relative 'clear/all'
10
- require_relative 'style'
11
- require_relative 'text'
12
- require_relative 'virtual_buffer'
13
- require_relative 'html_char'
14
- require_relative 'refresh_group'
15
- require_relative 'refresh'
16
- require_relative 'renderers/all'
17
- require_relative 'output'
18
- require_relative 'viewport'
19
- require_relative 'virtual_terminal'
20
- require_relative 'wordwrap'
21
- require_relative 'view_helpers/all'
1
+ require 'vedeu/output/esc'
2
+ require 'vedeu/colours/colour_translator'
3
+ require 'vedeu/colours/background'
4
+ require 'vedeu/colours/foreground'
5
+ require 'vedeu/output/presentation'
6
+ require 'vedeu/output/borders'
7
+ require 'vedeu/output/border'
8
+ require 'vedeu/colours/colour'
9
+ require 'vedeu/output/compressor'
10
+ require 'vedeu/output/clear/all'
11
+ require 'vedeu/output/style'
12
+ require 'vedeu/output/text'
13
+ require 'vedeu/output/virtual_buffer'
14
+ require 'vedeu/output/html_char'
15
+ require 'vedeu/output/refresh_group'
16
+ require 'vedeu/output/refresh'
17
+ require 'vedeu/output/renderers/all'
18
+ require 'vedeu/output/output'
19
+ require 'vedeu/output/viewport'
20
+ require 'vedeu/output/virtual_terminal'
21
+ require 'vedeu/output/wordwrap'
@@ -9,5 +9,5 @@ module Vedeu
9
9
 
10
10
  end # Vedeu
11
11
 
12
- require_relative 'named_group'
13
- require_relative 'named_interface'
12
+ require 'vedeu/output/clear/named_group'
13
+ require 'vedeu/output/clear/named_interface'
@@ -1,4 +1,4 @@
1
- require 'vedeu/support/common'
1
+ require 'vedeu/common'
2
2
 
3
3
  module Vedeu
4
4
 
@@ -6,6 +6,9 @@ module Vedeu
6
6
  # @api private
7
7
  module Presentation
8
8
 
9
+ # Returns the background colour for the model, or if it does not exist,
10
+ # returns the parent background colour, or an empty Vedeu::Background.
11
+ #
9
12
  # @return [Vedeu::Background]
10
13
  def background
11
14
  @background ||= if colour
@@ -17,6 +20,9 @@ module Vedeu
17
20
  end
18
21
  end
19
22
 
23
+ # Allows the setting of the background colour by coercing the given value
24
+ # into a Vedeu::Background colour.
25
+ #
20
26
  # @return [Vedeu::Background]
21
27
  def background=(value)
22
28
  self.colour = Vedeu::Colour.coerce(
@@ -38,11 +44,17 @@ module Vedeu
38
44
  end
39
45
  end
40
46
 
47
+ # Allows the setting of the model's colour by coercing the given value into
48
+ # a Vedeu::Colour.
49
+ #
41
50
  # @return [Vedeu::Colour]
42
51
  def colour=(value)
43
52
  @colour = attributes[:colour] = Vedeu::Colour.coerce(value)
44
53
  end
45
54
 
55
+ # Returns the foreground colour for the model, or if it does not exist,
56
+ # returns the parent foreground colour, or an empty Vedeu::Foreground.
57
+ #
46
58
  # @return [Vedeu::Foreground]
47
59
  def foreground
48
60
  @foreground ||= if colour
@@ -54,6 +66,9 @@ module Vedeu
54
66
  end
55
67
  end
56
68
 
69
+ # Allows the setting of the foreground colour by coercing the given value
70
+ # into a Vedeu::Foreground colour.
71
+ #
57
72
  # @return [Vedeu::Foreground]
58
73
  def foreground=(value)
59
74
  self.colour = Vedeu::Colour.coerce(
@@ -61,6 +76,9 @@ module Vedeu
61
76
  background: colour.background)
62
77
  end
63
78
 
79
+ # Returns the parent background colour if a parent colour is available, or
80
+ # an empty Vedeu::Background.
81
+ #
64
82
  # @return [Vedeu::Background]
65
83
  def parent_background
66
84
  if parent_colour
@@ -72,11 +90,16 @@ module Vedeu
72
90
  end
73
91
  end
74
92
 
93
+ # Returns the parent colour if available or NilClass.
94
+ #
75
95
  # @return [String|NilClass]
76
96
  def parent_colour
77
97
  parent.colour if parent
78
98
  end
79
99
 
100
+ # Returns the parent foreground colour if a parent colour is available, or
101
+ # an empty Vedeu::Foreground.
102
+ #
80
103
  # @return [Vedeu::Foreground]
81
104
  def parent_foreground
82
105
  if parent_colour
@@ -88,6 +111,8 @@ module Vedeu
88
111
  end
89
112
  end
90
113
 
114
+ # Returns the parent style if available or NilClass.
115
+ #
91
116
  # @return [String|NilClass]
92
117
  def parent_style
93
118
  if parent
@@ -1,4 +1,4 @@
1
- require_relative 'refresh_group'
1
+ require 'vedeu/output/refresh_group'
2
2
 
3
3
  module Vedeu
4
4
 
@@ -1,4 +1,4 @@
1
- require_relative 'refresh'
1
+ require 'vedeu/output/refresh'
2
2
 
3
3
  module Vedeu
4
4
 
@@ -46,8 +46,10 @@ module Vedeu
46
46
 
47
47
  # @return [Set]
48
48
  def members
49
- fail Vedeu::MissingRequired,
50
- 'Cannot refresh group with an empty group name.' unless present?(name)
49
+ unless present?(name)
50
+ fail Vedeu::MissingRequired,
51
+ 'Cannot refresh group with an empty group name.'
52
+ end
51
53
 
52
54
  Vedeu.groups.by_name(name).members
53
55
  end
@@ -1,11 +1,11 @@
1
- require_relative 'renderer_options'
2
- require_relative 'escape_sequence'
3
- require_relative 'file'
4
- require_relative 'html'
5
- require_relative 'json'
6
- require_relative 'null'
7
- require_relative 'terminal'
8
- require_relative 'text'
1
+ require 'vedeu/output/renderers/renderer_options'
2
+ require 'vedeu/output/renderers/escape_sequence'
3
+ require 'vedeu/output/renderers/file'
4
+ require 'vedeu/output/renderers/html'
5
+ require 'vedeu/output/renderers/json'
6
+ require 'vedeu/output/renderers/null'
7
+ require 'vedeu/output/renderers/terminal'
8
+ require 'vedeu/output/renderers/text'
9
9
 
10
10
  module Vedeu
11
11
 
@@ -21,10 +21,10 @@ module Vedeu
21
21
  @options[:content] = output
22
22
 
23
23
  if write_file?
24
- super(Vedeu::Template.parse(self, template))
24
+ super(Vedeu::Templating::Template.parse(self, template))
25
25
 
26
26
  else
27
- Vedeu::Template.parse(self, template)
27
+ Vedeu::Templating::Template.parse(self, template)
28
28
 
29
29
  end
30
30
  end
@@ -56,10 +56,8 @@ module Vedeu
56
56
 
57
57
  end # Vedeu
58
58
 
59
- require_relative 'store'
60
- require_relative 'registerable'
61
- require_relative 'collection'
62
- require_relative 'collections/all'
63
- require_relative 'model'
64
- require_relative 'repositories/all'
65
- require_relative 'repository'
59
+ require 'vedeu/repositories/store'
60
+ require 'vedeu/repositories/registerable'
61
+ require 'vedeu/repositories/collection'
62
+ require 'vedeu/repositories/model'
63
+ require 'vedeu/repositories/repository'
@@ -96,4 +96,46 @@ module Vedeu
96
96
 
97
97
  end # Collection
98
98
 
99
+ # A collection of {Vedeu::Char} instances.
100
+ #
101
+ # @api private
102
+ class Chars < Vedeu::Collection
103
+
104
+ end # Chars
105
+
106
+ # A collection of {Vedeu::Event} instances.
107
+ #
108
+ # @api private
109
+ class EventCollection < Vedeu::Collection
110
+
111
+ end # EventCollection
112
+
113
+ # A collection of {Vedeu::Interface} instances.
114
+ #
115
+ # @api private
116
+ class InterfaceCollection < Vedeu::Collection
117
+
118
+ end # InterfaceCollection
119
+
120
+ # A collection of {Vedeu::Key} instances.
121
+ #
122
+ # @api private
123
+ class Keys < Vedeu::Collection
124
+
125
+ end # Keys
126
+
127
+ # A collection of {Vedeu::Line} instances.
128
+ #
129
+ # @api private
130
+ class Lines < Vedeu::Collection
131
+
132
+ end # Lines
133
+
134
+ # A collection of {Vedeu::Stream} instances.
135
+ #
136
+ # @api private
137
+ class Streams < Vedeu::Collection
138
+
139
+ end # Streams
140
+
99
141
  end # Vedeu
@@ -1,4 +1,4 @@
1
- require 'vedeu/support/common'
1
+ require 'vedeu/common'
2
2
 
3
3
  module Vedeu
4
4
 
@@ -19,7 +19,7 @@ module Vedeu
19
19
  #
20
20
  module ClassMethods
21
21
 
22
- # @!attribute [r]
22
+ # @!attribute [r] repository
23
23
  # @return [Vedeu::Repository]
24
24
  attr_reader :repository
25
25