vedeu 0.4.57 → 0.4.58

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/bin/vedeu_drb_server +1 -0
  3. data/examples/drb_app.rb +1 -0
  4. data/lib/vedeu/all.rb +95 -65
  5. data/lib/vedeu/api.rb +0 -45
  6. data/lib/vedeu/application.rb +1 -0
  7. data/lib/vedeu/{bindings/all.rb → bindings.rb} +0 -6
  8. data/lib/vedeu/bindings/system.rb +1 -1
  9. data/lib/vedeu/cli/generator/templates/application/config/configuration.erb +1 -0
  10. data/lib/vedeu/configuration/api.rb +47 -3
  11. data/lib/vedeu/configuration/configuration.rb +6 -7
  12. data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -0
  13. data/lib/vedeu/{dsl/all.rb → dsl.rb} +0 -16
  14. data/lib/vedeu/dsl/composition.rb +4 -4
  15. data/lib/vedeu/events/event_collection.rb +9 -0
  16. data/lib/vedeu/input/keys.rb +9 -0
  17. data/lib/vedeu/main_loop.rb +2 -2
  18. data/lib/vedeu/models/chars.rb +9 -0
  19. data/lib/vedeu/models/interface_collection.rb +9 -0
  20. data/lib/vedeu/models/lines.rb +9 -0
  21. data/lib/vedeu/models/streams.rb +9 -0
  22. data/lib/vedeu/{null/all.rb → null.rb} +2 -8
  23. data/lib/vedeu/output/{renderers/all.rb → renderers.rb} +0 -0
  24. data/lib/vedeu/{repositories/all.rb → repositories.rb} +9 -0
  25. data/lib/vedeu/repositories/collection.rb +0 -36
  26. data/lib/vedeu/terminal.rb +1 -54
  27. data/lib/vedeu/terminal_mode.rb +57 -0
  28. data/lib/vedeu/version.rb +1 -1
  29. data/test/lib/vedeu/configuration/api_test.rb +24 -0
  30. data/test/lib/vedeu/events/event_collection_test.rb +18 -0
  31. data/test/lib/vedeu/input/keys_test.rb +18 -0
  32. data/test/lib/vedeu/models/chars_test.rb +18 -0
  33. data/test/lib/vedeu/models/interface_collection_test.rb +18 -0
  34. data/test/lib/vedeu/models/lines_test.rb +18 -0
  35. data/test/lib/vedeu/models/streams_test.rb +18 -0
  36. data/test/lib/vedeu/repositories/collection_test.rb +0 -78
  37. data/test/lib/vedeu/terminal_mode_test.rb +72 -0
  38. data/test/lib/vedeu/terminal_test.rb +6 -67
  39. data/test/support/stats.sh +3 -0
  40. metadata +27 -9
  41. data/lib/vedeu/input/all.rb +0 -18
  42. data/test/support/colour_test.sh +0 -100
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a0da67baa3addb0036a2b6abda7b67388a77a69
4
- data.tar.gz: a485c5238c12220429d69c2bcd1349d3e6dec625
3
+ metadata.gz: 52a8757a96a4e695945e2c59065f847070891d3c
4
+ data.tar.gz: 6065e953ab86ba1b97d1989fdacf82d7cbcbbb92
5
5
  SHA512:
6
- metadata.gz: 1a172e1281b71465ac807c5345e7807d6d8319e9a1933ebbeafef580ba5fffc330be8d27c35ee3713b82f0d5c7789bb1bd1e2aa124f3a82f1a0aec1b43d3bcb2
7
- data.tar.gz: 241aad422c08ca44ca1671e78d6e2bab9cd80c27ffd5abe19b3b231a7bad946d8700024d3e1163cdd25d0ec806e48485d2674e6fc17dfc3e8e6930e9fa859fe6
6
+ metadata.gz: 30b4dbcbe0dd9a72aa9bde52d362cc6d0b8df74f4ce67143f0003cadfd5fada198db127c2d731ad1d73b8169603754adcc2d7150b0390859f661ed435ce395cd
7
+ data.tar.gz: 15c6d9d16e928e0c1bf8817bcee63fd759c46f17df16fd4b213625f7b7523917b322ca9ba7a4a676a550d132a26667e66fdfface9ad14e914d86b55579ec31db
data/bin/vedeu_drb_server CHANGED
@@ -18,6 +18,7 @@ class VedeuTestApplication
18
18
  drb_width 80
