vedeu 0.4.62 → 0.4.63

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu/all.rb +6 -5
  3. data/lib/vedeu/api.rb +5 -128
  4. data/lib/vedeu/application/application_controller.rb +0 -2
  5. data/lib/vedeu/application/application_helper.rb +0 -2
  6. data/lib/vedeu/application/application_view.rb +0 -2
  7. data/lib/vedeu/application/controller.rb +1 -1
  8. data/lib/vedeu/bindings/application.rb +12 -4
  9. data/lib/vedeu/bindings/system.rb +4 -4
  10. data/lib/vedeu/bindings/visibility.rb +6 -2
  11. data/lib/vedeu/buffers/buffer.rb +1 -1
  12. data/lib/vedeu/buffers/display_buffer.rb +2 -2
  13. data/lib/vedeu/cli/generator/templates/application/Gemfile +1 -1
  14. data/lib/vedeu/cli/generator/templates/application/application.erb +1 -1
  15. data/lib/vedeu/cli/generator/templates/application/config/configuration.erb +2 -2
  16. data/lib/vedeu/cli/generator/view.rb +2 -2
  17. data/lib/vedeu/colours/colour.rb +1 -1
  18. data/lib/vedeu/colours/colour_translator.rb +2 -2
  19. data/lib/vedeu/configuration/api.rb +1 -1
  20. data/lib/vedeu/configuration/configuration.rb +1 -1
  21. data/lib/vedeu/cursor/refresh_cursor.rb +1 -1
  22. data/lib/vedeu/distributed/server.rb +1 -1
  23. data/lib/vedeu/dsl/border.rb +1 -1
  24. data/lib/vedeu/dsl/geometry.rb +7 -6
  25. data/lib/vedeu/dsl/view.rb +3 -3
  26. data/lib/vedeu/events/event.rb +1 -1
  27. data/lib/vedeu/events/trigger.rb +1 -1
  28. data/lib/vedeu/exceptions.rb +14 -0
  29. data/lib/vedeu/geometry/dimension.rb +1 -1
  30. data/lib/vedeu/geometry/geometry.rb +2 -2
  31. data/lib/vedeu/geometry/position_validator.rb +1 -1
  32. data/lib/vedeu/input/input.rb +6 -5
  33. data/lib/vedeu/input/keymap.rb +3 -3
  34. data/lib/vedeu/input/mapper.rb +3 -3
  35. data/lib/vedeu/internal_api.rb +147 -0
  36. data/lib/vedeu/models/char.rb +2 -2
  37. data/lib/vedeu/models/focus.rb +1 -1
  38. data/lib/vedeu/models/line.rb +1 -1
  39. data/lib/vedeu/models/stream.rb +1 -1
  40. data/lib/vedeu/output/esc.rb +1 -1
  41. data/lib/vedeu/output/presentation.rb +9 -9
  42. data/lib/vedeu/output/refresh.rb +1 -1
  43. data/lib/vedeu/output/renderers.rb +1 -1
  44. data/lib/vedeu/output/text.rb +1 -1
  45. data/lib/vedeu/output/viewport.rb +1 -1
  46. data/lib/vedeu/repositories.rb +1 -1
  47. data/lib/vedeu/repositories/repository.rb +4 -4
  48. data/lib/vedeu/{application.rb → runtime/application.rb} +0 -0
  49. data/lib/vedeu/{bootstrap.rb → runtime/bootstrap.rb} +0 -0
  50. data/lib/vedeu/{launcher.rb → runtime/launcher.rb} +1 -1
  51. data/lib/vedeu/{main_loop.rb → runtime/main_loop.rb} +1 -1
  52. data/lib/vedeu/{router.rb → runtime/router.rb} +57 -4
  53. data/lib/vedeu/terminal.rb +1 -1
  54. data/lib/vedeu/version.rb +1 -1
  55. data/test/lib/vedeu/api_test.rb +1 -15
  56. data/test/lib/vedeu/bindings/application_test.rb +3 -3
  57. data/test/lib/vedeu/internal_api_test.rb +25 -0
  58. data/test/lib/vedeu/output/clear/named_group_test.rb +8 -7
  59. data/test/lib/vedeu/output/presentation_test.rb +45 -0
  60. data/test/lib/vedeu/output/renderers_test.rb +14 -4
  61. data/test/lib/vedeu/{application_test.rb → runtime/application_test.rb} +0 -0
  62. data/test/lib/vedeu/{bootstrap_test.rb → runtime/bootstrap_test.rb} +11 -0
  63. data/test/lib/vedeu/{launcher_test.rb → runtime/launcher_test.rb} +0 -0
  64. data/test/lib/vedeu/{main_loop_test.rb → runtime/main_loop_test.rb} +0 -0
  65. data/test/lib/vedeu/{router_test.rb → runtime/router_test.rb} +13 -1
  66. metadata +20 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30927938a72729c5f3bae9a255a5c8b7602360f9
