vedeu 0.8.7 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/TODO.md +8 -0
  3. data/docs/dsl/by_method/buffer_update.md +3 -1
  4. data/docs/dsl/by_method/buffer_write.md +3 -1
  5. data/docs/dsl/by_method/cursor.md +3 -1
  6. data/docs/dsl/by_method/cursors.md +3 -1
  7. data/docs/dsl/by_method/direct_write.md +3 -1
  8. data/docs/dsl/by_method/log_stderr.md +4 -1
  9. data/docs/dsl/by_method/log_stdout.md +4 -1
  10. data/docs/dsl/by_method/log_timestamp.md +7 -1
  11. data/docs/dsl/by_method/render_output.md +3 -1
  12. data/docs/events/by_name/{geometry_down.md → aliases/geometry_down.md} +0 -0
  13. data/docs/events/by_name/{geometry_left.md → aliases/geometry_left.md} +0 -0
  14. data/docs/events/by_name/{geometry_right.md → aliases/geometry_right.md} +0 -0
  15. data/docs/events/by_name/{geometry_up.md → aliases/geometry_up.md} +0 -0
  16. data/docs/events/by_name/cursor_down.md +5 -0
  17. data/docs/events/by_name/cursor_left.md +3 -0
  18. data/docs/events/by_name/cursor_origin.md +3 -0
  19. data/docs/events/by_name/cursor_right.md +5 -0
  20. data/docs/events/by_name/cursor_top.md +3 -0
  21. data/docs/events/by_name/cursor_up.md +3 -0
  22. data/docs/events/by_name/hide_cursor.md +6 -1
  23. data/docs/events/by_name/maximise.md +2 -3
  24. data/docs/events/by_name/show_cursor.md +6 -1
  25. data/docs/events/by_name/unmaximise.md +5 -3
  26. data/docs/events/by_name/view_down.md +8 -0
  27. data/docs/events/by_name/view_left.md +8 -0
  28. data/docs/events/by_name/view_right.md +8 -0
  29. data/docs/events/by_name/view_up.md +8 -0
  30. data/docs/events/document.md +2 -1
  31. data/docs/events/focus.md +2 -1
  32. data/docs/events/menu.md +2 -1
  33. data/docs/events/movement.md +2 -1
  34. data/docs/events/refresh.md +2 -1
  35. data/docs/events/view.md +2 -1
  36. data/docs/events/visibility.md +2 -1
  37. data/examples/dsl_horizontal_alignment.rb +1 -1
  38. data/examples/dsl_vertical_alignment.rb +1 -1
  39. data/integrations/dsl_app_border_001.rb +63 -0
  40. data/integrations/dsl_app_border_002.rb +63 -0
  41. data/integrations/dsl_app_border_003.rb +63 -0
  42. data/integrations/dsl_app_border_004.rb +63 -0
  43. data/integrations/dsl_app_border_005.rb +63 -0
  44. data/integrations/expected/dsl_app_border_001.out +1 -0
  45. data/integrations/expected/dsl_app_border_002.out +1 -0
  46. data/integrations/expected/dsl_app_border_003.out +1 -0
  47. data/integrations/expected/dsl_app_border_004.out +1 -0
  48. data/integrations/expected/dsl_app_border_005.out +1 -0
  49. data/integrations/test_runner.sh +7 -0
  50. data/lib/vedeu.rb +2 -1
  51. data/lib/vedeu/borders/repository.rb +1 -5
  52. data/lib/vedeu/cursors/cursor.rb +29 -70
  53. data/lib/vedeu/cursors/move.rb +11 -4
  54. data/lib/vedeu/cursors/reposition.rb +2 -2
  55. data/lib/vedeu/cursors/repository.rb +7 -12
  56. data/lib/vedeu/dsl/elements.rb +0 -1
  57. data/lib/vedeu/error.rb +17 -5
  58. data/lib/vedeu/geometries/dsl/dsl.rb +2 -28
  59. data/lib/vedeu/geometries/dsl/grid.rb +2 -0
  60. data/lib/vedeu/geometries/geometry.rb +2 -22
  61. data/lib/vedeu/geometries/move.rb +45 -10
  62. data/lib/vedeu/geometries/repository.rb +0 -20
  63. data/lib/vedeu/input/capture.rb +2 -1
  64. data/lib/vedeu/logging/log.rb +25 -25
  65. data/lib/vedeu/renderers/file.rb +0 -5
  66. data/lib/vedeu/renderers/json.rb +1 -1
  67. data/lib/vedeu/renderers/options.rb +3 -1
  68. data/lib/vedeu/renderers/text.rb +0 -7
  69. data/lib/vedeu/runtime/bootstrap.rb +1 -1
  70. data/lib/vedeu/runtime/launcher.rb +8 -5
  71. data/lib/vedeu/version.rb +1 -1
  72. data/test/lib/vedeu/application/application_controller_test.rb +2 -4
  73. data/test/lib/vedeu/cursors/cursor_test.rb +9 -12
  74. data/test/lib/vedeu/cursors/move_test.rb +7 -3
  75. data/test/lib/vedeu/geometries/move_test.rb +22 -9
  76. data/test/lib/vedeu/interfaces/interface_test.rb +71 -73
  77. data/test/lib/vedeu/logging/log_test.rb +1 -1
  78. data/test/lib/vedeu/runtime/launcher_test.rb +5 -4
  79. data/test/support/examples/material_colours_app.rb +59 -8
  80. data/test/test_helper.rb +1 -0
  81. metadata +16 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e661f87496fae0bee6cfad0f28107ef83de0afd7
