vedeu 0.4.40 → 0.4.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +23 -28
  3. data/Guardfile +0 -8
  4. data/Rakefile +0 -6
  5. data/docs/applications.md +0 -1
  6. data/docs/dsl.md +7 -12
  7. data/examples/borders_app.rb +5 -0
  8. data/examples/configuration_app.rb +5 -0
  9. data/examples/drb_app.rb +5 -0
  10. data/examples/geometry_app.rb +5 -0
  11. data/examples/material_colours_app.rb +5 -0
  12. data/examples/panel_app.rb +5 -0
  13. data/examples/typed_commands/typed_commands_app.rb +5 -0
  14. data/examples/view_templates_app/view_templates_app.rb +5 -0
  15. data/lib/vedeu/api.rb +8 -8
  16. data/lib/vedeu/application/all.rb +3 -0
  17. data/lib/vedeu/application/application_controller.rb +4 -0
  18. data/lib/vedeu/application/application_helper.rb +4 -0
  19. data/lib/vedeu/application/application_view.rb +6 -0
  20. data/lib/vedeu/application/controller.rb +23 -0
  21. data/lib/vedeu/application/helper.rb +23 -0
  22. data/lib/vedeu/application/view.rb +23 -0
  23. data/lib/vedeu/application.rb +1 -3
  24. data/lib/vedeu/bindings.rb +64 -65
  25. data/lib/vedeu/bootstrap.rb +2 -0
  26. data/lib/vedeu/buffers/buffer.rb +44 -0
  27. data/lib/vedeu/configuration/api.rb +44 -119
  28. data/lib/vedeu/configuration/cli.rb +2 -0
  29. data/lib/vedeu/configuration/configuration.rb +4 -20
  30. data/lib/vedeu/cursor/cursor.rb +7 -7
  31. data/lib/vedeu/cursor/reposition.rb +2 -0
  32. data/lib/vedeu/dsl/border.rb +58 -2
  33. data/lib/vedeu/dsl/composition.rb +5 -3
  34. data/lib/vedeu/dsl/geometry.rb +14 -5
  35. data/lib/vedeu/dsl/group.rb +2 -0
  36. data/lib/vedeu/dsl/interface.rb +23 -3
  37. data/lib/vedeu/dsl/keymap.rb +11 -6
  38. data/lib/vedeu/dsl/line.rb +8 -0
  39. data/lib/vedeu/dsl/menu.rb +3 -1
  40. data/lib/vedeu/dsl/presentation.rb +12 -3
  41. data/lib/vedeu/dsl/text.rb +2 -0
  42. data/lib/vedeu/dsl/view.rb +6 -1
  43. data/lib/vedeu/events/event.rb +3 -1
  44. data/lib/vedeu/generator/application.rb +2 -7
  45. data/lib/vedeu/generator/templates/application/app/models/keymaps/_global_.rb +5 -0
  46. data/lib/vedeu/generator/templates/application/app/views/interfaces/name.erb +10 -0
  47. data/lib/vedeu/generator/view.rb +2 -0
  48. data/lib/vedeu/geometry/geometry.rb +14 -0
  49. data/lib/vedeu/geometry/index_position.rb +1 -0
  50. data/lib/vedeu/geometry/position.rb +5 -0
  51. data/lib/vedeu/input/all.rb +0 -8
  52. data/lib/vedeu/input/input.rb +24 -8
  53. data/lib/vedeu/input/mapper.rb +5 -12
  54. data/lib/vedeu/models/composition.rb +3 -3
  55. data/lib/vedeu/models/escape_char.rb +2 -0
  56. data/lib/vedeu/models/focus.rb +8 -0
  57. data/lib/vedeu/models/interface.rb +1 -1
  58. data/lib/vedeu/models/line.rb +1 -5
  59. data/lib/vedeu/models/menu.rb +4 -2
  60. data/lib/vedeu/models/panel.rb +2 -0
  61. data/lib/vedeu/null/buffer.rb +2 -0
  62. data/lib/vedeu/null/interface.rb +2 -0
  63. data/lib/vedeu/output/background.rb +1 -1
  64. data/lib/vedeu/output/border.rb +5 -157
  65. data/lib/vedeu/output/compressor.rb +2 -0
  66. data/lib/vedeu/output/foreground.rb +1 -1
  67. data/lib/vedeu/output/refresh.rb +5 -9
  68. data/lib/vedeu/output/render_border.rb +230 -0
  69. data/lib/vedeu/output/renderers/escape_sequence.rb +2 -3
  70. data/lib/vedeu/output/renderers/file.rb +10 -9
  71. data/lib/vedeu/repositories/collections/all.rb +4 -4
  72. data/lib/vedeu/repositories/repositories/all.rb +4 -4
  73. data/lib/vedeu/repositories/repositories/{background_colours.rb → backgrounds.rb} +3 -3
  74. data/lib/vedeu/repositories/repositories/cursors.rb +3 -0
  75. data/lib/vedeu/repositories/repositories/{events_repository.rb → events.rb} +5 -5
  76. data/lib/vedeu/repositories/repositories/{foreground_colours.rb → foregrounds.rb} +3 -3
  77. data/lib/vedeu/repositories/repositories/{interfaces_repository.rb → interfaces.rb} +4 -4
  78. data/lib/vedeu/storage/associative_store.rb +2 -0
  79. data/lib/vedeu/storage/conveyor_store.rb +2 -0
  80. data/lib/vedeu/storage/fifo_store.rb +2 -0
  81. data/lib/vedeu/storage/store.rb +7 -7
  82. data/lib/vedeu/support/options.rb +2 -0
  83. data/lib/vedeu/support/terminal.rb +3 -3
  84. data/lib/vedeu/support/timer.rb +2 -0
  85. data/lib/vedeu/support/visibility.rb +2 -0
  86. data/lib/vedeu/templating/directive.rb +2 -0
  87. data/lib/vedeu/templating/preprocessor.rb +2 -0
  88. data/lib/vedeu/version.rb +1 -1
  89. data/lib/vedeu.rb +3 -1
  90. data/test/lib/vedeu/bindings_test.rb +15 -0
  91. data/test/lib/vedeu/buffers/buffer_test.rb +12 -0
  92. data/test/lib/vedeu/configuration/api_test.rb +0 -39
  93. data/test/lib/vedeu/configuration/configuration_test.rb +0 -9
  94. data/test/lib/vedeu/cursor/cursor_test.rb +6 -0
  95. data/test/lib/vedeu/dsl/border_test.rb +12 -0
  96. data/test/lib/vedeu/dsl/composition_test.rb +2 -2
  97. data/test/lib/vedeu/geometry/index_position_test.rb +2 -0
  98. data/test/lib/vedeu/geometry/position_test.rb +6 -0
  99. data/test/lib/vedeu/models/cell_test.rb +16 -8
  100. data/test/lib/vedeu/models/char_test.rb +8 -0
  101. data/test/lib/vedeu/models/composition_test.rb +2 -2
  102. data/test/lib/vedeu/models/interface_test.rb +10 -0
  103. data/test/lib/vedeu/models/line_test.rb +12 -0
  104. data/test/lib/vedeu/models/stream_test.rb +1 -13
  105. data/test/lib/vedeu/output/border_test.rb +1 -0
  106. data/test/lib/vedeu/output/presentation_test.rb +2 -0
  107. data/test/lib/vedeu/output/render_border_test.rb +16 -0
  108. data/test/lib/vedeu/output/renderers/file_test.rb +32 -16
  109. data/test/lib/vedeu/repositories/collection_test.rb +7 -0
  110. data/test/lib/vedeu/repositories/collections/all_test.rb +18 -6
  111. data/test/lib/vedeu/repositories/model_test.rb +33 -7
  112. data/test/lib/vedeu/repositories/repositories/{background_colours_test.rb → backgrounds_test.rb} +3 -3
  113. data/test/lib/vedeu/repositories/repositories/borders_test.rb +7 -17
  114. data/test/lib/vedeu/repositories/repositories/buffers_test.rb +7 -22
  115. data/test/lib/vedeu/repositories/repositories/cursors_test.rb +32 -0
  116. data/test/lib/vedeu/repositories/repositories/events_test.rb +22 -0
  117. data/test/lib/vedeu/repositories/repositories/{foreground_colours_test.rb → foregrounds_test.rb} +3 -3
  118. data/test/lib/vedeu/repositories/repositories/geometries_test.rb +7 -21
  119. data/test/lib/vedeu/repositories/repositories/groups_test.rb +11 -0
  120. data/test/lib/vedeu/repositories/repositories/{interfaces_repositories_test.rb → interfaces_test.rb} +14 -3
  121. data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +10 -1
  122. data/test/lib/vedeu/repositories/repositories/menus_test.rb +10 -1
  123. data/test/lib/vedeu/repositories/repository_test.rb +15 -9
  124. data/test/lib/vedeu/storage/conveyor_store_test.rb +2 -4
  125. data/test/lib/vedeu/support/terminal_test.rb +2 -2
  126. data/test/lib/vedeu/templating/helpers_test.rb +4 -0
  127. data/vedeu.gemspec +0 -2
  128. metadata +20 -54
  129. data/config/cucumber.yml +0 -8
  130. data/features/cli_vedeu.feature +0 -5
  131. data/features/start_stop.feature +0 -27
  132. data/features/step_definitions/vedeu_steps.rb +0 -0
  133. data/features/support/env.rb +0 -15
  134. data/lib/vedeu/generator/templates/application/app/models/keymaps/_system_.rb +0 -7
  135. data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +0 -13
  136. data/test/lib/vedeu/repositories/repositories/interfaces_repository_test.rb +0 -11
