vedeu 0.8.16 → 0.8.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/TODO.md +8 -0
  3. data/examples/dsl_alignment.rb +5 -2
  4. data/examples/dsl_horizontal_alignment.rb +5 -2
  5. data/examples/dsl_vertical_alignment.rb +5 -2
  6. data/integrations/test_runner.sh +2 -3
  7. data/lib/vedeu.rb +31 -1
  8. data/lib/vedeu/borders/all.rb +19 -0
  9. data/lib/vedeu/borders/border.rb +1 -2
  10. data/lib/vedeu/borders/caption.rb +2 -0
  11. data/lib/vedeu/borders/refresh.rb +4 -17
  12. data/lib/vedeu/borders/repository.rb +0 -14
  13. data/lib/vedeu/borders/title.rb +9 -3
  14. data/lib/vedeu/buffers/all.rb +25 -0
  15. data/lib/vedeu/buffers/buffer.rb +2 -2
  16. data/lib/vedeu/buffers/refresh.rb +1 -15
  17. data/lib/vedeu/buffers/terminal.rb +0 -15
  18. data/lib/vedeu/buffers/view.rb +2 -2
  19. data/lib/vedeu/cells/empty.rb +4 -5
  20. data/lib/vedeu/coercers/all.rb +0 -5
  21. data/lib/vedeu/cursors/all.rb +88 -0
  22. data/lib/vedeu/cursors/cursor.rb +7 -92
  23. data/lib/vedeu/cursors/move.rb +44 -14
  24. data/lib/vedeu/cursors/refresh.rb +5 -17
  25. data/lib/vedeu/cursors/reposition.rb +2 -2
  26. data/lib/vedeu/distributed/all.rb +16 -0
  27. data/lib/vedeu/distributed/server.rb +0 -16
  28. data/lib/vedeu/dsl/dsl.rb +2 -2
  29. data/lib/vedeu/dsl/helpers/align.rb +1 -1
  30. data/lib/vedeu/dsl/helpers/attributes.rb +1 -1
  31. data/lib/vedeu/dsl/helpers/truncate.rb +1 -1
  32. data/lib/vedeu/dsl/helpers/wordwrap.rb +1 -1
  33. data/lib/vedeu/dsl/view.rb +1 -1
  34. data/lib/vedeu/dsl/views.rb +22 -6
  35. data/lib/vedeu/editor/all.rb +54 -0
  36. data/lib/vedeu/editor/cropper.rb +3 -5
  37. data/lib/vedeu/editor/cursor.rb +2 -4
  38. data/lib/vedeu/editor/document.rb +1 -1
  39. data/lib/vedeu/editor/editor.rb +2 -17
  40. data/lib/vedeu/editor/repository.rb +0 -45
  41. data/lib/vedeu/events/event.rb +1 -1
  42. data/lib/vedeu/geometries/all.rb +46 -1
  43. data/lib/vedeu/geometries/area/area.rb +2 -2
  44. data/lib/vedeu/geometries/dsl/grid.rb +16 -20
  45. data/lib/vedeu/geometries/geometry.rb +1 -1
  46. data/lib/vedeu/geometries/move.rb +2 -38
  47. data/lib/vedeu/geometries/repository.rb +0 -14
  48. data/lib/vedeu/groups/all.rb +23 -0
  49. data/lib/vedeu/groups/clear.rb +1 -10
  50. data/lib/vedeu/groups/group.rb +0 -12
  51. data/lib/vedeu/groups/refresh.rb +2 -11
  52. data/lib/vedeu/input/all.rb +35 -0
  53. data/lib/vedeu/input/capture.rb +2 -2
  54. data/lib/vedeu/input/mapper.rb +0 -35
  55. data/lib/vedeu/input/raw.rb +1 -1
  56. data/lib/vedeu/input/read.rb +1 -1
  57. data/lib/vedeu/interfaces/all.rb +24 -0
  58. data/lib/vedeu/interfaces/clear.rb +32 -46
  59. data/lib/vedeu/interfaces/interface.rb +0 -16
  60. data/lib/vedeu/menus/all.rb +44 -0
  61. data/lib/vedeu/menus/menu.rb +13 -8
  62. data/lib/vedeu/menus/repository.rb +0 -44
  63. data/lib/vedeu/models/all.rb +13 -0
  64. data/lib/vedeu/models/focus.rb +0 -13
  65. data/lib/vedeu/models/toggleable.rb +1 -1
  66. data/lib/vedeu/null/generic.rb +1 -1
  67. data/lib/vedeu/output/all.rb +7 -0
  68. data/lib/vedeu/output/compressor.rb +11 -6
  69. data/lib/vedeu/output/compressors/character.rb +2 -0
  70. data/lib/vedeu/output/refresh.rb +0 -7
  71. data/lib/vedeu/output/viewport.rb +2 -5
  72. data/lib/vedeu/plugins/plugin.rb +1 -1
  73. data/lib/vedeu/presentation/colour.rb +6 -1
  74. data/lib/vedeu/renderers/all.rb +1 -1
  75. data/lib/vedeu/repositories/repositories.rb +1 -1
  76. data/lib/vedeu/runtime/all.rb +28 -0
  77. data/lib/vedeu/runtime/application.rb +0 -18
  78. data/lib/vedeu/runtime/flags.rb +0 -7
  79. data/lib/vedeu/runtime/router.rb +0 -11
  80. data/lib/vedeu/runtime/traps.rb +2 -0
  81. data/lib/vedeu/templating/view_template.rb +2 -4
  82. data/lib/vedeu/terminal/all.rb +7 -0
  83. data/lib/vedeu/terminal/terminal.rb +0 -7
  84. data/lib/vedeu/version.rb +1 -1
  85. data/lib/vedeu/views/view.rb +3 -3
  86. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  87. data/test/lib/vedeu/cursors/move_test.rb +2 -2
  88. data/test/lib/vedeu/presentation/colour_test.rb +26 -0
  89. data/test/support/colour_support.sh +3 -1
  90. data/test/support/examples/material_colours_app.rb +2 -28
  91. data/test/support/stats.sh +1 -1
  92. data/test/test_helper.rb +0 -1
  93. data/vedeu.gemspec +1 -1
  94. metadata +4 -6
  95. data/test/support/helpers/presentation_colour_test_class.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 805fd2db1418da4e71a147f7e0c3abffe83cbca0
