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
@@ -79,11 +79,4 @@ module Vedeu
79
79
  :ready?,
80
80
  :ready!
81
81
 
82
- # :nocov:
83
-
84
- # See {file:docs/events/system.md#\_initialize_}
85
- Vedeu.bind(:_initialize_) { Vedeu.ready! }
86
-
87
- # :nocov:
88
-
89
82
  end # Vedeu
@@ -176,15 +176,4 @@ module Vedeu
176
176
  def_delegators Vedeu::Runtime::Router,
177
177
  :goto
178
178
 
179
- # :nocov:
180
-
181
- # See {file:docs/events/application.md#\_goto_}
182
- Vedeu.bind(:_goto_) do |controller, action, **args|
183
- Vedeu::Runtime::Router.goto(controller, action, **args)
184
- end
185
-
186
- # Vedeu.bind_alias(:_action_, :_goto_)
187
-
188
- # :nocov:
189
-
190
179
  end # Vedeu
@@ -9,6 +9,7 @@ module Vedeu
9
9
  module Traps
10
10
 
11
11
  # :nocov:
12
+
12
13
  Signal.trap('INT') do
13
14
  exit(1)
14
15
  end
@@ -22,6 +23,7 @@ module Vedeu
22
23
  Signal.trap('USR2') {}
23
24
 
24
25
  Signal.trap('SIGWINCH') { Vedeu.trigger(:_resize_) }
26
+
25
27
  # :nocov:
26
28
 
27
29
  end # Traps
@@ -72,15 +72,13 @@ module Vedeu
72
72
  }
73
73
  end
74
74
 
75
- # Returns the interface by name.
76
- #
77
- # @return (see Vedeu::Interfaces::Repository#by_name)
75
+ # @macro interface_by_name
78
76
  def interface
79
77
  Vedeu.interfaces.by_name(name)
80
78
  end
81
79
  alias interface? interface
82
80
 
83
- # @return [String|Symbol]
81
+ # @macro return_name
84
82
  def name
85
83
  options[:name]
86
84
  end
@@ -9,6 +9,13 @@ module Vedeu
9
9
 
10
10
  end # Terminal
11
11
 
12
+ # :nocov:
13
+
14
+ # See {file:docs/events/view.md#\_resize_}
15
+ Vedeu.bind(:_resize_, delay: 0.25) { Vedeu.resize }
16
+
17
+ # :nocov:
18
+
12
19
  end # Vedeu
13
20
 
14
21
  require 'vedeu/terminal/mode'
@@ -169,11 +169,4 @@ module Vedeu
169
169
  def_delegators Vedeu::Terminal,
170
170
  :resize
171
171
 
172
- # :nocov:
173
-
174
- # See {file:docs/events/view.md#\_resize_}
175
- Vedeu.bind(:_resize_, delay: 0.25) { Vedeu.resize }
176
-
177
- # :nocov:
178
-
179
172
  end # Vedeu
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.16'
6
+ VERSION = '0.8.17'
7
7
 
8
8
  end
@@ -47,7 +47,7 @@ module Vedeu
47
47
  alias cursor_visible? cursor_visible
48
48
 
49
49
  # @!attribute [rw] name
50
- # @return [String|Symbol]
50
+ # @macro return_name
51
51
  attr_accessor :name
52
52
 
53
53
  # @!attribute [rw] wordwrap
@@ -146,7 +146,7 @@ module Vedeu
146
146
 
147
147
  private
148
148
 
149
- # @return [Vedeu::Buffers::Buffer]
149
+ # @macro buffer_by_name
150
150
  def buffer
151
151
  Vedeu.buffers.by_name(name)
152
152
  end
@@ -166,7 +166,7 @@ module Vedeu
166
166
  }
167
167
  end
168
168
 
169
- # @return [Vedeu::Interfaces::Interface]
169
+ # @macro interface_by_name
170
170
  def interface
171
171
  Vedeu.interfaces.by_name(name)
172
172
  end
@@ -198,8 +198,8 @@ module Vedeu
198
198
 
199
199
  it { subject.x.must_equal(6) }
200
200
  it { subject.y.must_equal(6) }
201
- it { subject.ox.must_equal(0) }
202
- it { subject.oy.must_equal(0) }
201
+ it { subject.ox.must_equal(1) }
202
+ it { subject.oy.must_equal(1) }
203
203
  end
204
204
 