@@ -36,13 +36,13 @@ module Vedeu
36
36
  Vedeu.bind(:_drb_restart_) { Vedeu::Distributed::Server.restart }
37
37
 
38
38
  # Use the DRb server to request the client application to start.
39
- Vedeu.bind(:_drb_start_) { Vedeu::Distributed::Server.start }
39
+ Vedeu.bind(:_drb_start_) { Vedeu::Distributed::Server.start }
40
40
 
41
41
  # Use the DRb server to request the status of the client application.
42
- Vedeu.bind(:_drb_status_) { Vedeu::Distributed::Server.status }
42
+ Vedeu.bind(:_drb_status_) { Vedeu::Distributed::Server.status }
43
43
 
44
44
  # Use the DRb server to request the client application to stop.
45
- Vedeu.bind(:_drb_stop_) { Vedeu::Distributed::Server.stop }
45
+ Vedeu.bind(:_drb_stop_) { Vedeu::Distributed::Server.stop }
46
46
 
47
47
  # Vedeu triggers this event when `:_exit_` is triggered. You can hook into
48
48
  # this to perform a special action before the application terminates. Saving
@@ -86,28 +86,44 @@ module Vedeu
86
86
  # events. Please see those events for their behaviour.
87
87
  Vedeu.bind(:_resize_, delay: 0.15) { Vedeu.resize }