4
- data.tar.gz: 5ae3a8f1f58bbce6b6581063d766f8b67cb87925
3
+ metadata.gz: 428c6ce796c2302c1c1ffdc4fe0e24dbc93bd72d
4
+ data.tar.gz: f2be6bebebfc68dad88801c1d28100bcd615a7fe
5
5
  SHA512:
6
- metadata.gz: 8b85555d260e7e07638b1239abb46f97c99929539f8bac9efebe7b4239c72d47bc3941012826595806bf5b195e6a6421a5cd85b20affdc89f443ba68608c69c0
7
- data.tar.gz: c8906b96488c8158013fd89a5f5faa4a7f77c8978a199e994f059de9735b341e35d19647c810af8a98a861c745146c46dbcc101543444c96948c17e401a0b326
6
+ metadata.gz: ea73e52d7a7641e7d201508946bd444f8010c33d43b198ae2a8db66b634beb2f6604eaae721f1123a3fdb7a7580635c677419f6de963eb6c4d4eef366abf14af
7
+ data.tar.gz: 29571610db40d58fdb32d01ce87719da00ff8f28f5f67bb0776156d9a79a4affe5f3b48ed76b90a0fb7e87e44bfaa4c9ded1194508b6340e2cf8e8b14f5d510e
data/TODO.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 2016-02-25
2
+
3
+ - In Vedeu::XCoordinate and Vedeu::YCoordinate, rename #d_dn to
4
+ #bd_bdn
5
+ - Add new #d_dn to Vedeu::XCoordinate and Vedeu::YCoordinate.
6
+ - Rename all private instance variables used for memoization from
7
+ '@...' to '@_...'.
8
+
1
9
  ## 2016-01-16