4
- data.tar.gz: e9c940bfeba84b518e8c9aae271b78e64ece3e7b
3
+ metadata.gz: 8abebd20481d927ef3b7de1f4a21c566109fcb5a
4
+ data.tar.gz: 3db48c0f3218d6d534cf731f256084e6a98efb91
5
5
  SHA512:
6
- metadata.gz: 2f690ac0877398edcf8cae81bf4d82d0da2bc997e938fec1680cd527d544b036363295bc9cfaf0a79c8cbef1fef4d7bde28b7f7580a46da72d02cab7a4407c42
7
- data.tar.gz: f383c6aa69b348950df538a5cf5df7b942adc99d3ce927d62cd88c54d51450511c337b0d642b32e66217ceee5528cb2159caab913ef42e09b7a2a256e22b3a1f
6
+ metadata.gz: e6555ade9af405d42797525c9ce496d4e6f105babf54d6edbfe5cf2fcbc618b71823b9709544fca60c8c2a853918d4d259dc372ca56bf037061d351add0f5016
7
+ data.tar.gz: 057a89420029e115a3a87bcdc56872d0e01b0149e08c4d29899870632a0e989377b09b295bf7be4f94f4e8ed8800c1fec1a59292cb635696bca7d2604edee9c5
data/TODO.md CHANGED
@@ -2,3 +2,11 @@
2
2
 
3
3
  - Add Vedeu::Index which converts a Vedeu::Point to an array index.
4
4
  i.e. Never less than 0, always 1 less than the Vedeu::Point value.
5
+
6
+ ## 2016-01-11
7
+
8
+ - Investigate the differences between memoizing in
9
+ Vedeu::Geometries::Geometry#area and not memoizing. Memoizing saves
10
+ ~80ms on running test suite and considerably impacts app
11
+ responsiveness, however changes to the geometry (such as movement or
12
+ maximising) are not reflected.
@@ -1 +1,3 @@
1
- @todo Add more documentation.
1
+ Write the given output to the configured or default renderers.
2
+
3
+ Vedeu.buffer_update(output)
@@ -1 +1,3 @@
1
- @todo Add more documentation.
1
+ Write the given output to the configured or default renderers.
2
+
3
+ Vedeu.buffer_write(output)
@@ -1 +1,3 @@
1
- @todo Add more documentation.
1
+ Fetch the cursor of the currently focussed interface/view.
2
+
3
+ Vedeu.cursor
@@ -1 +1,3 @@
1
- @todo Add more documentation.
1
+ Manipulate the repository of cursors.
2
+
3
+ Vedeu.cursors
@@ -1 +1,3 @@
1
- @todo Add more documentation.
1
+ Write the given output to the configured or default renderers.
2
+
3
+ Vedeu.direct_write(output)
@@ -1 +1,4 @@
1
- @todo Add more documentation.
1
+ Write a message to STDERR. Will also attempt to write to the log file
2
+ if configured for later reference.
3
+
4
+ Vedeu.log_stderr(message: message, type: type)
@@ -1 +1,4 @@
1
- @todo Add more documentation.
1
+ Write a message to STDOUT. Will also attempt to write to the log file
2
+ if configured for later reference.
3
+
4
+ Vedeu.log_stdout(message: message, type: type)
@@ -1 +1,7 @@
1
- @todo Add more documentation.
1
+ Returns a formatted timestamp indicating the number of seconds the
2
+ client application has been running.
3
+
4
+ The first time this method is called, it will return `[ 0.0000] `.
5
+ Subsequent calls will be relative to this first time entry.
6
+
7
+ Vedeu.log_timestamp # => [137.7842]
@@ -1 +1,3 @@
1
- @todo Add more documentation.
1
+ Write the given output to the configured or default renderers.
2
+
3
+ Vedeu.render_output(output)
@@ -1,4 +1,9 @@
1
1
  ### `:_cursor_down_`