88
88
 
89
- # Hide the cursor of the named interface or interface currently in focus.
90
- Vedeu.bind(:_cursor_hide_) do |name|
91
- Vedeu::Visibility.for_cursor(name).hide
89
+ # @see {Vedeu::Move}
90
+ Vedeu.bind(:_cursor_down_) do |name|
91
+ Vedeu::Move.by_name(Vedeu::Cursor, :down, name)
92
92
  end
93
93
 
94
- # Show the cursor of the named interface or interface currently in focus.
95
- Vedeu.bind(:_cursor_show_) do |name|
96
- Vedeu::Visibility.for_cursor(name).show
94
+ # @see {Vedeu::Move}
95
+ Vedeu.bind(:_cursor_left_) do |name|
96
+ Vedeu::Move.by_name(Vedeu::Cursor, :left, name)
97
97
  end
98
98
 
99
99
  # @see {Vedeu::Move}
100
- %w(cursor view).each do |model|
101
- [:down, :left, :right, :up].each do |direction|
102
- Vedeu.bind("_#{model}_#{direction}_".to_sym) do |name|
103
- klass = {
104
- 'cursor' => Vedeu::Cursor,
105
- 'view' => Vedeu::Geometry,
106
- }.fetch(model)
107
-
108
- Vedeu::Move.by_name(klass, direction, name)
109
- end
110
- end
100
+ Vedeu.bind(:_cursor_right_) do |name|
101
+ Vedeu::Move.by_name(Vedeu::Cursor, :right, name)
102
+ end
103
+
104
+ # @see {Vedeu::Move}
105
+ Vedeu.bind(:_cursor_up_) do |name|
106
+ Vedeu::Move.by_name(Vedeu::Cursor, :up, name)
107
+ end
108
+
109
+ # @see {Vedeu::Move}
110
+ Vedeu.bind(:_geometry_down_) do |name|
111
+ Vedeu::Move.by_name(Vedeu::Geometry, :down, name)
112
+ end
113
+
114
+ # @see {Vedeu::Move}
115
+ Vedeu.bind(:_geometry_left_) do |name|
116
+ Vedeu::Move.by_name(Vedeu::Geometry, :left, name)
117
+ end
118
+
119
+ # @see {Vedeu::Move}
120
+ Vedeu.bind(:_geometry_right_) do |name|
121
+ Vedeu::Move.by_name(Vedeu::Geometry, :right, name)
122
+ end
123
+
124
+ # @see {Vedeu::Move}
125
+ Vedeu.bind(:_geometry_up_) do |name|
126
+ Vedeu::Move.by_name(Vedeu::Geometry, :up, name)
111
127
  end