4
- data.tar.gz: eeb3240c0d98fd5450ddf9f4a9cdf5f5e81ac1b3
3
+ metadata.gz: b5a611c12fd166638545458a66d83fefcceb4201
4
+ data.tar.gz: 4d7c37c1ac9281c6cae6a65dc83827e78b2ec578
5
5
  SHA512:
6
- metadata.gz: 645204564d7353b20bd33141221af4a2fa1bca84da5990a4a0280041b304985ce5391809239fd3e08235deab9f87933ea38ead859e4653a494a2e70d49be64c4
7
- data.tar.gz: 04ae7389a57c38d513a7f7a8f2af5d1910d8f5fe4881668453a6d2b7eb426450d997c0c7b2c6e938cd50d6c446f8c08f0f6b0bd168b4ea14e1fbc9c302f1b67d
6
+ metadata.gz: 134e9ebd933984c61d89832cef7da1583aa36ea046e440ccdf2afa1f1bc6858820a6f7d270b39dfda7fa5204da4925808164998d4210f24ff016798cbeda2bff
7
+ data.tar.gz: 19f6de39f023fe2bb7d9d0aab6014ce112227df1e8a2f8b8d511d6aea01c4e4015587077967a5b7f1b8da8633ab3bc724c4c34669f74220bc2f961e61b3d8d57
@@ -1,13 +1,13 @@
1
1
  require 'vedeu/version'
2
- require 'vedeu/launcher'
3
- require 'vedeu/bootstrap'
2
+ require 'vedeu/runtime/launcher'
3
+ require 'vedeu/runtime/bootstrap'
4
4
  require 'vedeu/exceptions'
5
5
  require 'vedeu/log'
6
6
  require 'vedeu/debug'
7
7
  require 'vedeu/traps'
8
8
  require 'vedeu/common'
9
9
  require 'vedeu/terminal_mode'
10
- require 'vedeu/router'
10
+ require 'vedeu/runtime/router'
11
11
 
12
12
  require 'vedeu/configuration/cli'
13
13
  require 'vedeu/configuration/api'
@@ -15,8 +15,8 @@ require 'vedeu/configuration/configuration'
15
15
 
16
16
  require 'vedeu/terminal'
17
17
  require 'vedeu/timer'
18
- require 'vedeu/main_loop'
19
- require 'vedeu/application'
18
+ require 'vedeu/runtime/main_loop'
19
+ require 'vedeu/runtime/application'
20
20
 
21
21
  require 'vedeu/models/toggleable'
22
22
 
@@ -172,6 +172,7 @@ require 'vedeu/output/virtual_terminal'
172
172
  require 'vedeu/output/wordwrap'
173
173
 
174
174
  require 'vedeu/api'
175
+ require 'vedeu/internal_api'
175
176
 
176
177
  require 'vedeu/bindings/application'
