vedeu 0.4.26 → 0.4.27
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 +5 -3
- data/examples/panel_app.rb +61 -0
- data/lib/vedeu/bindings.rb +10 -0
- data/lib/vedeu/cursor/cursor.rb +6 -0
- data/lib/vedeu/cursor/move.rb +20 -14
- data/lib/vedeu/dsl/interface.rb +56 -0
- data/lib/vedeu/models/escape_char.rb +7 -7
- data/lib/vedeu/models/interface.rb +14 -17
- data/lib/vedeu/models/panel.rb +17 -0
- data/lib/vedeu/models/stream.rb +1 -1
- data/lib/vedeu/output/border.rb +17 -37
- data/lib/vedeu/output/esc.rb +17 -16
- data/lib/vedeu/output/html_char.rb +18 -15
- data/lib/vedeu/output/refresh.rb +8 -2
- data/lib/vedeu/output/viewport.rb +3 -1
- data/lib/vedeu/repositories/repositories/cursors.rb +1 -1
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +8 -0
- data/lib/vedeu/repositories/repository.rb +9 -0
- data/lib/vedeu/storage/store.rb +1 -0
- data/lib/vedeu/support/terminal.rb +7 -0
- data/lib/vedeu/support/visibility.rb +15 -4
- data/test/lib/vedeu/buffers/buffer_test.rb +1 -0
- data/test/lib/vedeu/dsl/components/border_test.rb +1 -0
- data/test/lib/vedeu/dsl/interface_test.rb +35 -5
- data/test/lib/vedeu/models/escape_char_test.rb +7 -2
- data/test/lib/vedeu/models/focus_test.rb +6 -11
- data/test/lib/vedeu/models/interface_test.rb +12 -9
- data/test/lib/vedeu/output/border_test.rb +3 -0
- data/test/lib/vedeu/output/esc_test.rb +4 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repositories_test.rb +19 -0
- data/test/lib/vedeu/repositories/repository_test.rb +34 -0
- data/test/lib/vedeu/storage/store_test.rb +4 -4
- data/test/lib/vedeu/support/terminal_test.rb +22 -13
- data/test/test_helper.rb +6 -6
- data/vedeu.gemspec +4 -4
- metadata +10 -8
@@ -30,6 +30,7 @@ module Vedeu
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
+
after { Vedeu.interfaces.reset }
|
33
34
|
|
34
35
|
describe '.build' do
|
35
36
|
subject {
|
@@ -111,6 +112,7 @@ module Vedeu
|
|
111
112
|
end
|
112
113
|
end
|
113
114
|
end
|
115
|
+
after { Vedeu.interfaces.reset }
|
114
116
|
|
115
117
|
describe '#bx' do
|
116
118
|
subject { instance.bx }
|
@@ -424,6 +426,7 @@ module Vedeu
|
|
424
426
|
visible(visibility)
|
425
427
|
end
|
426
428
|
end
|
429
|
+
after { Vedeu.interfaces.reset }
|
427
430
|
|
428
431
|
subject { instance.render }
|
429
432
|
|
@@ -150,6 +150,10 @@ module Vedeu
|
|
150
150
|
it 'returns an escape sequence when the style is underline off' do
|
151
151
|
described.string('underline_off').must_equal("\e[24m")
|
152
152
|
end
|
153
|
+
|
154
|
+
it 'returns an escape sequence when the style is underline off' do
|
155
|
+
described.string('cursor_position').must_equal("\e[6n")
|
156
|
+
end
|
153
157
|
end
|
154
158
|
|
155
159
|
end # Esc
|
@@ -6,6 +6,25 @@ module Vedeu
|
|
6
6
|
|
7
7
|
let(:described) { Vedeu::InterfacesRepository }
|
8
8
|
|
9
|
+
describe '#zindexed' do
|
10
|
+
before do
|
11
|
+
@hydrogen = Vedeu.interface 'hydrogen' do
|
12
|
+
zindex 2
|
13
|
+
end
|
14
|
+
@helium = Vedeu.interface 'helium' do
|
15
|
+
zindex 3
|
16
|
+
end
|
17
|
+
@lithium = Vedeu.interface 'lithium' do
|
18
|
+
zindex 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
after { Vedeu.interfaces.reset }
|
22
|
+
|
23
|
+
subject { Vedeu.interfaces.zindexed }
|
24
|
+
|
25
|
+
it { subject.must_equal([@lithium, @hydrogen, @helium]) }
|
26
|
+
end
|
27
|
+
|
9
28
|
end # InterfacesRepository
|
10
29
|
|
11
30
|
end # Vedeu
|
@@ -60,6 +60,40 @@ module Vedeu
|
|
60
60
|
it { instance.instance_variable_get('@storage').must_equal(storage) }
|
61
61
|
end
|
62
62
|
|
63
|
+
describe '#all' do
|
64
|
+
subject { instance.all }
|
65
|
+
|
66
|
+
context 'when there are no models stored in the repository' do
|
67
|
+
before { instance.reset }
|
68
|
+
|
69
|
+
it { subject.must_equal([]) }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when there are models stored in the repository' do
|
73
|
+
context 'when the repository is a glorified Hash' do
|
74
|
+
let(:storage) {
|
75
|
+
{
|
76
|
+
oxygen: :life,
|
77
|
+
plutonium: :death,
|
78
|
+
}
|
79
|
+
}
|
80
|
+
it { subject.must_equal([:life, :death]) }
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'when the repository is a glorified Set' do
|
84
|
+
let(:storage) { Set[:oxygen, :hydrogen] }
|
85
|
+
|
86
|
+
it { subject.must_equal([:oxygen, :hydrogen]) }
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when the repository is unknown' do
|
90
|
+
let(:storage) { [:hydrogen, :helium] }
|
91
|
+
|
92
|
+
it { subject.must_equal([:hydrogen, :helium]) }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
63
97
|
describe '#current' do
|
64
98
|
subject { instance.current }
|
65
99
|
|
@@ -26,10 +26,6 @@ module Vedeu
|
|
26
26
|
let(:model) {}
|
27
27
|
let(:storage) {}
|
28
28
|
|
29
|
-
describe 'alias methods' do
|
30
|
-
it { instance.must_respond_to(:registered?) }
|
31
|
-
end
|
32
|
-
|
33
29
|
describe '#each' do
|
34
30
|
subject { instance.each }
|
35
31
|
|
@@ -84,6 +80,8 @@ module Vedeu
|
|
84
80
|
|
85
81
|
it { subject.must_equal(true) }
|
86
82
|
end
|
83
|
+
|
84
|
+
it { instance.must_respond_to(:registered?) }
|
87
85
|
end
|
88
86
|
|
89
87
|
describe '#reset' do
|
@@ -94,6 +92,8 @@ module Vedeu
|
|
94
92
|
it 'resets the repository' do
|
95
93
|
instance.reset.must_equal({})
|
96
94
|
end
|
95
|
+
|
96
|
+
it { instance.must_respond_to(:reset!) }
|
97
97
|
end
|
98
98
|
|
99
99
|
describe '#size' do
|
@@ -13,19 +13,6 @@ module Vedeu
|
|
13
13
|
IO.console.stubs(:print)
|
14
14
|
end
|
15
15
|
|
16
|
-
describe 'alias methods' do
|
17
|
-
it { described.must_respond_to(:read) }
|
18
|
-
it { described.must_respond_to(:write) }
|
19
|
-
it { described.must_respond_to(:x) }
|
20
|
-
it { described.must_respond_to(:y) }
|
21
|
-
it { described.must_respond_to(:tx) }
|
22
|
-
it { described.must_respond_to(:ty) }
|
23
|
-
it { described.must_respond_to(:xn) }
|
24
|
-
it { described.must_respond_to(:txn) }
|
25
|
-
it { described.must_respond_to(:yn) }
|
26
|
-
it { described.must_respond_to(:tyn) }
|
27
|
-
end
|
28
|
-
|
29
16
|
describe '.open' do
|
30
17
|
context 'when a block was not given' do
|
31
18
|
it { proc { Terminal.open }.must_raise(InvalidSyntax) }
|
@@ -55,6 +42,8 @@ module Vedeu
|
|
55
42
|
describe '.input' do
|
56
43
|
subject { Terminal.input }
|
57
44
|
|
45
|
+
it { described.must_respond_to(:read) }
|
46
|
+
|
58
47
|
context 'when the terminal is in cooked mode' do
|
59
48
|
let(:mode) { :cooked }
|
60
49
|
let(:input) { "Some input\r\n" }
|
@@ -85,11 +74,14 @@ module Vedeu
|
|
85
74
|
describe '.output' do
|
86
75
|
subject { described.output(*_value) }
|
87
76
|
|
77
|
+
it { described.must_respond_to(:write) }
|
78
|
+
|
88
79
|
context 'when the value is a String' do
|
89
80
|
let(:_value) { 'Some output...' }
|
90
81
|
|
91
82
|
it { subject.must_equal(['Some output...']) }
|
92
83
|
end
|
84
|
+
|
93
85
|
context 'when there are multiple values' do
|
94
86
|
let(:_value) { ['Some output...', 'more output...', 'even more...'] }
|
95
87
|
|
@@ -190,6 +182,12 @@ module Vedeu
|
|
190
182
|
end
|
191
183
|
end
|
192
184
|
|
185
|
+
describe '.cursor' do
|
186
|
+
subject { described.cursor }
|
187
|
+
|
188
|
+
# it { subject.must_be_instance_of(Vedeu::Position) }
|
189
|
+
end
|
190
|
+
|
193
191
|
describe '.centre' do
|
194
192
|
subject { described.centre }
|
195
193
|
|
@@ -226,6 +224,11 @@ module Vedeu
|
|
226
224
|
it { subject.must_be_instance_of(Fixnum) }
|
227
225
|
|
228
226
|
it { subject.must_equal(1) }
|
227
|
+
|
228
|
+
it { described.must_respond_to(:x) }
|
229
|
+
it { described.must_respond_to(:y) }
|
230
|
+
it { described.must_respond_to(:tx) }
|
231
|
+
it { described.must_respond_to(:ty) }
|
229
232
|
end
|
230
233
|
|
231
234
|
describe '.width' do
|
@@ -233,6 +236,9 @@ module Vedeu
|
|
233
236
|
|
234
237
|
it { subject.must_be_instance_of(Fixnum) }
|
235
238
|
|
239
|
+
it { described.must_respond_to(:xn) }
|
240
|
+
it { described.must_respond_to(:txn) }
|
241
|
+
|
236
242
|
context 'via method' do
|
237
243
|
it 'returns the width' do
|
238
244
|
subject.must_equal(80)
|
@@ -251,6 +257,9 @@ module Vedeu
|
|
251
257
|
|
252
258
|
it { subject.must_be_instance_of(Fixnum) }
|
253
259
|
|
260
|
+
it { described.must_respond_to(:yn) }
|
261
|
+
it { described.must_respond_to(:tyn) }
|
262
|
+
|
254
263
|
context 'via method' do
|
255
264
|
it 'returns the height' do
|
256
265
|
subject.must_equal(25)
|
data/test/test_helper.rb
CHANGED
@@ -52,13 +52,13 @@ def test_configuration
|
|
52
52
|
|
53
53
|
Vedeu.configure do
|
54
54
|
colour_mode 16_777_216
|
55
|
-
|
56
|
-
|
55
|
+
# adds ~40ms to test run speed
|
56
|
+
# debug!
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
log '/tmp/vedeu_test_helper.log'
|
58
|
+
# if debug! above is commented out, then only
|
59
|
+
# `Vedeu.log(type: <any type>, message: '...', force: true)`
|
60
|
+
# will be logged, otherwise every `Vedeu.log` will be logged.
|
61
|
+
# log '/tmp/vedeu_test_helper.log'
|
62
62
|
end
|
63
63
|
|
64
64
|
Vedeu::Repositories.reset!
|
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.27'
|
8
8
|
spec.authors = ['Gavin Laking']
|
9
9
|
spec.email = ['gavinlaking@gmail.com']
|
10
10
|
spec.summary = 'A terminal case of wonderland.'
|
@@ -19,17 +19,17 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.8'
|
22
|
-
spec.add_development_dependency 'guard', '2.12.
|
22
|
+
spec.add_development_dependency 'guard', '2.12.6'
|
23
23
|
spec.add_development_dependency 'guard-bundler', '2.1.0'
|
24
24
|
spec.add_development_dependency 'guard-minitest', '2.4.4'
|
25
25
|
spec.add_development_dependency 'inch', '0.6.2'
|
26
26
|
spec.add_development_dependency 'minitest', '5.7.0'
|
27
|
-
spec.add_development_dependency 'minitest-reporters', '1.0.
|
27
|
+
spec.add_development_dependency 'minitest-reporters', '1.0.17'
|
28
28
|
spec.add_development_dependency 'mocha', '1.1.0'
|
29
29
|
spec.add_development_dependency 'pry', '0.10.1'
|
30
30
|
spec.add_development_dependency 'pry-byebug', '3.1.0'
|
31
31
|
spec.add_development_dependency 'rake', '10.4.2'
|
32
|
-
spec.add_development_dependency 'rubocop', '0.
|
32
|
+
spec.add_development_dependency 'rubocop', '0.32.0'
|
33
33
|
spec.add_development_dependency 'ruby-prof', '0.15.8'
|
34
34
|
spec.add_development_dependency 'simplecov', '0.10.0'
|
35
35
|
spec.add_development_dependency 'simplecov-console', '0.2.0'
|
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.27
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.12.
|
33
|
+
version: 2.12.6
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.12.
|
40
|
+
version: 2.12.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: guard-bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0.
|
103
|
+
version: 1.0.17
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.0.
|
110
|
+
version: 1.0.17
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mocha
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - '='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
173
|
+
version: 0.32.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
180
|
+
version: 0.32.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: ruby-prof
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,6 +277,7 @@ files:
|
|
277
277
|
- examples/geometry_app.rb
|
278
278
|
- examples/hello_world.rb
|
279
279
|
- examples/material_colours_app.rb
|
280
|
+
- examples/panel_app.rb
|
280
281
|
- examples/typed_commands/command.erb
|
281
282
|
- examples/typed_commands/output.erb
|
282
283
|
- examples/typed_commands/status.erb
|
@@ -365,6 +366,7 @@ files:
|
|
365
366
|
- lib/vedeu/models/interface.rb
|
366
367
|
- lib/vedeu/models/line.rb
|
367
368
|
- lib/vedeu/models/menu.rb
|
369
|
+
- lib/vedeu/models/panel.rb
|
368
370
|
- lib/vedeu/models/stream.rb
|
369
371
|
- lib/vedeu/null/all.rb
|
370
372
|
- lib/vedeu/null/border.rb
|