19
19
  drb_height 25
20
20
 
21
+ # terminal_mode :raw
21
22
  # cooked!
22
23
  # raw!
23
24
 
data/examples/drb_app.rb CHANGED
@@ -23,6 +23,7 @@ class VedeuTestApplication
23
23
  drb_width 80
24
24
  drb_height 25
25
25
 
26
+ # terminal_mode :raw
26
27
  # cooked!
27
28
  # raw!
28
29
 
data/lib/vedeu/all.rb CHANGED
@@ -1,21 +1,34 @@
1
-
2
- # load order is important
3
-
4
1
  require 'vedeu/version'
2
+ require 'vedeu/launcher'
3
+ require 'vedeu/bootstrap'
5
4
  require 'vedeu/exceptions'
5
+ require 'vedeu/log'
6
6
  require 'vedeu/debug'
7
7
  require 'vedeu/traps'
8
+ require 'vedeu/common'
9
+ require 'vedeu/terminal_mode'
10
+ require 'vedeu/terminal'
11
+ require 'vedeu/timer'
12
+ require 'vedeu/main_loop'
13
+ require 'vedeu/application'
14
+ require 'vedeu/repositories'
8
15
 
9
- require 'vedeu/null/all'
16
+ require 'vedeu/null'
17
+ require 'vedeu/null/border'
18
+ require 'vedeu/null/buffer'
19
+ require 'vedeu/null/generic'
20
+ require 'vedeu/null/geometry'
21
+ require 'vedeu/null/interface'
22
+
23
+ require 'vedeu/repositories/collection'
24
+ require 'vedeu/repositories/store'
25
+ require 'vedeu/repositories/registerable'
26
+ require 'vedeu/repositories/repository'
10
27
 
11
28
  require 'vedeu/geometry/area'
12
29
  require 'vedeu/geometry/coordinate'
13
30
  require 'vedeu/geometry/dimension'
14
-
15
31
  require 'vedeu/geometry/geometry'
16
- require 'vedeu/repositories/store'
17
- require 'vedeu/repositories/registerable'
18
- require 'vedeu/repositories/repository'
19
32
  require 'vedeu/geometry/geometries'
20
33
  require 'vedeu/geometry/grid'
21
34
  require 'vedeu/geometry/index_position'
@@ -23,95 +36,112 @@ require 'vedeu/geometry/position_index'
23
36
  require 'vedeu/geometry/position'
24
37
  require 'vedeu/geometry/position_validator'
25
38
 
26
- require 'vedeu/repositories/all'
27
-
28
- require 'vedeu/api'
29
- require 'vedeu/bindings/all'
30
-
31
- require 'vedeu/cli/generator/all'
32
-
33
- # load order has not been fully established beyond this point
39
+ require 'vedeu/colours/colours'
40
+ require 'vedeu/colours/backgrounds'
41
+ require 'vedeu/colours/foregrounds'
42
+ require 'vedeu/colours/colour_translator'
43
+ require 'vedeu/colours/background'
44
+ require 'vedeu/colours/foreground'
45
+ require 'vedeu/colours/colour'
34
46
 
35
47
  require 'vedeu/buffers/buffers'
36
48
  require 'vedeu/buffers/buffer'
37
49
  require 'vedeu/buffers/display_buffer'
38
50
 
39
- require 'vedeu/configuration/cli'
40
- require 'vedeu/configuration/api'
41
- require 'vedeu/configuration/configuration'
42
-
43
- require 'vedeu/repositories/all'
44
-
45
- require 'vedeu/cursor/cursor'
46
51
  require 'vedeu/cursor/cursors'
52
+ require 'vedeu/cursor/cursor'
47
53
  require 'vedeu/cursor/move'
48
54
  require 'vedeu/cursor/refresh_cursor'
49
55
  require 'vedeu/cursor/reposition'
50
56
 
