vedeu 0.8.23 → 0.8.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/integrations/dsl_app_017.rb +5 -0
  3. data/integrations/expected/dsl_app_017.out +1 -0
  4. data/integrations/test_runner.rb +1 -0
  5. data/integrations/test_runner.sh +3 -0
  6. data/lib/vedeu/borders/border.rb +2 -0
  7. data/lib/vedeu/borders/dsl.rb +2 -0
  8. data/lib/vedeu/borders/repository.rb +2 -0
  9. data/lib/vedeu/buffers/buffer.rb +2 -0
  10. data/lib/vedeu/buffers/empty.rb +2 -2
  11. data/lib/vedeu/buffers/refresh.rb +2 -0
  12. data/lib/vedeu/buffers/repository.rb +2 -0
  13. data/lib/vedeu/colours/colour.rb +2 -0
  14. data/lib/vedeu/colours/repository.rb +2 -0
  15. data/lib/vedeu/configuration/api.rb +2 -0
  16. data/lib/vedeu/configuration/configuration.rb +2 -0
  17. data/lib/vedeu/cursors/repository.rb +2 -0
  18. data/lib/vedeu/distributed/client.rb +3 -0
  19. data/lib/vedeu/distributed/server.rb +3 -0
  20. data/lib/vedeu/distributed/subprocess.rb +2 -0
  21. data/lib/vedeu/distributed/uri.rb +2 -0
  22. data/lib/vedeu/dsl/view.rb +2 -0
  23. data/lib/vedeu/dsl/views.rb +2 -0
  24. data/lib/vedeu/editor/editor.rb +2 -0
  25. data/lib/vedeu/editor/repository.rb +2 -0
  26. data/lib/vedeu/events/event.rb +2 -13
  27. data/lib/vedeu/events/trigger.rb +21 -1
  28. data/lib/vedeu/geometries/dsl/dsl.rb +2 -0
  29. data/lib/vedeu/geometries/geometry.rb +2 -0
  30. data/lib/vedeu/geometries/move.rb +67 -42
  31. data/lib/vedeu/geometries/repository.rb +2 -0
  32. data/lib/vedeu/groups/clear.rb +2 -0
  33. data/lib/vedeu/groups/dsl.rb +2 -0
  34. data/lib/vedeu/groups/group.rb +2 -0
  35. data/lib/vedeu/groups/refresh.rb +2 -0
  36. data/lib/vedeu/groups/repository.rb +2 -0
  37. data/lib/vedeu/input/capture.rb +2 -0
  38. data/lib/vedeu/input/dsl.rb +2 -0
  39. data/lib/vedeu/input/key.rb +2 -0
  40. data/lib/vedeu/input/keymap.rb +2 -0
  41. data/lib/vedeu/input/repository.rb +2 -0
  42. data/lib/vedeu/input/translator.rb +2 -0
  43. data/lib/vedeu/interfaces/clear.rb +2 -0
  44. data/lib/vedeu/interfaces/dsl.rb +2 -0
  45. data/lib/vedeu/interfaces/interface.rb +2 -0
  46. data/lib/vedeu/interfaces/null.rb +2 -0
  47. data/lib/vedeu/interfaces/repository.rb +2 -0
  48. data/lib/vedeu/logging/timer.rb +2 -0
  49. data/lib/vedeu/menus/dsl.rb +2 -0
  50. data/lib/vedeu/menus/menu.rb +2 -0
  51. data/lib/vedeu/menus/repository.rb +2 -0
  52. data/lib/vedeu/models/page.rb +2 -0
  53. data/lib/vedeu/models/row.rb +2 -0
  54. data/lib/vedeu/null/generic.rb +2 -0
  55. data/lib/vedeu/output/refresh.rb +3 -0
  56. data/lib/vedeu/plugins/plugin.rb +2 -0
  57. data/lib/vedeu/plugins/plugins.rb +2 -0
  58. data/lib/vedeu/presentation/style.rb +2 -0
  59. data/lib/vedeu/renderers/escape.rb +2 -0
  60. data/lib/vedeu/renderers/html.rb +2 -0
  61. data/lib/vedeu/renderers/json.rb +2 -0
  62. data/lib/vedeu/renderers/support/file.rb +2 -0
  63. data/lib/vedeu/renderers/terminal.rb +2 -0
  64. data/lib/vedeu/renderers/text.rb +2 -0
  65. data/lib/vedeu/repositories/model.rb +2 -0
  66. data/lib/vedeu/repositories/repository.rb +2 -0
  67. data/lib/vedeu/runtime/bootstrap.rb +2 -0
  68. data/lib/vedeu/runtime/launcher.rb +2 -0
  69. data/lib/vedeu/runtime/main_loop.rb +2 -0
  70. data/lib/vedeu/runtime/traps.rb +62 -9
  71. data/lib/vedeu/templating/template.rb +2 -0
  72. data/lib/vedeu/templating/view_template.rb +2 -0
  73. data/lib/vedeu/version.rb +2 -2
  74. data/lib/vedeu/views/composition.rb +2 -0
  75. data/lib/vedeu/views/line.rb +2 -0
  76. data/lib/vedeu/views/stream.rb +2 -0
  77. data/lib/vedeu/views/view.rb +2 -0
  78. data/test/lib/vedeu/runtime/traps_test.rb +24 -2
  79. data/vedeu.gemspec +2 -2
  80. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23c1d81d7fc643062c5bfe739de370ff0e5dc948