2
10
 
3
11
  - Add Vedeu::Index which converts a Vedeu::Point to an array index.
@@ -12,8 +12,11 @@ class AlignmentApp
12
12
  Vedeu.configure do
13
13
  debug!
14
14
  log '/tmp/alignment.log'
15
- renderers(Vedeu::Renderers::Terminal.new,
16
- Vedeu::Renderers::Text.new(filename: '/tmp/alignment.out'))
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new,
17
+ # Vedeu::Renderers::Text.new(
18
+ # filename: '/tmp/alignment.out'),
19
+ ]
17
20
  run_once!
18
21
  standalone!
19
22
  end
@@ -51,8 +51,11 @@ class HorizontalAlignmentApp
51
51
  Vedeu.configure do
52
52
  debug!
53
53
  log '/tmp/vedeu_horizontal.log'
54
- renderers(Vedeu::Renderers::Terminal.new,
55
- Vedeu::Renderers::Text.new(filename: '/tmp/vedeu_horizontal.out'))
54
+ renderers [
55
+ Vedeu::Renderers::Terminal.new,
56
+ # Vedeu::Renderers::Text.new(
57
+ # filename: '/tmp/vedeu_horizontal.out'),
58
+ ]
56
59
  end
57
60
 
58
61
  Vedeu.interface :left_interface do
@@ -51,8 +51,11 @@ class VerticalAlignmentApp
51
51
  Vedeu.configure do
52
52
  debug!
53
53
  log '/tmp/vedeu_vertical.log'
54
- renderers(Vedeu::Renderers::Terminal.new,
55
- Vedeu::Renderers::Text.new(filename: '/tmp/vedeu_vertical.out'))
54
+ renderers [
55
+ Vedeu::Renderers::Terminal.new,
56
+ # Vedeu::Renderers::Text.new(
57
+ # filename: '/tmp/vedeu_vertical.out'),
58
+ ]
56
59
  end
57
60
 
58
61
  Vedeu.interface :top_interface do
@@ -1,12 +1,11 @@
1
1
  #!/bin/bash
2
2
 
3
+ set -euo pipefail
4
+
3
5
  # Notes:
4
6
  # At the moment, the terminal must be set to width 135 x height 34 for
5
7
  # these tests to pass.
6
8
 
7
- # die on error
8
- set -e
9
-
10
9
  # change to directory that contains this script
11
10
  cd "$(dirname "$0")"
12
11
 
data/lib/vedeu.rb CHANGED
@@ -70,6 +70,36 @@ end # Vedeu
70
70
  # target model to act upon. May default to `Vedeu.focus`.
71
71
  #
72
72
  # @!macro [new] return_name
73
- # @return [NilClass|Symbol|String]
73
+ # @return [NilClass|Symbol|String] The name of the model, the target
74
+ # model or the name of the associated model.
75
+ #
76
+ # @!macro [new] border_by_name
77
+ # Returns the named border from the borders repository.
78
+ # @return [Vedeu::Borders::Border]
79
+ #
80
+ # @!macro [new] buffer_by_name
81
+ # Returns the named buffer from the buffer repository.
82
+ # @return [Vedeu::Buffers::Buffer]
83
+ #
84
+ # @!macro [new] cursor_by_name
85
+ # Returns the named cursor from the cursors repository.
86
+ # @return [Vedeu::Cursors::Cursor]
87
+ #
88
+ # @!macro [new] document_by_name
89
+ # Returns the named document from the documents repository.
90
+ # @return [Vedeu::Editor::Document]
91
+ #
92
+ # @!macro [new] geometry_by_name
93
+ # Returns the named geometry from the geometries repository.
94
+ # @return [Vedeu::Geometries::Geometry]
95
+
96
+ # @!macro [new] group_by_name
97
+ # Returns the named group from the groups repository.
98
+ # @return [Vedeu::Groups::Group]
99
+ #
100
+ # @!macro [new] interface_by_name
101
+ # Returns the named interface/view from the interfaces repository.
102
+ # @return [Vedeu::Interfaces::Interface]
103
+ #
74
104
 
