vedeu 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -15
- data/deps.md +93 -96
- data/lib/vedeu.rb +1 -6
- data/lib/vedeu/api/line.rb +0 -4
- data/lib/vedeu/api/view.rb +0 -1
- data/lib/vedeu/application.rb +1 -3
- data/lib/vedeu/instrumentation.rb +1 -1
- data/lib/vedeu/models/colour.rb +3 -2
- data/lib/vedeu/models/geometry.rb +16 -0
- data/lib/vedeu/models/interface.rb +9 -1
- data/lib/vedeu/output/render_interface.rb +3 -0
- data/lib/vedeu/output/text_adaptor.rb +2 -0
- data/lib/vedeu/output/view.rb +17 -24
- data/lib/vedeu/support/esc.rb +1 -21
- data/test/lib/vedeu/api/base_test.rb +0 -11
- data/test/lib/vedeu/api/grid_test.rb +10 -0
- data/test/lib/vedeu/api/line_test.rb +0 -11
- data/test/lib/vedeu/api/stream_test.rb +0 -11
- data/test/lib/vedeu/api/view_test.rb +1 -4
- data/test/lib/vedeu/models/composition_test.rb +3 -0
- data/test/lib/vedeu/output/view_test.rb +0 -27
- data/test/lib/vedeu/support/esc_test.rb +1 -21
- data/vedeu.gemspec +1 -1
- metadata +2 -20
- data/lib/vedeu/output/dsl_parser.rb +0 -19
- data/lib/vedeu/output/erb_parser.rb +0 -59
- data/lib/vedeu/output/json_parser.rb +0 -23
- data/lib/vedeu/output/menu_parser.rb +0 -51
- data/lib/vedeu/output/raw_parser.rb +0 -42
- data/lib/vedeu/support/helpers.rb +0 -66
- data/test/lib/vedeu/output/dsl_parser_test.rb +0 -19
- data/test/lib/vedeu/output/erb_parser_test.rb +0 -242
- data/test/lib/vedeu/output/json_parser_test.rb +0 -17
- data/test/lib/vedeu/output/menu_parser_test.rb +0 -46
- data/test/lib/vedeu/output/raw_parser_test.rb +0 -74
- data/test/lib/vedeu/support/helpers_test.rb +0 -71
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'vedeu/output/json_parser'
|
3
|
-
|
4
|
-
module Vedeu
|
5
|
-
describe JSONParser do
|
6
|
-
describe '.parse' do
|
7
|
-
it 'returns a hash when the JSON is valid' do
|
8
|
-
JSONParser.parse("{\"some\": \"JSON\"}")
|
9
|
-
.must_be_instance_of(Hash)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'returns an empty hash when the JSON is invalid' do
|
13
|
-
JSONParser.parse('{ invalid JSON }').must_be_instance_of(Hash)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'vedeu/support/menu'
|
3
|
-
require 'vedeu/output/menu_parser'
|
4
|
-
|
5
|
-
module Vedeu
|
6
|
-
describe MenuParser do
|
7
|
-
describe '.parse' do
|
8
|
-
it 'returns an interface' do
|
9
|
-
items = [
|
10
|
-
[false, true, 'Hydrogen'],
|
11
|
-
[true, false, 'Helium'],
|
12
|
-
[false, false, 'Lithium'],
|
13
|
-
[true, true, 'Beryllium']
|
14
|
-
]
|
15
|
-
args = ['dummy', items]
|
16
|
-
parser = MenuParser.parse(args)
|
17
|
-
parser.must_equal(
|
18
|
-
{
|
19
|
-
interfaces: {
|
20
|
-
name: 'dummy',
|
21
|
-
lines: [
|
22
|
-
{
|
23
|
-
streams: {
|
24
|
-
text: ' > Hydrogen'
|
25
|
-
}
|
26
|
-
}, {
|
27
|
-
streams: {
|
28
|
-
text: '* Helium'
|
29
|
-
}
|
30
|
-
}, {
|
31
|
-
streams: {
|
32
|
-
text: ' Lithium'
|
33
|
-
}
|
34
|
-
}, {
|
35
|
-
streams: {
|
36
|
-
text: '*> Beryllium'
|
37
|
-
}
|
38
|
-
}
|
39
|
-
]
|
40
|
-
}
|
41
|
-
}
|
42
|
-
)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'vedeu/output/raw_parser'
|
3
|
-
|
4
|
-
module Vedeu
|
5
|
-
describe RawParser do
|
6
|
-
describe '.parse' do
|
7
|
-
it 'returns a Hash when the output is content for multiple interfaces' do
|
8
|
-
RawParser.parse({
|
9
|
-
test: 'Some content...',
|
10
|
-
dummy: 'More content...'
|
11
|
-
}).must_equal({
|
12
|
-
interfaces: [
|
13
|
-
{
|
14
|
-
name: 'test',
|
15
|
-
lines: [
|
16
|
-
{
|
17
|
-
streams: { text: 'Some content...' }
|
18
|
-
}
|
19
|
-
]
|
20
|
-
}, {
|
21
|
-
name: 'dummy',
|
22
|
-
lines: [
|
23
|
-
{
|
24
|
-
streams: { text: 'More content...' }
|
25
|
-
}
|
26
|
-
]
|
27
|
-
}
|
28
|
-
]
|
29
|
-
})
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns a Hash when the output is content for a single interface' do
|
33
|
-
RawParser.parse({
|
34
|
-
dummy: 'Some content...'
|
35
|
-
}).must_equal({
|
36
|
-
interfaces: [
|
37
|
-
{
|
38
|
-
name: 'dummy',
|
39
|
-
lines: [
|
40
|
-
{
|
41
|
-
streams: { text: 'Some content...' }
|
42
|
-
}
|
43
|
-
]
|
44
|
-
}
|
45
|
-
]
|
46
|
-
})
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'returns a Hash when the output is content is a Hash' do
|
50
|
-
RawParser.parse({ dummy: [{ streams: { text: 'Some content' } }] })
|
51
|
-
.must_equal(
|
52
|
-
{
|
53
|
-
interfaces: [
|
54
|
-
{
|
55
|
-
name: 'dummy',
|
56
|
-
lines: [
|
57
|
-
{
|
58
|
-
streams: {
|
59
|
-
text: 'Some content'
|
60
|
-
}
|
61
|
-
}
|
62
|
-
]
|
63
|
-
}
|
64
|
-
]
|
65
|
-
}
|
66
|
-
)
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'returns a Hash when the output is empty' do
|
70
|
-
RawParser.parse({}).must_equal({ interfaces: [] })
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'vedeu/support/helpers'
|
3
|
-
|
4
|
-
module Vedeu
|
5
|
-
class TestHelpers
|
6
|
-
include Helpers
|
7
|
-
end
|
8
|
-
|
9
|
-
describe Helpers do
|
10
|
-
describe '.line' do
|
11
|
-
it 'returns the block with line returns removed' do
|
12
|
-
skip
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '.foreground' do
|
17
|
-
it 'returns an escape sequence for the specified CSS foreground' do
|
18
|
-
TestHelpers.new.foreground('#a5f500').must_equal("\e[38;5;148m")
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'returns an escape sequence plus interpolation when a block is given' do
|
22
|
-
TestHelpers.new.foreground('#a5f500') { 'Some text' }
|
23
|
-
.must_equal("\e[38;5;148mSome text\e[38;2;39m")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '.background' do
|
28
|
-
it 'returns an escape sequence for the specified CSS background' do
|
29
|
-
TestHelpers.new.background('#2f2f2f').must_equal("\e[48;5;16m")
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns an escape sequence plus interpolation when a block is given' do
|
33
|
-
TestHelpers.new.background('#2f2f2f') { 'Some text' }
|
34
|
-
.must_equal("\e[48;5;16mSome text\e[48;2;49m")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '.colour' do
|
39
|
-
it 'returns an escape sequence for the specified CSS colours' do
|
40
|
-
TestHelpers.new.colour({ background: '#2f2f2f', foreground: '#a5ff00' })
|
41
|
-
.must_equal("\e[38;5;154m\e[48;5;16m")
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'returns an escape sequence plus interpolation when a block is given' do
|
45
|
-
TestHelpers.new.colour({ background: '#2f2f2f', foreground: '#a5ff00' }) { 'Some text' }
|
46
|
-
.must_equal("\e[38;5;154m\e[48;5;16mSome text\e[38;2;39m\e[48;2;49m")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '.style' do
|
51
|
-
it 'returns an escape sequence for multiple styles' do
|
52
|
-
TestHelpers.new.style('bold', 'underline')
|
53
|
-
.must_equal("\e[1m\e[4m")
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'returns an escape sequence for a style' do
|
57
|
-
TestHelpers.new.style('colour_reset')
|
58
|
-
.must_equal("\e[38;2;39m\e[48;2;49m")
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'returns an empty string for no styles' do
|
62
|
-
TestHelpers.new.style.must_equal('')
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'returns an escape sequence plus interpolation when a block is given' do
|
66
|
-
TestHelpers.new.style('bold', 'underline') { 'Some text' }
|
67
|
-
.must_equal("\e[1m\e[4mSome text\e[0m")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|