112
128
 
113
129
  # @see {Vedeu::Move}
@@ -117,10 +133,7 @@ module Vedeu
117
133
 
118
134
  # When triggered will return the current position of the cursor.
119
135
  Vedeu.bind(:_cursor_position_) do |name|
120
- named = name ? name : Vedeu.focus
121
- cursor = Vedeu.cursors.by_name(named)
122
-
123
- Vedeu::Position.new(cursor.y, cursor.x) if cursor
136
+ Vedeu.cursors.by_name(name).position
124
137
  end
125
138
 
126
139
  # Move the cursor to a relative position inside the interface.
@@ -191,9 +204,6 @@ module Vedeu
191
204
  # if given.
192
205
  Vedeu.bind(:_clear_) { |name| Vedeu::Clear.by_name(name) }
193
206
 
194
- # Clears the spaces occupied by the interfaces belonging to the named group.
195
- Vedeu.bind(:_clear_group_) { |name| Vedeu::Clear.by_group(name) }
196
-
197
207
  # Will cause all interfaces to refresh, or the named interface if given.
198
208
  #
199
209
  # @note
@@ -209,12 +219,14 @@ module Vedeu
209
219
  # Will cause all interfaces in the named group to refresh.
210
220
  Vedeu.bind(:_refresh_group_) { |name| Vedeu::Refresh.by_group(name) }
211
221
 
212
- # Will clear the terminal and then show all of the interfaces belonging to
213
- # the named group.
214
- Vedeu.bind(:_show_group_) do |name|
215
- Vedeu.trigger(:_clear_)
216
- Vedeu.trigger(:_refresh_group_, name)
222
+ # Clears the spaces occupied by the interfaces belonging to the named group.
223
+ Vedeu.bind(:_clear_group_) { |name| Vedeu::Clear.by_group(name) }
224
+
225
+ # Hide the cursor of the named interface or interface currently in focus.
226
+ Vedeu.bind(:_hide_cursor_) do |name|
227
+ Vedeu::Visibility.for_cursor(name).hide
217
228
  end
229
+ Vedeu.bind(:_cursor_hide_) { |name| Vedeu.trigger(:_hide_cursor_, name) }
218
230
 
219
231
  # Will hide all of the interfaces belonging to the named group. Useful for
220
232
  # hiding part of that which is currently displaying in the terminal.
@@ -222,50 +234,37 @@ module Vedeu
222
234
  # @note
223
235
  # This may be rarely used, since the action of showing a group using
224
236
  # `Vedeu.trigger(:_show_group_, group_name)` will effectively clear the
225
- # terminal and show the new group.
237
+ # terminal and show the new group.}
226
238
  Vedeu.bind(:_hide_group_) { |name| Vedeu.trigger(:_clear_group_, name) }
227
239
 
228
- # Will hide the named interface. If the interface is currently visible, it
229
- # will be cleared- rendered blank. To show the interface, the
230
- # ':_show_interface_' event should be triggered.
231
- # Triggering the ':_hide_group_' event to which this named interface belongs
232
- # will also hide the interface.
240
+ # @see Vedeu::Buffer#hide
233
241
  Vedeu.bind(:_hide_interface_) { |name| Vedeu.buffers.by_name(name).hide }
234
242
 
235
- # Will show the named interface. If the interface is currently invisible, it
236
- # will be shown- rendered with its latest content. To hide the interface,
237
- # the ':_hide_interface_' event should be triggered.
238
- # Triggering the ':_show_group_' event to which this named interface belongs
239
- # will also show the interface.
240
- Vedeu.bind(:_show_interface_) { |name| Vedeu.buffers.by_name(name).show }
243
+ # Show the cursor of the named interface or interface currently in focus.
244
+ Vedeu.bind(:_show_cursor_) do |name|
245
+ Vedeu::Visibility.for_cursor(name).show
246
+ end
247
+ Vedeu.bind(:_cursor_show_) { |name| Vedeu.trigger(:_show_cursor_, name) }
241
248
 
242
- # Will toggle the visibility of the named interface. If the interface is
243
- # currently visible, the area it occupies will be clears and the interface
244
- # will be marked invisible. If the interface is invisible, then the
245
- # interface will be marked visible and rendered in the area it occupies.
246
- #
247
- # @note
248
- # If an interface is marked visible whilst another view is occupying some
249
- # or all of the interface's current position, the interface will overwrite
250
- # this area- this may cause visual corruption.
251
- Vedeu.bind(:_toggle_interface_) do |name|
252
- if Vedeu.interfaces.by_name(name).visible?
253
- Vedeu.trigger(:_hide_interface_, name)
249
+ # Will clear the terminal and then show all of the interfaces belonging to
250
+ # the named group.
251
+ Vedeu.bind(:_show_group_) do |name|
252
+ Vedeu.trigger(:_clear_)
253
+ Vedeu.trigger(:_refresh_group_, name)
254
+ end
254
255
 
