vedeu 0.6.29 → 0.6.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/Guardfile +6 -5
  4. data/README.md +50 -4
  5. data/Rakefile +16 -4
  6. data/docs/dsl.md +3 -3
  7. data/lib/vedeu/all.rb +6 -8
  8. data/lib/vedeu/bindings/all.rb +43 -13
  9. data/lib/vedeu/borders/border.rb +26 -3
  10. data/lib/vedeu/borders/refresh.rb +5 -0
  11. data/lib/vedeu/buffers/refresh.rb +10 -0
  12. data/lib/vedeu/cursors/cursor.rb +59 -0
  13. data/lib/vedeu/cursors/refresh.rb +5 -0
  14. data/lib/vedeu/distributed/server.rb +12 -0
  15. data/lib/vedeu/distributed/subprocess.rb +7 -2
  16. data/lib/vedeu/editor/editor.rb +5 -0
  17. data/lib/vedeu/editor/repository.rb +41 -0
  18. data/lib/vedeu/geometry/geometry.rb +19 -8
  19. data/lib/vedeu/geometry/repository.rb +25 -0
  20. data/lib/vedeu/groups/clear.rb +3 -0
  21. data/lib/vedeu/groups/group.rb +9 -0
  22. data/lib/vedeu/groups/refresh.rb +5 -0
  23. data/lib/vedeu/input/dsl.rb +4 -4
  24. data/lib/vedeu/input/mapper.rb +3 -0
  25. data/lib/vedeu/interfaces/all.rb +1 -0
  26. data/lib/vedeu/interfaces/dsl.rb +1 -1
  27. data/lib/vedeu/interfaces/interface.rb +12 -0
  28. data/lib/vedeu/logging/log.rb +3 -0
  29. data/lib/vedeu/menus/repository.rb +40 -0
  30. data/lib/vedeu/models/focus.rb +9 -0
  31. data/lib/vedeu/output/clear/interface.rb +9 -1
  32. data/lib/vedeu/output/refresh/refresh.rb +3 -0
  33. data/lib/vedeu/repositories/model.rb +1 -9
  34. data/lib/vedeu/runtime/application.rb +7 -0
  35. data/lib/vedeu/runtime/flags.rb +3 -0
  36. data/lib/vedeu/runtime/launcher.rb +2 -0
  37. data/lib/vedeu/runtime/router.rb +7 -0
  38. data/lib/vedeu/terminal/buffer.rb +11 -0
  39. data/lib/vedeu/terminal/terminal.rb +3 -0
  40. data/lib/vedeu/version.rb +1 -1
  41. data/test/lib/vedeu/bindings/all_test.rb +19 -0
  42. data/test/lib/vedeu/borders/border_test.rb +0 -4
  43. data/test/lib/vedeu/borders/refresh_test.rb +4 -0
  44. data/test/lib/vedeu/buffers/refresh_test.rb +5 -0
  45. data/test/lib/vedeu/cursors/cursor_test.rb +21 -0
  46. data/test/lib/vedeu/cursors/refresh_test.rb +4 -0
  47. data/test/lib/vedeu/distributed/server_test.rb +7 -0
  48. data/test/lib/vedeu/editor/editor_test.rb +4 -0
  49. data/test/lib/vedeu/editor/repository_test.rb +12 -0
  50. data/test/lib/vedeu/events/aliases_test.rb +0 -1
  51. data/test/lib/vedeu/geometry/geometry_test.rb +0 -3
  52. data/test/lib/vedeu/geometry/repository_test.rb +13 -0
  53. data/test/lib/vedeu/groups/clear_test.rb +4 -0
  54. data/test/lib/vedeu/groups/group_test.rb +6 -0
  55. data/test/lib/vedeu/groups/refresh_test.rb +4 -0
  56. data/test/lib/vedeu/input/dsl_test.rb +3 -3
  57. data/test/lib/vedeu/input/mapper_test.rb +4 -0
  58. data/test/lib/vedeu/interfaces/interface_test.rb +9 -0
  59. data/test/lib/vedeu/logging/log_test.rb +4 -0
  60. data/test/lib/vedeu/menus/repository_test.rb +13 -0
  61. data/test/lib/vedeu/models/focus_test.rb +6 -0
  62. data/test/lib/vedeu/output/clear/interface_test.rb +5 -0
  63. data/test/lib/vedeu/output/refresh/refresh_test.rb +4 -0
  64. data/test/lib/vedeu/repositories/model_test.rb +0 -15
  65. data/test/lib/vedeu/runtime/application_test.rb +5 -0
  66. data/test/lib/vedeu/runtime/flags_test.rb +4 -0
  67. data/test/lib/vedeu/runtime/router_test.rb +26 -0
  68. data/test/lib/vedeu/terminal/buffer_test.rb +8 -0
  69. data/test/lib/vedeu/terminal/terminal_test.rb +4 -0
  70. data/test/support/examples/material_colours_app.rb +24 -4
  71. data/test/test_helper.rb +23 -23
  72. metadata +4 -40
  73. data/lib/vedeu/bindings/application.rb +0 -41
  74. data/lib/vedeu/bindings/bindings.rb +0 -46
  75. data/lib/vedeu/bindings/cursors.rb +0 -101
  76. data/lib/vedeu/bindings/document.rb +0 -97
  77. data/lib/vedeu/bindings/drb.rb +0 -78
  78. data/lib/vedeu/bindings/focus.rb +0 -46
  79. data/lib/vedeu/bindings/menus.rb +0 -99
  80. data/lib/vedeu/bindings/movement.rb +0 -51
  81. data/lib/vedeu/bindings/refresh.rb +0 -74
  82. data/lib/vedeu/bindings/system.rb +0 -81
  83. data/lib/vedeu/bindings/view.rb +0 -50
  84. data/lib/vedeu/bindings/visibility.rb +0 -118
  85. data/test/lib/vedeu/bindings/application_test.rb +0 -39
  86. data/test/lib/vedeu/bindings/bindings_test.rb +0 -109
  87. data/test/lib/vedeu/bindings/cursors_test.rb +0 -24
  88. data/test/lib/vedeu/bindings/document_test.rb +0 -25
  89. data/test/lib/vedeu/bindings/drb_test.rb +0 -27
  90. data/test/lib/vedeu/bindings/focus_test.rb +0 -19
  91. data/test/lib/vedeu/bindings/menus_test.rb +0 -26
  92. data/test/lib/vedeu/bindings/movement_test.rb +0 -24
  93. data/test/lib/vedeu/bindings/refresh_test.rb +0 -22
  94. data/test/lib/vedeu/bindings/system_test.rb +0 -24
  95. data/test/lib/vedeu/bindings/view_test.rb +0 -19
  96. data/test/lib/vedeu/bindings/visibility_test.rb +0 -52
  97. data/test/support/all_seeds.sh +0 -9
