vedeu 0.6.20 → 0.6.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +4 -0
- data/Rakefile +13 -0
- data/bin/vedeu_drb_server +6 -6
- data/docs/api.md +14 -0
- data/docs/dsl.md +12 -12
- data/docs/events/document.md +4 -2
- data/docs/events/drb.md +4 -0
- data/docs/events/focus.md +2 -0
- data/docs/events/menu.md +2 -0
- data/docs/events/movement.md +7 -5
- data/docs/events/refresh.md +2 -0
- data/docs/events/system.md +5 -0
- data/docs/events/view.md +2 -0
- data/docs/events/visibility.md +2 -0
- data/lib/vedeu.rb +0 -23
- data/lib/vedeu/all.rb +2 -4
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/borders/all.rb +3 -3
- data/lib/vedeu/borders/border.rb +2 -2
- data/lib/vedeu/borders/dsl.rb +21 -27
- data/lib/vedeu/borders/null.rb +2 -15
- data/lib/vedeu/borders/render.rb +1 -1
- data/lib/vedeu/borders/repository.rb +9 -0
- data/lib/vedeu/buffers/buffer.rb +2 -2
- data/lib/vedeu/buffers/null.rb +1 -31
- data/lib/vedeu/buffers/refresh.rb +8 -8
- data/lib/vedeu/buffers/repository.rb +9 -0
- data/lib/vedeu/colours/backgrounds.rb +9 -0
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/foregrounds.rb +9 -0
- data/lib/vedeu/common.rb +22 -13
- data/lib/vedeu/configuration/configuration.rb +6 -0
- data/lib/vedeu/cursors/cursor.rb +13 -8
- data/lib/vedeu/cursors/refresh.rb +2 -2
- data/lib/vedeu/cursors/repository.rb +18 -1
- data/lib/vedeu/distributed/server.rb +23 -0
- data/lib/vedeu/distributed/templates/default_borders.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_geometries.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_interfaces.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_keymaps.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_menus.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_views.vedeu +1 -1
- data/lib/vedeu/dsl/composition.rb +7 -17
- data/lib/vedeu/dsl/dsl.rb +12 -0
- data/lib/vedeu/dsl/interface.rb +32 -33
- data/lib/vedeu/dsl/keymap.rb +13 -19
- data/lib/vedeu/dsl/line.rb +3 -13
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/dsl/stream.rb +0 -10
- data/lib/vedeu/dsl/use.rb +6 -6
- data/lib/vedeu/dsl/view.rb +17 -19
- data/lib/vedeu/editor/cursor.rb +32 -10
- data/lib/vedeu/editor/document.rb +33 -35
- data/lib/vedeu/editor/editor.rb +3 -4
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/line.rb +1 -8
- data/lib/vedeu/editor/lines.rb +1 -1
- data/lib/vedeu/editor/repository.rb +9 -0
- data/lib/vedeu/esc/esc.rb +2 -1
- data/lib/vedeu/events/aliases.rb +8 -1
- data/lib/vedeu/events/event.rb +8 -0
- data/lib/vedeu/events/repository.rb +9 -0
- data/lib/vedeu/events/trigger.rb +9 -5
- data/lib/vedeu/geometry/coordinate.rb +2 -2
- data/lib/vedeu/geometry/dsl.rb +32 -38
- data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +3 -3
- data/lib/vedeu/geometry/null.rb +2 -24
- data/lib/vedeu/geometry/repository.rb +9 -0
- data/lib/vedeu/groups/clear.rb +7 -3
- data/lib/vedeu/groups/dsl.rb +29 -35
- data/lib/vedeu/groups/group.rb +28 -4
- data/lib/vedeu/groups/refresh.rb +3 -2
- data/lib/vedeu/groups/repository.rb +9 -0
- data/lib/vedeu/input/capture.rb +1 -1
- data/lib/vedeu/input/keymap.rb +2 -1
- data/lib/vedeu/input/keymaps.rb +9 -0
- data/lib/vedeu/input/mapper.rb +4 -0
- data/lib/vedeu/input/translator.rb +1 -1
- data/lib/vedeu/logging/debug.rb +13 -0
- data/lib/vedeu/logging/log.rb +8 -0
- data/lib/vedeu/logging/timer.rb +13 -0
- data/lib/vedeu/menus/dsl.rb +8 -18
- data/lib/vedeu/menus/menu.rb +8 -4
- data/lib/vedeu/menus/null.rb +1 -1
- data/lib/vedeu/menus/repository.rb +9 -0
- data/lib/vedeu/models/cell.rb +5 -0
- data/lib/vedeu/models/escape.rb +5 -0
- data/lib/vedeu/models/focus.rb +20 -5
- data/lib/vedeu/models/interface.rb +10 -1
- data/lib/vedeu/models/interfaces.rb +9 -0
- data/lib/vedeu/models/toggleable.rb +19 -4
- data/lib/vedeu/models/views/char.rb +6 -1
- data/lib/vedeu/models/views/html_char.rb +1 -4
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/generic.rb +14 -2
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/interface.rb +5 -1
- data/lib/vedeu/output/compressor.rb +8 -4
- data/lib/vedeu/output/direct.rb +4 -4
- data/lib/vedeu/output/presentation/all.rb +15 -0
- data/lib/vedeu/output/presentation/presentation.rb +0 -7
- data/lib/vedeu/output/refresh/refresh.rb +1 -3
- data/lib/vedeu/output/renderers/all.rb +10 -0
- data/lib/vedeu/output/renderers/terminal.rb +1 -3
- data/lib/vedeu/repositories/collection.rb +3 -3
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +8 -8
- data/lib/vedeu/repositories/store.rb +3 -2
- data/lib/vedeu/runtime/application.rb +4 -0
- data/lib/vedeu/runtime/bootstrap.rb +1 -1
- data/lib/vedeu/runtime/flags.rb +7 -0
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/runtime/router.rb +4 -0
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +2 -0
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/terminal/buffer.rb +7 -0
- data/lib/vedeu/terminal/terminal.rb +8 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/dsl_test.rb +0 -6
- data/test/lib/vedeu/borders/null_test.rb +0 -12
- data/test/lib/vedeu/buffers/null_test.rb +0 -37
- data/test/lib/vedeu/common_test.rb +33 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +0 -6
- data/test/lib/vedeu/dsl/dsl_test.rb +1 -0
- data/test/lib/vedeu/dsl/interface_test.rb +0 -6
- data/test/lib/vedeu/dsl/keymap_test.rb +0 -5
- data/test/lib/vedeu/dsl/line_test.rb +0 -7
- data/test/lib/vedeu/dsl/stream_test.rb +0 -7
- data/test/lib/vedeu/editor/cursor_test.rb +23 -8
- data/test/lib/vedeu/editor/document_test.rb +27 -23
- data/test/lib/vedeu/editor/line_test.rb +0 -30
- data/test/lib/vedeu/geometry/dsl_test.rb +0 -5
- data/test/lib/vedeu/geometry/null_test.rb +0 -30
- data/test/lib/vedeu/groups/dsl_test.rb +0 -6
- data/test/lib/vedeu/groups/group_test.rb +15 -7
- data/test/lib/vedeu/menus/dsl_test.rb +0 -5
- data/test/lib/vedeu/models/cell_test.rb +4 -0
- data/test/lib/vedeu/models/escape_test.rb +4 -0
- data/test/lib/vedeu/models/views/char_test.rb +4 -0
- data/test/lib/vedeu/null/generic_test.rb +13 -0
- data/test/lib/vedeu/terminal/buffer_test.rb +3 -2
- data/test/lib/vedeu_test.rb +81 -3
- data/test/support/examples/borders_app.rb +1 -3
- data/test/support/examples/drb_app.rb +1 -3
- data/test/support/examples/editor_app.rb +2 -4
- data/test/support/examples/focus_app.rb +1 -3
- data/test/support/examples/hello_world.rb +1 -6
- data/test/support/examples/material_colours_app.rb +1 -3
- data/test/support/examples/view_templates_app/view_templates_app.rb +1 -3
- data/test/support/helpers/model_test_class.rb +1 -5
- data/test/support/who.rb +29 -0
- data/test/test_helper.rb +0 -1
- metadata +5 -17
- data/lib/vedeu/api/all.rb +0 -15
- data/lib/vedeu/api/external.rb +0 -194
- data/lib/vedeu/api/internal.rb +0 -177
- data/test/lib/vedeu/api/external_test.rb +0 -74
- data/test/lib/vedeu/api/internal_test.rb +0 -33
- data/test/support/examples/typed_commands/command.erb +0 -1
- data/test/support/examples/typed_commands/output.erb +0 -1
- data/test/support/examples/typed_commands/status.erb +0 -1
- data/test/support/examples/typed_commands/typed_commands_app.rb +0 -94
data/lib/vedeu/api/internal.rb
DELETED
@@ -1,177 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
module API
|
4
|
-
|
5
|
-
# The internal API methods allow Vedeu to function and change
|
6
|
-
# without major refactoring. The methods listed here will rarely
|
7
|
-
# be used by client applications.
|
8
|
-
#
|
9
|
-
module Internal
|
10
|
-
|
11
|
-
extend Forwardable
|
12
|
-
|
13
|
-
module_function
|
14
|
-
|
15
|
-
# Manipulate the repository of background colours.
|
16
|
-
#
|
17
|
-
# @example
|
18
|
-
# Vedeu.background_colours
|
19
|
-
#
|
20
|
-
# @!method background_colours
|
21
|
-
# @return [Vedeu::Colours::Backgrounds]
|
22
|
-
def_delegators Vedeu::Colours::Backgrounds, :background_colours
|
23
|
-
|
24
|
-
# Manipulate the repository of borders.
|
25
|
-
#
|
26
|
-
# @example
|
27
|
-
# Vedeu.borders
|
28
|
-
#
|
29
|
-
# @!method borders
|
30
|
-
# @return [Vedeu::Borders::Repository]
|
31
|
-
def_delegators Vedeu::Borders::Repository, :borders
|
32
|
-
|
33
|
-
# Manipulate the repository of buffers.
|
34
|
-
#
|
35
|
-
# @example
|
36
|
-
# Vedeu.buffers
|
37
|
-
#
|
38
|
-
# @!method buffers
|
39
|
-
# @return [Vedeu::Buffers::Repository]
|
40
|
-
def_delegators Vedeu::Buffers::Repository, :buffers
|
41
|
-
|
42
|
-
# Manipulate the repository of cursors.
|
43
|
-
#
|
44
|
-
# @example
|
45
|
-
# Vedeu.cursors
|
46
|
-
#
|
47
|
-
# @!method cursors
|
48
|
-
# @return [Vedeu::Cursors::Repository]
|
49
|
-
def_delegators Vedeu::Cursors::Repository, :cursors
|
50
|
-
|
51
|
-
# Allow debugging via the creation of stack traces courtesy of
|
52
|
-
# ruby-prof.
|
53
|
-
#
|
54
|
-
# @example
|
55
|
-
# Vedeu.debug
|
56
|
-
#
|
57
|
-
# @!method debug
|
58
|
-
# @return [Vedeu::Logging::Debug]
|
59
|
-
def_delegators Vedeu::Logging::Debug, :debug
|
60
|
-
|
61
|
-
# Manipulate the repository of documents.
|
62
|
-
#
|
63
|
-
# @example
|
64
|
-
# Vedeu.documents
|
65
|
-
#
|
66
|
-
# @!method documents
|
67
|
-
# @return [Vedeu::Editor::Repository]
|
68
|
-
def_delegators Vedeu::Editor::Repository, :documents
|
69
|
-
|
70
|
-
# Manipulate the repository of events.
|
71
|
-
#
|
72
|
-
# @example
|
73
|
-
# Vedeu.events
|
74
|
-
#
|
75
|
-
# @!method events
|
76
|
-
# @return [Vedeu::Events::Repository]
|
77
|
-
def_delegators Vedeu::Events::Repository, :events
|
78
|
-
|
79
|
-
# Manipulate the repository of foreground colours.
|
80
|
-
#
|
81
|
-
# @example
|
82
|
-
# Vedeu.foreground_colours
|
83
|
-
#
|
84
|
-
# @!method foreground_colours
|
85
|
-
# @return [Vedeu::Colours::Foregrounds]
|
86
|
-
def_delegators Vedeu::Colours::Foregrounds, :foreground_colours
|
87
|
-
|
88
|
-
# Manipulate the repository of geometries.
|
89
|
-
#
|
90
|
-
# @example
|
91
|
-
# Vedeu.geometries
|
92
|
-
#
|
93
|
-
# @!method geometries
|
94
|
-
# @return [Vedeu::Geometry::Repository]
|
95
|
-
def_delegators Vedeu::Geometry::Repository, :geometries
|
96
|
-
|
97
|
-
# Manipulate the repository of groups.
|
98
|
-
#
|
99
|
-
# @example
|
100
|
-
# Vedeu.groups
|
101
|
-
#
|
102
|
-
# @!method groups
|
103
|
-
# @return [Vedeu::Groups::Repository]
|
104
|
-
def_delegators Vedeu::Groups::Repository, :groups
|
105
|
-
|
106
|
-
# Manipulate the repository of interfaces.
|
107
|
-
#
|
108
|
-
# @example
|
109
|
-
# Vedeu.interfaces
|
110
|
-
#
|
111
|
-
# @!method interfaces
|
112
|
-
# @return [Vedeu::Models::Interfaces]
|
113
|
-
def_delegators Vedeu::Models::Interfaces, :interfaces
|
114
|
-
|
115
|
-
# Manipulate the repository of keymaps.
|
116
|
-
#
|
117
|
-
# @example
|
118
|
-
# Vedeu.keymaps
|
119
|
-
#
|
120
|
-
# @!method keymaps
|
121
|
-
# @return [Vedeu::Input::Keymaps]
|
122
|
-
def_delegators Vedeu::Input::Keymaps, :keymaps
|
123
|
-
|
124
|
-
# Manipulate the repository of menus.
|
125
|
-
#
|
126
|
-
# @example
|
127
|
-
# Vedeu.menus
|
128
|
-
#
|
129
|
-
# @!method menus
|
130
|
-
# @return [Vedeu::Menus::Repository]
|
131
|
-
def_delegators Vedeu::Menus::Repository, :menus
|
132
|
-
|
133
|
-
# Manipulate the internal flags.
|
134
|
-
#
|
135
|
-
# @!method ready?
|
136
|
-
# @!method ready!
|
137
|
-
# @return [Boolean]
|
138
|
-
def_delegators Vedeu::Runtime::Flags, :ready?, :ready!
|
139
|
-
|
140
|
-
# @example
|
141
|
-
# Vedeu.renderer
|
142
|
-
# Vedeu.renderers
|
143
|
-
#
|
144
|
-
# @!method renderer
|
145
|
-
# @see Vedeu::Renderers#renderer
|
146
|
-
# @!method renderers
|
147
|
-
# @see Vedeu::Renderers#renderers
|
148
|
-
def_delegators Vedeu::Renderers, :renderer, :renderers
|
149
|
-
|
150
|
-
# Instruct the terminal to resize. This will happen
|
151
|
-
# automatically as the terminal recieves SIGWINCH signals.
|
152
|
-
#
|
153
|
-
# @example
|
154
|
-
# Vedeu.resize
|
155
|
-
#
|
156
|
-
# @!method resize
|
157
|
-
# @see Vedeu::Terminal#resize
|
158
|
-
def_delegators Vedeu::Terminal, :resize
|
159
|
-
|
160
|
-
# Measure the execution time of the code in the given block.
|
161
|
-
#
|
162
|
-
# @example
|
163
|
-
# Vedeu.timer do
|
164
|
-
# # ... some code here ...
|
165
|
-
# end
|
166
|
-
#
|
167
|
-
# @!method timer
|
168
|
-
# @see Vedeu::Logging::Timer.timer
|
169
|
-
def_delegators Vedeu::Logging::Timer, :timer
|
170
|
-
|
171
|
-
end # Internal
|
172
|
-
|
173
|
-
end # API
|
174
|
-
|
175
|
-
extend Vedeu::API::Internal
|
176
|
-
|
177
|
-
end # Vedeu
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module API
|
6
|
-
|
7
|
-
describe External do
|
8
|
-
|
9
|
-
it { Vedeu.must_respond_to(:bind) }
|
10
|
-
it { Vedeu.must_respond_to(:bind_alias) }
|
11
|
-
it { Vedeu.must_respond_to(:border) }
|
12
|
-
it { Vedeu.must_respond_to(:bound?) }
|
13
|
-
it { Vedeu.must_respond_to(:clear) }
|
14
|
-
it { Vedeu.must_respond_to(:clear_by_group) }
|
15
|
-
it { Vedeu.must_respond_to(:clear_by_name) }
|
16
|
-
it { Vedeu.must_respond_to(:configuration) }
|
17
|
-
it { Vedeu.must_respond_to(:configure) }
|
18
|
-
it { Vedeu.must_respond_to(:cursor) }
|
19
|
-
it { Vedeu.must_respond_to(:drb_restart) }
|
20
|
-
it { Vedeu.must_respond_to(:drb_start) }
|
21
|
-
it { Vedeu.must_respond_to(:drb_status) }
|
22
|
-
it { Vedeu.must_respond_to(:drb_stop) }
|
23
|
-
it { Vedeu.must_respond_to(:events) }
|
24
|
-
it { Vedeu.must_respond_to(:exit) }
|
25
|
-
it { Vedeu.must_respond_to(:focus) }
|
26
|
-
it { Vedeu.must_respond_to(:focus_by_name) }
|
27
|
-
it { Vedeu.must_respond_to(:focus_next) }
|
28
|
-
it { Vedeu.must_respond_to(:focus_previous) }
|
29
|
-
it { Vedeu.must_respond_to(:focussed?) }
|
30
|
-
it { Vedeu.must_respond_to(:geometry) }
|
31
|
-
it { Vedeu.must_respond_to(:goto) }
|
32
|
-
it { Vedeu.must_respond_to(:group) }
|
33
|
-
|
34
|
-
describe 'Vedeu.height' do
|
35
|
-
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
36
|
-
|
37
|
-
it { Vedeu.must_respond_to(:height) }
|
38
|
-
it { Vedeu.height.must_equal(25) }
|
39
|
-
end
|
40
|
-
|
41
|
-
it { Vedeu.must_respond_to(:hide_cursor) }
|
42
|
-
it { Vedeu.must_respond_to(:hide_group) }
|
43
|
-
it { Vedeu.must_respond_to(:hide_interface) }
|
44
|
-
it { Vedeu.must_respond_to(:interface) }
|
45
|
-
it { Vedeu.must_respond_to(:keymap) }
|
46
|
-
it { Vedeu.must_respond_to(:keypress) }
|
47
|
-
it { Vedeu.must_respond_to(:log) }
|
48
|
-
it { Vedeu.must_respond_to(:log_stderr) }
|
49
|
-
it { Vedeu.must_respond_to(:log_stdout) }
|
50
|
-
it { Vedeu.must_respond_to(:menu) }
|
51
|
-
it { Vedeu.must_respond_to(:render) }
|
52
|
-
it { Vedeu.must_respond_to(:renders) }
|
53
|
-
it { Vedeu.must_respond_to(:show_cursor) }
|
54
|
-
it { Vedeu.must_respond_to(:show_group) }
|
55
|
-
it { Vedeu.must_respond_to(:show_interface) }
|
56
|
-
it { Vedeu.must_respond_to(:toggle_cursor) }
|
57
|
-
it { Vedeu.must_respond_to(:toggle_group) }
|
58
|
-
it { Vedeu.must_respond_to(:toggle_interface) }
|
59
|
-
it { Vedeu.must_respond_to(:trigger) }
|
60
|
-
it { Vedeu.must_respond_to(:unbind) }
|
61
|
-
it { Vedeu.must_respond_to(:unbind_alias) }
|
62
|
-
it { Vedeu.must_respond_to(:views) }
|
63
|
-
|
64
|
-
describe 'Vedeu.width' do
|
65
|
-
before { Terminal.stubs(:size).returns([25, 40]) }
|
66
|
-
|
67
|
-
it { Vedeu.must_respond_to(:width) }
|
68
|
-
it { Vedeu.width.must_equal(40) }
|
69
|
-
end
|
70
|
-
end # External
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
end # Vedeu
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module API
|
6
|
-
|
7
|
-
describe Internal do
|
8
|
-
|
9
|
-
it { Vedeu.must_respond_to(:background_colours) }
|
10
|
-
it { Vedeu.must_respond_to(:borders) }
|
11
|
-
it { Vedeu.must_respond_to(:buffers) }
|
12
|
-
it { Vedeu.must_respond_to(:cursors) }
|
13
|
-
it { Vedeu.must_respond_to(:debug) }
|
14
|
-
it { Vedeu.must_respond_to(:documents) }
|
15
|
-
it { Vedeu.must_respond_to(:events) }
|
16
|
-
it { Vedeu.must_respond_to(:foreground_colours) }
|
17
|
-
it { Vedeu.must_respond_to(:geometries) }
|
18
|
-
it { Vedeu.must_respond_to(:groups) }
|
19
|
-
it { Vedeu.must_respond_to(:interfaces) }
|
20
|
-
it { Vedeu.must_respond_to(:keymaps) }
|
21
|
-
it { Vedeu.must_respond_to(:menus) }
|
22
|
-
it { Vedeu.must_respond_to(:ready!) }
|
23
|
-
it { Vedeu.must_respond_to(:ready?) }
|
24
|
-
it { Vedeu.must_respond_to(:renderer) }
|
25
|
-
it { Vedeu.must_respond_to(:renderers) }
|
26
|
-
it { Vedeu.must_respond_to(:resize) }
|
27
|
-
it { Vedeu.must_respond_to(:timer) }
|
28
|
-
|
29
|
-
end # Internal
|
30
|
-
|
31
|
-
end # API
|
32
|
-
|
33
|
-
end # Vedeu
|
@@ -1 +0,0 @@
|
|
1
|
-
command
|
@@ -1 +0,0 @@
|
|
1
|
-
output
|
@@ -1 +0,0 @@
|
|
1
|
-
status
|
@@ -1,94 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
lib_dir = File.dirname(__FILE__) + '/../../lib'
|
4
|
-
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
|
-
|
6
|
-
require 'vedeu'
|
7
|
-
|
8
|
-
# A simple example application to test the input of commands. This will test
|
9
|
-
# the functionality of 'cooked' mode.
|
10
|
-
class VedeuTypedCommands
|
11
|
-
|
12
|
-
Vedeu.configure do
|
13
|
-
debug!
|
14
|
-
log '/tmp/vedeu_typed_commands_app.log'
|
15
|
-
end
|
16
|
-
|
17
|
-
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
18
|
-
|
19
|
-
Vedeu.interface 'output' do
|
20
|
-
colour foreground: '#ff0000', background: '#000022'
|
21
|
-
cursor!
|
22
|
-
end
|
23
|
-
|
24
|
-
Vedeu.interface 'status' do
|
25
|
-
colour foreground: '#00ff00', background: '#003300'
|
26
|
-
cursor!
|
27
|
-
end
|
28
|
-
|
29
|
-
Vedeu.interface 'command' do
|
30
|
-
colour foreground: '#ffff00', background: '#111111'
|
31
|
-
cursor!
|
32
|
-
end
|
33
|
-
|
34
|
-
Vedeu.keymap('_global_') do
|
35
|
-
key(:up, 'k') { Vedeu.trigger(:_cursor_up_) }
|
36
|
-
key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
|
37
|
-
key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
|
38
|
-
key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
|
39
|
-
|
40
|
-
key('q') { Vedeu.trigger(:_exit_) }
|
41
|
-
key(:escape) { Vedeu.trigger(:_mode_switch_) }
|
42
|
-
key(:shift_tab) { Vedeu.trigger(:_focus_prev_) }
|
43
|
-
key(:tab) { Vedeu.trigger(:_focus_next_) }
|
44
|
-
end
|
45
|
-
|
46
|
-
Vedeu.border('output') do
|
47
|
-
colour foreground: '#aadd00', background: '#000022'
|
48
|
-
hide_bottom!
|
49
|
-
end
|
50
|
-
Vedeu.border('status') do
|
51
|
-
colour foreground: '#aadd00', background: '#003300'
|
52
|
-
hide_top!
|
53
|
-
hide_bottom!
|
54
|
-
end
|
55
|
-
Vedeu.border('command') do
|
56
|
-
colour foreground: '#aadd00', background: '#111111'
|
57
|
-
hide_top!
|
58
|
-
end
|
59
|
-
|
60
|
-
Vedeu.geometry 'output' do
|
61
|
-
centred!
|
62
|
-
height 7
|
63
|
-
width 40
|
64
|
-
end
|
65
|
-
|
66
|
-
Vedeu.geometry('status') do
|
67
|
-
height 1
|
68
|
-
width 40
|
69
|
-
x use('output').left
|
70
|
-
y use('output').south(0)
|
71
|
-
end
|
72
|
-
|
73
|
-
Vedeu.geometry 'command' do
|
74
|
-
height 3
|
75
|
-
width 40
|
76
|
-
x use('status').left
|
77
|
-
y use('status').south(0)
|
78
|
-
end
|
79
|
-
|
80
|
-
Vedeu.focus_by_name 'command'
|
81
|
-
|
82
|
-
Vedeu.renders do
|
83
|
-
template_for('output', (File.dirname(__FILE__) + '/output.erb'), nil)
|
84
|
-
template_for('status', (File.dirname(__FILE__) + '/status.erb'), nil)
|
85
|
-
template_for('command', (File.dirname(__FILE__) + '/command.erb'), nil)
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.start(argv = ARGV)
|
89
|
-
Vedeu::Launcher.execute!(argv)
|
90
|
-
end
|
91
|
-
|
92
|
-
end # VedeuTypedCommands
|
93
|
-
|
94
|
-
VedeuTypedCommands.start(ARGV)
|