vedeu 0.6.6 → 0.6.7

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/.codeclimate.yml +0 -30
  3. data/lib/vedeu/all.rb +0 -1
  4. data/lib/vedeu/api.rb +5 -139
  5. data/lib/vedeu/application/application_controller.rb +12 -10
  6. data/lib/vedeu/application/application_helper.rb +3 -3
  7. data/lib/vedeu/application/application_view.rb +7 -6
  8. data/lib/vedeu/application/controller.rb +16 -10
  9. data/lib/vedeu/bindings/application.rb +6 -3
  10. data/lib/vedeu/bindings/bindings.rb +7 -6
  11. data/lib/vedeu/bindings/document.rb +18 -18
  12. data/lib/vedeu/bindings/drb.rb +12 -8
  13. data/lib/vedeu/bindings/focus.rb +12 -9
  14. data/lib/vedeu/bindings/menus.rb +12 -11
  15. data/lib/vedeu/bindings/movement.rb +23 -22
  16. data/lib/vedeu/bindings/refresh.rb +13 -10
  17. data/lib/vedeu/bindings/visibility.rb +10 -8
  18. data/lib/vedeu/borders/all.rb +26 -0
  19. data/lib/vedeu/borders/dsl.rb +1 -23
  20. data/lib/vedeu/buffers/all.rb +12 -0
  21. data/lib/vedeu/buffers/buffer.rb +1 -10
  22. data/lib/vedeu/buffers/refresh.rb +57 -0
  23. data/lib/vedeu/buffers/virtual_buffer.rb +1 -1
  24. data/lib/vedeu/cursors/all.rb +9 -0
  25. data/lib/vedeu/cursors/cursor.rb +16 -0
  26. data/lib/vedeu/dsl/interface.rb +4 -4
  27. data/lib/vedeu/events/aliases.rb +28 -9
  28. data/lib/vedeu/events/collection.rb +1 -0
  29. data/lib/vedeu/events/trigger.rb +5 -3
  30. data/lib/vedeu/geometry/all.rb +7 -0
  31. data/lib/vedeu/geometry/position.rb +2 -2
  32. data/lib/vedeu/input/editor/editor.rb +1 -1
  33. data/lib/vedeu/log/log.rb +6 -0
  34. data/lib/vedeu/log/timer.rb +2 -2
  35. data/lib/vedeu/models/focus.rb +3 -0
  36. data/lib/vedeu/models/group.rb +13 -0
  37. data/lib/vedeu/models/interface.rb +17 -1
  38. data/lib/vedeu/models/toggleable.rb +2 -1
  39. data/lib/vedeu/models/views/collections/chars.rb +1 -0
  40. data/lib/vedeu/models/views/collections/lines.rb +1 -0
  41. data/lib/vedeu/models/views/collections/streams.rb +1 -0
  42. data/lib/vedeu/models/views/collections/view_collection.rb +1 -0
  43. data/lib/vedeu/models/views/line.rb +2 -2
  44. data/lib/vedeu/null/generic.rb +27 -4
  45. data/lib/vedeu/null/interface.rb +1 -32
  46. data/lib/vedeu/null/menu.rb +1 -16
  47. data/lib/vedeu/null/view.rb +1 -33
  48. data/lib/vedeu/options.rb +3 -0
  49. data/lib/vedeu/output/clear/named_group.rb +5 -0
  50. data/lib/vedeu/output/clear/named_interface.rb +5 -0
  51. data/lib/vedeu/output/direct.rb +2 -2
  52. data/lib/vedeu/output/viewport.rb +1 -1
  53. data/lib/vedeu/refresh/refresh_group.rb +1 -1
  54. data/lib/vedeu/runtime/application.rb +3 -0
  55. data/lib/vedeu/terminal/terminal.rb +3 -0
  56. data/lib/vedeu/version.rb +1 -1
  57. data/test/lib/vedeu/buffers/refresh_test.rb +54 -0
  58. data/test/lib/vedeu/null/generic_test.rb +18 -0
  59. data/test/lib/vedeu/null/interface_test.rb +4 -30
  60. data/test/lib/vedeu/null/menu_test.rb +1 -18
  61. data/test/lib/vedeu/null/view_test.rb +6 -31
  62. data/{examples → test/support}/colour_support.sh +0 -0
  63. data/{examples → test/support/examples}/borders_app.rb +0 -0
  64. data/{examples → test/support/examples}/configuration_app.rb +0 -0
  65. data/{examples → test/support/examples}/drb_app.rb +0 -0
  66. data/{examples → test/support/examples}/editor_app.rb +0 -0
  67. data/{examples → test/support/examples}/focus_app.rb +0 -0
  68. data/{examples → test/support/examples}/hello_world.rb +0 -0
  69. data/{examples → test/support/examples}/material_colours_app.rb +0 -0
  70. data/{examples → test/support/examples}/material_colours_app_20150721.svg +0 -0
  71. data/{examples → test/support/examples}/typed_commands/command.erb +0 -0
  72. data/{examples → test/support/examples}/typed_commands/output.erb +0 -0
  73. data/{examples → test/support/examples}/typed_commands/status.erb +0 -0
  74. data/{examples → test/support/examples}/typed_commands/typed_commands_app.rb +0 -0
  75. data/{examples → test/support/examples}/view_templates_app/default.erb +0 -0
  76. data/{examples → test/support/examples}/view_templates_app/prune.erb +0 -0
  77. data/{examples → test/support/examples}/view_templates_app/view_templates_app.rb +0 -0
  78. data/{examples → test/support/examples}/view_templates_app/wrap.erb +0 -0
  79. metadata +38 -21
  80. data/lib/vedeu/refresh/refresh_buffer.rb +0 -53
  81. data/test/lib/vedeu/refresh/refresh_buffer_test.rb +0 -50