205
205
  describe '#move_right' do
@@ -242,7 +242,7 @@ module Vedeu
242
242
  context 'when < 0' do
243
243
  let(:ox) { -2 }
244
244
 
245
- it { subject.must_equal(0) }
245
+ it { subject.must_equal(1) }
246
246
  end
247
247
  end
248
248
 
@@ -254,7 +254,7 @@ module Vedeu
254
254
  context 'when < 0' do
255
255
  let(:oy) { -4 }
256
256
 
257
- it { subject.must_equal(0) }
257
+ it { subject.must_equal(1) }
258
258
  end
259
259
  end
260
260
 
@@ -44,13 +44,13 @@ module Vedeu
44
44
 
45
45
  context 'when the cursor is visible' do
46
46
  context 'when a valid direction is given' do
47
- let(:direction) { :move_left }
47
+ let(:direction) { :move_right }
48
48
 
49
49
  it { subject.must_be_instance_of(Vedeu::Cursors::Cursor) }
50
50
  end
51
51
 
52
52
  context 'when an invalid direction is given' do
53
- let(:direction) { :invalid }
53
+ let(:direction) { :move_left }
54
54
 
55
55
  it { subject.must_equal(nil) }
56
56
  end
@@ -4,6 +4,32 @@ require 'test_helper'
4
4
 
5
5
  module Vedeu
6
6
 
7
+ class ParentPresentationColourTestClass
8
+
9
+ include Vedeu::Presentation
10
+
11
+ attr_reader :colour
12
+
13
+ def initialize
14
+ @colour = { background: '#330000', foreground: '#00aadd' }
15
+ @parent = nil
16
+ end
17
+
18
+ end # ParentPresentationColourTestClass
19
+
20
+ class PresentationColourTestClass
21
+
22
+ include Vedeu::Presentation
23
+
24
+ attr_reader :parent
25
+
26
+ def initialize(attributes = {})
27
+ @colour = attributes[:colour]
28
+ @parent = attributes[:parent]
29
+ end
30
+
31
+ end # PresentationTestClass
32
+
7
33
  module Presentation
8
34
 
9
35
  describe Colour do
@@ -1,5 +1,7 @@
1
1
  #!/bin/bash
2
- #
2
+
3
+ set -euo pipefail
4
+
3
5
  # Vedeu can use 24-bit color codes. To test whether your terminal supports
4
6
  # this colour mode, running this file should output lots of beautiful colours.
5
7
  # If the output is 'patchy' and not many colours show, then it is unlikely
@@ -31,23 +31,6 @@ class VedeuMaterialColoursApp
31
31
  threaded false
32
32
  end
33
33
 
34
- class CursorView
35
- def render
36
- Vedeu.render do
37
- view('cursor') do
38
- line do
39
- stream 'Cursor: ', foreground: '#ff8800'
40
- stream "#{cursor_position}"
41
- end
42
- end
43
- end
44
- end
45
-
46
- def cursor_position
47
- Vedeu.trigger(:_cursor_position_, Vedeu.focus)
48
- end
49
- end
50
-
51
34
  # Borders can be defined as standalone declarations.
52
35
  Vedeu.border 'no_bottom' do
53
36
  background '#000000'
@@ -230,7 +213,7 @@ class VedeuMaterialColoursApp
230
213
  Vedeu.interface 'only_left' do
231
214
  colour foreground: '#000000', background: '#cddc39'
232
215
  border do
233
- foreground '#000000'
216
+ foreground '#ffffff'
234
217
  show_top false
235
218
  show_bottom false
236
219
  show_right false
@@ -301,21 +284,17 @@ class VedeuMaterialColoursApp
301
284
  end
302
285
 
303
286
  Vedeu.keymap('_global_') do
304
- key(:up) do
287
+ key(:up) do
305
288
  Vedeu.trigger(:_cursor_up_);
306
- CursorView.new.render
307
289
  end
308
290
  key(:right) do
309
291
  Vedeu.trigger(:_cursor_right_)
310
- CursorView.new.render
311
292
  end
312
293
  key(:down) do
313
294
  Vedeu.trigger(:_cursor_down_)
314
- CursorView.new.render
315
295
  end
316
296
  key(:left) do
317
297
  Vedeu.trigger(:_cursor_left_)
318
- CursorView.new.render
319
298
  end
320
299
  key(:home) { Vedeu.trigger(:_cursor_top_) }