57
+ require 'vedeu/output/renderers'
58
+
59
+ require 'vedeu/events/event_collection'
60
+ require 'vedeu/events/events'
61
+ require 'vedeu/events/event'
62
+ require 'vedeu/events/trigger'
63
+
64
+ require 'vedeu/models/cell'
65
+ require 'vedeu/models/char'
66
+ require 'vedeu/models/escape'
67
+ require 'vedeu/models/stream'
68
+ require 'vedeu/models/interfaces'
69
+ require 'vedeu/models/composition'
70
+ require 'vedeu/models/focus'
71
+ require 'vedeu/models/groups'
72
+ require 'vedeu/models/group'
73
+ require 'vedeu/models/menus'
74
+
75
+ require 'vedeu/templating/helpers'
76
+ require 'vedeu/templating/directive'
77
+ require 'vedeu/templating/preprocessor'
78
+ require 'vedeu/templating/template'
79
+
80
+ require 'vedeu/application/controller'
81
+ require 'vedeu/application/helper'
82
+ require 'vedeu/application/view'
83
+ require 'vedeu/application/application_controller'
84
+ require 'vedeu/application/application_helper'
85
+ require 'vedeu/application/application_view'
86
+
87
+ require 'vedeu/cli/generator/all'
88
+ require 'vedeu/cli/main'
89
+
90
+ require 'vedeu/configuration/cli'
91
+ require 'vedeu/configuration/api'
92
+ require 'vedeu/configuration/configuration'
93
+
51
94
  require 'vedeu/distributed/uri'
52
95
  require 'vedeu/distributed/server'
53
96
  require 'vedeu/distributed/client'
54
97
  require 'vedeu/distributed/subprocess'
55
98
  require 'vedeu/distributed/test_application'
56
99
 
57
- require 'vedeu/dsl/all'
58
-
59
- require 'vedeu/repositories/collection'
60
-
61
- require 'vedeu/events/events'
62
- require 'vedeu/events/event'
63
- require 'vedeu/events/trigger'
64
-
65
- require 'vedeu/input/all'
100
+ require 'vedeu/dsl'
101
+ require 'vedeu/dsl/use'
102
+ require 'vedeu/dsl/presentation'
103
+ require 'vedeu/dsl/border'
104
+ require 'vedeu/dsl/composition'
105
+ require 'vedeu/dsl/geometry'
106
+ require 'vedeu/dsl/group'
107
+ require 'vedeu/dsl/keymap'
108
+ require 'vedeu/dsl/text'
109
+ require 'vedeu/dsl/interface'
110
+ require 'vedeu/dsl/line'
111
+ require 'vedeu/dsl/menu'
112
+ require 'vedeu/dsl/stream'
113
+ require 'vedeu/dsl/view'
114
+
115
+ require 'vedeu/input/mapper'
116
+ require 'vedeu/input/key'
117
+ require 'vedeu/input/input'
118
+ require 'vedeu/input/keymaps'
119
+ require 'vedeu/input/keymap'
66
120
 
121
+ require 'vedeu/output/clear/named_group'
122
+ require 'vedeu/output/clear/named_interface'
67
123
  require 'vedeu/output/esc'
68
- require 'vedeu/colours/colour_translator'
69
- require 'vedeu/colours/background'
70
- require 'vedeu/colours/foreground'
71
124
  require 'vedeu/output/presentation'
72
125
  require 'vedeu/output/borders'
73
126
  require 'vedeu/output/border'
74
- require 'vedeu/colours/colour'
75
127
  require 'vedeu/output/compressor'
76
-
77
- require 'vedeu/output/clear/named_group'
78
- require 'vedeu/output/clear/named_interface'
79
-
80
128
  require 'vedeu/output/style'
81
129
  require 'vedeu/output/text'
82
130
  require 'vedeu/output/virtual_buffer'
83
131
  require 'vedeu/output/html_char'
84
132
  require 'vedeu/output/refresh_group'
85
133
  require 'vedeu/output/refresh'
86
- require 'vedeu/output/renderers/all'
87
134
  require 'vedeu/output/output'
88
135
  require 'vedeu/output/viewport'
89
136
  require 'vedeu/output/virtual_terminal'
90
137
  require 'vedeu/output/wordwrap'
91
138
 