177
178
  require 'vedeu/bindings/drb'
@@ -22,33 +22,6 @@ module Vedeu
22
22
 
23
23
  module_function
24
24
 
25
- # Manipulate the repository of background colours.
26
- #
27
- # @example
28
- # Vedeu.background_colours
29
- #
30
- # @!method background_colours
31
- # @return [Vedeu::Backgrounds]
32
- def_delegators Vedeu::Backgrounds, :background_colours
33
-
34
- # Manipulate the repository of borders.
35
- #
36
- # @example
37
- # Vedeu.borders
38
- #
39
- # @!method borders
40
- # @return [Vedeu::Borders]
41
- def_delegators Vedeu::Borders, :borders
42
-
43
- # Manipulate the repository of buffers.
44
- #
45
- # @example
46
- # Vedeu.buffers
47
- #
48
- # @!method buffers
49
- # @return [Vedeu::Buffers]
50
- def_delegators Vedeu::Buffers, :buffers
51
-
52
25
  # @!method configure
53
26
  # @see Vedeu::Configuration.configure
54
27
  # @!method configuration
@@ -64,15 +37,6 @@ module Vedeu
64
37
  # @return [Vedeu::Cursor]
65
38
  def_delegators Vedeu::Cursors, :cursor
66
39
 
67
- # Manipulate the repository of cursors.
68
- #
69
- # @example
70
- # Vedeu.cursors
71
- #
72
- # @!method cursors
73
- # @return [Vedeu::Cursors]
74
- def_delegators Vedeu::Cursors, :cursors
75
-
76
40
  # Manipulate the DRb server implementation.
77
41
  #
78
42
  # @example
@@ -149,15 +113,6 @@ module Vedeu
149
113
  # @see Vedeu::Event.unbind
150
114
  def_delegators Vedeu::Event, :bind, :bound?, :unbind
151
115
 
152
- # Manipulate the repository of events.
153
- #
154
- # @example
155
- # Vedeu.events
156
- #
157
- # @!method events
158
- # @return [Vedeu::Events]
159
- def_delegators Vedeu::Events, :events
160
-
161
116
  # @example
162
117
  # Vedeu.focus
163
118
  # Vedeu.focus_by_name
@@ -178,51 +133,6 @@ module Vedeu
178
133
  def_delegators Vedeu::Focus, :focus, :focus_by_name, :focussed?,
179
134
  :focus_next, :focus_previous
180
135
 
181
- # Manipulate the repository of foreground colours.
182
- #
183
- # @example
184
- # Vedeu.foreground_colours
185
- #
186
- # @!method foreground_colours
187
- # @return [Vedeu::Foregrounds]
188
- def_delegators Vedeu::Foregrounds, :foreground_colours
189
-
190
- # Manipulate the repository of geometries.
191
- #
192
- # @example
193
- # Vedeu.geometries
194
- #
195
- # @!method geometries
196
- # @return [Vedeu::Geometries]
197
- def_delegators Vedeu::Geometries, :geometries
198
-
199
- # Manipulate the repository of groups.
200
- #
201
- # @example
202
- # Vedeu.groups
203
- #
204
- # @!method groups
205
- # @return [Vedeu::Groups]
206
- def_delegators Vedeu::Groups, :groups
207
-
208
- # Manipulate the repository of interfaces.
209
- #
210
- # @example
211
- # Vedeu.interfaces
212
- #
213
- # @!method interfaces
214
- # @return [Vedeu::Interfaces]
215
- def_delegators Vedeu::Interfaces, :interfaces
216
-
217
- # Manipulate the repository of keymaps.
218
- #
219
- # @example
220
- # Vedeu.keymaps
221
- #
222
- # @!method keymaps
223
- # @return [Vedeu::Keymaps]
224
- def_delegators Vedeu::Keymaps, :keymaps
225
-
226
136
  # @example