@@ -9,8 +9,8 @@ module Vedeu
9
9
 
10
10
  extend self
11
11
 
12
- # Setup events relating to client applications. This method is called by
13
- # Vedeu.
12
+ # Setup events relating to client applications. This method is
13
+ # called by Vedeu.
14
14
  #
15
15
  # @return [TrueClass]
16
16
  def setup!
@@ -22,7 +22,10 @@ module Vedeu
22
22
  # Call a client application controller's action with parameters.
23
23
  #
24
24
  # @example
25
- # Vedeu.trigger(:_goto_, :your_controller, :some_action, { id: 7 })
25
+ # Vedeu.trigger(:_goto_,
26
+ # :your_controller,
27
+ # :some_action,
28
+ # { id: 7 })
26
29
  # Vedeu.goto(:your_controller, :some_action, { id: 7 })
27
30
  #
28
31
  # @return [TrueClass]
@@ -3,13 +3,14 @@ module Vedeu
3
3
  # Binds various events for running and manipulating Vedeu.
4
4
  #
5
5
  # @note
6
- # The methods these modules use are private, and should not be called
7
- # directly, however the produced events are all public and are highly
8
- # recommended to be used.
6
+ # The methods these modules use are private, and should not be
7
+ # called directly, however the produced events are all public and
8
+ # are highly recommended to be used.
9
9
  #
10
- # Unbinding any of these events is likely to cause problems, so I would
11
- # advise leaving them alone. A safe rule: when the name starts and ends with
12
- # an underscore, it's probably used by Vedeu internally.
10
+ # Unbinding any of these events is likely to cause problems, so I
11
+ # would advise leaving them alone. A safe rule: when the name
12
+ # starts and ends with an underscore, it's probably used by Vedeu
13
+ # internally.
13
14
  #
14
15
  module Bindings
15
16
 
@@ -10,8 +10,8 @@ module Vedeu
10
10
 
11
11
  extend self
12
12
 
13
- # Setup events relating to the document/editor/fake terminal. This method
14
- # is called by Vedeu.
13
+ # Setup events relating to the document/editor/fake terminal.
14
+ # This method is called by Vedeu.
15
15
  #
16
16
  # @return [TrueClass]
17
17
  def setup!
@@ -38,8 +38,8 @@ module Vedeu
38
38
  end
39
39
  end
40
40
 