92
- require 'vedeu/common'
93
- require 'vedeu/log'
94
- require 'vedeu/common'
95
- require 'vedeu/terminal'
96
- require 'vedeu/timer'
97
-
98
- require 'vedeu/templating/helpers'
99
- require 'vedeu/templating/directive'
100
- require 'vedeu/templating/preprocessor'
101
- require 'vedeu/templating/template'
102
-
103
- require 'vedeu/main_loop'
104
- require 'vedeu/application'
105
- require 'vedeu/launcher'
106
-
107
- require 'vedeu/application/controller'
108
- require 'vedeu/application/helper'
109
- require 'vedeu/application/view'
110
- require 'vedeu/application/application_controller'
111
- require 'vedeu/application/application_helper'
112
- require 'vedeu/application/application_view'
113
-
139
+ require 'vedeu/api'
114
140
 
115
- require 'vedeu/bootstrap'
141
+ require 'vedeu/bindings/drb'
142
+ require 'vedeu/bindings/menus'
143
+ require 'vedeu/bindings/movement'
144
+ require 'vedeu/bindings/system'
145
+ require 'vedeu/bindings/visibility'
116
146
 
117
- require 'vedeu/cli/main'
147
+ require 'vedeu/bindings'
data/lib/vedeu/api.rb CHANGED
@@ -1,48 +1,3 @@
1
- require 'vedeu/colours/colours'
2
- require 'vedeu/colours/backgrounds'
3
- require 'vedeu/colours/foregrounds'
4
- require 'vedeu/colours/colour_translator'
5
- require 'vedeu/colours/background'
6
- require 'vedeu/colours/foreground'
7
- require 'vedeu/colours/colour'
8
-
9
- require 'vedeu/buffers/buffers'
10
- require 'vedeu/output/borders'
11
- require 'vedeu/cursor/cursors'
12
- require 'vedeu/common'
13
- require 'vedeu/terminal'
14
- require 'vedeu/timer'
15
- require 'vedeu/output/renderers/all'
16
-
17
- require 'vedeu/repositories/collection'
18
-
19
- require 'vedeu/events/events'
20
- require 'vedeu/events/event'
21
- require 'vedeu/events/trigger'
22
-
23
- require 'vedeu/repositories/all'
24
-
25
- require 'vedeu/models/toggleable'
26
- require 'vedeu/models/cell'
27
- require 'vedeu/models/char'
28
- require 'vedeu/models/escape'
29
- require 'vedeu/models/stream'
30
- require 'vedeu/models/line'
31
- require 'vedeu/models/interfaces'
32
- require 'vedeu/models/interface'
33
- require 'vedeu/models/composition'
34
- require 'vedeu/models/focus'
35
- require 'vedeu/models/groups'
36
- require 'vedeu/models/group'
37
- require 'vedeu/models/menus'
38
- require 'vedeu/models/menu'
39
-
40
- require 'vedeu/input/all'
41
- require 'vedeu/dsl/all'
42
- require 'vedeu/application'
43
- require 'vedeu/output/clear/named_group'
44
- require 'vedeu/output/clear/named_interface'
45
-
46
1
  module Vedeu
47
2
 
48
3
  # Provides the API to Vedeu. Methods therein, and classes belonging to this
@@ -34,6 +34,7 @@ module Vedeu
34
34
  end # Eigenclass
35
35
 
36
36
  # :nocov:
37
+
37
38
  # Returns a new instance of Vedeu::Application.
38
39
  #
39
40
  # @param configuration [Vedeu::Configuration]
@@ -1,9 +1,3 @@
1
- require 'vedeu/bindings/visibility'
2
- require 'vedeu/bindings/movement'
3
- require 'vedeu/bindings/menus'
4
- require 'vedeu/bindings/drb'
5
- require 'vedeu/bindings/system'
6
-
7
1
  module Vedeu
8
2
 
9
3
  # Binds various events for running and manipulating Vedeu.
@@ -194,7 +194,7 @@ module Vedeu
194
194
  #
195
195
  # @return [void]
196
196
  def mode_switch!
197
- Vedeu.bind(:_mode_switch_) { fail ModeSwitch }
197
+ Vedeu.bind(:_mode_switch_) { fail Vedeu::ModeSwitch }
198
198
  end
199
199
 
200
200
  # Will cause the named interface to refresh, or if a name is not given,
@@ -13,6 +13,7 @@ Vedeu.configure do
13
13
  # drb_width 80