255
- else
256
- Vedeu.trigger(:_show_interface_, name)
256
+ # @see Vedeu::Buffer#show
257
+ Vedeu.bind(:_show_interface_) { |name| Vedeu.buffers.by_name(name).show }
257
258
 
258
- end
259
+ # @see Vedeu::Buffer#toggle
260
+ Vedeu.bind(:_toggle_interface_) do |name|
261
+ Vedeu.buffers.by_name(name).toggle
259
262
  end
260
263
 
261
- # Will maximise the named interface geometry. This means it will occupy all
262
- # of the available space on the terminal window.
264
+ # @see Vedeu::Geometry#maximise
263
265
  Vedeu.bind(:_maximise_) { |name| Vedeu.geometries.by_name(name).maximise }
264
266
 
265
- # Will unmaximise the named interface geometry. Previously, if a geometry
266
- # was maximised, then triggering the unmaximise event will return it to its
267
- # usual defined size (terminal size permitting: if the terminal has been
268
- # resized, then the new geometry size should adapt).
267
+ # @see Vedeu::Geometry#unmaximise
269
268
  Vedeu.bind(:_unmaximise_) do |name|
270
269
  Vedeu.geometries.by_name(name).unmaximise
271
270
  end
@@ -13,6 +13,8 @@ module Vedeu
13
13
  new(argv, entry_point).start
14
14
  end
15
15
 
16
+ # Returns a new instance of Vedeu::Bootstrap.
17
+ #
16
18
  # @param argv [Array<String>]
17
19
  # @param entry_point [void]
18
20
  # @return [Vedeu::Bootstrap]
@@ -106,6 +106,15 @@ module Vedeu
106
106
 
107
107
  # Hide this buffer.
108
108
  #
109
+ # @example
110
+ # Vedeu.trigger(:_hide_interface_, name)
111
+ #
112
+ # Will hide the named interface. If the interface is currently visible, it
113
+ # will be cleared- rendered blank. To show the interface, the
114
+ # ':_show_interface_' event should be triggered.
115
+ # Triggering the ':_hide_group_' event to which this named interface belongs
116
+ # will also hide the interface.
117
+ #
109
118
  # @return [void]
110
119
  def hide
111
120
  return nil unless visible?
@@ -133,6 +142,15 @@ module Vedeu
133
142
 
134
143
  # Show this buffer.
135
144
  #
145
+ # @example
146
+ # Vedeu.trigger(:_show_interface_, name)
147
+ #
148
+ # Will show the named interface. If the interface is currently invisible, it
149
+ # will be shown- rendered with its latest content. To hide the interface,
150
+ # the ':_hide_interface_' event should be triggered.
151
+ # Triggering the ':_show_group_' event to which this named interface belongs
152
+ # will also show the interface.
153
+ #
136
154
  # @return [void]
137
155
  def show
138
156
  return nil if visible?
@@ -141,6 +159,32 @@ module Vedeu
141
159
  render
142
160
  end
143
161
 
162
+ # Toggles the visibility of this buffer.
163
+ #
164
+ # @example
165
+ # Vedeu.trigger(:_toggle_interface_, name)
166
+ #
167
+ # Will toggle the visibility of the named interface. If the interface is
168
+ # currently visible, the area it occupies will be clears and the interface
169
+ # will be marked invisible. If the interface is invisible, then the
170
+ # interface will be marked visible and rendered in the area it occupies.
171
+ #
172
+ # @note
173
+ # If an interface is marked visible whilst another view is occupying some
174
+ # or all of the interface's current position, the interface will overwrite
175
+ # this area- this may cause visual corruption.
176
+ #
177
+ # @return [void]
178
+ def toggle
179
+ if visible?
180
+ hide
181
+
182
+ else
183
+ show
184
+
185
+ end
186
+ end
187
+
144
188
  private
145
189
 
146
190
  # Retrieve the latest content from the buffer.
@@ -15,13 +15,16 @@ module Vedeu
15
15
  new(&block).configuration
16
16
  end
17
17
 
18
+ # Returns a new instance of Vedeu::Config::API.
19
+ #
18
20
  # Configure Vedeu via a simple configuration API DSL. Options set here
19
21
  # override the default Vedeu configuration set in