4
- data.tar.gz: 4083354c5c95d5828d7108d1f1870ddbf934f38c
3
+ metadata.gz: bba38d1b7b8c6befc6f778050e727f1afa5ec5aa
4
+ data.tar.gz: 2f92824ce2e8faafd9cad5ccd7b69dcb528d2b42
5
5
  SHA512:
6
- metadata.gz: 31993a416e19b815f8d471d0a23364918c07d070ae9823c17316393b1523f6a2a4780eff35ea05bef6c6ab1a82d61f7b2eabadcba074407874102a0dd574f416
7
- data.tar.gz: b9b5bed7178bac6915911f7d4c0b19081a1c5c8094622d4d1e25e10dcbeab4c28b129188bed49487e03c20c1b1b108125d3bd2ca415a9e6533774366e94fd858
6
+ metadata.gz: 8f685282146b350cbdff354b6990054d022812c9cf9dba3b068efc8ed28313d318a3ea23418fb2ed943f593658017f7a6588e3e46fb564b06d2b57f10235defe
7
+ data.tar.gz: 0253772378f8d3de47153617970963329548b5ed5021326454d4ba21e078fb51a5df3e3f0380a0760b3c12af780cbfd7ff24af04a7afcb1729b68e6d21cad4af
@@ -31,6 +31,11 @@ class DSLApp
31
31
 
32
32
  Vedeu.render do
33
33
  view(:test_interface) do
34
+ foreground '#ffffff'
35
+ line do
36
+ left 'v->l->left', { background: '#aa00ff' }
37
+ right 'v->l->right', { background: '#5a5a5a' }
38
+ end
34
39
  end
35
40
  end
36
41
 