@@ -1,78 +0,0 @@
1
- module Vedeu
2
-
3
- module Bindings
4
-
5
- # System events relating to the DRb server implementation.
6
- #
7
- module DRB
8
-
9
- extend self
10
-
11
- # Setup events relating to the DRb server. This method is called
12
- # by Vedeu.
13
- #
14
- # @return [TrueClass]
15
- def setup!
16
- drb_input!
17
- drb_retrieve_output!
18
- drb_store_output!
19
- drb_restart!
20
- drb_start!
21
- drb_status!
22
- drb_stop!
23
- end
24
-
25
- private
26
-
27
- # See {file:docs/events/drb.md#\_drb_input_}
28
- def drb_input!
29
- Vedeu.bind(:_drb_input_) do |data, type|
30
- Vedeu.log(type: :drb, message: "Sending input (#{type})".freeze)
31
-
32
- case type
33
- when :command then Vedeu.trigger(:_command_, data)
34
- when :keypress then Vedeu.trigger(:_keypress_, data)
35
- else Vedeu.trigger(:_keypress_, data)
36
- end
37
- end
38
- end
39
-
40
- # See {file:docs/events/drb.md#\_drb_retrieve_output_}
41
- def drb_retrieve_output!
42
- Vedeu.bind(:_drb_retrieve_output_) do
43
- Vedeu::Terminal::Buffer.output
44
- end
45
- end
46
-
47
- # See {file:docs/events/drb.md#\_drb_store_output_}
48
- def drb_store_output!
49
- Vedeu.bind(:_drb_store_output_) do |data|
50
- Vedeu::Terminal::Buffer.write(data)
51
- end
52
- end
53
-
54
- # See {file:docs/events/drb.md#\_drb_restart_}
55
- def drb_restart!
56
- Vedeu.bind(:_drb_restart_) { Vedeu::Distributed::Server.restart }
57
- end
58
-
59
- # See {file:docs/events/drb.md#\_drb_start_}
60
- def drb_start!
61
- Vedeu.bind(:_drb_start_) { Vedeu::Distributed::Server.start }
62
- end
63
-
64
- # See {file:docs/events/drb.md#\_drb_status_}
65
- def drb_status!
66
- Vedeu.bind(:_drb_status_) { Vedeu::Distributed::Server.status }
67
- end
68
-
69
- # See {file:docs/events/drb.md#\_drb_stop_}
70
- def drb_stop!
71
- Vedeu.bind(:_drb_stop_) { Vedeu::Distributed::Server.stop }
72
- end
73
-
74
- end # DRB
75
-
76
- end # Bindings
77
-
78
- end # Vedeu
@@ -1,46 +0,0 @@
1
- module Vedeu
2
-
3
- module Bindings
4
-
5
- # Provides events to change the focus between interfaces/views.
6
- #
7
- module Focus
8
-
9
- extend self
10
-
11
- # Setup events relating to running Vedeu. This method is called
12
- # by Vedeu.
13
- #
14
- # @return [TrueClass]
15
- def setup!
16
- focus_by_name!
17
- focus_next!
18
- focus_prev!
19
- end
20
-
21
- private
22
-
23
- # :nocov:
24
-
25
- # See {file:docs/events/focus.md#\_focus_by_name_}
26
- def focus_by_name!
27
- Vedeu.bind(:_focus_by_name_) { |name| Vedeu.focus_by_name(name) }
28
- end
29
-
30
- # See {file:docs/events/focus.md#\_focus_next_}
31
- def focus_next!
32
- Vedeu.bind(:_focus_next_) { Vedeu.focus_next }
33
- end
34
-
35
- # See {file:docs/events/focus.md#\_focus_prev_}
36
- def focus_prev!
37
- Vedeu.bind(:_focus_prev_) { Vedeu.focus_previous }
38
- end
39
-
40
- # :nocov:
41
-
42
- end # Focus
43
-
44
- end # Bindings
45
-
46
- end # Vedeu
@@ -1,99 +0,0 @@
1
- module Vedeu
2
-
3
- module Bindings
4
-
5
- # Each of the Bindings::Menus events require a target menu name as
6
- # an argument.
7
- #
8
- module Menus
9
-
10
- extend self
11
-
12
- # Setup events relating to menus. This method is called by
13
- # Vedeu.
14
- #
15
- # @return [TrueClass]
16
- def setup!
17
- menu_bottom!
18
- menu_current!
19
- menu_deselect!
20
- menu_items!
21
- menu_next!
22
- menu_prev!
23
- menu_selected!
24
- menu_select!
25
- menu_top!
26
- menu_view!
27
- end
28
-
29
- private
30
-
31
- # :nocov:
32
-
33
- # See {file:docs/events/menu.md#\_menu_bottom_}
34
- def menu_bottom!
35
- Vedeu.bind(:_menu_bottom_) do |name|
36
- Vedeu.menus.by_name(name).bottom_item
37
- end
38
- end
39
-
40
- # See {file:docs/events/menu.md#\_menu_current_}
41
- def menu_current!
42
- Vedeu.bind(:_menu_current_) do |name|
43
- Vedeu.menus.by_name(name).current_item
44
- end
45
- end
46
-
47
- # See {file:docs/events/menu.md#\_menu_deselect_}
48
- def menu_deselect!
49
- Vedeu.bind(:_menu_deselect_) do |name|
50
- Vedeu.menus.by_name(name).deselect_item
51
- end
52
- end
53
-
54
- # See {file:docs/events/menu.md#\_menu_items_}
55
- def menu_items!
56
- Vedeu.bind(:_menu_items_) { |name| Vedeu.menus.by_name(name).items }
57
- end
58
-
59
- # See {file:docs/events/menu.md#\_menu_next_}
60
- def menu_next!
61
- Vedeu.bind(:_menu_next_) { |name| Vedeu.menus.by_name(name).next_item }
62
- end
63
-
64
- # See {file:docs/events/menu.md#\_menu_prev_}
65
- def menu_prev!
66
- Vedeu.bind(:_menu_prev_) { |name| Vedeu.menus.by_name(name).prev_item }
67
- end
68
-
69
- # See {file:docs/events/menu.md#\_menu_selected_}
70
- def menu_selected!
71
- Vedeu.bind(:_menu_selected_) do |name|
72
- Vedeu.menus.by_name(name).selected_item
73
- end
74
- end
75
-
76
- # See {file:docs/events/menu.md#\_menu_select_}
77
- def menu_select!
78
- Vedeu.bind(:_menu_select_) do |name|
79
- Vedeu.menus.by_name(name).select_item
80
- end
81
- end
82
-
83
- # See {file:docs/events/menu.md#\_menu_top_}
84
- def menu_top!
85
- Vedeu.bind(:_menu_top_) { |name| Vedeu.menus.by_name(name).top_item }
86
- end
87
-
88
- # See {file:docs/events/menu.md#\_menu_view_}
89
- def menu_view!
90
- Vedeu.bind(:_menu_view_) { |name| Vedeu.menus.by_name(name).view }
91
- end
92
-
93
- # :nocov:
94
-
95
- end # Menus
96
-
97
- end # Bindings
98
-
99
- end # Vedeu
@@ -1,51 +0,0 @@
1
- module Vedeu
2
-
3
- module Bindings
4
-
5
- # System events relating to movement of interfaces.
6
- #
7
- module Movement
8
-
9
- extend self
10
-
11
- # Setup events relating to movement. This method is called by
12
- # Vedeu.
13
- #
14
- # @return [TrueClass]
15
- def setup!
16
- directional!
17
- end
18
-
19
- # @return [TrueClass]
20
- def setup_aliases!
21
- %w(down left right up).each do |direction|
22
- Vedeu.bind_alias(:"_geometry_#{direction}_",
23
- :"_view_#{direction}_")
24
- end
25
- end
26
-
27
- private
28
-
29
- # :nocov:
30
-
31
- # See {file:docs/events/movement.md#\_view_up_down_left_right_}
32
- def directional!
33
- %w(down left right up).each do |direction|
34
- Vedeu.bind(:"_view_#{direction}_") do |name|
35
- Vedeu.geometries.by_name(name).send("move_#{direction}")
36
-
37
- Vedeu.trigger(:_clear_)
38
- Vedeu.trigger(:_refresh_)
39
- Vedeu.trigger(:_clear_view_, name)
40
- Vedeu.trigger(:_refresh_view_, name)
41
- end
42
- end
43
- end
44
-
45
- # :nocov:
46
-
47
- end # Movement
48
-
49
- end # Bindings
50
-
51
- end # Vedeu
@@ -1,74 +0,0 @@
1
- module Vedeu
2
-
3
- module Bindings
4
-
5
- # Provides events to refresh the view.
6
- #
7
- module Refresh
8
-
9
- extend self
10
-
11
- # Setup events relating to running Vedeu. This method is called
12
- # by Vedeu.
13
- #
14
- # @return [TrueClass]
15
- def setup!
16
- refresh!
17
- refresh_border!
18
- refresh_cursor!
19
- refresh_group!
20
- refresh_view!
21
- refresh_view_content!
22
- end
23
-
24
- private
25
-
26
- # :nocov:
27
-
28
- # See {file:docs/events/refresh.md#\_refresh_}
29
- def refresh!
30
- Vedeu.bind(:_refresh_) { Vedeu::Output::Refresh.all }
31
- end
32
-
33
- # See {file:docs/events/refresh.md#\_refresh_border_}
34
- def refresh_border!
35
- Vedeu.bind(:_refresh_border_) do |name|
36
- Vedeu::Borders::Refresh.by_name(name)
37
- end
38
- end
39
-
40
- # See {file:docs/events/refresh.md#\_refresh_cursor_}
41
- def refresh_cursor!
42
- Vedeu.bind(:_refresh_cursor_) do |name|
43
- Vedeu::Cursors::Refresh.by_name(name)
44
- end
45
- end
46
-
47
- # See {file:docs/events/refresh.md#\_refresh_group_}
48
- def refresh_group!
49
- Vedeu.bind(:_refresh_group_) do |name|
50
- Vedeu::Groups::Refresh.by_name(name)
51
- end
52
- end
53
-
54
- # See {file:docs/events/refresh.md#\_refresh_view_}
55
- def refresh_view!
56
- Vedeu.bind(:_refresh_view_) do |name|
57
- Vedeu::Buffers::Refresh.by_name(name)
58
- end
59
- end
60
-
61
- # See {file:docs/events/refresh.md#\_refresh_view_content_}
62
- def refresh_view_content!
63
- Vedeu.bind(:_refresh_view_content_) do |name|
64
- Vedeu::Buffers::Refresh.refresh_content_by_name(name)
65
- end
66
- end
67
-
68
- # :nocov:
69
-
70
- end # Refresh
71
-
72
- end # Bindings
73
-
74
- end # Vedeu
@@ -1,81 +0,0 @@
1
- module Vedeu
2
-
3
- module Bindings
4
-
5
- # Provides events to manage Vedeu.
6
- #
7
- module System
8
-
9
- extend self
10
-
11
- # Setup events relating to running Vedeu. This method is called
12
- # by Vedeu.
13
- #
14
- # @return [TrueClass]
15
- def setup!
16
- cleanup!
17
- command!
18
- editor!
19
- exit!
20
- initialize!
21
- keypress!
22
- log!
23
- mode_switch!
24
- end
25
-
26
- private
27
-
28
- # :nocov:
29
-
30
- # See {file:docs/events/system.md#\_cleanup_}
31
- def cleanup!
32
- Vedeu.bind(:_cleanup_) do
33
- Vedeu.trigger(:_drb_stop_)
34
- Vedeu.trigger(:cleanup)
35
- end
36
- end
37
-
38
- # See {file:docs/events/system.md#\_command_}
39
- def command!
40
- Vedeu.bind(:_command_) { |command| Vedeu.trigger(:command, command) }
41
- end
42
-
43
- # See {file:docs/events/system.md#\_editor_}
44
- def editor!
45
- Vedeu.bind(:_editor_) do |key|
46
- Vedeu::Editor::Editor.keypress(name: Vedeu.focus, input: key)
47
- end
48
- end
49
-
50
- # See {file:docs/events/system.md#\_exit_}
51
- def exit!
52
- Vedeu.bind(:_exit_) { Vedeu.exit }
53
- end
54
-
55
- # See {file:docs/events/system.md#\_initialize_}
56
- def initialize!
57
- Vedeu.bind(:_initialize_) { Vedeu.ready! }
58
- end
59
-
60
- # See {file:docs/events/system.md#\_keypress_}
61
- def keypress!
62
- Vedeu.bind(:_keypress_) { |key| Vedeu.keypress(key) }
63
- end
64
-
65
- # See {file:docs/events/system.md#\_log_}
66
- def log!
67
- Vedeu.bind(:_log_) { |msg| Vedeu.log(type: :debug, message: msg) }
68
- end
69
-
70
- # See {file:docs/events/system.md#\_mode_switch_}
71
- def mode_switch!
72
- Vedeu.bind(:_mode_switch_) { fail Vedeu::Error::ModeSwitch }
73
- end
74
-
75
- # :nocov:
76
-
77
- end # System
78
-
79
- end # Bindings
80
-
81
- end # Vedeu
@@ -1,50 +0,0 @@
1
- module Vedeu
2
-
3
- module Bindings
4
-
5
- # System events relating to the view.
6
- #
7
- module View
8
-
9
- extend self
10
-
11
- # Setup events relating to client applications. This method is
12
- # called by Vedeu.
13
- #
14
- # @return [TrueClass]
15
- def setup!
16
- maximise!
17
- resize!
18
- unmaximise!
19
- end
20
-
21
- private
22
-
23
- # :nocov:
24
-
25
- # See {file:docs/events/view.md#\_maximise_}
26
- def maximise!
27
- Vedeu.bind(:_maximise_) do |name|
28
- Vedeu.geometries.by_name(name).maximise
29
- end
30
- end
31
-
32
- # See {file:docs/events/view.md#\_resize_}
33
- def resize!
34
- Vedeu.bind(:_resize_, delay: 0.25) { Vedeu.resize }
35
- end
36
-
37
- # See {file:docs/events/view.md#\_unmaximise_}
38
- def unmaximise!
39
- Vedeu.bind(:_unmaximise_) do |name|
40
- Vedeu.geometries.by_name(name).unmaximise
41
- end
42
- end
43
-
44
- # :nocov:
45
-
46
- end # View
47
-
48
- end # Bindings
49
-
50
- end # Vedeu