227
137
  # Vedeu.log
228
138
  # Vedeu.log_stdout
@@ -250,24 +160,12 @@ module Vedeu
250
160
  # @see Vedeu::Menu.menu
251
161
  def_delegators Vedeu::Menu, :menu
252
162
 
253
- # Manipulate the repository of menus.
163
+ # Instruct Vedeu to load the client application controller action with
164
+ # parameters.
254
165
  #
255
- # @example
256
- # Vedeu.menus
257
- #
258
- # @!method menus
259
- # @return [Vedeu::Menus]
260
- def_delegators Vedeu::Menus, :menus
261
-
262
- # @example
263
- # Vedeu.renderer
264
- # Vedeu.renderers
265
- #
266
- # @!method renderer
267
- # @see Vedeu::Renderers#renderer
268
- # @!method renderers
269
- # @see Vedeu::Renderers#renderers
270
- def_delegators Vedeu::Renderers, :renderer, :renderers
166
+ # @!method goto
167
+ # @see Vedeu::Router.goto
168
+ def_delegators Vedeu::Router, :goto
271
169
 
272
170
  # Return the height of the terminal running the client application.
273
171
  #
@@ -287,27 +185,6 @@ module Vedeu
287
185
  # @see Vedeu::Terminal#width
288
186
  def_delegators Vedeu::Terminal, :width
289
187
 
290
- # Instruct the terminal to resize. This will happen automatically as the
291
- # terminal recieves SIGWINCH signals.
292
- #
293
- # @example
294
- # Vedeu.resize
295
- #
296
- # @!method resize
297
- # @see Vedeu::Terminal#resize
298
- def_delegators Vedeu::Terminal, :resize
299
-
300
- # Measure the execution time of the code in the given block.
301
- #
302
- # @example
303
- # Vedeu.timer do
304
- # # ... some code here ...
305
- # end
306
- #
307
- # @!method timer
308
- # @see Vedeu::Timer.timer
309
- def_delegators Vedeu::Timer, :timer
310
-
311
188
  # Trigger an event by name.
312
189
  #
313
190
  # @example
@@ -1,5 +1,3 @@
1
- require 'vedeu/application/controller'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Provides methods which should be available to all client application
@@ -1,5 +1,3 @@
1
- require 'vedeu/application/helper'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Provides methods which should be available to all client application
@@ -1,5 +1,3 @@
1
- require 'vedeu/application/view'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Provides the mechanism to render views for the client application. The
@@ -49,7 +49,7 @@ module Vedeu
49
49
  #
50
50
  # end
51
51
  #
52
- # Vedeu.trigger(:_action_, :your_controller, :show, { some: :args })
52
+ # Vedeu.trigger(:_goto_, :your_controller, :show, { some: :args })
53
53
  #
54
54
  # @param action_name [Symbol] THe name of the action.
55
55
  # @return [void]
@@ -14,19 +14,27 @@ module Vedeu
14
14
  #
15
15
  # @return [void]
16
16
  def setup!
17
- action!
17
+ goto!
18
18
  end
19
19
 
20
20
  private
21
21
 
22
+ # Call a client application controller's action with parameters.
23
+ #
22
24
  # @example
23
- # Vedeu.trigger(:_action_, :your_controller, :some_action, { id: 7 })
25
+ # Vedeu.trigger(:_goto_, :your_controller, :some_action, { id: 7 })
26
+ # Vedeu.goto(:your_controller, :some_action, { id: 7 })
24
27
  #
25
28
  # @return [void]
26
- def action!
27
- Vedeu.bind(:_action_) do |controller, action, **args|
29
+ def goto!
30
+ Vedeu.bind(:_goto_) do |controller, action, **args|
28
31
  Vedeu::Router.goto(controller, action, **args)
29
32
  end