20
22
  # {Vedeu::Configuration#defaults}.
21
23
  #
22
24
  # @example
23
25
  # Vedeu.configure do
24
- # ...
26
+ # # ...
27
+ # end
25
28
  #
26
29
  # @param block [Proc]
27
30
  # @return [Configuration::API]
@@ -33,9 +36,6 @@ module Vedeu
33
36
  #
34
37
  # @return [Hash<Symbol => Boolean, Fixnum, String>]
35
38
  def configuration
36
- new_system_keys = Configuration.default_system_keys.merge!(system_keys)
37
- options.merge!(system_keys: new_system_keys) if system_keys.any?
38
-
39
39
  Vedeu::Config.log(Esc.green { '[api]' }, options)
40
40
  end
41
41
 
@@ -45,11 +45,13 @@ module Vedeu
45
45
  # @example
46
46
  # Vedeu.configure do
47
47
  # interactive!
48
- # ...
48
+ # # ...
49
+ # end
49
50
  #
50
51
  # Vedeu.configure do
51
52
  # interactive false
52
- # ...
53
+ # # ...
54
+ # end
53
55
  #
54
56
  # @param value [Boolean]
55
57
  # @return [Boolean]
@@ -64,7 +66,8 @@ module Vedeu
64
66
  # @example
65
67
  # Vedeu.configure do
66
68
  # standalone!
67
- # ...
69
+ # # ...
70
+ # end
68
71
  #
69
72
  # @param value [Boolean]
70
73
  # @return [Boolean]
@@ -80,7 +83,8 @@ module Vedeu
80
83
  # @example
81
84
  # Vedeu.configure do
82
85
  # run_once!
83
- # ...
86
+ # # ...
87
+ # end
84
88
  #
85
89
  # @param value [Boolean]
86
90
  # @return [Boolean]
@@ -94,7 +98,8 @@ module Vedeu
94
98
  # @example
95
99
  # Vedeu.configure do
96
100
  # drb!
97
- # ...
101
+ # # ...
102
+ # end
98
103
  #
99
104
  # @param value [Boolean]
100
105
  # @return [Boolean]
@@ -108,7 +113,8 @@ module Vedeu
108
113
  # @example
109
114
  # Vedeu.configure do
110
115
  # drb_host 'localhost'
111
- # ...
116
+ # # ...
117
+ # end
112
118
  #
113
119
  # @param hostname [String]
114
120
  # @return [String]
@@ -121,7 +127,8 @@ module Vedeu
121
127
  # @example
122
128
  # Vedeu.configure do
123
129
  # drb_port 12345
124
- # ...
130
+ # # ...
131
+ # end
125
132
  #
126
133
  # @param port [Fixnum|String]
127
134
  # @return [String]
@@ -134,7 +141,8 @@ module Vedeu
134
141
  # @example
135
142
  # Vedeu.configure do
136
143
  # drb_height 25
137
- # ...
144
+ # # ...
145
+ # end
138
146
  #
139
147
  # @param height [Fixnum]
140
148
  # @return [Fixnum]
@@ -147,7 +155,8 @@ module Vedeu
147
155
  # @example
148
156
  # Vedeu.configure do
149
157
  # drb_width 80
150
- # ...
158
+ # # ...
159
+ # end
151
160
  #
152
161
  # @param width [Fixnum]
153
162
  # @return [Fixnum]
@@ -160,7 +169,8 @@ module Vedeu
160
169
  # @example
161
170
  # Vedeu.configure do
162
171
  # cooked!
163
- # ...
172
+ # # ...
173
+ # end
164
174
  #
165
175
  # @return [Boolean]
166
176
  def cooked!
@@ -173,7 +183,8 @@ module Vedeu
173
183
  # @example
174
184
  # Vedeu.configure do
175
185
  # raw!
176
- # ...
186
+ # # ...
187
+ # end
177
188
  #
178
189
  # @return [Boolean]
179
190
  def raw!
@@ -192,11 +203,13 @@ module Vedeu
192
203
  # @example
193
204
  # Vedeu.configure do
194
205
  # debug!
195
- # ...
206
+ # # ...
207
+ # end
196
208
  #
197
209
  # Vedeu.configure do
198
210
  # debug false
199
- # ...
211
+ # # ...
212
+ # end
200
213
  #
201
214
  # @param value [Boolean]
202
215
  # @return [Boolean]
@@ -210,7 +223,8 @@ module Vedeu
210
223
  # @example
211
224
  # Vedeu.configure do
212
225
  # colour_mode 256
213
- # ...
226
+ # # ...
227
+ # end
214
228
  #
215
229
  # @note
