vedeu 0.6.42 → 0.6.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/buffers/buffer.rb +28 -0
- data/lib/vedeu/colours/colour.rb +5 -0
- data/lib/vedeu/cursors/all.rb +1 -0
- data/lib/vedeu/cursors/cursor.rb +28 -8
- data/lib/vedeu/cursors/dsl.rb +68 -0
- data/lib/vedeu/cursors/refresh.rb +11 -9
- data/lib/vedeu/dsl/view.rb +1 -0
- data/lib/vedeu/interfaces/dsl.rb +1 -50
- data/lib/vedeu/interfaces/interface.rb +18 -12
- data/lib/vedeu/models/toggleable.rb +44 -9
- data/lib/vedeu/models/views/view.rb +14 -8
- data/lib/vedeu/null/generic.rb +1 -0
- data/lib/vedeu/output/renderers/all.rb +6 -3
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +71 -0
- data/test/lib/vedeu/colours/colour_test.rb +6 -0
- data/test/lib/vedeu/cursors/dsl_test.rb +91 -0
- data/test/lib/vedeu/cursors/refresh_test.rb +31 -21
- data/test/lib/vedeu/interfaces/dsl_test.rb +0 -76
- data/test/lib/vedeu/interfaces/interface_test.rb +26 -21
- data/test/lib/vedeu/models/toggleable_test.rb +17 -0
- data/test/lib/vedeu/models/views/view_test.rb +2 -0
- data/test/support/examples/material_colours_app.rb +1 -4
- metadata +5 -11
- data/lib/vedeu/output/renderers/escape_sequence.rb +0 -46
- data/lib/vedeu/output/renderers/null.rb +0 -36
- data/lib/vedeu/output/renderers/text.rb +0 -37
- data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +0 -78
- data/test/lib/vedeu/output/renderers/null_test.rb +0 -36
- data/test/lib/vedeu/output/renderers/text_test.rb +0 -36
@@ -78,6 +78,23 @@ module Vedeu
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
describe '#hide_cursor' do
|
82
|
+
subject { instance.hide_cursor }
|
83
|
+
|
84
|
+
# @todo Add more tests.
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '#show_cursor' do
|
88
|
+
subject { instance.show_cursor }
|
89
|
+
|
90
|
+
# @todo Add more tests.
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#toggle_cursor' do
|
94
|
+
subject { instance.toggle_cursor }
|
95
|
+
|
96
|
+
# @todo Add more tests.
|
97
|
+
end
|
81
98
|
end # Toggleable
|
82
99
|
|
83
100
|
end # Vedeu
|
@@ -33,6 +33,8 @@ module Vedeu
|
|
33
33
|
instance.must_respond_to(:attributes)
|
34
34
|
instance.must_respond_to(:client)
|
35
35
|
instance.must_respond_to(:client=)
|
36
|
+
instance.must_respond_to(:cursor_visible)
|
37
|
+
instance.must_respond_to(:cursor_visible=)
|
36
38
|
instance.must_respond_to(:name)
|
37
39
|
instance.must_respond_to(:name=)
|
38
40
|
instance.must_respond_to(:parent)
|
@@ -31,7 +31,6 @@ class VedeuMaterialColoursApp
|
|
31
31
|
caption('Unicorns!')
|
32
32
|
end
|
33
33
|
colour foreground: '#ffffff', background: :default
|
34
|
-
cursor!
|
35
34
|
geometry 'main_interface' do
|
36
35
|
x 3
|
37
36
|
xn 24
|
@@ -58,7 +57,6 @@ class VedeuMaterialColoursApp
|
|
58
57
|
bottom_left('+')
|
59
58
|
end
|
60
59
|
colour(foreground: '#ffffff', background: :default)
|
61
|
-
cursor!
|
62
60
|
geometry 'other_interface' do
|
63
61
|
x(27)
|
64
62
|
xn(47)
|
@@ -79,7 +77,6 @@ class VedeuMaterialColoursApp
|
|
79
77
|
bottom_left('+')
|
80
78
|
end
|
81
79
|
colour(foreground: '#ffffff', background: :default)
|
82
|
-
cursor!
|
83
80
|
geometry 'empty_interface' do
|
84
81
|
x(50)
|
85
82
|
xn(64)
|
@@ -92,7 +89,6 @@ class VedeuMaterialColoursApp
|
|
92
89
|
|
93
90
|
Vedeu.interface 'keys_interface' do
|
94
91
|
colour(foreground: '#ffffff', background: :default)
|
95
|
-
cursor!
|
96
92
|
geometry 'keys_interface' do
|
97
93
|
x(3)
|
98
94
|
xn(64)
|
@@ -204,6 +200,7 @@ class VedeuMaterialColoursApp
|
|
204
200
|
end
|
205
201
|
|
206
202
|
view 'keys_interface' do
|
203
|
+
cursor false
|
207
204
|
line {
|
208
205
|
stream {
|
209
206
|
left "\u2190 \u2193 \u2191 \u2192",
|
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.6.
|
4
|
+
version: 0.6.43
|
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-
|
11
|
+
date: 2015-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -350,6 +350,7 @@ files:
|
|
350
350
|
- lib/vedeu/configuration/configuration.rb
|
351
351
|
- lib/vedeu/cursors/all.rb
|
352
352
|
- lib/vedeu/cursors/cursor.rb
|
353
|
+
- lib/vedeu/cursors/dsl.rb
|
353
354
|
- lib/vedeu/cursors/refresh.rb
|
354
355
|
- lib/vedeu/cursors/repository.rb
|
355
356
|
- lib/vedeu/distributed/all.rb
|
@@ -473,14 +474,11 @@ files:
|
|
473
474
|
- lib/vedeu/output/presentation/styles.rb
|
474
475
|
- lib/vedeu/output/refresh/refresh.rb
|
475
476
|
- lib/vedeu/output/renderers/all.rb
|
476
|
-
- lib/vedeu/output/renderers/escape_sequence.rb
|
477
477
|
- lib/vedeu/output/renderers/file.rb
|
478
478
|
- lib/vedeu/output/renderers/html.rb
|
479
479
|
- lib/vedeu/output/renderers/json.rb
|
480
|
-
- lib/vedeu/output/renderers/null.rb
|
481
480
|
- lib/vedeu/output/renderers/options.rb
|
482
481
|
- lib/vedeu/output/renderers/terminal.rb
|
483
|
-
- lib/vedeu/output/renderers/text.rb
|
484
482
|
- lib/vedeu/output/templates/html_renderer.vedeu
|
485
483
|
- lib/vedeu/output/text.rb
|
486
484
|
- lib/vedeu/output/viewport.rb
|
@@ -540,6 +538,7 @@ files:
|
|
540
538
|
- test/lib/vedeu/configuration/api_test.rb
|
541
539
|
- test/lib/vedeu/configuration/configuration_test.rb
|
542
540
|
- test/lib/vedeu/cursors/cursor_test.rb
|
541
|
+
- test/lib/vedeu/cursors/dsl_test.rb
|
543
542
|
- test/lib/vedeu/cursors/refresh_test.rb
|
544
543
|
- test/lib/vedeu/cursors/repository_test.rb
|
545
544
|
- test/lib/vedeu/distributed/client_test.rb
|
@@ -638,14 +637,11 @@ files:
|
|
638
637
|
- test/lib/vedeu/output/presentation/styles_test.rb
|
639
638
|
- test/lib/vedeu/output/refresh/refresh_test.rb
|
640
639
|
- test/lib/vedeu/output/renderers/all_test.rb
|
641
|
-
- test/lib/vedeu/output/renderers/escape_sequence_test.rb
|
642
640
|
- test/lib/vedeu/output/renderers/file_test.rb
|
643
641
|
- test/lib/vedeu/output/renderers/html_test.rb
|
644
642
|
- test/lib/vedeu/output/renderers/json_test.rb
|
645
|
-
- test/lib/vedeu/output/renderers/null_test.rb
|
646
643
|
- test/lib/vedeu/output/renderers/options_test.rb
|
647
644
|
- test/lib/vedeu/output/renderers/terminal_test.rb
|
648
|
-
- test/lib/vedeu/output/renderers/text_test.rb
|
649
645
|
- test/lib/vedeu/output/text_test.rb
|
650
646
|
- test/lib/vedeu/output/viewport_test.rb
|
651
647
|
- test/lib/vedeu/output/wordwrap_test.rb
|
@@ -743,6 +739,7 @@ test_files:
|
|
743
739
|
- test/lib/vedeu/configuration/api_test.rb
|
744
740
|
- test/lib/vedeu/configuration/configuration_test.rb
|
745
741
|
- test/lib/vedeu/cursors/cursor_test.rb
|
742
|
+
- test/lib/vedeu/cursors/dsl_test.rb
|
746
743
|
- test/lib/vedeu/cursors/refresh_test.rb
|
747
744
|
- test/lib/vedeu/cursors/repository_test.rb
|
748
745
|
- test/lib/vedeu/distributed/client_test.rb
|
@@ -841,14 +838,11 @@ test_files:
|
|
841
838
|
- test/lib/vedeu/output/presentation/styles_test.rb
|
842
839
|
- test/lib/vedeu/output/refresh/refresh_test.rb
|
843
840
|
- test/lib/vedeu/output/renderers/all_test.rb
|
844
|
-
- test/lib/vedeu/output/renderers/escape_sequence_test.rb
|
845
841
|
- test/lib/vedeu/output/renderers/file_test.rb
|
846
842
|
- test/lib/vedeu/output/renderers/html_test.rb
|
847
843
|
- test/lib/vedeu/output/renderers/json_test.rb
|
848
|
-
- test/lib/vedeu/output/renderers/null_test.rb
|
849
844
|
- test/lib/vedeu/output/renderers/options_test.rb
|
850
845
|
- test/lib/vedeu/output/renderers/terminal_test.rb
|
851
|
-
- test/lib/vedeu/output/renderers/text_test.rb
|
852
846
|
- test/lib/vedeu/output/text_test.rb
|
853
847
|
- test/lib/vedeu/output/viewport_test.rb
|
854
848
|
- test/lib/vedeu/output/wordwrap_test.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
module Renderers
|
4
|
-
|
5
|
-
# A renderer which returns the escape sequence for each character.
|
6
|
-
#
|
7
|
-
class EscapeSequence
|
8
|
-
|
9
|
-
include Vedeu::Renderers::Options
|
10
|
-
|
11
|
-
# Returns a new instance of Vedeu::Renderers::EscapeSequence.
|
12
|
-
#
|
13
|
-
# @param options [Hash]
|
14
|
-
# @return [Vedeu::Renderers::EscapeSequence]
|
15
|
-
def initialize(options = {})
|
16
|
-
@options = options || {}
|
17
|
-
end
|
18
|
-
|
19
|
-
# Render a cleared output.
|
20
|
-
#
|
21
|
-
# @return [String]
|
22
|
-
def clear
|
23
|
-
''
|
24
|
-
end
|
25
|
-
|
26
|
-
# Render the output with the escape sequences escaped.
|
27
|
-
#
|
28
|
-
# @param output [Vedeu::Models::Page]
|
29
|
-
# @return [String]
|
30
|
-
def render(output)
|
31
|
-
out = ''
|
32
|
-
|
33
|
-
output.each do |row|
|
34
|
-
row.each do |cell|
|
35
|
-
out << Vedeu::EscapeSequences::Esc.escape(cell.to_s)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
out
|
40
|
-
end
|
41
|
-
|
42
|
-
end # EscapeSequence
|
43
|
-
|
44
|
-
end # Renderers
|
45
|
-
|
46
|
-
end # Vedeu
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
module Renderers
|
4
|
-
|
5
|
-
# A renderer which returns nothing.
|
6
|
-
#
|
7
|
-
class Null
|
8
|
-
|
9
|
-
include Vedeu::Renderers::Options
|
10
|
-
|
11
|
-
# Returns a new instance of Vedeu::Renderers::Null.
|
12
|
-
#
|
13
|
-
# @param options [Hash]
|
14
|
-
# @return [Vedeu::Renderers::Null]
|
15
|
-
def initialize(options = {})
|
16
|
-
@options = options || {}
|
17
|
-
end
|
18
|
-
|
19
|
-
# Render a cleared output.
|
20
|
-
#
|
21
|
-
# @return [String]
|
22
|
-
def clear
|
23
|
-
''
|
24
|
-
end
|
25
|
-
|
26
|
-
# @param output [Vedeu::Models::Page]
|
27
|
-
# @return [String]
|
28
|
-
def render(output)
|
29
|
-
output
|
30
|
-
end
|
31
|
-
|
32
|
-
end # Null
|
33
|
-
|
34
|
-
end # Renderers
|
35
|
-
|
36
|
-
end # Vedeu
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
module Renderers
|
4
|
-
|
5
|
-
# Converts a grid of {Vedeu::Views::Char} objects into a stream of
|
6
|
-
# escape sequences and content.
|
7
|
-
#
|
8
|
-
class Text
|
9
|
-
|
10
|
-
include Vedeu::Renderers::Options
|
11
|
-
|
12
|
-
# Returns a new instance of Vedeu::Renderers::Text.
|
13
|
-
#
|
14
|
-
# @param options [Hash]
|
15
|
-
# @return [Vedeu::Renderers::Text]
|
16
|
-
def initialize(options = {})
|
17
|
-
@options = options || {}
|
18
|
-
end
|
19
|
-
|
20
|
-
# Render a cleared output.
|
21
|
-
#
|
22
|
-
# @return [String]
|
23
|
-
def clear
|
24
|
-
''
|
25
|
-
end
|
26
|
-
|
27
|
-
# @param output [Vedeu::Models::Page]
|
28
|
-
# @return [String]
|
29
|
-
def render(output)
|
30
|
-
Vedeu::Output::Compressor.render(output)
|
31
|
-
end
|
32
|
-
|
33
|
-
end # Text
|
34
|
-
|
35
|
-
end # Renderers
|
36
|
-
|
37
|
-
end # Vedeu
|
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Renderers
|
6
|
-
|
7
|
-
describe EscapeSequence do
|
8
|
-
|
9
|
-
let(:described) { Vedeu::Renderers::EscapeSequence }
|
10
|
-
let(:instance) { described.new(options) }
|
11
|
-
let(:options) { {} }
|
12
|
-
let(:output) { Vedeu::Models::Page.new }
|
13
|
-
|
14
|
-
describe '#initialize' do
|
15
|
-
it { instance.must_be_instance_of(described) }
|
16
|
-
it { instance.instance_variable_get('@options').must_equal(options) }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#clear' do
|
20
|
-
subject { instance.clear }
|
21
|
-
|
22
|
-
it { subject.must_be_instance_of(String) }
|
23
|
-
it { subject.must_equal('') }
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#render' do
|
27
|
-
subject { instance.render(output) }
|
28
|
-
|
29
|
-
it { subject.must_be_instance_of(String) }
|
30
|
-
|
31
|
-
context 'when there is an empty buffer' do
|
32
|
-
let(:expected) { '' }
|
33
|
-
|
34
|
-
it { subject.must_equal(expected) }
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'when there is content on the buffer' do
|
38
|
-
let(:output) {
|
39
|
-
Vedeu::Models::Page.coerce([
|
40
|
-
Vedeu::Views::Char.new(value: 't',
|
41
|
-
colour: {
|
42
|
-
background: '#ff0000',
|
43
|
-
foreground: '#ffffff'
|
44
|
-
}),
|
45
|
-
Vedeu::Views::Char.new(value: 'e',
|
46
|
-
colour: {
|
47
|
-
background: '#ffff00',
|
48
|
-
foreground: '#000000'
|
49
|
-
}),
|
50
|
-
Vedeu::Views::Char.new(value: 's',
|
51
|
-
colour: {
|
52
|
-
background: '#00ff00',
|
53
|
-
foreground: '#000000'
|
54
|
-
}),
|
55
|
-
Vedeu::Views::Char.new(value: 't',
|
56
|
-
colour: {
|
57
|
-
background: '#00ffff',
|
58
|
-
foreground: '#000000'
|
59
|
-
}),
|
60
|
-
])
|
61
|
-
}
|
62
|
-
|
63
|
-
it {
|
64
|
-
subject.must_equal(
|
65
|
-
"\\e[38;2;255;255;255m\\e[48;2;255;0;0mt" \
|
66
|
-
"\\e[38;2;0;0;0m\\e[48;2;255;255;0me" \
|
67
|
-
"\\e[38;2;0;0;0m\\e[48;2;0;255;0ms" \
|
68
|
-
"\\e[38;2;0;0;0m\\e[48;2;0;255;255mt"
|
69
|
-
)
|
70
|
-
}
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
end # EscapeSequence
|
75
|
-
|
76
|
-
end # Renderers
|
77
|
-
|
78
|
-
end # Vedeu
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Renderers
|
6
|
-
|
7
|
-
describe Null do
|
8
|
-
|
9
|
-
let(:described) { Vedeu::Renderers::Null }
|
10
|
-
let(:instance) { described.new(options) }
|
11
|
-
let(:options) { {} }
|
12
|
-
let(:output) {}
|
13
|
-
|
14
|
-
describe '#initialize' do
|
15
|
-
it { instance.must_be_instance_of(Vedeu::Renderers::Null) }
|
16
|
-
it { instance.instance_variable_get('@options').must_equal(options) }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#clear' do
|
20
|
-
subject { instance.clear }
|
21
|
-
|
22
|
-
it { subject.must_be_instance_of(String) }
|
23
|
-
it { subject.must_equal('') }
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#render' do
|
27
|
-
subject { instance.render(output) }
|
28
|
-
|
29
|
-
it { subject.must_be_instance_of(NilClass) }
|
30
|
-
end
|
31
|
-
|
32
|
-
end # Null
|
33
|
-
|
34
|
-
end # Renderers
|
35
|
-
|
36
|
-
end # Vedeu
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Renderers
|
6
|
-
|
7
|
-
describe Text do
|
8
|
-
|
9
|
-
let(:described) { Vedeu::Renderers::Text }
|
10
|
-
let(:instance) { described.new(options) }
|
11
|
-
let(:options) { {} }
|
12
|
-
let(:output) {}
|
13
|
-
|
14
|
-
describe '#initialize' do
|
15
|
-
it { instance.must_be_instance_of(described) }
|
16
|
-
it { instance.instance_variable_get('@options').must_equal(options) }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#clear' do
|
20
|
-
subject { instance.clear }
|
21
|
-
|
22
|
-
it { subject.must_be_instance_of(String) }
|
23
|
-
it { subject.must_equal('') }
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#render' do
|
27
|
-
subject { instance.render(output) }
|
28
|
-
|
29
|
-
it { subject.must_be_instance_of(String) }
|
30
|
-
end
|
31
|
-
|
32
|
-
end # Text
|
33
|
-
|
34
|
-
end # Renderers
|
35
|
-
|
36
|
-
end # Vedeu
|