41
- # This event attempts to delete the character in the named document at the
42
- # current virtual cursor position.
41
+ # This event attempts to delete the character in the named
42
+ # document at the current virtual cursor position.
43
43
  #
44
44
  # @example
45
45
  # Vedeu.trigger(:_editor_delete_character_, name)
@@ -51,8 +51,8 @@ module Vedeu
51
51
  end
52
52
  end
53
53
 
54
- # This event attempts to delete the line in the named document at the
55
- # current virtual cursor position.
54
+ # This event attempts to delete the line in the named document
55
+ # at the current virtual cursor position.
56
56
  #
57
57
  # @example
58
58
  # Vedeu.trigger(:_editor_delete_line_, name)
@@ -64,8 +64,8 @@ module Vedeu
64
64
  end
65
65
  end
66
66
 
67
- # This event attempts to move the virtual cursor down by one line in the
68
- # named document.
67
+ # This event attempts to move the virtual cursor down by one
68
+ # line in the named document.
69
69
  #
70
70
  # @example
71
71
  # Vedeu.trigger(:_editor_down_, name)
@@ -77,8 +77,8 @@ module Vedeu
77
77
  end
78
78
  end
79
79
 
80
- # This event attempts to insert the given character in the named document
81
- # at the current virtual cursor position.
80
+ # This event attempts to insert the given character in the named
81
+ # document at the current virtual cursor position.
82
82
  #
83
83
  # @example
84
84
  # Vedeu.trigger(:_editor_insert_character_, name, character)
@@ -90,8 +90,8 @@ module Vedeu
90
90
  end
91
91
  end
92
92
 
93
- # This event attempts to insert a new line in the named document at the
94
- # current virtual cursor position.
93
+ # This event attempts to insert a new line in the named document
94
+ # at the current virtual cursor position.
95
95
  #
96
96
  # @example
97
97
  # Vedeu.trigger(:_editor_insert_line_, name)
@@ -103,8 +103,8 @@ module Vedeu
103
103
  end
104
104
  end
105
105
 
106
- # This event attempts to move the virtual cursor left by one character in
107
- # the named document.
106
+ # This event attempts to move the virtual cursor left by one
107
+ # character in the named document.
108
108
  #
109
109
  # @example
110
110
  # Vedeu.trigger(:_editor_left_, name)
@@ -114,8 +114,8 @@ module Vedeu
114
114
  Vedeu.bind(:_editor_left_) { |name| Vedeu.documents.by_name(name).left }
115
115
  end
116
116
 
117
- # This event attempts to move the virtual cursor right by one character in
118
- # the named document.
117
+ # This event attempts to move the virtual cursor right by one
118
+ # character in the named document.
119
119
  #
120
120
  # @example
121
121
  # Vedeu.trigger(:_editor_right_, name)
@@ -127,8 +127,8 @@ module Vedeu
127
127
  end
128
128
  end
129
129
 
130
- # This event attempts to move the virtual cursor up by one line in the
131
- # named document.
130
+ # This event attempts to move the virtual cursor up by one line
131
+ # in the named document.
132
132
  #
133
133
  # @example
134
134
  # Vedeu.trigger(:_editor_up_, name)
@@ -9,7 +9,8 @@ module Vedeu
9
9
 
10
10
  extend self
11
11
 
12
- # Setup events relating to the DRb server. This method is called by Vedeu.
12
+ # Setup events relating to the DRb server. This method is called
13
+ # by Vedeu.
13
14
  #
14
15
  # @return [TrueClass]
15
16
  def setup!
@@ -24,8 +25,8 @@ module Vedeu
24
25
 
25
26
  private
26
27
 
27
- # Triggering this event will send input to the running application as long
28
- # as it has the DRb server running.
28
+ # Triggering this event will send input to the running
29
+ # application as long as it has the DRb server running.
29
30
  #
30
31
  # @example
31
32
  # Vedeu.trigger(:_drb_input_, data, type)
@@ -47,15 +48,16 @@ module Vedeu
47
48
  # @example
48
49
  # Vedeu.trigger(:_drb_retrieve_output_)
49
50
  #