14
14
  # drb_height 25
15
15
 
16
+ # terminal_mode :raw
16
17
  # cooked!
17
18
  # raw!
18
19
 
@@ -44,12 +44,17 @@ module Vedeu
44
44
  #
45
45
  # @example
46
46
  # Vedeu.configure do
47
- # interactive!
47
+ # interactive! # => same as `interactive true` or `standalone false`
48
48
  # # ...
49
49
  # end
50
50
  #
51
51
  # Vedeu.configure do
52
- # interactive false
52
+ # interactive true # => Allow user input.
53
+ # # ...
54
+ # end
55
+ #
56
+ # Vedeu.configure do
57
+ # interactive false # => Disallow user input.
53
58
  # # ...
54
59
  # end
55
60
  #
@@ -65,7 +70,17 @@ module Vedeu
65
70
  #
66
71
  # @example
67
72
  # Vedeu.configure do
68
- # standalone!
73
+ # standalone! # => same as `standalone true` or `interactive false`
74
+ # # ...
75
+ # end
76
+ #
77
+ # Vedeu.configure do
78
+ # standalone true # => Disallow user input.
79
+ # # ...
80
+ # end
81
+ #
82
+ # Vedeu.configure do
83
+ # standalone false # => Allow user input.
69
84
  # # ...
70
85
  # end
71
86
  #
@@ -360,6 +375,35 @@ module Vedeu
360
375
  end
361
376
  alias_method :compression!, :compression
362
377
 
378
+ # Sets the terminal mode. Valid values can be either ':raw' or ':cooked'.
379
+ #
380
+ # @example
381
+ # Vedeu.configure do
382
+ # terminal_mode :raw
383
+ # # ...
384
+ # end
385
+ #
386
+ # Vedeu.configure do
387
+ # terminal_mode :cooked
388
+ # # ...
389
+ # end
390
+ #
391
+ # @param mode [Symbol] Either ':raw' or ':cooked'.
392
+ # @raise [Vedeu::InvalidSyntax] When the mode is not ':raw' or ':cooked'.
393
+ # @return [Symbol]
394
+ # @see Vedeu::Config::API#raw!
395
+ # @see Vedeu::Config::API#cooked!
396
+ def terminal_mode(value)
397
+ if value == :raw || value == :cooked
398
+ options[:terminal_mode] = value
399
+
400
+ else
401
+ fail Vedeu::InvalidSyntax, 'Terminal mode can be set to either :raw or ' \
402
+ ':cooked'
403
+
404
+ end
405
+ end
406
+
363
407
  private
364
408
 
365
409
  # Returns the options set via the configuration API DSL or an empty Hash
@@ -48,10 +48,10 @@ module Vedeu
48
48
  end
49
49
  alias_method :compression?, :compression
50
50
 
51
- # Configure Vedeu with sensible defaults. If the client application sets
52
- # options, override the defaults with those, and if command-line arguments
53
- # are provided at application invocation, override any options with the
54
- # arguments provided.
51
+ # Provides the mechanism to configure Vedeu. If the client application
52
+ # sets options, override the defaults with those, and if command-line
53
+ # arguments are provided at application invocation, override any options
54
+ # with the arguments provided.
55
55
  #
56
56
  # @example
57
57
  # Vedeu.configure
@@ -71,11 +71,10 @@ module Vedeu
71
71
  end
72
72
 
73
73
  # Returns the configuration singleton.
74
+ # Append configuration methods to access the configuration variable.
74
75
  #
75
76
  # @example
76
77
  # Vedeu.configuration
77
- # # ...
78
- # end
79
78
  #
80
79
  # @return [Vedeu::Configuration]
81
80
  def configuration
@@ -259,7 +258,7 @@ module Vedeu
259
258
  # The Vedeu default options, which of course are influenced by environment
260
259
  # variables also.
261
260
  #
262
- # @return [Hash]
261
+ # @return [Hash<Symbol => void>]
263
262
  def defaults
264
263
  {
265
264
  base_path: base_path,
@@ -8,6 +8,7 @@ Vedeu.configure do
8
8
  # drb_width 80
9
9
  # drb_height 25
10
10
 
11
+ # terminal_mode :raw
11
12
  # cooked!
12
13
  # raw!
13
14