321
300
  key(:end) { Vedeu.trigger(:_cursor_bottom_) }
@@ -350,19 +329,15 @@ class VedeuMaterialColoursApp
350
329
 
351
330
  key('h') do
352
331
  Vedeu.trigger(:_view_left_, Vedeu.focus)
353
- CursorView.new.render
354
332
  end
355
333
  key('j') do
356
334
  Vedeu.trigger(:_view_down_, Vedeu.focus)
357
- CursorView.new.render
358
335
  end
359
336
  key('k') do
360
337
  Vedeu.trigger(:_view_up_, Vedeu.focus)
361
- CursorView.new.render
362
338
  end
363
339
  key('l') do
364
340
  Vedeu.trigger(:_view_right_, Vedeu.focus)
365
- CursorView.new.render
366
341
  end
367
342
 
368
343
  key('m') { Vedeu.trigger(:_maximise_, Vedeu.focus) }
@@ -623,7 +598,6 @@ class VedeuMaterialColoursApp
623
598
  line 'style'
624
599
  end
625
600
  end
626
- CursorView.new.render
627
601
  end
628
602
 
629
603
  Vedeu.focus_by_name 'main_interface'
@@ -3,7 +3,7 @@
3
3
  # Displays the number of lines of Vedeu application code and the corresponding
4
4
  # number of lines of Vedeu test code per commit.
5
5
 
6
- set -e
6
+ set -euo pipefail
7
7
 
8
8
  function main {
9
9
  for rev in `revisions`; do
data/test/test_helper.rb CHANGED
@@ -96,7 +96,6 @@ end # MiniTest
96
96
  require 'mocha/setup'
97
97
  require 'vedeu'
98
98
  require 'support/helpers/model_test_class'
99
- require 'support/helpers/presentation_colour_test_class'
100
99
 
101
100
  if ENV['PERFORMANCE'].to_i == 1
102
101
  require 'minitest/reporters'
data/vedeu.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'guard-minitest', '2.4.4'
26
26
  spec.add_development_dependency 'guard-rubocop', '1.2.0'
27
27
  spec.add_development_dependency 'minitest', '5.8.4'
28
- spec.add_development_dependency 'minitest-reporters', '1.1.7'
28
+ spec.add_development_dependency 'minitest-reporters', '1.1.8'
29
29
  spec.add_development_dependency 'mocha', '1.1.0'
30
30
  spec.add_development_dependency 'rubocop', '0.37.2'
31
31
  spec.add_development_dependency 'simplecov', '0.11.2'
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.16
4
+ version: 0.8.17
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-02-18 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.1.7
75
+ version: 1.1.8
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.1.7
82
+ version: 1.1.8
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mocha
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -1068,7 +1068,6 @@ files:
1068
1068
  - test/support/examples/view_templates_app/view_templates_app.rb
1069
1069
  - test/support/examples/view_templates_app/wrap.erb
1070
1070
  - test/support/helpers/model_test_class.rb
1071
- - test/support/helpers/presentation_colour_test_class.rb
1072
1071
  - test/support/stats.sh
1073
1072
  - test/support/templates/html_renderer.vedeu
1074
1073
  - test/support/ttyrec.rb
@@ -1333,7 +1332,6 @@ test_files:
1333
1332
  - test/support/examples/view_templates_app/view_templates_app.rb
1334
1333
  - test/support/examples/view_templates_app/wrap.erb
1335
1334
  - test/support/helpers/model_test_class.rb
1336
- - test/support/helpers/presentation_colour_test_class.rb
1337
1335
  - test/support/stats.sh
1338
1336
  - test/support/templates/html_renderer.vedeu
1339
1337
  - test/support/ttyrec.rb
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vedeu
4
-
5
- class ParentPresentationColourTestClass
6
-
7
- include Vedeu::Presentation
8
-
9
- attr_reader :colour
10
-
11
- def initialize
12
- @colour = { background: '#330000', foreground: '#00aadd' }
13
- @parent = nil
14
- end
15
-
16
- end # ParentPresentationColourTestClass
17
-
18
- class PresentationColourTestClass
19
-
20
- include Vedeu::Presentation
21
-
22
- attr_reader :parent
23
-
24
- def initialize(attributes = {})
25
- @colour = attributes[:colour]
26
- @parent = attributes[:parent]
27
- end
28
-
29
- end # PresentationTestClass
30
-
31
- end # Vedeu