216
230
  # iTerm 2 on Mac OSX will handle the true colour setting (16777216),
@@ -233,7 +247,8 @@ module Vedeu
233
247
  # @example
234
248
  # Vedeu.configure do
235
249
  # log '/var/log/vedeu.log'
236
- # ...
250
+ # # ...
251
+ # end
237
252
  #
238
253
  # @param filename [String]
239
254
  # @return [String]
@@ -247,11 +262,13 @@ module Vedeu
247
262
  # @example
248
263
  # Vedeu.configure do
249
264
  # renderer MyRenderer
250
- # ...
265
+ # # ...
266
+ # end
251
267
  #
252
268
  # Vedeu.configure do
253
269
  # renderers MyRenderer, MyOtherRenderer
254
- # ...
270
+ # # ...
271
+ # end
255
272
  #
256
273
  # @param renderer [Array<Class>|Class]
257
274
  # @return [Array<Class>]
@@ -265,7 +282,8 @@ module Vedeu
265
282
  # @example
266
283
  # Vedeu.configure do
267
284
  # stdin IO.console
268
- # ...
285
+ # # ...
286
+ # end
269
287
  #
270
288
  # @param io [File|IO]
271
289
  # @return [File|IO]
@@ -278,7 +296,8 @@ module Vedeu
278
296
  # @example
279
297
  # Vedeu.configure do
280
298
  # stdout IO.console
281
- # ...
299
+ # # ...
300
+ # end
282
301
  #
283
302
  # @param io [File|IO]
284
303
  # @return [File|IO]
@@ -291,7 +310,8 @@ module Vedeu
291
310
  # @example
292
311
  # Vedeu.configure do
293
312
  # stderr IO.console
294
- # ...
313
+ # # ...
314
+ # end
295
315
  #
296
316
  # @param io [File|IO]
297
317
  # @return [File|IO]
@@ -299,81 +319,6 @@ module Vedeu
299
319
  options[:stderr] = io
300
320
  end
301
321
 
302
- # Sets the key used to exit the client application. The default is `q`.
303
- #
304
- # @example
305
- # Vedeu.configure do
306
- # exit_key 'x'
307
- # ...
308
- #
309
- # Vedeu.configure do
310
- # exit_key :f4
311
- # ...
312
- #
313
- # @param value [String|Symbol]
314
- # @return [String|Symbol]
315
- def exit_key(value)
316
- return invalid_key('exit_key') unless valid_key?(value)
317
- system_keys[:exit] = value
318
- end
319
-
320
- # Sets the key used to switch focus to the next defined interface. The
321
- # default is `:tab`.
322
- #
323
- # @example
324
- # Vedeu.configure do
325
- # focus_next_key 'n'
326
- # ...
327
- #
328
- # Vedeu.configure do
329
- # focus_next_key :right
330
- # ...
331
- #
332
- # @param value [String|Symbol]
333
- # @return [String|Symbol]
334
- def focus_next_key(value)
335
- return invalid_key('focus_next_key') unless valid_key?(value)
336
- system_keys[:focus_next] = value
337
- end
338
-
339
- # Sets the key used to switch focus to the previous interface. The default
340
- # is `:shift_tab`.
341
- #
342
- # @example
343
- # Vedeu.configure do
344
- # focus_prev_key 'p'
345
- # ...
346
- #
347
- # Vedeu.configure do
348
- # focus_prev_key :left
349
- # ...
350
- #
351
- # @param value [String|Symbol]
352
- # @return [String|Symbol]
353
- def focus_prev_key(value)
354
- return invalid_key('focus_prev_key') unless valid_key?(value)
355
- system_keys[:focus_prev] = value
356
- end
357
-
358
- # Sets the key used to switch between raw and cooked mode in Vedeu. The
359
- # default is `:escape`.
360
- #
361
- # @example
362
- # Vedeu.configure do
363
- # mode_switch_key 'm'
364
- # ...
365
- #
366
- # Vedeu.configure do
367
- # mode_switch_key :f1
368
- # ...
369
- #
370
- # @param value [String|Symbol]
371
- # @return [String|Symbol]
372
- def mode_switch_key(value)
373
- return invalid_key('mode_switch_key') unless valid_key?(value)
374
- system_keys[:mode_switch] = value
375
- end
376
-
377
322
  private
378
323
 
379
324
  # Returns the options set via the configuration API DSL or an empty Hash
@@ -384,14 +329,6 @@ module Vedeu
384
329
  @options ||= {}
385
330
  end
386
331
 