75
105
  require 'vedeu/all'
@@ -33,6 +33,25 @@ module Vedeu
33
33
 
34
34
  end # Borders
35
35
 
36
+ # :nocov:
37
+
38
+ # {include:file:docs/events/by_name/refresh_border.md}
39
+ Vedeu.bind(:_refresh_border_) do |name|
40
+ Vedeu::Borders::Refresh.by_name(name) if Vedeu.ready?
41
+ end
42
+
43
+ # See {file:docs/events/by_name/set_border_caption.md}
44
+ Vedeu.bind(:_set_border_caption_) do |name, caption|
45
+ Vedeu.borders.by_name(name).caption = caption
46
+ end
47
+
48
+ # See {file:docs/events/by_name/set_border_title.md}
49
+ Vedeu.bind(:_set_border_title_) do |name, title|
50
+ Vedeu.borders.by_name(name).title = title
51
+ end
52
+
53
+ # :nocov:
54
+
36
55
  end # Vedeu
37
56
 
38
57
  require 'vedeu/borders/title'
@@ -107,8 +107,7 @@ module Vedeu
107
107
  attr_writer :right_vertical
108
108
 
109
109
  # @!attribute [r] name
110
- # @return [String|Symbol] Associates the border with the
111
- # same-named interface/view.
110
+ # @macro return_name
112
111
  attr_reader :name
113
112
 
114
113
  # @!attribute [r] parent
@@ -18,11 +18,13 @@ module Vedeu
18
18
  private
19
19
 
20
20
  # @return [Fixnum]
21
+ # @see Vedeu::Borders::Title#start_index
21
22
  def start_index
22
23
  (width - size) - 1
23
24
  end
24
25
 
25
26
  # @return [Fixnum]
27
+ # @see Vedeu::Borders::Title#y
26
28
  def y
27
29
  geometry.yn
28
30
  end
@@ -77,7 +77,7 @@ module Vedeu
77
77
  protected
78
78
 
79
79
  # @!attribute [r] name
80
- # @return [String|Symbol]
80
+ # @macro return_name
81
81
  attr_reader :name
82
82
 
83
83
  private
@@ -91,9 +91,7 @@ module Vedeu
91
91
  }
92
92
  end
93
93
 
94
- # Returns the border for the interface.
95
- #
96
- # @return (see Vedeu::Borders::Repository#by_name)
94
+ # @macro border_by_name
97
95
  def border
98
96
  @border ||= Vedeu.borders.by_name(name)
99
97
  end
@@ -122,9 +120,7 @@ module Vedeu
122
120
  [(bottom_left if left?), captionbar, (bottom_right if right?)].compact
123
121
  end
124
122
 
125
- # Returns the geometry for the interface.
126
- #
127
- # @return (see Vedeu::Geometries::Repository#by_name)
123
+ # @macro geometry_by_name
128
124
  def geometry
129
125
  Vedeu.geometries.by_name(name)
130
126
  end
@@ -136,7 +132,7 @@ module Vedeu
136
132
  #
137
133
  # @return (see Vedeu::Interfaces::Repository#by_name)
138
134
  def interface
139
- @interface ||= Vedeu.interfaces.by_name(name)
135
+ @_interface ||= Vedeu.interfaces.by_name(name)
140
136
  end
141
137
  alias parent interface
142
138
 
@@ -218,13 +214,4 @@ module Vedeu
218
214
 
219
215
  end # Borders
220
216
 
221
- # :nocov:
222
-
223
- # {include:file:docs/events/by_name/refresh_border.md}
224
- Vedeu.bind(:_refresh_border_) do |name|
225
- Vedeu::Borders::Refresh.by_name(name) if Vedeu.ready?
226
- end
227
-
228
- # :nocov:
229
-
230
217
  end # Vedeu