@@ -0,0 +1 @@
1
+ (0l(B(0q(B Test (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(Bv->l->left        v->l->right(0x(B(0x(B                             (0x(B(0x(B                             (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B
@@ -3,6 +3,7 @@
3
3
  # Provides the result of running an integration test.
4
4
  #
5
5
  # @api private
6
+ #
6
7
  class TestRunner
7
8
 
8
9
  # @param (see #initialize)
@@ -44,3 +44,6 @@ cd "$(dirname "$0")"
44
44
  ./dsl_app_border_009.rb # only right
45
45
  ./dsl_app_border_010.rb # only bottom
46
46
  ./dsl_app_border_011.rb # only left
47
+
48
+ # Failing
49
+ # ./dsl_app_017.rb
@@ -16,6 +16,8 @@ module Vedeu
16
16
  # More details can be found at:
17
17
  # http://en.wikipedia.org/wiki/Box-drawing_character
18
18
  #
19
+ # @api private
20
+ #
19
21
  class Border
20
22
 
21
23
  extend Forwardable
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Provides a mechanism to help configure borders in Vedeu.
8
8
  #
9
+ # @api public
10
+ #
9
11
  class DSL
10
12
 
11
13
  include Vedeu::DSL
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Allows the storing of interface/view borders independent of the
8
8
  # interface instance.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Repository < Vedeu::Repositories::Repository
11
13
 
12
14
  null Vedeu::Borders::Border, enabled: false
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Used by Vedeu internally to manage the buffers of each interface
8
8
  # defined.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Buffer
11
13
 
12
14
  include Vedeu::Common
@@ -55,8 +55,8 @@ module Vedeu
55
55
 
56
56
  # @return [Array<Array<Vedeu::Cells::Empty>>]
57
57
  def empty
58
- Array.new(height) do |h|
59
- Array.new(width) do |w|
58
+ Array.new(height) do
59
+ Array.new(width) do
60
60
  Vedeu::Cells::Empty.new(name: name)
61
61
  end
62
62
  end
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Refreshes the given named interface.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Refresh
10
12
 
11
13
  include Vedeu::Common
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Allows the storing of view buffers.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Repository < Vedeu::Repositories::Repository
10
12
 
11
13
  null Vedeu::Buffers::Null
@@ -37,6 +37,8 @@ module Vedeu
37
37
  #
38
38
  # @todo Fix colours in all terminals. (GL: 2015-04-13)
39
39
  #
40
+ # @api private
41
+ #
40
42
  class Colour
41
43
 
42
44
  class << self
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Allows the storing of HTML/CSS colours and their respective
8
8
  # escape sequences.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Repository
11
13
 
12
14
  # @!attribute [r] storage
@@ -8,6 +8,8 @@ module Vedeu
8
8
  # configuration into options used by Vedeu to affect certain
9
9
  # behaviours.
10
10
  #
11
+ # @api public
12
+ #
11
13
  class API
12
14
 
13
15
  include Vedeu::Common
@@ -54,6 +54,8 @@ module Vedeu
54
54
  # overridden by client application settings (via the configuration
55
55
  # API).
56
56
  #
57
+ # @api private
58
+ #
57
59
  class Configuration
58
60
 
59
61
  include Singleton
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Allows the storing of each interface's cursor.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Repository < Vedeu::Repositories::Repository
10
12
 
11
13
  class << self
@@ -15,6 +15,9 @@ module Vedeu
15
15
  # connect("druby://localhost:21420")
16
16
  # client.input('a')
17
17
  # client.output # => 'some content...'
18
+ #
19
+ # @api private
20
+ #
18
21
  class Client
19
22
 
20
23
  # @param (see #initialize)
@@ -9,6 +9,9 @@ module Vedeu
9
9
 
10
10
  # A class for the server side of the DRb server/client
11
11
  # relationship.
12
+ #
13
+ # @api private
14
+ #
12
15
  class Server
13
16
 
14
17
  $SAFE = 1 # disable `eval` and related calls on strings passed
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Creates a subprocess of the DRb server.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Subprocess
10
12
 
11
13
  # @param (see #initialize)
@@ -10,6 +10,8 @@ module Vedeu
10
10
  # Value class which provides the host and port for the DRb server
11
11
  # and client.
12
12
  #
13
+ # @api private
14
+ #
13
15
  class Uri
14
16
 
15
17
  # @!attribute [r] host
@@ -40,6 +40,8 @@ module Vedeu
40
40
  # be red.
41
41
  # - Styles are named. See the table below for supported styles.
42
42
  #
43
+ # @api public
44
+ #
43
45
  class View
44
46
 
45
47
  include Vedeu::Common
@@ -82,6 +82,8 @@ module Vedeu
82
82
  # |- streams/stream
83
83
  # |- char
84
84
  #
85
+ # @api public
86
+ #
85
87
  class Views
86
88
 
87
89
  include Vedeu::DSL
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Handles keypresses for a named document whilst the terminal is
8
8
  # in fake mode.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Editor
11
13
 
12
14
  extend Forwardable
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Allows the storing of documents.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Repository < Vedeu::Repositories::Repository
10
12
 
11
13
  real Vedeu::Editor::Document
@@ -31,6 +31,8 @@ module Vedeu
31
31
  # :do_stuff
32
32
  # end
33
33
  #
34
+ # @api private
35
+ #
34
36
  class Event
35
37
 
36
38
  include Vedeu::Repositories::Model
@@ -182,19 +184,6 @@ module Vedeu
182
184
  @executed_at = @now # set execution time to now
183
185
  @now = 0 # reset now
184
186
 
185
- message = if args.size > 1
186
- "Triggering: '#{name.inspect}' with #{args.inspect}"
187
-
188
- elsif args.one?
189
- "Triggering: '#{name.inspect}' for #{args.first.inspect}"
190
-
191
- else
192
- "Triggering: '#{name.inspect}'"
193
-
194
- end
195
-
196
- Vedeu.log(type: :event, message: message)
197
-
198
187
  closure.call(*args)
199
188
  end
200
189
 
@@ -67,9 +67,29 @@ module Vedeu
67
67
 
68
68
  private
69
69
 
70
+ # @return [String]
71
+ def message
72
+ if args.size > 1
73
+ "Triggering: '#{name.inspect}' with #{args.inspect}"
74
+
75
+ elsif args.one?
76
+ "Triggering: '#{name.inspect}' for #{args.first.inspect}"
77
+
78
+ else
79
+ "Triggering: '#{name.inspect}'"
80
+
81
+ end
82
+ end
83
+
84
+ # Trigger each registered event for this name.
85
+ #
70
86
  # @return [Array<void>|void]
71
87
  def results
72
- @results ||= registered_events.map { |event| event.trigger(*args) }
88
+ @results ||= registered_events.map do |event|
89
+ Vedeu.log(type: :event, message: message)
90
+
91
+ event.trigger(*args)
92
+ end
73
93
  end
74
94
 
75
95
  # Return all of the registered events for this name.
@@ -73,6 +73,8 @@ module Vedeu
73
73
  # yn +--------------+ # south: yn + 1
74
74
  # south
75
75
  #
76
+ # @api public
77
+ #
76
78
  class DSL
77
79
 
78
80
  include Vedeu::Common
@@ -12,6 +12,8 @@ module Vedeu
12
12
  # the client's requirements and the terminal's current viewing
13
13
  # area.
14
14
  #
15
+ # @api private
16
+ #
15
17
  class Geometry
16
18
 
17
19
  extend Forwardable
@@ -62,6 +62,17 @@ module Vedeu
62
62
 
63
63
  private
64
64
 
65
+ # @return [Hash<Symbol => Symbol>]
66
+ def cursor_event
67
+ {
68
+ down: :_cursor_down_,
69
+ left: :_cursor_left_,
70
+ origin: :_cursor_origin_,
71
+ right: :_cursor_right_,
72
+ up: :_cursor_up_,
73
+ }[direction]
74
+ end
75
+
65
76
  # @macro defaults_method
66
77
  def defaults
67
78
  {
@@ -76,52 +87,17 @@ module Vedeu
76
87
  direction != :none
77
88
  end
78
89
 
79
- # Moves the geometry in the direction given by the offset also
80
- # given.
81
- #
82
90
  # @return [Hash<Symbol => Hash<Symbol => Fixnum>>]
83
- def movement
84
- {
85
- down: {
86
- y: y + offset,
87
- yn: yn + offset,
88
- },
89
- left: {
90
- x: x - offset,
91
- xn: xn - offset,
92
- },
93
- none: {},
94
- origin: {
95
- x: 1,
96
- xn: (xn - x + 1),
97
- y: 1,
98
- yn: (yn - y + 1),
99
- },
100
- right: {
101
- x: x + offset,
102
- xn: xn + offset,
103
- },
104
- up: {
105
- y: y - offset,
106
- yn: yn - offset,
107
- },
108
- }
91
+ def directional_move
92
+ movement.fetch(direction, {})
109
93
  end
110
94
 
111
- # @return [Hash<Symbol => Symbol>]
112
- def cursor_event
95
+ # @return [Hash<Symbol => Fixnum>]
96
+ def down
113
97
  {
114
- down: :_cursor_down_,
115
- left: :_cursor_left_,
116
- origin: :_cursor_origin_,
117
- right: :_cursor_right_,
118
- up: :_cursor_up_,
119
- }[direction]
120
- end
121
-
122
- # @return [Hash<Symbol => Hash<Symbol => Fixnum>>]
123
- def directional_move
124
- movement.fetch(direction, {})
98
+ y: y + offset,
99
+ yn: yn + offset,
100
+ }
125
101
  end
126
102
 
127
103
  # @macro geometry_by_name
@@ -129,11 +105,52 @@ module Vedeu
129
105
  @geometry ||= Vedeu.geometries.by_name(name)
130
106
  end
131
107
 
108
+ # @return [Hash<Symbol => Fixnum>]
109
+ def left
110
+ {
111
+ x: x - offset,
112
+ xn: xn - offset,
113
+ }
114
+ end
115
+
116
+ # Moves the geometry in the direction given by the offset also
117
+ # given.
118
+ #
119
+ # @return [Hash<Symbol => Hash<Symbol => Fixnum>>]
120
+ def movement
121
+ {
122
+ down: down,
123
+ left: left,
124
+ none: {},
125
+ origin: origin,
126
+ right: right,
127
+ up: up,
128
+ }
129
+ end
130
+
132
131
  # @return [Hash<Symbol => Boolean|String|Symbol>]
133
132
  def new_attributes
134
133
  geometry.attributes.merge!(unalign_unmaximise)
135
134
  end
136
135
 
136
+ # @return [Hash<Symbol => Fixnum>]
137
+ def origin
138
+ {
139
+ x: 1,
140
+ xn: (xn - x + 1),
141
+ y: 1,
142
+ yn: (yn - y + 1),
143
+ }
144
+ end
145
+
146
+ # @return [Hash<Symbol => Fixnum>]
147
+ def right
148
+ {
149
+ x: x + offset,
150
+ xn: xn + offset,
151
+ }
152
+ end
153
+
137
154
  # @return [Hash<Symbol => Boolean|Symbol]
138
155
  def unalign_unmaximise
139
156
  {
@@ -143,6 +160,14 @@ module Vedeu
143
160
  }.merge(directional_move)
144
161
  end
145
162
 
163
+ # @return [Hash<Symbol => Fixnum>]
164
+ def up
165
+ {
166
+ y: y - offset,
167
+ yn: yn - offset,
168
+ }
169
+ end
170
+
146
171
  # Refresh the cursor after moving.
147
172
  #
148
173
  # @return [void]
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Allows the storing of interface/view geometry independent of the
8
8
  # interface instance.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Repository < Vedeu::Repositories::Repository
11
13
 
12
14
  null Vedeu::Geometries::Geometry
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Clear the interfaces belonging to the named group.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Clear
10
12
 
11
13
  class << self
@@ -15,6 +15,8 @@ module Vedeu
15
15
  # showing or hiding the group would of course, show or hide the
16
16
  # interfaces of that group.
17
17
  #
18
+ # @api public
19
+ #
18
20
  class DSL
19
21
 
20
22
  include Vedeu::DSL
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Interfaces can be associated with one another by being members
8
8
  # of the same Group. A Group is a collection of interface names.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Group
11
13
 
12
14
  include Vedeu::Repositories::Model
@@ -14,6 +14,8 @@ module Vedeu
14
14
  # @example
15
15
  # Vedeu.trigger(:_refresh_group_, group_name)
16
16
  #
17
+ # @api private
18
+ #
17
19
  class Refresh
18
20
 
19
21
  include Vedeu::Common
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Allows the storing of view groups.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Repository < Vedeu::Repositories::Repository
10
12
 
11
13
  null Vedeu::Groups::Group
@@ -10,6 +10,8 @@ module Vedeu
10
10
  # Captures input from the user terminal via 'getch' and
11
11
  # translates special characters into symbols.
12
12
  #
13
+ # @api private
14
+ #
13
15
  class Capture
14
16
 
15
17
  include Vedeu::Common
@@ -9,6 +9,8 @@ module Vedeu
9
9
  # of this definition will affect that interface. This allows you
10
10
  # to form context driven behaviour for your application.
11
11
  #
12
+ # @api private
13
+ #
12
14
  class DSL
13
15
 
14
16
  include Vedeu::Common
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # A single keypress or combination of keypresses bound to a
8
8
  # specific action.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Key
11
13
 
12
14
  # @!attribute [r] input
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # A container class for keys associated with a particular
8
8
  # interface.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Keymap
11
13
 
12
14
  include Vedeu::Repositories::Model
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Allows the storing of keymaps.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Repository < Vedeu::Repositories::Repository
10
12
 
11
13
  real Vedeu::Input::Keymap
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Translates escape sequences provided by the terminal into
8
8
  # symbols which Vedeu can use for various behaviours.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Translator
11
13
 
12
14
  # @param (see #initialize)
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Clear the named interface.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Clear
10
12
 
11
13
  include Vedeu::Common
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # DSL for creating interfaces.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class DSL
10
12
 
11
13
  include Vedeu::Common
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # An Interface represents a portion of the terminal defined by
8
8
  # {Vedeu::Geometries::Geometry}.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Interface
11
13
 
12
14
  include Vedeu::Repositories::Model
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Provides a non-existent model to swallow messages.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Null < Vedeu::Null::Generic
10
12
 
11
13
  include Vedeu::Presentation
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Allows the storing of interfaces and views.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Repository < Vedeu::Repositories::Repository
10
12
 
11
13
  null Vedeu::Interfaces::Null
@@ -8,6 +8,8 @@ module Vedeu
8
8
  # The configuration option 'debug' must be set to true to enable
9
9
  # this functionality.
10
10
  #
11
+ # @api private
12
+ #
11
13
  class Timer
12
14
 
13
15
  class << self
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Provides the mechanism to create menus within client
8
8
  # applications and use events to drive them.
9
9
  #
10
+ # @api public
11
+ #
10
12
  class DSL
11
13
 
12
14
  include Vedeu::DSL
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Converts the collection passed into a list of menu items which
8
8
  # can be navigated using the instance methods or events provided.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Menu
11
13
 
12
14
  include Vedeu::Repositories::Model
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Allows the storing of menus by name.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Repository < Vedeu::Repositories::Repository
10
12
 
11
13
  real Vedeu::Menus::Menu
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # A Page represents an array of Vedeu::Models::Row objects.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Page
10
12
 
11
13
  include Enumerable
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # A Row represents an array of Vedeu::Cells::Empty objects.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Row
10
12
 
11
13
  include Enumerable
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Provides a non-existent model to swallow messages.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Generic
10
12
 
11
13
  # @!attribute [r] attributes
@@ -5,6 +5,9 @@ module Vedeu
5
5
  module Output
6
6
 
7
7
  # @see Vedeu::Bindings::System#refresh!
8
+ #
9
+ # @api private
10
+ #
8
11
  class Refresh
9
12
 
10
13
  # @return (see #all)
@@ -4,6 +4,8 @@ module Vedeu
4
4
 
5
5
  # A class responsible for plugin loading.
6
6
  #
7
+ # @api private
8
+ #
7
9
  class Plugin
8
10
 
9
11
  # @!attribute [r] name
@@ -4,6 +4,8 @@ module Vedeu
4
4
 
5
5
  # A class responsible for managing plugins installation.
6
6
  #
7
+ # @api private
8
+ #
7
9
  class Plugins
8
10
 
9
11
  # Returns a new instance of Vedeu::Plugins.
@@ -15,6 +15,8 @@ module Vedeu
15
15
  #
16
16
  # @see Vedeu::EscapeSequences::Esc
17
17
  #
18
+ # @api private
19
+ #
18
20
  class Style
19
21
 
20
22
  class << self
@@ -8,6 +8,8 @@ module Vedeu
8
8
  # {Vedeu::Cells::Char} objects into a stream of characters without
9
9
  # escape sequences.
10
10
  #
11
+ # @api private
12
+ #
11
13
  class Escape < Vedeu::Renderers::File
12
14
 
13
15
  include Vedeu::Renderers::Options
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Renders a {Vedeu::Buffers::Terminal} as a HTML snippet; a table
8
8
  # by default.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class HTML < Vedeu::Renderers::File
11
13
 
12
14
  include Vedeu::Renderers::Options
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Renders a {Vedeu::Buffers::Terminal} as JSON.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class JSON < Vedeu::Renderers::File
10
12
 
11
13
  include Vedeu::Renderers::Options
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Writes the given output to a file.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class File
10
12
 
11
13
  include Vedeu::Renderers::Options
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Converts a grid of {Vedeu::Cells::Char} objects into a stream of
8
8
  # escape sequences and content suitable for a terminal.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class Terminal
11
13
 
12
14
  include Vedeu::Renderers::Options
@@ -8,6 +8,8 @@ module Vedeu
8
8
  # {Vedeu::Cells::Char} objects into a stream of characters without
9
9
  # escape sequences.
10
10
  #
11
+ # @api private
12
+ #
11
13
  class Text < Vedeu::Renderers::File
12
14
 
13
15
  include Vedeu::Renderers::Options
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # When included into a class, provides the mechanism to store the
8
8
  # class in a repository for later retrieval.
9
9
  #
10
+ # @api private
11
+ #
10
12
  module Model
11
13
 
12
14
  # @!attribute [rw] repository
@@ -12,6 +12,8 @@ module Vedeu
12
12
  #
13
13
  # { 'models' => [Model] }
14
14
  #
15
+ # @api private
16
+ #
15
17
  class Repository
16
18
 
17
19
  include Vedeu::Common
@@ -10,6 +10,8 @@ module Vedeu
10
10
  # initializes Vedeu with this data, then starts the client
11
11
  # application.
12
12
  #
13
+ # @api private
14
+ #
13
15
  class Bootstrap
14
16
 
15
17
  # @param (see #initialize)
@@ -8,6 +8,8 @@ module Vedeu
8
8
  # uncaught exceptions and finally the exiting of the application
9
9
  # with the correct exit code.
10
10
  #
11
+ # @api public
12
+ #
11
13
  class Launcher
12
14
 
13
15
  # @!attribute [r] exit_code
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Provides the main loop for a Vedeu application.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class MainLoop
10
12
 
11
13
  trap('SIGTERM') { stop! }
@@ -6,23 +6,76 @@ module Vedeu
6
6
 
7
7
  # Vedeu can respond to various signals which are handled here.
8
8
  #
9
+ # @api private
10
+ #
9
11
  module Traps
10
12
 
11
13
  # :nocov:
12
14
 
13
- Signal.trap('INT') do
14
- exit(1)
15
- end
15
+ # @param keys [Array<Symbol>]
16
+ # @macro param_block
17
+ # @macro raise_requires_block
18
+ # @return [Array<Symbol>]
19
+ def self.add_signal_trap(*keys, &block)
20
+ raise Vedeu::Error::RequiresBlock unless block_given?
21
+
22
+ # fail Signal.list.inspect
16
23
 
17
- Signal.trap('TERM') do
18
- exit(1)
24
+ keys.each do |key|
25
+ Signal.trap(key.to_s, &block) if Signal.list.key?(key.to_s)
26
+ end
19
27
  end
20
28
 
21
- Signal.trap('TTIN') {}
22
- Signal.trap('USR1') {}
23
- Signal.trap('USR2') {}
29
+ # Resize terminal
30
+ add_signal_trap(:WINCH) { Vedeu.trigger(:_resize_) }
31
+
32
+ # Stop runtime (failure)
33
+ add_signal_trap(:INT, :TERM) { exit(1) }
34
+
35
+ # Read from terminal
36
+ add_signal_trap(:TTIN) {}
37
+
38
+ # User
39
+ add_signal_trap(:USR1, :USR2) {}
24
40
 
25
- Signal.trap('SIGWINCH') { Vedeu.trigger(:_resize_) }
41
+ # Signals from Ubuntu Linux 16.04.
42
+ #
43
+ # {
44
+ # "EXIT" => 0,
45
+ # "HUP" => 1,
46
+ # "INT" => 2,
47
+ # "QUIT" => 3,
48
+ # "ILL" => 4,
49
+ # "TRAP" => 5,
50
+ # "ABRT" => 6,
51
+ # "IOT" => 6,
52
+ # "BUS" => 7,
53
+ # "FPE" => 8,
54
+ # "KILL" => 9,
55
+ # "USR1" => 10,
56
+ # "SEGV" => 11,
57
+ # "USR2" => 12,
58
+ # "PIPE" => 13,
59
+ # "ALRM" => 14,
60
+ # "TERM" => 15,
61
+ # "CHLD" => 17,
62
+ # "CLD" => 17,
63
+ # "STOP" => 19,
64
+ # "CONT" => 18,
65
+ # "TSTP" => 20,
66
+ # "TTIN" => 21,
67
+ # "TTOU" => 22,
68
+ # "URG" => 23,
69
+ # "XCPU" => 24,
70
+ # "XFSZ" => 25,
71
+ # "VTALRM" => 26,
72
+ # "PROF" => 27,
73
+ # "WINCH" => 28,
74
+ # "IO" => 29,
75
+ # "POLL" => 29,
76
+ # "PWR" => 30,
77
+ # "SYS" => 31,
78
+ # }
26
79
 
27
80
  # :nocov:
28
81
 
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Generic class to loading a template and parsing it via ERb.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Template
10
12
 
11
13
  # @param (see #initialize)
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # Extend Template to provide client application view specific
8
8
  # parsing.
9
9
  #
10
+ # @api private
11
+ #
10
12
  class ViewTemplate < Vedeu::Templating::Template
11
13
 
12
14
  include Vedeu::Common
data/lib/vedeu/version.rb CHANGED
@@ -3,6 +3,6 @@
3
3
  module Vedeu
4
4
 
5
5
  # The current version of Vedeu.
6
- VERSION = '0.8.23'
6
+ VERSION = '0.8.24'
7
7
 
8
- end
8
+ end # Vedeu
@@ -8,6 +8,8 @@ module Vedeu
8
8
 
9
9
  # A composition is a collection of interfaces.
10
10
  #
11
+ # @api private
12
+ #
11
13
  class Composition
12
14
 
13
15
  include Vedeu::Repositories::Model
@@ -10,6 +10,8 @@ module Vedeu
10
10
  # {Vedeu::Views::Stream} objects. A line's width is determined by
11
11
  # the {Vedeu::Geometries::Geometry} it belongs to.
12
12
  #
13
+ # @api private
14
+ #
13
15
  class Line
14
16
 
15
17
  # Provides DSL methods for Vedeu::Views::Line objects.
@@ -11,6 +11,8 @@ module Vedeu
11
11
  # {Vedeu::Views::Line} which you wish to colour and style
12
12
  # independently of the other characters in that line.
13
13
  #
14
+ # @api private
15
+ #
14
16
  class Stream
15
17
 
16
18
  # Provides DSL methods for Vedeu::Views::Stream objects.
@@ -9,6 +9,8 @@ module Vedeu
9
9
  # Represents a container for {Vedeu::Views::Line} and
10
10
  # {Vedeu::Views::Stream} objects.
11
11
  #
12
+ # @api private
13
+ #
12
14
  class View
13
15
 
14
16
  # Provides DSL methods for Vedeu::Views::View objects.
@@ -8,8 +8,30 @@ module Vedeu
8
8
 
9
9
  describe Traps do
10
10
 
11
- # @todo Add more tests.
12
- # it { skip }
11
+ let(:described) { Vedeu::Runtime::Traps }
12
+ let(:keys) { :SIGWINCH }
13
+
14
+ describe '.add_signal_trap' do
15
+ subject { described.add_signal_trap(keys) { } }
16
+
17
+ context 'when the required block was given' do
18
+ context 'when signals were given' do
19
+ it { subject.must_equal([:SIGWINCH]) }
20
+ end
21
+
22
+ context 'when no signals were given' do
23
+ let(:keys) {}
24
+
25
+ it { subject.must_equal([nil]) }
26
+ end
27
+ end
28
+
29
+ context 'when the required block was not given' do
30
+ subject { described.add_signal_trap(keys) }
31
+
32
+ it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) }
33
+ end
34
+ end
13
35
 
14
36
  end # Traps
15
37
 
data/vedeu.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'yard', '0.8.7.6'
34
34
 
35
35
  spec.add_dependency 'bundler', '~> 1.10'
36
- spec.add_dependency 'rake', '~> 10.4'
36
+ spec.add_dependency 'rake', '~> 10.5'
37
37
  spec.add_dependency 'thor', '0.19.1'
38
- spec.add_dependency 'vedeu_cli', '0.0.8'
38
+ spec.add_dependency 'vedeu_cli', '0.0.10'
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.23
4
+ version: 0.8.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '10.4'
173
+ version: '10.5'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '10.4'
180
+ version: '10.5'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: thor
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - '='
200
200
  - !ruby/object:Gem::Version
201
- version: 0.0.8
201
+ version: 0.0.10
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: 0.0.8
208
+ version: 0.0.10
209
209
  description: A framework for building GUI/TUI terminal/console applications.
210
210
  email:
211
211
  - gavinlaking@gmail.com
@@ -587,6 +587,7 @@ files:
587
587
  - integrations/expected/dsl_app_014.out
588
588
  - integrations/expected/dsl_app_015.out
589
589
  - integrations/expected/dsl_app_016.out
590
+ - integrations/expected/dsl_app_017.out
590
591
  - integrations/expected/dsl_app_021.out
591
592
  - integrations/expected/dsl_app_022.out
592
593
  - integrations/expected/dsl_app_border_001.out