387
- # Returns the system keys set via the configuration API DSL or an empty
388
- # hash if none were redefined.
389
- #
390
- # @return [Hash]
391
- def system_keys
392
- @system_keys ||= {}
393
- end
394
-
395
332
  # Checks that the value provided to {#colour_mode} is valid.
396
333
  #
397
334
  # @param value [Fixnum]
@@ -414,18 +351,6 @@ module Vedeu
414
351
  (value.is_a?(String) || value.is_a?(Symbol)) && present?(value)
415
352
  end
416
353
 
417
- # Raises an exception on behalf of the calling method to report that the
418
- # value provided is not valid.
419
- #
420
- # @param system_key [String] The calling method wishing to raise an
421
- # exception.
422
- # @raise [InvalidSyntax] When the system_key parameter is not a String or
423
- # Symbol.
424
- # @return [InvalidSyntax]
425
- def invalid_key(system_key)
426
- fail InvalidSyntax, "`#{system_key}` must be a String or a Symbol."
427
- end
428
-
429
354
  end # API
430
355
 
431
356
  end # Config
@@ -13,6 +13,8 @@ module Vedeu
13
13
  new(args).configuration
14
14
  end
15
15
 
16
+ # Returns a new instance of Vedeu::Config::CLI.
17
+ #
16
18
  # Configure Vedeu via command-line arguments. Options set here via
17
19
  # arguments override the client application configuration set via
18
20
  # {Vedeu::API#configure}.
@@ -41,6 +41,8 @@ module Vedeu
41
41
  #
42
42
  # @example
43
43
  # Vedeu.configure
44
+ # # ...
45
+ # end
44
46
  #
45
47
  # @param args [Array]
46
48
  # @param opts [Hash]
@@ -58,6 +60,8 @@ module Vedeu
58
60
  #
59
61
  # @example
60
62
  # Vedeu.configuration
63
+ # # ...
64
+ # end
61
65
  #
62
66
  # @return [Vedeu::Configuration]
63
67
  def configuration
@@ -171,13 +175,6 @@ module Vedeu
171
175
  instance.options[:stderr]
172
176
  end
173
177
 
174
- # Returns the redefined system keys for vital Vedeu functions.
175
- #
176
- # @return [Hash]
177
- def system_keys
178
- instance.options[:system_keys]
179
- end
180
-
181
178
  # Returns the terminal mode for the application. Default is `:raw`.
182
179
  #
183
180
  # @return [Symbol]
@@ -185,18 +182,6 @@ module Vedeu
185
182
  instance.options[:terminal_mode]
186
183
  end
187
184
 
188
- # Vedeu's default system keys. Use {Vedeu::Configuration.system_keys}.
189
- #
190
- # @return [Hash]
191
- def default_system_keys
192
- {
193
- exit: 'q',
194
- focus_next: :tab,
195
- focus_prev: :shift_tab,
196
- mode_switch: :escape,
197
- }
198
- end
199
-
200
185
  # @param value [void]
201
186
  # @return [void]
202
187
  def options=(value)
@@ -270,7 +255,6 @@ module Vedeu
270
255
  stdin: nil,
271
256
  stdout: nil,
272
257
  stderr: nil,
273
- system_keys: Vedeu::Configuration.default_system_keys,
274
258
  terminal_mode: :raw,
275
259
  }
276
260
  end
@@ -97,6 +97,13 @@ module Vedeu
97
97
  @hide_cursor ||= Vedeu::EscapeChar.new(Vedeu::Esc.hide_cursor)
98
98
  end
99
99
 
100
+ # Return the position of this cursor.
101
+ #
102
+ # @return [Vedeu::Position]
103
+ def position
104
+ @position ||= Vedeu::Position.new(y, x)
105
+ end
106
+
100
107
  # @return [Vedeu::EscapeChar]
101
108
  def show_cursor
102
109
  @show_cursor ||= Vedeu::EscapeChar.new(Vedeu::Esc.show_cursor)
@@ -110,13 +117,6 @@ module Vedeu
110
117
 
111
118
  private
112
119
 
113
- # Return the position of this cursor.
114
- #
115
- # @return [Vedeu::Position]
116
- def position
117
- @position ||= Vedeu::Position.new(y, x)
118
- end
119
-
120
120
  # The default values for a new instance of this class.
121
121
  #
122
122
  # @return [Hash]
@@ -11,6 +11,8 @@ module Vedeu
11
11
  new(entity, name, y, x).to
12
12
  end
13
13
 
14
+ # Returns a new instance of Vedeu::Reposition.
15
+ #
14
16
  # @param entity []
15
17
  # @param name [String]
16
18
  # @param y [Fixnum]