50
- # @todo This event queries Vedeu. Events should only be commands.
51
+ # @todo This event queries Vedeu. Events should only be
52
+ # commands.
51
53
  #
52
54
  # @return [TrueClass]
53
55
  def drb_retrieve_output!
54
56
  Vedeu.bind(:_drb_retrieve_output_) { Vedeu::VirtualBuffers.retrieve }
55
57
  end
56
58
 
57
- # Triggering this event with 'data' will push data into the running
58
- # application's virtual buffer.
59
+ # Triggering this event with 'data' will push data into the
60
+ # running application's virtual buffer.
59
61
  #
60
62
  # @example
61
63
  # Vedeu.trigger(:_drb_store_output_, data)
@@ -67,7 +69,8 @@ module Vedeu
67
69
  end
68
70
  end
69
71
 
70
- # Use the DRb server to request the client application to restart.
72
+ # Use the DRb server to request the client application to
73
+ # restart.
71
74
  #
72
75
  # @example
73
76
  # Vedeu.trigger(:_drb_restart_)
@@ -89,7 +92,8 @@ module Vedeu
89
92
  Vedeu.bind(:_drb_start_) { Vedeu::Distributed::Server.start }
90
93
  end
91
94
 
92
- # Use the DRb server to request the status of the client application.
95
+ # Use the DRb server to request the status of the client
96
+ # application.
93
97
  #
94
98
  # @example
95
99
  # Vedeu.trigger(:_drb_status_)
@@ -2,15 +2,17 @@ module Vedeu
2
2
 
3
3
  module Bindings
4
4
 
5
- # Creates system events which when called provide a variety of core
6
- # functions and behaviours. They are soft-namespaced using underscores.
5
+ # Creates system events which when called provide a variety of
6
+ # core functions and behaviours. They are soft-namespaced using
7
+ # underscores.
7
8
  #
8
9
  # :nocov:
9
10
  module Focus
10
11
 
11
12
  extend self
12
13
 
13
- # Setup events relating to running Vedeu. This method is called by Vedeu.
14
+ # Setup events relating to running Vedeu. This method is called
15
+ # by Vedeu.
14
16
  #
15
17
  # @return [TrueClass]
16
18
  def setup!
@@ -21,8 +23,8 @@ module Vedeu
21
23
 
22
24
  private
23
25
 
24
- # When triggered with an interface name will focus that interface and
25
- # restore the cursor position and visibility.
26
+ # When triggered with an interface name will focus that
27
+ # interface and restore the cursor position and visibility.
26
28
  #
27
29
  # @example
28
30
  # Vedeu.trigger(:_focus_by_name_, name)
@@ -32,8 +34,8 @@ module Vedeu
32
34
  Vedeu.bind(:_focus_by_name_) { |name| Vedeu.focus_by_name(name) }
33
35
  end
34
36
 
35
- # When triggered will focus the next interface and restore the cursor
36
- # position and visibility.
37
+ # When triggered will focus the next interface and restore the
38
+ # cursor position and visibility.
37
39
  #
38
40
  # @example
39
41
  # Vedeu.trigger(:_focus_next_)
@@ -43,11 +45,12 @@ module Vedeu
43
45
  Vedeu.bind(:_focus_next_) { Vedeu.focus_next }
44
46
  end
45
47
 
46
- # When triggered will focus the previous interface and restore the cursor
47
- # position and visibility.
48
+ # When triggered will focus the previous interface and restore
49
+ # the cursor position and visibility.
48
50
  #
49
51
  # @example
50
52
  # Vedeu.trigger(:_focus_prev_)
53
+ # Vedeu.focus_previous
51
54
  #
52
55
  # @return [TrueClass]
53
56
  def focus_prev!
@@ -2,15 +2,16 @@ module Vedeu
2
2
 
3
3
  module Bindings
4
4
 
5
- # Each of the Bindings::Menus events require a target menu name as an
6
- # argument.
5
+ # Each of the Bindings::Menus events require a target menu name as
6
+ # an argument.
7
7
  #
8
8
  # :nocov:
9
9
  module Menus
10
10
 
11
11
  extend self
12
12
 