@@ -25,18 +25,4 @@ module Vedeu
25
25
  def_delegators Vedeu::Borders::Repository,
26
26
  :borders
27
27
 
28
- # :nocov:
29
-
30
- # See {file:docs/events/by_name/set_border_caption.md}
31
- Vedeu.bind(:_set_border_caption_) do |name, caption|
32
- Vedeu.borders.by_name(name).caption = caption
33
- end
34
-
35
- # See {file:docs/events/by_name/set_border_title.md}
36
- Vedeu.bind(:_set_border_title_) do |name, title|
37
- Vedeu.borders.by_name(name).title = title
38
- end
39
-
40
- # :nocov:
41
-
42
28
  end # Vedeu
@@ -82,7 +82,7 @@ module Vedeu
82
82
  attr_reader :horizontal
83
83
 
84
84
  # @!attribute [r] name
85
- # @return [String|Symbol]
85
+ # @macro return_name
86
86
  attr_reader :name
87
87
 
88
88
  private
@@ -95,7 +95,7 @@ module Vedeu
95
95
  value: char)
96
96
  end
97
97
 
98
- # @return [Vedeu::Borders::Border]
98
+ # @macro border_by_name
99
99
  def border
100
100
  @_border ||= Vedeu.borders.by_name(name)
101
101
  end
@@ -126,7 +126,7 @@ module Vedeu
126
126
  start_index + (size - 1)
127
127
  end
128
128
 
129
- # @return [Vedeu::Geometries::Geometry]
129
+ # @macro geometry_by_name
130
130
  def geometry
131
131
  @_geometry ||= Vedeu.geometries.by_name(name)
132
132
  end
@@ -154,6 +154,10 @@ module Vedeu
154
154
  pad.size
155
155
  end
156
156
 
157
+ # Provides the index on the horizontal border for where the
158
+ # title (or caption) should start. The title will appear
159
+ # top-left, whilst the caption will be justified bottom-right.
160
+ #
157
161
  # @return [Fixnum]
158
162
  def start_index
159
163
  1
@@ -189,6 +193,8 @@ module Vedeu
189
193
  geometry.bx + start_index
190
194
  end
191
195
 
196
+ # Return the vertical position for the title (or caption).
197
+ #
192
198
  # @return [Fixnum]
193
199
  def y
194
200
  geometry.y
@@ -18,6 +18,31 @@ module Vedeu
18
18
 
19
19
  end # Buffers
20
20
 
21
+ # :nocov:
22
+
23
+ # @see Vedeu::Buffers::Terminal#clear
24
+ Vedeu.bind(:_clear_) { Vedeu.clear }
25
+
26
+ # @see Vedeu::Buffers::Terminal#output
27
+ Vedeu.bind(:_drb_retrieve_output_) { Vedeu::Buffers::Terminal.output }
28
+
29
+ # @see Vedeu::Buffers::Terminal#write
30
+ Vedeu.bind(:_drb_store_output_) do |data|
31
+ Vedeu::Buffers::Terminal.write(data)
32
+ end
33
+
34
+ # See {file:docs/events/by_name/refresh_view.md}
35
+ Vedeu.bind(:_refresh_view_) do |name|
36
+ Vedeu::Buffers::Refresh.by_name(name) if Vedeu.ready?
37
+ end
38
+
39
+ # See {file:docs/events/by_name/refresh_view_content.md}
40
+ Vedeu.bind(:_refresh_view_content_) do |name|
41
+ Vedeu::Buffers::Refresh.refresh_content_by_name(name) if Vedeu.ready?
42
+ end
43
+
44
+ # :nocov:
45
+
21
46
  end # Vedeu
22
47
 
23
48
  require 'vedeu/buffers/empty'
@@ -33,7 +33,7 @@ module Vedeu
33
33
  attr_accessor :previous
34
34
 
35
35
  # @!attribute [r] name