33
+
34
+ # @todo Remove this aliasing event. (GL 2015-07-26)
35
+ Vedeu.bind(:_action_) do |controller, action, **args|
36
+ Vedeu.trigger(:_goto_, controller, action, **args)
37
+ end
30
38
  end
31
39
 
32
40
  end # Application
@@ -7,7 +7,7 @@ module Vedeu
7
7
  #
8
8
  # @note
9
9
  # Unbinding any of these events is likely to cause problems, so I would
10
- # advise leaving them alone. A safe rule: if the name starts with an
10
+ # advise leaving them alone. A safe rule: when the name starts with an
11
11
  # underscore, it's probably used by Vedeu internally.
12
12
  #
13
13
  # :nocov:
@@ -56,8 +56,8 @@ module Vedeu
56
56
  end
57
57
  end
58
58
 
59
- # Clears the whole terminal space, or the named interface area to be
60
- # cleared if given.
59
+ # Clears the whole terminal space, or when a name is given, the named
60
+ # interface area will be cleared.
61
61
  #
62
62
  # @example
63
63
  # Vedeu.trigger(:_clear_)
@@ -196,7 +196,7 @@ module Vedeu
196
196
  Vedeu.bind(:_mode_switch_) { fail Vedeu::ModeSwitch }
197
197
  end
198
198
 
199
- # Will cause the named interface to refresh, or if a name is not given,
199
+ # Will cause the named interface to refresh, or when a name is not given,
200
200
  # will refresh all interfaces.
201
201
  #
202
202
  # @note: Hidden interfaces will be still refreshed in memory but not
@@ -41,7 +41,7 @@ module Vedeu
41
41
  end
42
42
  end
43
43
 
44
- # Hide the cursor of the named interface or if a name is not given, the
44
+ # Hide the cursor of the named interface or when a name is not given, the
45
45
  # interface currently in focus.
46
46
  #
47
47
  # @example
@@ -54,6 +54,8 @@ module Vedeu
54
54
  Vedeu.bind(:_hide_cursor_) do |name|
55
55
  Vedeu::Cursor.hide_cursor(name)
56
56
  end
57
+
58
+ # @todo Remove this aliasing event. (GL 2015-07-26)
57
59
  Vedeu.bind(:_cursor_hide_) do |name|
58
60
  Vedeu.trigger(:_hide_cursor_, name)
59
61
  end
@@ -79,7 +81,7 @@ module Vedeu
79
81
  end
80
82
  end
81
83
 
82
- # Show the cursor of the named interface or if a name is not given, the
84
+ # Show the cursor of the named interface or when a name is not given, the
83
85
  # interface currently in focus.
84
86
  #
85
87
  # @example
@@ -92,6 +94,8 @@ module Vedeu
92
94
  Vedeu.bind(:_show_cursor_) do |name|
93
95
  Vedeu::Cursor.show_cursor(name)
94
96
  end
97
+
98
+ # @todo Remove this aliasing event. (GL 2015-07-26)
95
99
  Vedeu.bind(:_cursor_show_) do |name|
96
100
  Vedeu.trigger(:_show_cursor_, name)
97
101
  end
@@ -7,7 +7,7 @@ module Vedeu
7
7
  #
8
8
  # The content on the screen, or last output will always be the 'Front' buffer.
9
9
  # Content due to be displayed on next refresh will come from the 'Back' buffer
10
- # if available, otherwise from the current 'Front' buffer. When new content
10
+ # when available, otherwise from the current 'Front' buffer. When new content
11
11
  # is copied to the 'Front' buffer, the current 'Front' buffer is also copied
12
12
  # to the 'Previous' buffer.
13
13
  #
@@ -19,8 +19,8 @@ module Vedeu
19
19
  self
20
20
  end
21
21
 
22
- # Store the view if it has a name. This view will be shown next time the
23
- # refresh event is triggered for the interface.
22
+ # When a name is given, the view is stored with this name. This view will be
23
+ # shown next time the refresh event is triggered for the interface.
24
24
  #
