vedeu 0.4.13 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.travis.yml +2 -1
- data/Guardfile +6 -5
- data/README.md +3 -30
- data/Rakefile +5 -5
- data/bin/vedeu_drb_client +1 -1
- data/bin/vedeu_drb_server +91 -89
- data/bin/vedeu_test +4 -0
- data/config/rubocop_enabled.yml +5 -10
- data/examples/borders_app.rb +2 -1
- data/examples/colours_app.rb +13 -8
- data/examples/configuration_app.rb +3 -2
- data/examples/cursor_app.rb +16 -11
- data/examples/drb_app.rb +88 -89
- data/examples/focus_app.rb +31 -32
- data/examples/geometry_app.rb +2 -1
- data/examples/hello_world.rb +2 -1
- data/examples/lines_app.rb +2 -1
- data/examples/material_colours_app.rb +126 -0
- data/examples/typed_commands/typed_commands_app.rb +5 -1
- data/examples/view_templates_app/view_templates_app.rb +6 -3
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/api.rb +18 -10
- data/lib/vedeu/application.rb +0 -1
- data/lib/vedeu/bindings.rb +77 -16
- data/lib/vedeu/buffers/all.rb +2 -5
- data/lib/vedeu/buffers/buffer.rb +69 -25
- data/lib/vedeu/buffers/display_buffer.rb +3 -7
- data/lib/vedeu/configuration/all.rb +3 -6
- data/lib/vedeu/configuration/api.rb +28 -4
- data/lib/vedeu/configuration/cli.rb +9 -9
- data/lib/vedeu/configuration/configuration.rb +11 -7
- data/lib/vedeu/cursor/all.rb +3 -6
- data/lib/vedeu/cursor/cursor.rb +22 -14
- data/lib/vedeu/cursor/move.rb +32 -22
- data/lib/vedeu/cursor/refresh_cursor.rb +1 -1
- data/lib/vedeu/debug.rb +2 -1
- data/lib/vedeu/distributed/client.rb +1 -7
- data/lib/vedeu/distributed/server.rb +0 -4
- data/lib/vedeu/distributed/subprocess.rb +1 -1
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -1
- data/lib/vedeu/distributed/test_application.rb +3 -5
- data/lib/vedeu/distributed/uri.rb +2 -2
- data/lib/vedeu/dsl/all.rb +6 -6
- data/lib/vedeu/dsl/components/all.rb +0 -3
- data/lib/vedeu/dsl/components/border.rb +20 -12
- data/lib/vedeu/dsl/components/geometry.rb +68 -3
- data/lib/vedeu/dsl/components/keymap.rb +1 -2
- data/lib/vedeu/dsl/composition.rb +8 -1
- data/lib/vedeu/dsl/interface.rb +61 -11
- data/lib/vedeu/dsl/line.rb +12 -12
- data/lib/vedeu/dsl/shared/all.rb +4 -7
- data/lib/vedeu/dsl/shared/colour.rb +2 -2
- data/lib/vedeu/dsl/shared/text.rb +2 -35
- data/lib/vedeu/dsl/shared/use.rb +2 -2
- data/lib/vedeu/dsl/view.rb +4 -4
- data/lib/vedeu/events/all.rb +3 -5
- data/lib/vedeu/events/event.rb +5 -5
- data/lib/vedeu/geometry/all.rb +11 -16
- data/lib/vedeu/geometry/area.rb +2 -5
- data/lib/vedeu/geometry/canvas.rb +12 -16
- data/lib/vedeu/geometry/dimension.rb +20 -22
- data/lib/vedeu/geometry/geometry.rb +28 -30
- data/lib/vedeu/geometry/grid.rb +1 -1
- data/lib/vedeu/geometry/index_position.rb +7 -0
- data/lib/vedeu/geometry/null_geometry.rb +61 -0
- data/lib/vedeu/geometry/position.rb +0 -3
- data/lib/vedeu/geometry/position_index.rb +7 -0
- data/lib/vedeu/geometry/position_validator.rb +44 -33
- data/lib/vedeu/input/all.rb +5 -4
- data/lib/vedeu/input/keymap.rb +0 -1
- data/lib/vedeu/input/mapper.rb +1 -3
- data/lib/vedeu/launcher.rb +6 -7
- data/lib/vedeu/main_loop.rb +1 -2
- data/lib/vedeu/models/all.rb +1 -0
- data/lib/vedeu/models/cell.rb +5 -8
- data/lib/vedeu/models/char.rb +50 -15
- data/lib/vedeu/models/composition.rb +8 -1
- data/lib/vedeu/models/focus.rb +4 -4
- data/lib/vedeu/models/group.rb +3 -3
- data/lib/vedeu/models/interface.rb +62 -46
- data/lib/vedeu/models/line.rb +1 -1
- data/lib/vedeu/models/null.rb +48 -0
- data/lib/vedeu/models/stream.rb +5 -5
- data/lib/vedeu/output/all.rb +20 -30
- data/lib/vedeu/output/border.rb +93 -40
- data/lib/vedeu/output/clear.rb +100 -15
- data/lib/vedeu/output/colour.rb +56 -12
- data/lib/vedeu/output/compressor.rb +59 -0
- data/lib/vedeu/output/html_char.rb +4 -2
- data/lib/vedeu/output/null_border.rb +16 -4
- data/lib/vedeu/output/output.rb +13 -21
- data/lib/vedeu/output/presentation.rb +28 -23
- data/lib/vedeu/output/refresh.rb +2 -2
- data/lib/vedeu/output/renderers/all.rb +80 -3
- data/lib/vedeu/output/renderers/file_renderer.rb +38 -2
- data/lib/vedeu/output/renderers/html_renderer.rb +6 -4
- data/lib/vedeu/output/renderers/json_renderer.rb +52 -0
- data/lib/vedeu/output/renderers/null_renderer.rb +14 -0
- data/lib/vedeu/output/renderers/terminal_renderer.rb +2 -12
- data/lib/vedeu/output/style.rb +33 -3
- data/lib/vedeu/output/text.rb +98 -1
- data/lib/vedeu/output/translator.rb +30 -7
- data/lib/vedeu/output/viewport.rb +43 -79
- data/lib/vedeu/output/wordwrap.rb +4 -4
- data/lib/vedeu/repositories/all.rb +22 -179
- data/lib/vedeu/repositories/collection.rb +11 -13
- data/lib/vedeu/repositories/collections/all.rb +8 -0
- data/lib/vedeu/repositories/collections/chars.rb +9 -0
- data/lib/vedeu/repositories/collections/events.rb +9 -0
- data/lib/vedeu/repositories/collections/interfaces.rb +9 -0
- data/lib/vedeu/repositories/collections/keys.rb +9 -0
- data/lib/vedeu/repositories/collections/lines.rb +9 -0
- data/lib/vedeu/repositories/collections/streams.rb +9 -0
- data/lib/vedeu/repositories/model.rb +7 -2
- data/lib/vedeu/repositories/repositories/all.rb +14 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/borders.rb +38 -0
- data/lib/vedeu/repositories/repositories/buffers.rb +36 -0
- data/lib/vedeu/repositories/repositories/colours.rb +63 -0
- data/lib/vedeu/repositories/repositories/cursors.rb +29 -0
- data/lib/vedeu/repositories/repositories/events_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +14 -0
- data/lib/vedeu/repositories/repositories/geometries.rb +37 -0
- data/lib/vedeu/repositories/repositories/groups.rb +24 -0
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +24 -0
- data/lib/vedeu/repositories/repositories/keymaps.rb +24 -0
- data/lib/vedeu/repositories/repositories/menus.rb +24 -0
- data/lib/vedeu/repositories/repository.rb +29 -47
- data/lib/vedeu/storage/all.rb +6 -0
- data/lib/vedeu/storage/associative_store.rb +47 -0
- data/lib/vedeu/storage/conveyor_store.rb +69 -0
- data/lib/vedeu/storage/fifo_store.rb +37 -0
- data/lib/vedeu/storage/store.rb +58 -0
- data/lib/vedeu/support/all.rb +5 -10
- data/lib/vedeu/support/common.rb +0 -8
- data/lib/vedeu/support/log.rb +13 -24
- data/lib/vedeu/support/template.rb +4 -1
- data/lib/vedeu/support/terminal.rb +10 -10
- data/lib/vedeu/support/trace.rb +15 -88
- data/lib/vedeu/support/visibility.rb +73 -0
- data/lib/vedeu.rb +37 -0
- data/test/lib/vedeu/api_test.rb +7 -3
- data/test/lib/vedeu/application_test.rb +9 -3
- data/test/lib/vedeu/bindings_test.rb +21 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +110 -134
- data/test/lib/vedeu/buffers/display_buffer_test.rb +8 -0
- data/test/lib/vedeu/configuration/api_test.rb +5 -1
- data/test/lib/vedeu/configuration/configuration_test.rb +4 -6
- data/test/lib/vedeu/cursor/cursor_test.rb +25 -17
- data/test/lib/vedeu/cursor/move_test.rb +7 -7
- data/test/lib/vedeu/distributed/client_test.rb +1 -1
- data/test/lib/vedeu/distributed/subprocess_test.rb +3 -1
- data/test/lib/vedeu/distributed/uri_test.rb +5 -5
- data/test/lib/vedeu/dsl/components/geometry_test.rb +43 -0
- data/test/lib/vedeu/dsl/components/keymap_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +6 -5
- data/test/lib/vedeu/dsl/interface_test.rb +81 -16
- data/test/lib/vedeu/dsl/shared/colour_test.rb +4 -4
- data/test/lib/vedeu/dsl/shared/text_test.rb +87 -9
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/events/event_test.rb +3 -1
- data/test/lib/vedeu/events/trigger_test.rb +8 -4
- data/test/lib/vedeu/geometry/dimension_test.rb +1 -1
- data/test/lib/vedeu/geometry/geometry_test.rb +5 -3
- data/test/lib/vedeu/geometry/index_position_test.rb +30 -7
- data/test/lib/vedeu/geometry/null_geometry_test.rb +57 -0
- data/test/lib/vedeu/geometry/position_index_test.rb +14 -0
- data/test/lib/vedeu/geometry/position_validator_test.rb +17 -3
- data/test/lib/vedeu/input/keymap_test.rb +3 -1
- data/test/lib/vedeu/input/mapper_test.rb +8 -4
- data/test/lib/vedeu/launcher_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +10 -8
- data/test/lib/vedeu/models/char_test.rb +52 -28
- data/test/lib/vedeu/models/composition_test.rb +26 -4
- data/test/lib/vedeu/models/group_test.rb +11 -5
- data/test/lib/vedeu/models/interface_test.rb +32 -19
- data/test/lib/vedeu/models/line_test.rb +21 -25
- data/test/lib/vedeu/models/menu_test.rb +10 -6
- data/test/lib/vedeu/models/null_test.rb +66 -0
- data/test/lib/vedeu/models/stream_test.rb +13 -10
- data/test/lib/vedeu/output/border_test.rb +29 -8
- data/test/lib/vedeu/output/clear_test.rb +23 -4
- data/test/lib/vedeu/output/colour_test.rb +20 -4
- data/test/lib/vedeu/output/compressor_test.rb +43 -0
- data/test/lib/vedeu/output/html_char_test.rb +29 -17
- data/test/lib/vedeu/output/null_border_test.rb +2 -1
- data/test/lib/vedeu/output/output_test.rb +20 -30
- data/test/lib/vedeu/output/presentation_test.rb +39 -16
- data/test/lib/vedeu/output/refresh_test.rb +14 -10
- data/test/lib/vedeu/output/renderers/all_test.rb +96 -0
- data/test/lib/vedeu/output/renderers/file_renderer_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/html_renderer_test.rb +13 -9
- data/test/lib/vedeu/output/renderers/json_renderer_test.rb +52 -0
- data/test/lib/vedeu/output/renderers/null_renderer_test.rb +19 -0
- data/test/lib/vedeu/output/style_test.rb +41 -1
- data/test/lib/vedeu/output/text_test.rb +61 -10
- data/test/lib/vedeu/output/translator_test.rb +14 -0
- data/test/lib/vedeu/output/viewport_test.rb +22 -3
- data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -3
- data/test/lib/vedeu/output/wordwrap_test.rb +58 -45
- data/test/lib/vedeu/repositories/collections/chars_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/events_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/interfaces_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/keys_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/lines_test.rb +16 -0
- data/test/lib/vedeu/repositories/collections/streams_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/background_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/borders_test.rb +51 -0
- data/test/lib/vedeu/repositories/repositories/buffers_test.rb +52 -0
- data/test/lib/vedeu/repositories/repositories/colours_test.rb +16 -0
- data/test/lib/vedeu/repositories/repositories/cursors_test.rb +39 -0
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/foreground_colours_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/geometries_test.rb +42 -0
- data/test/lib/vedeu/repositories/repositories/groups_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repositories_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +17 -0
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +17 -0
- data/test/lib/vedeu/repositories/repository_test.rb +16 -36
- data/test/lib/vedeu/storage/associative_store_test.rb +69 -0
- data/test/lib/vedeu/storage/conveyor_store_test.rb +135 -0
- data/test/lib/vedeu/storage/fifo_store_test.rb +47 -0
- data/test/lib/vedeu/storage/store_test.rb +123 -0
- data/test/lib/vedeu/support/common_test.rb +0 -9
- data/test/lib/vedeu/support/terminal_test.rb +78 -55
- data/test/lib/vedeu/support/visibility_test.rb +80 -0
- data/test/test_helper.rb +13 -11
- data/vedeu.gemspec +4 -3
- metadata +92 -32
- data/lib/vedeu/cursor/toggle.rb +0 -55
- data/lib/vedeu/exceptions.rb +0 -37
- data/lib/vedeu/geometry/centre.rb +0 -85
- data/lib/vedeu/geometry/content.rb +0 -70
- data/lib/vedeu/geometry/limit.rb +0 -58
- data/lib/vedeu/output/compositor.rb +0 -62
- data/lib/vedeu/repositories/collections.rb +0 -41
- data/lib/vedeu/support/coercions.rb +0 -60
- data/lib/vedeu/support/sentence.rb +0 -91
- data/lib/vedeu/support/visible.rb +0 -90
- data/test/lib/vedeu/cursor/toggle_test.rb +0 -63
- data/test/lib/vedeu/geometry/centre_test.rb +0 -58
- data/test/lib/vedeu/geometry/content_test.rb +0 -98
- data/test/lib/vedeu/geometry/limit_test.rb +0 -30
- data/test/lib/vedeu/output/compositor_test.rb +0 -48
- data/test/lib/vedeu/repositories/all_test.rb +0 -135
- data/test/lib/vedeu/repositories/collections_test.rb +0 -71
- data/test/lib/vedeu/support/coercions_test.rb +0 -84
- data/test/lib/vedeu/support/sentence_test.rb +0 -56
- data/test/lib/vedeu/support/visible_test.rb +0 -161
data/examples/drb_app.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
lib_dir =
|
3
|
+
lib_dir = '/Users/gavinlaking/Source/vedeu/lib/vedeu/distributed/../../../lib'
|
4
4
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
5
|
|
6
6
|
require 'vedeu'
|
@@ -8,108 +8,107 @@ require 'vedeu'
|
|
8
8
|
# An example application to demonstrate the DRb server.
|
9
9
|
#
|
10
10
|
class VedeuTestApplication
|
11
|
-
# include Vedeu
|
12
|
-
|
13
|
-
Vedeu.configure do
|
14
|
-
colour_mode 16_777_216
|
15
|
-
log '/tmp/vedeu_test_helper.log'
|
16
|
-
debug!
|
17
|
-
drb!
|
18
|
-
drb_host 'localhost'
|
19
|
-
drb_port 21420
|
20
|
-
drb_width 80
|
21
|
-
drb_height 25
|
22
|
-
|
23
|
-
# cooked!
|
24
|
-
# raw!
|
25
|
-
|
26
|
-
# run_once!
|
27
|
-
|
28
|
-
# interactive!
|
29
|
-
# standalone!
|
30
|
-
|
31
|
-
# trace!
|
32
|
-
|
33
|
-
# System keys can be redefined
|
34
|
-
# exit_key 'q'
|
35
|
-
# focus_next_key :tab
|
36
|
-
# focus_prev_key :shift_tab
|
37
|
-
# mode_switch_key :escape
|
38
|
-
|
39
|
-
# Not used yet
|
40
|
-
# stdin File.open("/dev/tty", "r")
|
41
|
-
# stdout File.open("/dev/tty", "w")
|
42
|
-
# stderr File.open("/tmp/vedeu_error.log", "w+")
|
43
|
-
end
|
44
11
|
|
45
|
-
Vedeu.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
show_bottom!
|
54
|
-
show_left!
|
55
|
-
show_right!
|
56
|
-
show_top!
|
57
|
-
|
58
|
-
# Define characters used to draw border
|
59
|
-
bottom_right '+'
|
60
|
-
bottom_left '+'
|
61
|
-
horizontal '-'
|
62
|
-
top_right '+'
|
63
|
-
top_left '+'
|
64
|
-
vertical '|'
|
65
|
-
end
|
12
|
+
Vedeu.configure do
|
13
|
+
log '/tmp/vedeu_test_helper.log'
|
14
|
+
debug!
|
15
|
+
drb!
|
16
|
+
drb_host 'localhost'
|
17
|
+
drb_port 21_420
|
18
|
+
drb_width 80
|
19
|
+
drb_height 25
|
66
20
|
|
67
|
-
|
68
|
-
|
69
|
-
height 6
|
70
|
-
width 26
|
71
|
-
x 4
|
72
|
-
y 4
|
73
|
-
end
|
21
|
+
# cooked!
|
22
|
+
# raw!
|
74
23
|
|
75
|
-
|
76
|
-
colour foreground: '#ff0000', background: '#000000'
|
77
|
-
cursor!
|
78
|
-
end
|
24
|
+
# run_once!
|
79
25
|
|
80
|
-
|
81
|
-
|
82
|
-
key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
|
83
|
-
key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
|
84
|
-
key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
|
85
|
-
end
|
26
|
+
# interactive!
|
27
|
+
# standalone!
|
86
28
|
|
87
|
-
|
88
|
-
|
89
|
-
|
29
|
+
# trace!
|
30
|
+
|
31
|
+
# System keys can be redefined
|
32
|
+
# exit_key 'q'
|
33
|
+
# focus_next_key :tab
|
34
|
+
# focus_prev_key :shift_tab
|
35
|
+
# mode_switch_key :escape
|
36
|
+
|
37
|
+
# Not used yet
|
38
|
+
# stdin File.open("/dev/tty", "r")
|
39
|
+
# stdout File.open("/dev/tty", "w")
|
40
|
+
# stderr File.open("/tmp/vedeu_error.log", "w+")
|
41
|
+
end
|
42
|
+
|
43
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
44
|
+
|
45
|
+
Vedeu.border 'test_interface' do
|
46
|
+
# Define colour and style of border
|
47
|
+
colour foreground: '#ffff00', background: '#0000ff'
|
48
|
+
style 'normal'
|
49
|
+
|
50
|
+
# Define visibility of border
|
51
|
+
show_bottom!
|
52
|
+
show_left!
|
53
|
+
show_right!
|
54
|
+
show_top!
|
55
|
+
|
56
|
+
# Define characters used to draw border
|
57
|
+
bottom_right '+'
|
58
|
+
bottom_left '+'
|
59
|
+
horizontal '-'
|
60
|
+
top_right '+'
|
61
|
+
top_left '+'
|
62
|
+
vertical '|'
|
63
|
+
end
|
90
64
|
|
91
|
-
Vedeu.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
65
|
+
Vedeu.geometry 'test_interface' do
|
66
|
+
# centred!
|
67
|
+
height 6
|
68
|
+
width 26
|
69
|
+
x 4
|
70
|
+
y 4
|
71
|
+
end
|
72
|
+
|
73
|
+
Vedeu.interface 'test_interface' do
|
74
|
+
colour foreground: '#ff0000', background: '#000000'
|
75
|
+
cursor!
|
76
|
+
end
|
77
|
+
|
78
|
+
Vedeu.keymap 'test_interface' do
|
79
|
+
key(:up, 'k') { Vedeu.trigger(:_cursor_up_) }
|
80
|
+
key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
|
81
|
+
key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
|
82
|
+
key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
|
83
|
+
end
|
84
|
+
|
85
|
+
Vedeu.menu 'test_interface' do
|
86
|
+
# ...
|
87
|
+
end
|
88
|
+
|
89
|
+
Vedeu.renders do
|
90
|
+
view 'test_interface' do
|
91
|
+
lines do
|
92
|
+
line 'a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1'
|
93
|
+
line 'a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p2q2r2s2t2u2v2w2x2y2z2'
|
94
|
+
line 'a3b3c3d3e3f3g3h3i3j3k3l3m3n3o3p3q3r3s3t3u3v3w3x3y3z3'
|
95
|
+
line 'a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4'
|
96
|
+
line 'a5b5c5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5'
|
97
|
+
line 'a6b6c6d6e6f6g6h6i6j6k6l6m6n6o6p6q6r6s6t6u6v6w6x6y6z6'
|
98
|
+
line 'a7b7c7d7e7f7g7h7i7j7k7l7m7n7o7p7q7r7s7t7u7v7w7x7y7z7'
|
99
|
+
line 'a8b8c8d8e8f8g8h8i8j8k8l8m8n8o8p8q8r8s8t8u8v8w8x8y8z8'
|
100
|
+
end
|
102
101
|
end
|
103
102
|
end
|
104
|
-
end
|
105
103
|
|
106
|
-
def self.start(argv
|
107
|
-
stdin
|
104
|
+
def self.start(argv = ARGV,
|
105
|
+
stdin = STDIN,
|
108
106
|
stdout = STDOUT,
|
109
107
|
stderr = STDERR,
|
110
108
|
kernel = Kernel)
|
111
109
|
Vedeu::Launcher.execute!(argv, stdin, stdout, stderr, kernel)
|
112
110
|
end
|
111
|
+
|
113
112
|
end
|
114
113
|
|
115
114
|
VedeuTestApplication.start(ARGV)
|
data/examples/focus_app.rb
CHANGED
@@ -14,102 +14,100 @@ require 'vedeu'
|
|
14
14
|
#
|
15
15
|
# Use 'space' to change focus, 'q' to exit.
|
16
16
|
class VedeuFocusApp
|
17
|
-
include Vedeu
|
18
17
|
|
19
|
-
configure do
|
20
|
-
colour_mode 16_777_216
|
18
|
+
Vedeu.configure do
|
21
19
|
debug!
|
22
20
|
log '/tmp/vedeu_focus_app.log'
|
23
21
|
end
|
24
22
|
|
25
|
-
bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
23
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
26
24
|
|
27
|
-
update =
|
25
|
+
update = proc do
|
28
26
|
Vedeu.focus_next
|
29
27
|
|
30
28
|
Vedeu.renders { view('status') { lines { line(Vedeu.focus) } } }
|
31
29
|
end
|
32
30
|
|
33
|
-
interface 'aluminium' do
|
31
|
+
Vedeu.interface 'aluminium' do
|
34
32
|
colour foreground: '#ffffff', background: '#330000'
|
35
33
|
cursor true
|
36
34
|
geometry do
|
37
|
-
height
|
38
|
-
width
|
35
|
+
height 3
|
36
|
+
width 10
|
39
37
|
x 3
|
40
38
|
y 3
|
41
39
|
end
|
42
40
|
keymap { key(' ') { update.call } }
|
43
41
|
end
|
44
42
|
|
45
|
-
interface 'boron' do
|
46
|
-
colour
|
47
|
-
cursor
|
43
|
+
Vedeu.interface 'boron' do
|
44
|
+
colour foreground: '#ffffff', background: '#003300'
|
45
|
+
cursor true
|
48
46
|
geometry do
|
49
|
-
height
|
50
|
-
width
|
51
|
-
x
|
47
|
+
height 3
|
48
|
+
width 10
|
49
|
+
x 15
|
52
50
|
y 3
|
53
51
|
end
|
54
52
|
keymap { key(' ') { update.call } }
|
55
53
|
end
|
56
54
|
|
57
|
-
interface 'copper' do
|
55
|
+
Vedeu.interface 'copper' do
|
58
56
|
colour foreground: '#ffffff', background: '#000033'
|
59
57
|
cursor true
|
60
58
|
focus!
|
61
59
|
geometry do
|
62
|
-
height
|
63
|
-
width
|
60
|
+
height 3
|
61
|
+
width 10
|
64
62
|
x 3
|
65
|
-
y
|
63
|
+
y 8
|
66
64
|
end
|
67
65
|
keymap { key(' ') { update.call } }
|
68
66
|
end
|
69
67
|
|
70
|
-
interface 'dubnium' do
|
68
|
+
Vedeu.interface 'dubnium' do
|
71
69
|
colour foreground: '#ffffff', background: '#333300'
|
72
70
|
cursor true
|
73
71
|
geometry do
|
74
|
-
height
|
75
|
-
width
|
76
|
-
x
|
77
|
-
y
|
72
|
+
height 3
|
73
|
+
width 10
|
74
|
+
x 15
|
75
|
+
y 8
|
78
76
|
end
|
79
77
|
keymap { key(' ') { update.call } }
|
80
78
|
end
|
81
79
|
|
82
|
-
interface 'status' do
|
80
|
+
Vedeu.interface 'status' do
|
83
81
|
colour foreground: '#ffffff', background: '#000000'
|
84
82
|
cursor false
|
85
83
|
geometry do
|
86
|
-
height
|
84
|
+
height 3
|
87
85
|
width 10
|
88
|
-
x
|
89
|
-
y
|
86
|
+
x 3
|
87
|
+
y 13
|
90
88
|
end
|
91
89
|
keymap { key(' ') { update.call } }
|
92
90
|
end
|
93
91
|
|
94
|
-
renders do
|
92
|
+
Vedeu.renders do
|
95
93
|
view('aluminium') do
|
96
94
|
lines do
|
97
|
-
line '
|
95
|
+
line 'Aluminium'
|
98
96
|
end
|
99
97
|
end
|
100
98
|
view('boron') do
|
101
99
|
lines do
|
102
|
-
line '
|
100
|
+
line 'Boron'
|
103
101
|
end
|
104
102
|
end
|
105
103
|
view('copper') do
|
106
104
|
lines do
|
107
|
-
line '
|
105
|
+
line 'Copper'
|
108
106
|
end
|
109
107
|
end
|
110
108
|
view('dubnium') do
|
111
109
|
lines do
|
112
|
-
line '
|
110
|
+
line 'Dubnium'
|
113
111
|
end
|
114
112
|
end
|
115
113
|
view('status') do
|
@@ -122,6 +120,7 @@ class VedeuFocusApp
|
|
122
120
|
def self.start(argv = ARGV)
|
123
121
|
Vedeu::Launcher.execute!(argv)
|
124
122
|
end
|
123
|
+
|
125
124
|
end
|
126
125
|
|
127
126
|
VedeuFocusApp.start(ARGV)
|
data/examples/geometry_app.rb
CHANGED
@@ -8,10 +8,10 @@ require 'vedeu'
|
|
8
8
|
# An example application to demonstrate geometry.
|
9
9
|
#
|
10
10
|
class VedeuGeometryApp
|
11
|
+
|
11
12
|
include Vedeu
|
12
13
|
|
13
14
|
configure do
|
14
|
-
colour_mode 16_777_216
|
15
15
|
debug!
|
16
16
|
log '/tmp/vedeu_geometry_app.log'
|
17
17
|
end
|
@@ -135,6 +135,7 @@ class VedeuGeometryApp
|
|
135
135
|
def self.start(argv = ARGV)
|
136
136
|
Vedeu::Launcher.execute!(argv)
|
137
137
|
end
|
138
|
+
|
138
139
|
end
|
139
140
|
|
140
141
|
VedeuGeometryApp.start(ARGV)
|
data/examples/hello_world.rb
CHANGED
@@ -11,10 +11,10 @@ require 'vedeu'
|
|
11
11
|
# An example application to demonstrate 'Hello World'.
|
12
12
|
#
|
13
13
|
class HelloWorldApp
|
14
|
+
|
14
15
|
include Vedeu
|
15
16
|
|
16
17
|
configure do
|
17
|
-
colour_mode 16_777_216
|
18
18
|
debug!
|
19
19
|
log '/tmp/vedeu_hello_world.log'
|
20
20
|
end
|
@@ -44,6 +44,7 @@ class HelloWorldApp
|
|
44
44
|
def self.start(argv = ARGV)
|
45
45
|
Vedeu::Launcher.execute!(argv)
|
46
46
|
end
|
47
|
+
|
47
48
|
end
|
48
49
|
|
49
50
|
HelloWorldApp.start(ARGV)
|
data/examples/lines_app.rb
CHANGED
@@ -8,10 +8,10 @@ require 'vedeu'
|
|
8
8
|
# An example application to demonstrate interface lines.
|
9
9
|
#
|
10
10
|
class VedeuLinesApp
|
11
|
+
|
11
12
|
include Vedeu
|
12
13
|
|
13
14
|
configure do
|
14
|
-
colour_mode 16_777_216
|
15
15
|
debug!
|
16
16
|
log '/tmp/vedeu_lines_app.log'
|
17
17
|
end
|
@@ -68,6 +68,7 @@ class VedeuLinesApp
|
|
68
68
|
def self.start(argv = ARGV)
|
69
69
|
Vedeu::Launcher.execute!(argv)
|
70
70
|
end
|
71
|
+
|
71
72
|
end
|
72
73
|
|
73
74
|
VedeuLinesApp.start(ARGV)
|
@@ -0,0 +1,126 @@
|
|
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
|
+
# An example application to demonstrate colours.
|
9
|
+
#
|
10
|
+
class VedeuMaterialColoursApp
|
11
|
+
|
12
|
+
include Vedeu
|
13
|
+
|
14
|
+
configure do
|
15
|
+
# debug!
|
16
|
+
log '/tmp/vedeu_material_colours_app.log'
|
17
|
+
renderers Vedeu::FileRenderer
|
18
|
+
end
|
19
|
+
|
20
|
+
# bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
21
|
+
|
22
|
+
interface 'main_interface' do
|
23
|
+
border 'main_interface' do
|
24
|
+
colour foreground: '#ffffff', background: '#000000'
|
25
|
+
title 'Rainbow!'
|
26
|
+
end
|
27
|
+
colour foreground: '#ffffff', background: '#000000'
|
28
|
+
cursor!
|
29
|
+
geometry 'main_interface' do
|
30
|
+
x 5
|
31
|
+
xn 25
|
32
|
+
y 3
|
33
|
+
yn 13
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
interface 'other_interface' do
|
38
|
+
border 'other_interface' do
|
39
|
+
colour foreground: '#ffffff', background: '#000000'
|
40
|
+
title 'Wow!'
|
41
|
+
end
|
42
|
+
colour foreground: '#ffffff', background: '#000000'
|
43
|
+
cursor!
|
44
|
+
geometry 'other_interface' do
|
45
|
+
x 27
|
46
|
+
xn 47
|
47
|
+
y 3
|
48
|
+
yn 13
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
keymap('_global_') do
|
53
|
+
key(:up, 'k') { Vedeu.trigger(:_cursor_up_) }
|
54
|
+
key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
|
55
|
+
key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
|
56
|
+
key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
|
57
|
+
key('t') do
|
58
|
+
Vedeu.trigger(:_toggle_interface_, 'main_interface')
|
59
|
+
Vedeu.trigger(:_toggle_interface_, 'other_interface')
|
60
|
+
end
|
61
|
+
key('1') { Vedeu.trigger(:_hide_interface_, 'main_interface') }
|
62
|
+
key('2') { Vedeu.trigger(:_show_interface_, 'main_interface') }
|
63
|
+
key('3') { Vedeu.trigger(:_hide_interface_, 'other_interface') }
|
64
|
+
key('4') { Vedeu.trigger(:_show_interface_, 'other_interface') }
|
65
|
+
end
|
66
|
+
|
67
|
+
renders do
|
68
|
+
view 'main_interface' do
|
69
|
+
line { centre 'Red', width: 20, background: '#f44336' }
|
70
|
+
line { centre 'Pink', width: 20, background: '#e91e63' }
|
71
|
+
line { centre 'Purple', width: 20, background: '#9c27b0' }
|
72
|
+
line { centre 'Deep Purple', width: 20, background: '#673ab7' }
|
73
|
+
line { centre 'Indigo', width: 20, background: '#3f51b5' }
|
74
|
+
line { centre 'Blue', width: 20, background: '#2196f3' }
|
75
|
+
line { centre 'Light Blue', width: 20, background: '#03a9f4' }
|
76
|
+
line { centre 'Cyan', width: 20, background: '#00bcd4' }
|
77
|
+
line { centre 'Teal', width: 20, background: '#009688' }
|
78
|
+
line { centre 'Green', width: 20, background: '#4caf50' }
|
79
|
+
line { centre 'Light Green', width: 20, background: '#8bc34a' }
|
80
|
+
line { centre 'Lime', width: 20, background: '#cddc39' }
|
81
|
+
line { centre 'Yellow', width: 20, background: '#ffeb3b' }
|
82
|
+
line { centre 'Amber', width: 20, background: '#ffc107' }
|
83
|
+
line { centre 'Orange', width: 20, background: '#ff9800' }
|
84
|
+
line { centre 'Deep Orange', width: 20, background: '#ff5722' }
|
85
|
+
line { centre 'Brown', width: 20, background: '#795548' }
|
86
|
+
line { centre 'Grey', width: 20, background: '#9e9e9e' }
|
87
|
+
line { centre 'Blue Grey', width: 20, background: '#607d8b' }
|
88
|
+
end
|
89
|
+
|
90
|
+
view 'other_interface' do
|
91
|
+
line { centre 'Blue Grey', width: 20, background: '#607d8b' }
|
92
|
+
line { centre 'Grey', width: 20, background: '#9e9e9e' }
|
93
|
+
line { centre 'Brown', width: 20, background: '#795548' }
|
94
|
+
line { centre 'Deep Orange', width: 20, background: '#ff5722' }
|
95
|
+
line { centre 'Orange', width: 20, background: '#ff9800' }
|
96
|
+
line { centre 'Amber', width: 20, background: '#ffc107' }
|
97
|
+
line { centre 'Yellow', width: 20, background: '#ffeb3b' }
|
98
|
+
line { centre 'Lime', width: 20, background: '#cddc39' }
|
99
|
+
line { centre 'Light Green', width: 20, background: '#8bc34a' }
|
100
|
+
line { centre 'Green', width: 20, background: '#4caf50' }
|
101
|
+
line { centre 'Teal', width: 20, background: '#009688' }
|
102
|
+
line { centre 'Cyan', width: 20, background: '#00bcd4' }
|
103
|
+
line { centre 'Light Blue', width: 20, background: '#03a9f4' }
|
104
|
+
line { centre 'Blue', width: 20, background: '#2196f3' }
|
105
|
+
line { centre 'Indigo', width: 20, background: '#3f51b5' }
|
106
|
+
line { centre 'Deep Purple', width: 20, background: '#673ab7' }
|
107
|
+
line { centre 'Purple', width: 20, background: '#9c27b0' }
|
108
|
+
line { centre 'Pink', width: 20, background: '#e91e63' }
|
109
|
+
line { centre 'Red', width: 20, background: '#f44336' }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
focus_by_name 'main_interface'
|
114
|
+
|
115
|
+
def self.start(argv = ARGV)
|
116
|
+
Vedeu::Launcher.execute!(argv)
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
VedeuMaterialColoursApp.start(ARGV)
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
@@ -5,11 +5,14 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
5
5
|
|
6
6
|
require 'vedeu'
|
7
7
|
|
8
|
+
# A simple example application to test the input of commands. This will test
|
9
|
+
# the functionality of 'cooked' mode.
|
10
|
+
#
|
8
11
|
class VedeuTypedCommands
|
12
|
+
|
9
13
|
include Vedeu
|
10
14
|
|
11
15
|
configure do
|
12
|
-
colour_mode 16_777_216
|
13
16
|
debug!
|
14
17
|
log '/tmp/vedeu_typed_commands_app.log'
|
15
18
|
end
|
@@ -83,6 +86,7 @@ class VedeuTypedCommands
|
|
83
86
|
def self.start(argv = ARGV)
|
84
87
|
Vedeu::Launcher.execute!(argv)
|
85
88
|
end
|
89
|
+
|
86
90
|
end
|
87
91
|
|
88
92
|
VedeuTypedCommands.start(ARGV)
|
@@ -8,10 +8,10 @@ require 'vedeu'
|
|
8
8
|
# An example application to demonstrate templates.
|
9
9
|
#
|
10
10
|
class VedeuViewTemplateApp
|
11
|
+
|
11
12
|
include Vedeu
|
12
13
|
|
13
14
|
configure do
|
14
|
-
colour_mode 16_777_216
|
15
15
|
debug!
|
16
16
|
log '/tmp/vedeu_view_templates_app.log'
|
17
17
|
end
|
@@ -72,13 +72,16 @@ class VedeuViewTemplateApp
|
|
72
72
|
|
73
73
|
renders do
|
74
74
|
template_for('default', (File.dirname(__FILE__) + '/template.erb'), nil)
|
75
|
-
template_for('prune', (File.dirname(__FILE__) + '/template.erb'), nil,
|
76
|
-
|
75
|
+
template_for('prune', (File.dirname(__FILE__) + '/template.erb'), nil,
|
76
|
+
mode: :prune, width: 22)
|
77
|
+
template_for('wrap', (File.dirname(__FILE__) + '/template.erb'), nil,
|
78
|
+
mode: :wrap, width: 25)
|
77
79
|
end
|
78
80
|
|
79
81
|
def self.start(argv = ARGV)
|
80
82
|
Vedeu::Launcher.execute!(argv)
|
81
83
|
end
|
84
|
+
|
82
85
|
end
|
83
86
|
|
84
87
|
VedeuViewTemplateApp.start(ARGV)
|
data/lib/vedeu/all.rb
CHANGED
data/lib/vedeu/api.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'vedeu/support/common'
|
2
2
|
require 'vedeu/support/terminal'
|
3
|
+
require 'vedeu/output/renderers/all'
|
3
4
|
require 'vedeu/events/all'
|
4
5
|
require 'vedeu/models/all'
|
5
6
|
require 'vedeu/input/all'
|
@@ -95,7 +96,7 @@ module Vedeu
|
|
95
96
|
# @!method unbind
|
96
97
|
# @see Vedeu::Event.unbind
|
97
98
|
def_delegators Vedeu::Event, :bind,
|
98
|
-
|
99
|
+
:unbind
|
99
100
|
|
100
101
|
# @!method trigger
|
101
102
|
# @see Vedeu::Trigger.trigger
|
@@ -106,7 +107,7 @@ module Vedeu
|
|
106
107
|
# @!method configuration
|
107
108
|
# @see Vedeu::Configuration.configuration
|
108
109
|
def_delegators Vedeu::Configuration, :configure,
|
109
|
-
|
110
|
+
:configuration
|
110
111
|
|
111
112
|
# @!method border
|
112
113
|
# @see Vedeu::DSL::Border.border
|
@@ -135,8 +136,8 @@ module Vedeu
|
|
135
136
|
# @!method views
|
136
137
|
# @see Vedeu::DSL::View.views
|
137
138
|
def_delegators Vedeu::DSL::View, :interface,
|
138
|
-
|
139
|
-
|
139
|
+
:renders,
|
140
|
+
:views
|
140
141
|
|
141
142
|
# @!method focus
|
142
143
|
# @see Vedeu::Focus#focus
|
@@ -149,10 +150,10 @@ module Vedeu
|
|
149
150
|
# @!method focus_previous
|
150
151
|
# @see Vedeu::Focus#focus_previous
|
151
152
|
def_delegators Vedeu::Focus, :focus,
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
153
|
+
:focus_by_name,
|
154
|
+
:focussed?,
|
155
|
+
:focus_next,
|
156
|
+
:focus_previous
|
156
157
|
|
157
158
|
# @!method log
|
158
159
|
# @see Vedeu::Log.log
|
@@ -169,8 +170,15 @@ module Vedeu
|
|
169
170
|
# @!method resize
|
170
171
|
# @see Vedeu::Terminal#resize
|
171
172
|
def_delegators Vedeu::Terminal, :height,
|
172
|
-
|
173
|
-
|
173
|
+
:width,
|
174
|
+
:resize
|
175
|
+
|
176
|
+
# @!method renderer
|
177
|
+
# @see Vedeu::Renderers#renderer
|
178
|
+
# @!method renderers
|
179
|
+
# @see Vedeu::Renderers#renderers
|
180
|
+
def_delegators Vedeu::Renderers, :renderer,
|
181
|
+
:renderers
|
174
182
|
|
175
183
|
end # API
|
176
184
|
|