2
+ Moves the cursor one line down, unless the bottom-most position for
3
+ the view or terminal is reached.
2
4
 
3
5
  Vedeu.trigger(:_cursor_down_, name)
4
6
  Vedeu.trigger(:_cursor_down_, Vedeu.focus)
7
+
8
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
9
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -4,3 +4,6 @@ for the view or terminal is reached.
4
4
 
5
5
  Vedeu.trigger(:_cursor_left_, name)
6
6
  Vedeu.trigger(:_cursor_left_, Vedeu.focus)
7
+
8
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
9
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -3,4 +3,7 @@ This event moves the cursor to the interface origin; the top left
3
3
  corner of the named interface.
4
4
 
5
5
  Vedeu.trigger(:_cursor_origin_, name)
6
+ Vedeu.trigger(:_cursor_origin_, Vedeu.focus)
7
+
6
8
  Vedeu.trigger(:_cursor_reset_, name)
9
+ Vedeu.trigger(:_cursor_reset_, Vedeu.focus)
@@ -1,4 +1,9 @@
1
1
  ### `:_cursor_right_`
2
+ Moves the cursor one character to the right, unless the right-most
3
+ position for the view or terminal is reached.
2
4
 
3
5
  Vedeu.trigger(:_cursor_right_, name)
4
6
  Vedeu.trigger(:_cursor_right_, Vedeu.focus)
7
+
8
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
9
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -5,3 +5,6 @@ to the first line of the content.
5
5
 
6
6
  Vedeu.trigger(:_cursor_top_, name)
7
7
  Vedeu.trigger(:_cursor_top_, Vedeu.focus)
8
+
9
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
10
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -4,3 +4,6 @@ view or terminal is reached.
4
4
 
5
5
  Vedeu.trigger(:_cursor_up_, name)
6
6
  Vedeu.trigger(:_cursor_up_, Vedeu.focus)
7
+
8
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
9
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -1,10 +1,15 @@
1
1
  ### Vedeu.hide_cursor / `:_hide_cursor_`
2
- Hide the cursor.
2
+ Hide a named cursor, or without a name, the cursor of the currently
3
+ focussed interface.
3
4
 
4
5
  Vedeu.trigger(:_hide_cursor_, name)
5
6
  Vedeu.trigger(:_hide_cursor_, Vedeu.focus)
7
+ Vedeu.trigger(:_hide_cursor_)
8
+
6
9
  Vedeu.trigger(:_cursor_hide_, name)
7
10
  Vedeu.trigger(:_cursor_hide_, Vedeu.focus)
11
+ Vedeu.trigger(:_cursor_hide_)
8
12
 
9
13
  Vedeu.hide_cursor(name)
10
14
  Vedeu.hide_cursor(Vedeu.focus)
15
+ Vedeu.hide_cursor
@@ -1,6 +1,5 @@
1
1
  ### `:_maximise_`
2
- Maximising an interface.
2
+ Will maximise the named interface geometry. This means it will occupy
3
+ all of the available space on the terminal window.
3
4
 