25
25
  # @raise [Vedeu::InvalidSyntax] The name is not defined.
26
26
  # @return [Vedeu::Interface]
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'vedeu'
4
- # gem 'ruby-prof' # uncomment if using the `debug!` configuration option.
4
+ # gem 'ruby-prof' # uncomment when using the `debug!` configuration option.
@@ -1,5 +1,5 @@
1
1
  require_relative 'config/configuration'
2
- # Uncomment this, if you are manually setting the entry point below
2
+ # When manually setting the entry point below, uncomment this line:
3
3
  # require_relative 'app/controllers/some_controller'
4
4
 
5
5
  module <%= object.name_as_class %>
@@ -1,12 +1,12 @@
1
1
  Vedeu.configure do
2
2
  # base_path
3
3
 
4
- # colour_mode 16_777_216 # Some terminals don't render colour at all if this
4
+ # colour_mode 16_777_216 # Some terminals don't render colour at all when this
5
5
  # value is not one of 8, 16, 256 or 16777216.
6
6
 
7
7
  # compression false
8
8
 
9
- # debug! # Add "gem 'ruby-prof'" to your Gemfile if uncommenting this line.
9
+ # debug! # Requires "gem 'ruby-prof'" in your Gemfile.
10
10
  # drb!
11
11
  # drb_host 'localhost'
12
12
  # drb_port 21420
@@ -37,8 +37,8 @@ module Vedeu
37
37
  make_view_class_file
38
38
 
39
39
  output("Please update the 'root' setting in 'config/configuration.rb'" \
40
- " to '#{app_name}::#{name_as_class}Controller.new' if you " \
41
- 'would like to start Vedeu at this controller.')
40
+ " to '#{app_name}::#{name_as_class}Controller.new' to start " \
41
+ 'Vedeu at this controller.')
42
42
  end
43
43
 
44
44
  private
@@ -23,7 +23,7 @@ module Vedeu
23
23
  # to): iTerm2 (OSX), Gnome Terminal (Linux).
24
24
  #
25
25
  # Setting your `$TERM` environment variable as above gets you up to 256
26
- # colours, but if you then add the `colour_mode 16_777_216` configuration to
26
+ # colours, but when you then add the `colour_mode 16_777_216` configuration to
27
27
  # your client application, it's really a hit and miss affair. iTerm2 renders
28
28
  # all the colours correctly as does Gnome Terminal. Terminator (Linux) goes
29
29
  # crazy though and defaults to 16 colours despite the `$TERM` setting. This
@@ -14,8 +14,8 @@ module Vedeu
14
14
  # colour corresponding with that colour.
15
15
  #
16
16
  # Finally, when provided a CSS/HTML colour string e.g. '#ff0000', Vedeu will
17
- # translate that to the 8-bit escape sequence or if you have a capable
18
- # terminal and the `VEDEU_TERM=xterm-truecolor` environment variable set,
17
+ # translate that to the 8-bit escape sequence or when you have a capable
18
+ # terminal and the `TERM=xterm-truecolor` environment variable set,
19
19
  # a 24-bit representation.
20
20
  #
21
21
  # @todo More documentation required (create a fancy chart!)
@@ -420,7 +420,7 @@ module Vedeu
420
420
  private
421
421
 
422
422
  # Returns the options set via the configuration API DSL or an empty Hash
423
- # if none were set.
423
+ # when none were set.
424
424
  #
425
425
  # @return [Hash]
426
426
  def options
@@ -49,7 +49,7 @@ module Vedeu
49
49
  alias_method :compression?, :compression
50
50
 
51
51
  # Provides the mechanism to configure Vedeu. If the client application
52
- # sets options, override the defaults with those, and if command-line
52
+ # sets options, override the defaults with those, and when command-line
53
53
  # arguments are provided at application invocation, override any options
54
54
  # with the arguments provided.
55
55
  #