36
- # @return [String|Symbol]
36
+ # @macro return_name
37
37
  attr_reader :name
38
38
 
39
39
  # Return a new instance of Buffer. Generally a Buffer is
@@ -185,7 +185,7 @@ module Vedeu
185
185
  }
186
186
  end
187
187
 
188
- # @return [Vedeu::Interfaces::Interface]
188
+ # @macro interface_by_name
189
189
  def interface
190
190
  Vedeu.interfaces.by_name(name)
191
191
  end
@@ -50,7 +50,7 @@ module Vedeu
50
50
 
51
51
  private
52
52
 
53
- # @return [Vedeu::Buffers::Buffer]
53
+ # @macro buffer_by_name
54
54
  def buffer
55
55
  Vedeu.buffers.by_name(name)
56
56
  end
@@ -81,18 +81,4 @@ module Vedeu
81
81
 
82
82
  end # Buffers
83
83
 
84
- # :nocov:
85
-
86
- # See {file:docs/events/by_name/refresh_view.md}
87
- Vedeu.bind(:_refresh_view_) do |name|
88
- Vedeu::Buffers::Refresh.by_name(name) if Vedeu.ready?
89
- end
90
-
91
- # See {file:docs/events/by_name/refresh_view_content.md}
92
- Vedeu.bind(:_refresh_view_content_) do |name|
93
- Vedeu::Buffers::Refresh.refresh_content_by_name(name) if Vedeu.ready?
94
- end
95
-
96
- # :nocov:
97
-
98
84
  end # Vedeu
@@ -100,19 +100,4 @@ module Vedeu
100
100
  :clear,
101
101
  :refresh
102
102
 
103
- # :nocov:
104
-
105
- # @see Vedeu::Buffers::Terminal#clear
106
- Vedeu.bind(:_clear_) { Vedeu.clear }
107
-
108
- # @see Vedeu::Buffers::Terminal#output
109
- Vedeu.bind(:_drb_retrieve_output_) { Vedeu::Buffers::Terminal.output }
110
-
111
- # @see Vedeu::Buffers::Terminal#write
112
- Vedeu.bind(:_drb_store_output_) do |data|
113
- Vedeu::Buffers::Terminal.write(data)
114
- end
115
-
116
- # :nocov:
117
-
118
103
  end # Vedeu
@@ -58,7 +58,7 @@ module Vedeu
58
58
  protected
59
59
 
60
60
  # @!attribute [r] name
61
- # @return [String|Symbol]
61
+ # @macro return_name
62
62
  attr_reader :name
63
63
 
64
64
  private
@@ -85,7 +85,7 @@ module Vedeu
85
85
  }
86
86
  end
87
87
 
88
- # @return [Vedeu::Geometries::Geometry]
88
+ # @macro geometry_by_name
89
89
  def geometry
90
90
  @_geometry ||= Vedeu.geometries.by_name(name)
91
91
  end
@@ -18,8 +18,7 @@ module Vedeu
18
18
  include Vedeu::Repositories::Defaults
19
19
 
20
20
  # @!attribute [r] name
21
- # @return [String|Symbol] The name of the interface/view this
22
- # cell belongs to.
21
+ # @macro return_name
23
22
  attr_reader :name
24
23
 
25
24
  # @!attribute [r] value
@@ -99,17 +98,17 @@ module Vedeu
99
98
  }
100
99
  end
101
100
 
102
- # @return [Vedeu::Borders::Border]
101
+ # @macro border_by_name
103
102
  def border
104
103
  Vedeu.borders.by_name(name)
105
104
  end
106
105
 
107
- # @return [Vedeu::Geometries::Geometry]
106
+ # @macro geometry_by_name
108
107
  def geometry
109
108
  Vedeu.geometries.by_name(name)
110
109
  end
111
110
 
112
- # @return [Vedeu::Interfaces::Interface]
111
+ # @macro interface_by_name
113
112
  def interface
114
113
  Vedeu.interfaces.by_name(name)
115
114
  end