13
- # Setup events relating to menus. This method is called by Vedeu.
13
+ # Setup events relating to menus. This method is called by
14
+ # Vedeu.
14
15
  #
15
16
  # @return [TrueClass]
16
17
  def setup!
@@ -64,8 +65,8 @@ module Vedeu
64
65
  end
65
66
  end
66
67
 
67
- # Returns all the menu items with respective `current` or `selected`
68
- # boolean indicators.
68
+ # Returns all the menu items with respective `current` or
69
+ # `selected` boolean indicators.
69
70
  #
70
71
  # @example
71
72
  # Vedeu.trigger(:_menu_items_, name)
@@ -75,8 +76,8 @@ module Vedeu
75
76
  Vedeu.bind(:_menu_items_) { |name| Vedeu.menus.by_name(name).items }
76
77
  end
77
78
 
78
- # Makes the next menu item the current menu item, until it reaches the
79
- # last item.
79
+ # Makes the next menu item the current menu item, until it
80
+ # reaches the last item.
80
81
  #
81
82
  # @example
82
83
  # Vedeu.trigger(:_menu_next_, name)
@@ -86,8 +87,8 @@ module Vedeu
86
87
  Vedeu.bind(:_menu_next_) { |name| Vedeu.menus.by_name(name).next_item }
87
88
  end
88
89
 
89
- # Makes the previous menu item the current menu item, until it reaches the
90
- # first item.
90
+ # Makes the previous menu item the current menu item, until it
91
+ # reaches the first item.
91
92
  #
92
93
  # @example
93
94
  # Vedeu.trigger(:_menu_prev_, name)
@@ -131,8 +132,8 @@ module Vedeu
131
132
  Vedeu.bind(:_menu_top_) { |name| Vedeu.menus.by_name(name).top_item }
132
133
  end
133
134
 
134
- # Returns a subset of the menu items; starting at the current item to the
135
- # last item.
135
+ # Returns a subset of the menu items; starting at the current
136
+ # item to the last item.
136
137
  #
137
138
  # @example
138
139
  # Vedeu.trigger(:_menu_view_, name)
@@ -9,7 +9,8 @@ module Vedeu
9
9
 
10
10
  extend self
11
11
 
12
- # Setup events relating to movement. This method is called by Vedeu.
12
+ # Setup events relating to movement. This method is called by
13
+ # Vedeu.
13
14
  #
14
15
  # @return [TrueClass]
15
16
  def setup!
@@ -26,23 +27,21 @@ module Vedeu
26
27
  # @example
27
28
  # Vedeu.trigger(:_cursor_down_)
28
29
  #
29
- # Vedeu.trigger(:_cursor_left_) # When a name is not given, the cursor
30
- # # in the interface which is currently in
31
- # # focus should move to the left.
30
+ # Vedeu.trigger(:_cursor_left_)
31
+ # # When a name is not given, the cursor in the interface
32
+ # # which is currently in focus should move to the left.
32
33
  #
33
34
  # Vedeu.trigger(:_cursor_left_, 'my_interface')
34
- # # When a name is given, the cursor
35
- # # instance belonging to this interface
36
- # # moves to the left.
35
+ # # When a name is given, the cursor instance belonging to
36
+ # # this interface moves to the left.
37
37
  #
38
38
  # Vedeu.trigger(:_cursor_right_)
39
39
  # Vedeu.trigger(:_cursor_up_)
40
40
  #
41
41
  # Vedeu.trigger(:_cursor_origin_) # /or/
42
42
  # Vedeu.trigger(:_cursor_origin_, 'my_interface')
43
- # # Moves the cursor to the top left of
44
- # # the named or current interface in
45
- # # focus.
43
+ # # Moves the cursor to the top left of the named or current
44
+ # # interface in focus.
46
45
  #
47
46
  # Vedeu.trigger(:_view_down_, 'my_interface')
48
47
  # Vedeu.trigger(:_view_left_, 'my_interface')
@@ -52,15 +51,16 @@ module Vedeu
52
51
  # Each of the :_view_* events has an alias, :_geometry_*
53
52
  #
54
53
  # @note
