vedeu 0.4.24 → 0.4.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/material_colours_app.rb +27 -11
- data/lib/vedeu/bindings.rb +22 -64
- data/lib/vedeu/cursor/cursor.rb +13 -9
- data/lib/vedeu/cursor/move.rb +68 -38
- data/lib/vedeu/debug.rb +5 -5
- data/lib/vedeu/distributed/uri.rb +1 -0
- data/lib/vedeu/geometry/geometry.rb +0 -22
- data/lib/vedeu/geometry/position.rb +1 -0
- data/lib/vedeu/models/all.rb +1 -0
- data/lib/vedeu/models/char.rb +7 -1
- data/lib/vedeu/models/escape_char.rb +49 -0
- data/lib/vedeu/output/border.rb +9 -8
- data/lib/vedeu/output/clear.rb +3 -1
- data/lib/vedeu/output/colour.rb +1 -0
- data/lib/vedeu/output/compressor.rb +6 -12
- data/lib/vedeu/output/presentation.rb +13 -6
- data/lib/vedeu/output/style.rb +1 -0
- data/lib/vedeu/output/translator.rb +1 -0
- data/lib/vedeu/output/viewport.rb +2 -1
- data/lib/vedeu/repositories/collection.rb +1 -0
- data/lib/vedeu/support/terminal.rb +6 -12
- data/test/lib/vedeu/cursor/cursor_test.rb +4 -4
- data/test/lib/vedeu/geometry/geometry_test.rb +0 -9
- data/test/lib/vedeu/models/escape_char_test.rb +56 -0
- data/test/lib/vedeu/output/compressor_test.rb +2 -8
- data/vedeu.gemspec +1 -1
- metadata +5 -5
- data/examples/cursor_app.rb +0 -126
- data/examples/lines_app.rb +0 -71
- data/examples/maximise_unmaximise_app.rb +0 -120
@@ -20,12 +20,6 @@ module Vedeu
|
|
20
20
|
|
21
21
|
it { subject.must_be_instance_of(String) }
|
22
22
|
|
23
|
-
context 'when the output is not a collection' do
|
24
|
-
let(:output) { 'abcd' }
|
25
|
-
|
26
|
-
it { subject.must_equal('abcd') }
|
27
|
-
end
|
28
|
-
|
29
23
|
context 'when the output is all Vedeu::Char elements' do
|
30
24
|
let(:output) {
|
31
25
|
[
|
@@ -57,12 +51,12 @@ module Vedeu
|
|
57
51
|
let(:output) {
|
58
52
|
[
|
59
53
|
Vedeu::Char.new(value: 'N'),
|
60
|
-
|
54
|
+
Vedeu::EscapeChar.new("\e[?25l"),
|
61
55
|
Vedeu::Char.new(value: 't'),
|
62
56
|
]
|
63
57
|
}
|
64
58
|
it 'converts the non-Vedeu::Char elements into String elements' do
|
65
|
-
subject.must_equal(
|
59
|
+
subject.must_equal("N\e[?25lt")
|
66
60
|
end
|
67
61
|
end
|
68
62
|
end
|
data/vedeu.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'vedeu'
|
7
|
-
spec.version = '0.4.
|
7
|
+
spec.version = '0.4.25'
|
8
8
|
spec.authors = ['Gavin Laking']
|
9
9
|
spec.email = ['gavinlaking@gmail.com']
|
10
10
|
spec.summary = 'A terminal case of wonderland.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vedeu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -272,14 +272,11 @@ files:
|
|
272
272
|
- examples/colour_support.sh
|
273
273
|
- examples/colours_app.rb
|
274
274
|
- examples/configuration_app.rb
|
275
|
-
- examples/cursor_app.rb
|
276
275
|
- examples/drb_app.rb
|
277
276
|
- examples/focus_app.rb
|
278
277
|
- examples/geometry_app.rb
|
279
278
|
- examples/hello_world.rb
|
280
|
-
- examples/lines_app.rb
|
281
279
|
- examples/material_colours_app.rb
|
282
|
-
- examples/maximise_unmaximise_app.rb
|
283
280
|
- examples/typed_commands/command.erb
|
284
281
|
- examples/typed_commands/output.erb
|
285
282
|
- examples/typed_commands/status.erb
|
@@ -362,6 +359,7 @@ files:
|
|
362
359
|
- lib/vedeu/models/cell.rb
|
363
360
|
- lib/vedeu/models/char.rb
|
364
361
|
- lib/vedeu/models/composition.rb
|
362
|
+
- lib/vedeu/models/escape_char.rb
|
365
363
|
- lib/vedeu/models/focus.rb
|
366
364
|
- lib/vedeu/models/group.rb
|
367
365
|
- lib/vedeu/models/interface.rb
|
@@ -487,6 +485,7 @@ files:
|
|
487
485
|
- test/lib/vedeu/models/cell_test.rb
|
488
486
|
- test/lib/vedeu/models/char_test.rb
|
489
487
|
- test/lib/vedeu/models/composition_test.rb
|
488
|
+
- test/lib/vedeu/models/escape_char_test.rb
|
490
489
|
- test/lib/vedeu/models/focus_test.rb
|
491
490
|
- test/lib/vedeu/models/group_test.rb
|
492
491
|
- test/lib/vedeu/models/interface_test.rb
|
@@ -637,6 +636,7 @@ test_files:
|
|
637
636
|
- test/lib/vedeu/models/cell_test.rb
|
638
637
|
- test/lib/vedeu/models/char_test.rb
|
639
638
|
- test/lib/vedeu/models/composition_test.rb
|
639
|
+
- test/lib/vedeu/models/escape_char_test.rb
|
640
640
|
- test/lib/vedeu/models/focus_test.rb
|
641
641
|
- test/lib/vedeu/models/group_test.rb
|
642
642
|
- test/lib/vedeu/models/interface_test.rb
|
data/examples/cursor_app.rb
DELETED
@@ -1,126 +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
|
-
# An example application to demonstrate cursors; their movement and effect on
|
9
|
-
# the viewport of the interface in focus.
|
10
|
-
class VedeuCursorApp
|
11
|
-
|
12
|
-
include Vedeu
|
13
|
-
|
14
|
-
configure do
|
15
|
-
debug!
|
16
|
-
log '/tmp/vedeu_cursor_app.log'
|
17
|
-
end
|
18
|
-
|
19
|
-
interface 'main_interface' do
|
20
|
-
colour foreground: '#ff0000', background: '#000000'
|
21
|
-
cursor!
|
22
|
-
|
23
|
-
geometry do
|
24
|
-
centred true
|
25
|
-
height 10
|
26
|
-
width 20
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
keymap('_global_') do
|
31
|
-
key(:up) { Vedeu.trigger(:_cursor_up_) }
|
32
|
-
key(:right) { Vedeu.trigger(:_cursor_right_) }
|
33
|
-
key(:down) { Vedeu.trigger(:_cursor_down_) }
|
34
|
-
key(:left) { Vedeu.trigger(:_cursor_left_) }
|
35
|
-
|
36
|
-
key('k') { Vedeu.trigger(:_geometry_up_, 'main_interface') }
|
37
|
-
key('l') { Vedeu.trigger(:_geometry_right_, 'main_interface') }
|
38
|
-
key('j') { Vedeu.trigger(:_geometry_down_, 'main_interface') }
|
39
|
-
key('h') { Vedeu.trigger(:_geometry_left_, 'main_interface') }
|
40
|
-
|
41
|
-
key('m') { Vedeu.trigger(:_maximise_, 'main_interface') }
|
42
|
-
key('u') { Vedeu.trigger(:_unmaximise_, 'main_interface') }
|
43
|
-
end
|
44
|
-
|
45
|
-
renders do
|
46
|
-
view 'main_interface' do
|
47
|
-
border do
|
48
|
-
colour foreground: '#aadd00', background: '#000000'
|
49
|
-
title 'Move!'
|
50
|
-
end
|
51
|
-
lines do
|
52
|
-
streams do
|
53
|
-
text 'A.3 '
|
54
|
-
end
|
55
|
-
streams do
|
56
|
-
background '#550000'
|
57
|
-
foreground '#ffff00'
|
58
|
-
text 'hydrogen'
|
59
|
-
end
|
60
|
-
streams do
|
61
|
-
text ' helium'
|
62
|
-
end
|
63
|
-
end
|
64
|
-
lines do
|
65
|
-
streams do
|
66
|
-
text 'B.34 '
|
67
|
-
text 'lithium ', colour: { foreground: '#63d48e' }
|
68
|
-
text 'beryllium '
|
69
|
-
text 'boron', colour: { background: '#770033' }
|
70
|
-
text ' nitrogen'
|
71
|
-
end
|
72
|
-
end
|
73
|
-
lines do
|
74
|
-
streams do
|
75
|
-
text 'C.345'
|
76
|
-
text ' carbon oxygen '
|
77
|
-
end
|
78
|
-
streams do
|
79
|
-
background '#aadd00'
|
80
|
-
foreground '#00ddaa'
|
81
|
-
text 'fluorine'
|
82
|
-
end
|
83
|
-
end
|
84
|
-
lines do
|
85
|
-
streams do
|
86
|
-
text 'D.3456'
|
87
|
-
end
|
88
|
-
end
|
89
|
-
lines do
|
90
|
-
streams do
|
91
|
-
text 'E.34567 neon sodium', colour: { foreground: '#ffffff' }
|
92
|
-
end
|
93
|
-
end
|
94
|
-
lines do
|
95
|
-
streams do
|
96
|
-
text 'F.345678 magnesium '
|
97
|
-
end
|
98
|
-
streams do
|
99
|
-
foreground '#00aaff'
|
100
|
-
text 'aluminium'
|
101
|
-
end
|
102
|
-
end
|
103
|
-
lines do
|
104
|
-
streams do
|
105
|
-
text 'G.3456789 silicon'
|
106
|
-
end
|
107
|
-
end
|
108
|
-
lines do
|
109
|
-
streams do
|
110
|
-
background '#550000'
|
111
|
-
foreground '#ff00ff'
|
112
|
-
text 'H.34567890'
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
focus_by_name 'main_interface'
|
119
|
-
|
120
|
-
def self.start(argv = ARGV)
|
121
|
-
Vedeu::Launcher.execute!(argv)
|
122
|
-
end
|
123
|
-
|
124
|
-
end
|
125
|
-
|
126
|
-
VedeuCursorApp.start(ARGV)
|
data/examples/lines_app.rb
DELETED
@@ -1,71 +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
|
-
# An example application to demonstrate interface lines.
|
9
|
-
class VedeuLinesApp
|
10
|
-
|
11
|
-
include Vedeu
|
12
|
-
|
13
|
-
configure do
|
14
|
-
debug!
|
15
|
-
log '/tmp/vedeu_lines_app.log'
|
16
|
-
end
|
17
|
-
|
18
|
-
interface 'ruthenium' do
|
19
|
-
geometry do
|
20
|
-
centred true
|
21
|
-
height 5
|
22
|
-
width 40
|
23
|
-
end
|
24
|
-
colour foreground: '#ffffff', background: '#000000'
|
25
|
-
end
|
26
|
-
|
27
|
-
interface 'tantalum' do
|
28
|
-
colour foreground: '#00aadd', background: '#000000'
|
29
|
-
geometry do
|
30
|
-
height 1
|
31
|
-
width 40
|
32
|
-
x Vedeu.use('ruthenium').left
|
33
|
-
y Vedeu.use('ruthenium').south
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
keymap('_global_') do
|
38
|
-
key(:up) { Vedeu.trigger(:_cursor_up_) }
|
39
|
-
key(:right) { Vedeu.trigger(:_cursor_right_) }
|
40
|
-
key(:down) { Vedeu.trigger(:_cursor_down_) }
|
41
|
-
key(:left) { Vedeu.trigger(:_cursor_left_) }
|
42
|
-
end
|
43
|
-
|
44
|
-
renders do
|
45
|
-
view 'ruthenium' do
|
46
|
-
lines do
|
47
|
-
line 'Ruthenium is a chemical element with'
|
48
|
-
line 'symbol Ru and atomic number 44. It is a'
|
49
|
-
line 'rare transition metal belonging to the'
|
50
|
-
line 'platinum group of the periodic table.'
|
51
|
-
line 'Like the other metals of the platinum'
|
52
|
-
line 'group, ruthenium is inert to most other'
|
53
|
-
line 'chemicals.'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
view 'tantalum' do
|
57
|
-
lines do
|
58
|
-
line 'Use cursor keys to navigate, Q to quit.'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
focus_by_name 'ruthenium'
|
64
|
-
|
65
|
-
def self.start(argv = ARGV)
|
66
|
-
Vedeu::Launcher.execute!(argv)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
VedeuLinesApp.start(ARGV)
|
@@ -1,120 +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
|
-
# An example application to demonstrate maximising and unmaximising views.
|
9
|
-
#
|
10
|
-
class VedeuMaximiseApp
|
11
|
-
|
12
|
-
include Vedeu
|
13
|
-
|
14
|
-
configure do
|
15
|
-
debug!
|
16
|
-
log '/tmp/vedeu_maximise_app.log'
|
17
|
-
end
|
18
|
-
|
19
|
-
interface 'main_interface' do
|
20
|
-
colour foreground: '#ff0000', background: '#000000'
|
21
|
-
cursor!
|
22
|
-
|
23
|
-
geometry do
|
24
|
-
centred true
|
25
|
-
height 10
|
26
|
-
width 20
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
keymap('_global_') do
|
31
|
-
key(:up, 'k') { Vedeu.trigger(:_cursor_up_) }
|
32
|
-
key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
|
33
|
-
key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
|
34
|
-
key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
|
35
|
-
key('m') { Vedeu.trigger(:_maximise_, 'main_interface') }
|
36
|
-
key('n') { Vedeu.trigger(:_unmaximise_, 'main_interface') }
|
37
|
-
end
|
38
|
-
|
39
|
-
renders do
|
40
|
-
view 'main_interface' do
|
41
|
-
border do
|
42
|
-
colour foreground: '#aadd00', background: '#000000'
|
43
|
-
title 'Move!'
|
44
|
-
end
|
45
|
-
lines do
|
46
|
-
streams do
|
47
|
-
text 'A.3 '
|
48
|
-
end
|
49
|
-
streams do
|
50
|
-
background '#550000'
|
51
|
-
foreground '#ffff00'
|
52
|
-
text 'hydrogen'
|
53
|
-
end
|
54
|
-
streams do
|
55
|
-
text ' helium'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
lines do
|
59
|
-
streams do
|
60
|
-
text 'B.34 '
|
61
|
-
text 'lithium ', colour: { foreground: '#63d48e' }
|
62
|
-
text 'beryllium '
|
63
|
-
text 'boron', colour: { background: '#770033' }
|
64
|
-
text ' nitrogen'
|
65
|
-
end
|
66
|
-
end
|
67
|
-
lines do
|
68
|
-
streams do
|
69
|
-
text 'C.345'
|
70
|
-
text ' carbon oxygen '
|
71
|
-
end
|
72
|
-
streams do
|
73
|
-
background '#aadd00'
|
74
|
-
foreground '#00ddaa'
|
75
|
-
text 'fluorine'
|
76
|
-
end
|
77
|
-
end
|
78
|
-
lines do
|
79
|
-
streams do
|
80
|
-
text 'D.3456'
|
81
|
-
end
|
82
|
-
end
|
83
|
-
lines do
|
84
|
-
streams do
|
85
|
-
text 'E.34567 neon sodium', colour: { foreground: '#ffffff' }
|
86
|
-
end
|
87
|
-
end
|
88
|
-
lines do
|
89
|
-
streams do
|
90
|
-
text 'F.345678 magnesium '
|
91
|
-
end
|
92
|
-
streams do
|
93
|
-
foreground '#00aaff'
|
94
|
-
text 'aluminium'
|
95
|
-
end
|
96
|
-
end
|
97
|
-
lines do
|
98
|
-
streams do
|
99
|
-
text 'G.3456789 silicon'
|
100
|
-
end
|
101
|
-
end
|
102
|
-
lines do
|
103
|
-
streams do
|
104
|
-
background '#550000'
|
105
|
-
foreground '#ff00ff'
|
106
|
-
text 'H.34567890'
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
focus_by_name 'main_interface'
|
113
|
-
|
114
|
-
def self.start(argv = ARGV)
|
115
|
-
Vedeu::Launcher.execute!(argv)
|
116
|
-
end
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
VedeuMaximiseApp.start(ARGV)
|