vedeu 0.4.33 → 0.4.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/bindings.rb +11 -0
- data/lib/vedeu/configuration/configuration.rb +6 -0
- data/lib/vedeu/dsl/geometry.rb +5 -0
- data/lib/vedeu/events/event.rb +3 -1
- data/lib/vedeu/input/mapper.rb +3 -0
- data/lib/vedeu/models/focus.rb +15 -0
- data/lib/vedeu/output/renderers/all.rb +9 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +3 -0
- data/lib/vedeu/repositories/repositories/borders.rb +6 -0
- data/lib/vedeu/repositories/repositories/buffers.rb +6 -0
- data/lib/vedeu/repositories/repositories/cursors.rb +12 -0
- data/lib/vedeu/repositories/repositories/events_repository.rb +6 -0
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +3 -0
- data/lib/vedeu/repositories/repositories/geometries.rb +6 -0
- data/lib/vedeu/repositories/repositories/groups.rb +9 -0
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +9 -0
- data/lib/vedeu/repositories/repositories/keymaps.rb +6 -0
- data/lib/vedeu/repositories/repositories/menus.rb +6 -0
- data/lib/vedeu/support/terminal.rb +3 -0
- data/lib/vedeu/support/timer.rb +5 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +159 -93
- data/test/lib/vedeu/configuration/api_test.rb +36 -10
- data/test/lib/vedeu/configuration/cli_test.rb +27 -27
- data/test/lib/vedeu/configuration/configuration_test.rb +8 -7
- data/test/lib/vedeu/cursor/cursor_test.rb +34 -0
- data/test/lib/vedeu/cursor/move_test.rb +32 -2
- data/test/lib/vedeu/distributed/client_test.rb +3 -5
- data/test/lib/vedeu/distributed/server_test.rb +37 -14
- data/test/lib/vedeu/distributed/subprocess_test.rb +12 -0
- data/test/lib/vedeu/distributed/uri_test.rb +2 -0
- data/test/lib/vedeu/dsl/border_test.rb +5 -7
- data/test/lib/vedeu/dsl/geometry_test.rb +6 -4
- data/test/lib/vedeu/dsl/line_test.rb +0 -4
- data/test/lib/vedeu/dsl/presentation_test.rb +8 -7
- data/test/lib/vedeu/events/event_test.rb +6 -6
- data/test/lib/vedeu/geometry/geometry_test.rb +53 -0
- data/test/lib/vedeu/input/keymap_test.rb +4 -0
- data/test/lib/vedeu/models/char_test.rb +24 -0
- data/test/lib/vedeu/models/group_test.rb +4 -0
- data/test/lib/vedeu/models/interface_test.rb +65 -0
- data/test/lib/vedeu/models/menu_test.rb +24 -0
- data/test/lib/vedeu/models/stream_test.rb +23 -0
- data/test/lib/vedeu/null/geometry_test.rb +12 -0
- data/test/lib/vedeu/output/border_test.rb +109 -0
- data/test/lib/vedeu/output/clear_test.rb +8 -8
- data/test/lib/vedeu/output/renderers/all_test.rb +16 -16
- data/test/lib/vedeu/output/style_test.rb +8 -0
- data/test/lib/vedeu/output/virtual_terminal_test.rb +14 -18
- data/test/lib/vedeu/repositories/collection_test.rb +21 -0
- data/test/lib/vedeu/repositories/model_test.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 627cd72e48091fbe2959ffc08efac5353a7af4cb
|
4
|
+
data.tar.gz: f027bb4b0648c2dce85949bdb8b381ba7eb09408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05fdee8984b672ea21e8fd03b29139dfcaa237ec93db32c2d7d4afa63ba421656caff81caa6cf580682cb66184e8fbbc67b331c96c9c2a16a67bb4d725b853d0
|
7
|
+
data.tar.gz: 50e6af9ada7c570262c426c493a330ab39897d4218e635bd151540d5c3a719a1eb0233d2280aef038ebd2b2aaa396030968ba068e9e51c5bcec8828bc6dcd4a0
|
data/lib/vedeu/bindings.rb
CHANGED
@@ -13,6 +13,8 @@ module Vedeu
|
|
13
13
|
# @api public
|
14
14
|
module Bindings
|
15
15
|
|
16
|
+
# Triggering this event will send input to the running application as long
|
17
|
+
# as it has the DRb server running.
|
16
18
|
Vedeu.bind(:_drb_input_) do |data, type|
|
17
19
|
Vedeu.log(type: :drb, message: "Sending input (#{type})")
|
18
20
|
|
@@ -24,13 +26,22 @@ module Vedeu
|
|
24
26
|
|
25
27
|
Vedeu.bind(:_drb_retrieve_output_) { Vedeu::VirtualBuffer.retrieve }
|
26
28
|
|
29
|
+
# Triggering this event with 'data' will push data into the running
|
30
|
+
# application's virtual buffer.
|
27
31
|
Vedeu.bind(:_drb_store_output_) do |data|
|
28
32
|
Vedeu::VirtualBuffer.store(Vedeu::Terminal.virtual.output(data))
|
29
33
|
end
|
30
34
|
|
35
|
+
# Use the DRb server to request the client application to restart.
|
31
36
|
Vedeu.bind(:_drb_restart_) { Vedeu::Distributed::Server.restart }
|
37
|
+
|
38
|
+
# Use the DRb server to request the client application to start.
|
32
39
|
Vedeu.bind(:_drb_start_) { Vedeu::Distributed::Server.start }
|
40
|
+
|
41
|
+
# Use the DRb server to request the status of the client application.
|
33
42
|
Vedeu.bind(:_drb_status_) { Vedeu::Distributed::Server.status }
|
43
|
+
|
44
|
+
# Use the DRb server to request the client application to stop.
|
34
45
|
Vedeu.bind(:_drb_stop_) { Vedeu::Distributed::Server.stop }
|
35
46
|
|
36
47
|
# Vedeu triggers this event when `:_exit_` is triggered. You can hook into
|
@@ -39,6 +39,9 @@ module Vedeu
|
|
39
39
|
# are provided at application invocation, override any options with the
|
40
40
|
# arguments provided.
|
41
41
|
#
|
42
|
+
# @example
|
43
|
+
# Vedeu.configure
|
44
|
+
#
|
42
45
|
# @param args [Array]
|
43
46
|
# @param opts [Hash]
|
44
47
|
# @option opts stdin [File|IO]
|
@@ -53,6 +56,9 @@ module Vedeu
|
|
53
56
|
|
54
57
|
# Returns the configuration singleton.
|
55
58
|
#
|
59
|
+
# @example
|
60
|
+
# Vedeu.configuration
|
61
|
+
#
|
56
62
|
# @return [Vedeu::Configuration]
|
57
63
|
def configuration
|
58
64
|
instance
|
data/lib/vedeu/dsl/geometry.rb
CHANGED
@@ -8,6 +8,11 @@ module Vedeu
|
|
8
8
|
# top-left, y = 1, x = 1. The 'y' coordinate is deliberately first.
|
9
9
|
#
|
10
10
|
# @example
|
11
|
+
#
|
12
|
+
# Vedeu.geometry 'some_interface' do
|
13
|
+
# # ...
|
14
|
+
#
|
15
|
+
#
|
11
16
|
# This crude ASCII diagram represents a Geometry within Vedeu, each of the
|
12
17
|
# labels is a value you can access or define.
|
13
18
|
#
|
data/lib/vedeu/events/event.rb
CHANGED
@@ -90,6 +90,9 @@ module Vedeu
|
|
90
90
|
|
91
91
|
# Unbind events from a named handler.
|
92
92
|
#
|
93
|
+
# @example
|
94
|
+
# Vedeu.unbind('some_event')
|
95
|
+
#
|
93
96
|
# @param name [String]
|
94
97
|
# @return [Boolean]
|
95
98
|
def unbind(name)
|
@@ -101,7 +104,6 @@ module Vedeu
|
|
101
104
|
|
102
105
|
true
|
103
106
|
end
|
104
|
-
alias_method :unevent, :unbind
|
105
107
|
|
106
108
|
extend Forwardable
|
107
109
|
|
data/lib/vedeu/input/mapper.rb
CHANGED
@@ -9,6 +9,9 @@ module Vedeu
|
|
9
9
|
# the associated action is fired, if not, we move to the next keymap or
|
10
10
|
# return false.
|
11
11
|
#
|
12
|
+
# @example
|
13
|
+
# Vedeu.keypress(key_name, keymap_name)
|
14
|
+
#
|
12
15
|
# @param (see #initialize)
|
13
16
|
# @return [Boolean]
|
14
17
|
def self.keypress(key = nil, name = nil)
|
data/lib/vedeu/models/focus.rb
CHANGED
@@ -38,6 +38,9 @@ module Vedeu
|
|
38
38
|
# Focus an interface by name. Used after defining an interface or interfaces
|
39
39
|
# to set the initially focussed interface.
|
40
40
|
#
|
41
|
+
# @example
|
42
|
+
# Vedeu.focus_by_name('name')
|
43
|
+
#
|
41
44
|
# @param name [String] The interface to focus; must be defined.
|
42
45
|
# @raise [ModelNotFound] When the interface cannot be found.
|
43
46
|
# @return [String] The name of the interface now in focus.
|
@@ -53,6 +56,9 @@ module Vedeu
|
|
53
56
|
|
54
57
|
# Return the interface currently focussed.
|
55
58
|
#
|
59
|
+
# @example
|
60
|
+
# Vedeu.focus
|
61
|
+
#
|
56
62
|
# @return [String]
|
57
63
|
def current
|
58
64
|
storage.first
|
@@ -61,6 +67,9 @@ module Vedeu
|
|
61
67
|
|
62
68
|
# Returns a boolean indicating whether the named interface is focussed.
|
63
69
|
#
|
70
|
+
# @example
|
71
|
+
# Vedeu.focussed?(name)
|
72
|
+
#
|
64
73
|
# @param name [String]
|
65
74
|
# @return [Boolean]
|
66
75
|
def current?(name)
|
@@ -77,6 +86,9 @@ module Vedeu
|
|
77
86
|
|
78
87
|
# Put the next interface relative to the current interfaces in focus.
|
79
88
|
#
|
89
|
+
# @example
|
90
|
+
# Vedeu.focus_next
|
91
|
+
#
|
80
92
|
# @return [String]
|
81
93
|
def next_item
|
82
94
|
storage.rotate!
|
@@ -88,6 +100,9 @@ module Vedeu
|
|
88
100
|
|
89
101
|
# Put the previous interface relative to the current interface in focus.
|
90
102
|
#
|
103
|
+
# @example
|
104
|
+
# Vedeu.focus_previous
|
105
|
+
#
|
91
106
|
# @return [String]
|
92
107
|
def prev_item
|
93
108
|
storage.rotate!(-1)
|
@@ -18,12 +18,18 @@ module Vedeu
|
|
18
18
|
|
19
19
|
# Provides access to the list of renderers.
|
20
20
|
#
|
21
|
+
# @example
|
22
|
+
# Vedeu.renderers
|
23
|
+
#
|
21
24
|
# @api public
|
22
25
|
# @return [Module]
|
23
26
|
def renderers
|
24
27
|
self
|
25
28
|
end
|
26
29
|
|
30
|
+
# @example
|
31
|
+
# Vedeu.renderers.render(*args)
|
32
|
+
#
|
27
33
|
# @return [Array<void>]
|
28
34
|
def render(*args)
|
29
35
|
threads = storage.map do |renderer|
|
@@ -53,6 +59,9 @@ module Vedeu
|
|
53
59
|
storage
|
54
60
|
end
|
55
61
|
|
62
|
+
# @example
|
63
|
+
# Vedeu.renderers.reset
|
64
|
+
#
|
56
65
|
# @return [Set]
|
57
66
|
def reset
|
58
67
|
@storage = Set.new
|
@@ -8,11 +8,17 @@ module Vedeu
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
11
|
+
# @example
|
12
|
+
# Vedeu.borders
|
13
|
+
#
|
11
14
|
# @return [Vedeu::Borders]
|
12
15
|
alias_method :borders, :repository
|
13
16
|
|
14
17
|
# Remove all stored models from the repository.
|
15
18
|
#
|
19
|
+
# @example
|
20
|
+
# Vedeu.borders.reset
|
21
|
+
#
|
16
22
|
# @return [Vedeu::Borders]
|
17
23
|
def reset!
|
18
24
|
@borders = register(Vedeu::Border)
|
@@ -7,11 +7,17 @@ module Vedeu
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
+
# @example
|
11
|
+
# Vedeu.buffers
|
12
|
+
#
|
10
13
|
# @return [Vedeu::Buffers]
|
11
14
|
alias_method :buffers, :repository
|
12
15
|
|
13
16
|
# Remove all stored models from the repository.
|
14
17
|
#
|
18
|
+
# @example
|
19
|
+
# Vedeu.buffers.reset
|
20
|
+
#
|
15
21
|
# @return [Vedeu::Buffers]
|
16
22
|
def reset!
|
17
23
|
@buffers = register(Vedeu::Buffer)
|
@@ -7,9 +7,15 @@ module Vedeu
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
+
# @example
|
11
|
+
# Vedeu.cursors
|
12
|
+
#
|
10
13
|
# @return [Vedeu::Cursors]
|
11
14
|
alias_method :cursors, :repository
|
12
15
|
|
16
|
+
# @example
|
17
|
+
# Vedeu.cursor
|
18
|
+
#
|
13
19
|
# @return [Vedeu::Cursor]
|
14
20
|
def cursor
|
15
21
|
cursors.by_name(Vedeu.focus) if Vedeu.focus
|
@@ -17,6 +23,9 @@ module Vedeu
|
|
17
23
|
|
18
24
|
# Remove all stored models from the repository.
|
19
25
|
#
|
26
|
+
# @example
|
27
|
+
# Vedeu.cursors.reset
|
28
|
+
#
|
20
29
|
# @return [Vedeu::Cursors]
|
21
30
|
def reset!
|
22
31
|
@cursors = register(Vedeu::Cursor)
|
@@ -24,6 +33,9 @@ module Vedeu
|
|
24
33
|
|
25
34
|
end
|
26
35
|
|
36
|
+
# @example
|
37
|
+
# Vedeu.cursors.by_name('some_name')
|
38
|
+
#
|
27
39
|
# @param name [String] The name of the stored cursor.
|
28
40
|
# @return [Vedeu::Cursor]
|
29
41
|
def by_name(name)
|
@@ -7,11 +7,17 @@ module Vedeu
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
+
# @example
|
11
|
+
# Vedeu.events
|
12
|
+
#
|
10
13
|
# @return [Vedeu::EventsRepository]
|
11
14
|
alias_method :events, :repository
|
12
15
|
|
13
16
|
# Remove all stored models from the repository.
|
14
17
|
#
|
18
|
+
# @example
|
19
|
+
# Vedeu.events.reset
|
20
|
+
#
|
15
21
|
# @return [Vedeu::EventsRepository]
|
16
22
|
def reset!
|
17
23
|
@events = new(Vedeu::Events)
|
@@ -8,11 +8,17 @@ module Vedeu
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
11
|
+
# @example
|
12
|
+
# Vedeu.geometries
|
13
|
+
#
|
11
14
|
# @return [Vedeu::Geometries]
|
12
15
|
alias_method :geometries, :repository
|
13
16
|
|
14
17
|
# Remove all stored models from the repository.
|
15
18
|
#
|
19
|
+
# @example
|
20
|
+
# Vedeu.geometries.reset!
|
21
|
+
#
|
16
22
|
# @return [Vedeu::Geometries]
|
17
23
|
def reset!
|
18
24
|
@geometries = register(Vedeu::Geometry)
|
@@ -7,11 +7,17 @@ module Vedeu
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
+
# @example
|
11
|
+
# Vedeu.groups
|
12
|
+
#
|
10
13
|
# @return [Vedeu::Groups]
|
11
14
|
alias_method :groups, :repository
|
12
15
|
|
13
16
|
# Remove all stored models from the repository.
|
14
17
|
#
|
18
|
+
# @example
|
19
|
+
# Vedeu.groups.reset!
|
20
|
+
#
|
15
21
|
# @return [Vedeu::Groups]
|
16
22
|
def reset!
|
17
23
|
@groups = register(Vedeu::Group)
|
@@ -19,6 +25,9 @@ module Vedeu
|
|
19
25
|
|
20
26
|
end
|
21
27
|
|
28
|
+
# @example
|
29
|
+
# Vedeu.groups.by_name('name')
|
30
|
+
#
|
22
31
|
# @param name [String] The name of the stored group.
|
23
32
|
# @return [Vedeu::Group]
|
24
33
|
def by_name(name)
|
@@ -7,11 +7,17 @@ module Vedeu
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
+
# @example
|
11
|
+
# Vedeu.interfaces
|
12
|
+
#
|
10
13
|
# @return [Vedeu::InterfacesRepository]
|
11
14
|
alias_method :interfaces, :repository
|
12
15
|
|
13
16
|
# Remove all stored models from the repository.
|
14
17
|
#
|
18
|
+
# @example
|
19
|
+
# Vedeu.interfaces.reset!
|
20
|
+
#
|
15
21
|
# @return [Vedeu::InterfacesRepository]
|
16
22
|
def reset!
|
17
23
|
@interfaces = register(Vedeu::Interface)
|
@@ -24,6 +30,9 @@ module Vedeu
|
|
24
30
|
|
25
31
|
# Returns the interfaces in zindex order.
|
26
32
|
#
|
33
|
+
# @example
|
34
|
+
# Vedeu.interfaces.zindexed
|
35
|
+
#
|
27
36
|
# @return [Array<Vedeu::Interface>]
|
28
37
|
# @see Vedeu::DSL::Interface#zindex
|
29
38
|
def zindexed
|
@@ -7,11 +7,17 @@ module Vedeu
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
+
# @example
|
11
|
+
# Vedeu.keymaps
|
12
|
+
#
|
10
13
|
# @return [Vedeu::Keymaps]
|
11
14
|
alias_method :keymaps, :repository
|
12
15
|
|
13
16
|
# Remove all stored models from the repository.
|
14
17
|
#
|
18
|
+
# @example
|
19
|
+
# Vedeu.keymaps.reset!
|
20
|
+
#
|
15
21
|
# @return [Vedeu::Keymaps]
|
16
22
|
def reset!
|
17
23
|
@keymaps = register(Vedeu::Keymap)
|
@@ -7,11 +7,17 @@ module Vedeu
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
+
# @example
|
11
|
+
# Vedeu.menus
|
12
|
+
#
|
10
13
|
# @return [Vedeu::Menus]
|
11
14
|
alias_method :menus, :repository
|
12
15
|
|
13
16
|
# Remove all stored models from the repository.
|
14
17
|
#
|
18
|
+
# @example
|
19
|
+
# Vedeu.menus.reset!
|
20
|
+
#
|
15
21
|
# @return [Vedeu::Menus]
|
16
22
|
def reset!
|
17
23
|
@menus = register(Vedeu::Menu)
|
data/lib/vedeu/support/timer.rb
CHANGED