4
5
  Vedeu.trigger(:_maximise_, name)
5
-
6
- See {Vedeu::Geometries::Geometry#maximise}
@@ -1,10 +1,15 @@
1
1
  ### Vedeu.show_cursor / `:_show_cursor_`
2
- Show the cursor.
2
+ Show a named cursor, or without a name, the cursor of the currently
3
+ focussed interface.
3
4
 
4
5
  Vedeu.trigger(:_show_cursor_, name)
5
6
  Vedeu.trigger(:_show_cursor_, Vedeu.focus)
7
+ Vedeu.trigger(:_show_cursor_)
8
+
6
9
  Vedeu.trigger(:_cursor_show_, name)
7
10
  Vedeu.trigger(:_cursor_show_, Vedeu.focus)
11
+ Vedeu.trigger(:_cursor_show_)
8
12
 
9
13
  Vedeu.show_cursor(name)
10
14
  Vedeu.show_cursor(Vedeu.focus)
15
+ Vedeu.show_cursor
@@ -1,6 +1,8 @@
1
1
  ### `:_unmaximise_`
2
- Unmaximising an interface.
2
+ Will unmaximise the named interface geometry. Previously, when a
3
+ geometry was maximised, then triggering the unmaximise event will
4
+ return it to its usual defined size (terminal size permitting: when
5
+ the terminal has been resized, then the new geometry size should
6
+ adapt).
3
7
 
4
8
  Vedeu.trigger(:_unmaximise_, name)
5
-
6
- See {Vedeu::Geometries::Geometry#unmaximise}
@@ -1,4 +1,12 @@
1
1
  ### `:_view_down_`
2
+ Moves the view one row/line down, unless the bottom/last row/line for
3
+ the terminal is reached.
2
4
 
3
5
  Vedeu.trigger(:_view_down_, name)
4
6
  Vedeu.trigger(:_view_down_, Vedeu.focus)
7
+
8
+ Vedeu.trigger(:_geometry_down_, name)
9
+ Vedeu.trigger(:_geometry_down_, Vedeu.focus)
10
+
11
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
12
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -1,4 +1,12 @@
1
1
  ### `:_view_left_`
2
+ Moves the view one column/character left, unless the left-most
3
+ column/character for the terminal is reached.
2
4
 
3
5
  Vedeu.trigger(:_view_left_, name)
4
6
  Vedeu.trigger(:_view_left_, Vedeu.focus)
7
+
8
+ Vedeu.trigger(:_geometry_left_, name)
9
+ Vedeu.trigger(:_geometry_left_, Vedeu.focus)
10
+
11
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
12
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -1,4 +1,12 @@
1
1
  ### `:_view_right_`
2
+ Moves the view one row/line right, unless the right-most row/line for
3
+ the terminal is reached.
2
4
 
3
5
  Vedeu.trigger(:_view_right_, name)
4
6
  Vedeu.trigger(:_view_right_, Vedeu.focus)
7
+
8
+ Vedeu.trigger(:_geometry_right_, name)
9
+ Vedeu.trigger(:_geometry_right_, Vedeu.focus)
10
+
11
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
12
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -1,4 +1,12 @@
1
1
  ### `:_view_up_`
2
+ Moves the view one row/line up, unless the top/first row/line for
3
+ the terminal is reached.
2
4
 
3
5
  Vedeu.trigger(:_view_up_, name)
4
6
  Vedeu.trigger(:_view_up_, Vedeu.focus)
7
+
8
+ Vedeu.trigger(:_geometry_up_, name)
9
+ Vedeu.trigger(:_geometry_up_, Vedeu.focus)
10
+
11
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
12
+ substituted for `Vedeu.focus` to use the interface currently in focus.
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Document Events
4
4
 
5
- Note: 'name' is a Symbol unless mentioned otherwise.
5
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
6
+ substituted for `Vedeu.focus` to use the interface currently in focus.
6
7
 
7
8
  {include:file:docs/events/by_name/editor_execute.md}
8
9
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Focus Events
4
4
 
5
- Note: 'name' is a Symbol unless mentioned otherwise.
5
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
6
+ substituted for `Vedeu.focus` to use the interface currently in focus.
6
7
 
7
8
  {include:file:docs/events/by_name/focus_by_name.md}
8
9
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Menu Events
4
4
 
5
- Note: 'name' is a Symbol unless mentioned otherwise.
5
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
6
+ substituted for `Vedeu.focus` to use the interface currently in focus.
6
7
 
7
8
  {include:file:docs/events/by_name/menu_bottom.md}
8
9
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Movement Events
4
4
 
5
- Note: 'name' is a Symbol unless mentioned otherwise.
5
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
6
+ substituted for `Vedeu.focus` to use the interface currently in focus.
6
7
 
7
8
  For cursor related movement events, please refer to
8
9
  {file:docs/cursors.md} Cursors.
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Refresh Events
4
4
 
5
- Note: 'name' is a Symbol unless mentioned otherwise.
5
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
6
+ substituted for `Vedeu.focus` to use the interface currently in focus.
6
7
 
7
8
  {include:file:docs/events/by_name/refresh.md}
8
9
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## View Events
4
4
 
5
- Note: 'name' is a Symbol unless mentioned otherwise.
5
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
6
+ substituted for `Vedeu.focus` to use the interface currently in focus.
6
7
 
7
8
  {include:file:docs/events/by_name/maximise.md}
8
9
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Visibility Events
4
4
 
5
- Note: 'name' is a Symbol unless mentioned otherwise.
5
+ Note: `name` is a Symbol unless mentioned otherwise, and can be
6
+ substituted for `Vedeu.focus` to use the interface currently in focus.
6
7
 
7
8
  {include:file:docs/events/by_name/clear.md}
8
9
 
@@ -38,7 +38,7 @@ class HorizontalAlignmentApp
38
38
  end
39
39
  end
40
40
 
41
- Vedeu.trigger(:_refresh_view, :centre_interface)
41
+ Vedeu.trigger(:_refresh_view_, :centre_interface)
42
42
  end
43
43
 
44
44
  def gc
@@ -38,7 +38,7 @@ class VerticalAlignmentApp
38
38
  end
39
39
  end
40
40
 
41
- Vedeu.trigger(:_refresh_view, :middle_interface)
41
+ Vedeu.trigger(:_refresh_view_, :middle_interface)
42
42
  end
43
43
 
44
44
  def gc
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_border_001.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_border_001.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_border_001.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_border_001.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.border :test_interface do
30
+ disable!
31
+ end
32
+
33
+ Vedeu.render do
34
+ view(:test_interface) do
35
+ lines do
36
+ line 'border off'
37
+ end
38
+ end
39
+ end
40
+
41
+ def self.actual
42
+ File.read('/tmp/dsl_app_border_001.out')
43
+ end
44
+
45
+ def self.expected
46
+ File.read(File.expand_path('../expected/dsl_app_border_001.out', __FILE__))
47
+ end
48
+
49
+ def self.start(argv = ARGV)
50
+ Vedeu::Launcher.execute!(argv)
51
+ end
52
+
53
+ end # DSLApp
54
+
55
+ DSLApp.start
56
+
57
+ if DSLApp.expected == DSLApp.actual
58
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
59
+ exit 0;
60
+ else
61
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
62
+ exit 1;
63
+ end
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_border_002.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_border_002.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_border_002.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_border_002.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.border :test_interface do
30
+ show_top false
31
+ end
32
+
33
+ Vedeu.render do
34
+ view(:test_interface) do
35
+ lines do
36
+ line 'no top'
37
+ end
38
+ end
39
+ end
40
+
41
+ def self.actual
42
+ File.read('/tmp/dsl_app_border_002.out')
43
+ end
44
+
45
+ def self.expected
46
+ File.read(File.expand_path('../expected/dsl_app_border_002.out', __FILE__))
47
+ end
48
+
49
+ def self.start(argv = ARGV)
50
+ Vedeu::Launcher.execute!(argv)
51
+ end
52
+
53
+ end # DSLApp
54
+
55
+ DSLApp.start
56
+
57
+ if DSLApp.expected == DSLApp.actual
58
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
59
+ exit 0;
60
+ else
61
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
62
+ exit 1;
63
+ end