55
- # The cursor or view may not be visible, but it will still move if
56
- # requested.
57
- # The cursor will not exceed the border or boundary of the interface, or
58
- # boundary of the visible terminal.
59
- # The cursor will move freely within the bounds of the interface,
60
- # irrespective of content.
61
- # The view will not exceed the boundary of the visible terminal.
62
- # The view will move freely within the bounds of the interface,
63
- # irrespective of content.
54
+ # The cursor or view may not be visible, but it will still
55
+ # move if requested.
56
+ # The cursor will not exceed the border or boundary of the
57
+ # interface, or boundary of the visible terminal.
58
+ # The cursor will move freely within the bounds of the
59
+ # interface, irrespective of content.
60
+ # The view will not exceed the boundary of the visible
61
+ # terminal.
62
+ # The view will move freely within the bounds of the
63
+ # interface, irrespective of content.
64
64
  #
65
65
  # @return [TrueClass]
66
66
  def directional!
@@ -85,8 +85,8 @@ module Vedeu
85
85
  end
86
86
  end
87
87
 
88
- # This event moves the cursor to the interface origin; the top left corner
89
- # of the named interface.
88
+ # This event moves the cursor to the interface origin; the top
89
+ # left corner of the named interface.
90
90
  #
91
91
  # @example
92
92
  # Vedeu.trigger(:_cursor_origin_, name)
@@ -107,7 +107,8 @@ module Vedeu
107
107
  # @example
108
108
  # Vedeu.trigger(:_cursor_position_, name)
109
109
  #
110
- # @todo This event queries Vedeu. Events should only be commands.
110
+ # @todo This event queries Vedeu. Events should only be
111
+ # commands.
111
112
  #
112
113
  # @return [TrueClass]
113
114
  # @see Vedeu::Move
@@ -2,15 +2,17 @@ module Vedeu
2
2
 
3
3
  module Bindings
4
4
 
5
- # Creates system events which when called provide a variety of core
6
- # functions and behaviours. They are soft-namespaced using underscores.
5
+ # Creates system events which when called provide a variety of
6
+ # core functions and behaviours. They are soft-namespaced using
7
+ # underscores.
7
8
  #
8
9
  # :nocov:
9
10
  module Refresh
10
11
 
11
12
  extend self
12
13
 
13
- # Setup events relating to running Vedeu. This method is called by Vedeu.
14
+ # Setup events relating to running Vedeu. This method is called
15
+ # by Vedeu.
14
16
  #
15
17
  # @return [TrueClass]
16
18
  def setup!
@@ -24,10 +26,11 @@ module Vedeu
24
26
  # Refreshes all registered interfaces or the named interface.
25
27
  #
26
28
  # @note
27
- # The interfaces will be refreshed in z-index order, meaning that
28
- # interfaces with a lower z-index will be drawn first. This means
29
- # overlapping interfaces will be drawn as specified.
30
- # Hidden interfaces will be still refreshed in memory but not shown.
29
+ # The interfaces will be refreshed in z-index order, meaning
30
+ # that interfaces with a lower z-index will be drawn first.
31
+ # This means overlapping interfaces will be drawn as
32
+ # specified. Hidden interfaces will be still refreshed in
33
+ # memory but not shown.
31
34
  #
32
35
  # @example
33
36
  # Vedeu.trigger(:_refresh_)
@@ -36,12 +39,12 @@ module Vedeu
36
39
  # @return [TrueClass]
37
40
  def refresh!
38
41
  Vedeu.bind(:_refresh_) do |name|
39
- name ? Vedeu::RefreshBuffer.by_name(name) : Vedeu::Refresh.all
42
+ name ? Vedeu::Buffers::Refresh.by_name(name) : Vedeu::Refresh.all
40
43
  end
41
44
  end
42
45
 
43
- # Will cause the named cursor to refresh, or the cursor of the interface
44
- # which is currently in focus.
46
+ # Will cause the named cursor to refresh, or the cursor of the
47
+ # interface which is currently in focus.
45
48
  #
46
49
  # @example
47
50
  # Vedeu.trigger(:_refresh_cursor_, name)