vedeu 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/bin/vedeu +1 -1
- data/lib/vedeu.rb +2 -0
- data/lib/vedeu/interface/interface.rb +6 -11
- data/lib/vedeu/output/compositor.rb +49 -15
- data/lib/vedeu/output/geometry.rb +72 -0
- data/lib/vedeu/output/renderer.rb +21 -0
- data/lib/vedeu/support/terminal.rb +3 -3
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/interface/interface_test.rb +14 -13
- data/test/lib/vedeu/output/compositor_test.rb +51 -24
- data/test/lib/vedeu/output/geometry_test.rb +118 -0
- data/test/lib/vedeu/output/renderer_test.rb +9 -0
- data/test/lib/vedeu/support/terminal_test.rb +3 -9
- metadata +8 -4
- data/test/support/test_app/bin/testapp +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f49a2565aad7f4e16195f4669892ace8f6d0f8c7
|
4
|
+
data.tar.gz: 04ddcf49ad7df1af4681bfbf0109af0f0da54037
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6712ac5a5121704148d9afeb3a8ed7655e4b523f5b71f2d8d4fd477f4feff62b45ab61a598de0064491fc682698e9cc94a53587bf0c2f6ed16f633e07bb9914
|
7
|
+
data.tar.gz: 8bb9e432e9178e755b68771d51f3fbfcdd8a1eba33b4bf6ed4794dfbebb6c38a97ea44a031b12dd514902e255aef82972fc3b0b5f37706297fd42ccd26f845ae
|
data/README.md
CHANGED
@@ -46,9 +46,18 @@ TODO: Write detailed documentation
|
|
46
46
|
| | | |-- Background < Base
|
47
47
|
| | |
|
48
48
|
| | |-- Position
|
49
|
+
| | | |-- Esc
|
50
|
+
| | |
|
49
51
|
| | |-- Style
|
50
52
|
| | |-- Esc
|
51
53
|
| |
|
54
|
+
| |-- Position
|
55
|
+
| | |-- Esc
|
56
|
+
| |
|
57
|
+
| |-- Renderer
|
58
|
+
| |-- Terminal
|
59
|
+
|
|
60
|
+
|-- Geometry
|
52
61
|
| |-- Terminal
|
53
62
|
|
|
54
63
|
|-- Terminal
|
@@ -56,6 +65,12 @@ TODO: Write detailed documentation
|
|
56
65
|
Terminal
|
57
66
|
|-- Esc
|
58
67
|
|-- Position
|
68
|
+
|-- Esc
|
69
|
+
|
70
|
+
### On Interfaces
|
71
|
+
|
72
|
+
When we create the interface we define it's width, height, and origin (y, x).
|
73
|
+
These numbers are based on the area available to the terminal. If the terminal is 80x25, then our interface can use all or some of this area.
|
59
74
|
|
60
75
|
|
61
76
|
## Contributing
|
data/bin/vedeu
CHANGED
data/lib/vedeu.rb
CHANGED
@@ -7,9 +7,11 @@ require_relative 'vedeu/output/background'
|
|
7
7
|
require_relative 'vedeu/output/compositor'
|
8
8
|
require_relative 'vedeu/output/directive'
|
9
9
|
require_relative 'vedeu/output/foreground'
|
10
|
+
require_relative 'vedeu/output/geometry'
|
10
11
|
require_relative 'vedeu/output/esc'
|
11
12
|
require_relative 'vedeu/output/colour'
|
12
13
|
require_relative 'vedeu/output/position'
|
14
|
+
require_relative 'vedeu/output/renderer'
|
13
15
|
require_relative 'vedeu/output/style'
|
14
16
|
require_relative 'vedeu/output/translator'
|
15
17
|
|
@@ -25,7 +25,11 @@ module Vedeu
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def output(command)
|
28
|
-
Compositor.write(command)
|
28
|
+
Compositor.write(command, self)
|
29
|
+
end
|
30
|
+
|
31
|
+
def geometry
|
32
|
+
@geometry ||= Geometry.new(options[:geometry])
|
29
33
|
end
|
30
34
|
|
31
35
|
private
|
@@ -40,22 +44,13 @@ module Vedeu
|
|
40
44
|
Terminal.input
|
41
45
|
end
|
42
46
|
|
43
|
-
def width
|
44
|
-
options[:width]
|
45
|
-
end
|
46
|
-
|
47
|
-
def height
|
48
|
-
options[:height]
|
49
|
-
end
|
50
|
-
|
51
47
|
def options
|
52
48
|
defaults.merge!(@options)
|
53
49
|
end
|
54
50
|
|
55
51
|
def defaults
|
56
52
|
{
|
57
|
-
|
58
|
-
height: Terminal.height
|
53
|
+
geometry: {}
|
59
54
|
}
|
60
55
|
end
|
61
56
|
end
|
@@ -1,34 +1,32 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class Compositor
|
3
3
|
class << self
|
4
|
-
def write(output = [])
|
4
|
+
def write(output = [], interface = Dummy)
|
5
5
|
return if output.nil? || output.empty?
|
6
6
|
|
7
|
-
new(output).write
|
7
|
+
new(output, interface).write
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def initialize(output = [])
|
12
|
-
@output = output
|
11
|
+
def initialize(output = [], interface = Dummy)
|
12
|
+
@output, @interface = output, interface
|
13
13
|
end
|
14
14
|
|
15
15
|
def write
|
16
|
-
|
17
|
-
clear_line(index)
|
18
|
-
|
19
|
-
write_line(data)
|
20
|
-
end.join("\n")
|
16
|
+
Renderer.write(composition)
|
21
17
|
end
|
22
18
|
|
23
19
|
private
|
24
20
|
|
25
|
-
attr_reader :output
|
21
|
+
attr_reader :output, :interface
|
26
22
|
|
27
|
-
def
|
23
|
+
def composition
|
28
24
|
container = []
|
29
25
|
streams = []
|
30
26
|
output.map do |line|
|
31
|
-
line.
|
27
|
+
line.each_with_index do |stream, index|
|
28
|
+
streams << clear_line(index)
|
29
|
+
|
32
30
|
if stream.is_a?(String)
|
33
31
|
streams << stream
|
34
32
|
else
|
@@ -42,11 +40,47 @@ module Vedeu
|
|
42
40
|
end
|
43
41
|
|
44
42
|
def clear_line(index)
|
45
|
-
|
43
|
+
[position(vy(index), vx), (" " * width), position(vy(index), vx)].join
|
44
|
+
end
|
45
|
+
|
46
|
+
def vx(index = 0)
|
47
|
+
geometry.vx(index)
|
48
|
+
end
|
49
|
+
|
50
|
+
def vy(index = 0)
|
51
|
+
geometry.vy(index)
|
52
|
+
end
|
53
|
+
|
54
|
+
def height
|
55
|
+
geometry.height
|
56
|
+
end
|
57
|
+
|
58
|
+
def width
|
59
|
+
geometry.width
|
60
|
+
end
|
61
|
+
|
62
|
+
def y
|
63
|
+
geometry.y
|
64
|
+
end
|
65
|
+
|
66
|
+
def dy
|
67
|
+
geometry.dy
|
68
|
+
end
|
69
|
+
|
70
|
+
def x
|
71
|
+
geometry.x
|
72
|
+
end
|
73
|
+
|
74
|
+
def dx
|
75
|
+
geometry.dx
|
76
|
+
end
|
77
|
+
|
78
|
+
def geometry
|
79
|
+
interface.geometry
|
46
80
|
end
|
47
81
|
|
48
|
-
def
|
49
|
-
|
82
|
+
def position(y, x)
|
83
|
+
Position.set(y, x)
|
50
84
|
end
|
51
85
|
end
|
52
86
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Vedeu
|
2
|
+
class Geometry
|
3
|
+
def initialize(values = {})
|
4
|
+
@values = values
|
5
|
+
end
|
6
|
+
|
7
|
+
def z
|
8
|
+
values[:z]
|
9
|
+
end
|
10
|
+
alias_method :layer, :z
|
11
|
+
|
12
|
+
def y
|
13
|
+
values[:y]
|
14
|
+
end
|
15
|
+
alias_method :row, :y
|
16
|
+
alias_method :line, :y
|
17
|
+
|
18
|
+
def x
|
19
|
+
values[:x]
|
20
|
+
end
|
21
|
+
alias_method :column, :x
|
22
|
+
alias_method :col, :x
|
23
|
+
|
24
|
+
def width
|
25
|
+
values[:width]
|
26
|
+
end
|
27
|
+
|
28
|
+
def height
|
29
|
+
values[:height]
|
30
|
+
end
|
31
|
+
|
32
|
+
def dy
|
33
|
+
clip_y? ? defaults[:height] : (y + height)
|
34
|
+
end
|
35
|
+
|
36
|
+
def dx
|
37
|
+
clip_x? ? defaults[:width] : (x + width)
|
38
|
+
end
|
39
|
+
|
40
|
+
def vx(index = 0) # virtual x position
|
41
|
+
((x..dx).to_a)[index]
|
42
|
+
end
|
43
|
+
|
44
|
+
def vy(index = 0) # virtual y position
|
45
|
+
((y..dy).to_a)[index]
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def clip_y?
|
51
|
+
((y + height) > defaults[:height])
|
52
|
+
end
|
53
|
+
|
54
|
+
def clip_x?
|
55
|
+
((x + width) > defaults[:width])
|
56
|
+
end
|
57
|
+
|
58
|
+
def values
|
59
|
+
defaults.merge(@values)
|
60
|
+
end
|
61
|
+
|
62
|
+
def defaults
|
63
|
+
{
|
64
|
+
width: Terminal.width,
|
65
|
+
height: Terminal.height,
|
66
|
+
z: 0,
|
67
|
+
y: 1,
|
68
|
+
x: 1
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Vedeu
|
2
|
+
class Renderer
|
3
|
+
class << self
|
4
|
+
def write(composition)
|
5
|
+
new(composition).write
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(composition)
|
10
|
+
@composition = composition
|
11
|
+
end
|
12
|
+
|
13
|
+
def write
|
14
|
+
composition.map { |stream| Terminal.output(stream) }
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
attr_reader :composition
|
20
|
+
end
|
21
|
+
end
|
@@ -6,7 +6,7 @@ module Vedeu
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def output(stream = '')
|
9
|
-
console.
|
9
|
+
console.print(stream)
|
10
10
|
end
|
11
11
|
|
12
12
|
def width
|
@@ -35,7 +35,7 @@ module Vedeu
|
|
35
35
|
console.cooked do
|
36
36
|
instance.initial_setup!
|
37
37
|
|
38
|
-
yield
|
38
|
+
yield instance
|
39
39
|
end if block_given?
|
40
40
|
end
|
41
41
|
alias_method :open_cooked, :cooked
|
@@ -44,7 +44,7 @@ module Vedeu
|
|
44
44
|
console.raw do
|
45
45
|
instance.initial_setup!
|
46
46
|
|
47
|
-
yield
|
47
|
+
yield instance
|
48
48
|
end if block_given?
|
49
49
|
end
|
50
50
|
alias_method :open_raw, :raw
|
data/lib/vedeu/version.rb
CHANGED
@@ -2,39 +2,40 @@ require_relative '../../../test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
describe Interface do
|
5
|
-
let(:described_class)
|
6
|
-
let(:
|
7
|
-
let(:options)
|
5
|
+
let(:described_class) { Interface }
|
6
|
+
let(:described_instance) { described_class.new(options) }
|
7
|
+
let(:options) { {} }
|
8
8
|
|
9
|
-
|
10
|
-
Terminal.stubs(:width).returns(80)
|
11
|
-
Terminal.stubs(:height).returns(25)
|
12
|
-
end
|
13
|
-
|
14
|
-
it { instance.must_be_instance_of(Interface) }
|
9
|
+
it { described_instance.must_be_instance_of(Interface) }
|
15
10
|
|
16
11
|
describe '#initial_state' do
|
17
|
-
subject {
|
12
|
+
subject { described_instance.initial_state }
|
18
13
|
|
19
14
|
it { proc { subject }.must_raise(NotImplementedError) }
|
20
15
|
end
|
21
16
|
|
22
17
|
describe '#event_loop' do
|
23
|
-
subject {
|
18
|
+
subject { described_instance.event_loop }
|
24
19
|
|
25
20
|
it { skip }
|
26
21
|
end
|
27
22
|
|
28
23
|
describe '#input' do
|
29
|
-
subject {
|
24
|
+
subject { described_instance.input }
|
30
25
|
|
31
26
|
it { skip }
|
32
27
|
end
|
33
28
|
|
34
29
|
describe '#output' do
|
35
|
-
subject {
|
30
|
+
subject { described_instance.output }
|
36
31
|
|
37
32
|
it { skip }
|
38
33
|
end
|
34
|
+
|
35
|
+
describe '#geometry' do
|
36
|
+
subject { described_instance.geometry }
|
37
|
+
|
38
|
+
it { subject.must_be_instance_of(Geometry) }
|
39
|
+
end
|
39
40
|
end
|
40
41
|
end
|
@@ -3,101 +3,128 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
describe Compositor do
|
5
5
|
let(:described_class) { Compositor }
|
6
|
-
let(:instance)
|
7
|
-
let(:
|
8
|
-
|
9
|
-
|
6
|
+
let(:instance) { described_class.new(output, interface) }
|
7
|
+
let(:output) { [[]] }
|
8
|
+
let(:stream) {}
|
9
|
+
let(:interface) {
|
10
|
+
Vedeu::Interface.new({
|
11
|
+
geometry: {
|
12
|
+
y: 2,
|
13
|
+
x: 2,
|
14
|
+
width: 20,
|
15
|
+
height: 10
|
16
|
+
}
|
17
|
+
})
|
18
|
+
}
|
19
|
+
|
20
|
+
before do
|
21
|
+
Terminal.stubs(:output)
|
22
|
+
Renderer.stubs(:write).returns(stream)
|
23
|
+
end
|
10
24
|
|
11
25
|
it { instance.must_be_instance_of(Compositor) }
|
12
26
|
|
13
27
|
describe '.write' do
|
14
|
-
subject { described_class.write(
|
15
|
-
|
16
|
-
it { subject.must_be_instance_of(String) }
|
28
|
+
subject { described_class.write(output, interface) }
|
17
29
|
|
18
30
|
context 'when empty' do
|
19
|
-
let(:
|
31
|
+
let(:output) { [] }
|
20
32
|
|
21
33
|
it { subject.must_be_instance_of(NilClass) }
|
22
34
|
end
|
23
35
|
|
24
36
|
context 'when unstyled' do
|
25
37
|
context 'and a single line' do
|
26
|
-
let(:
|
38
|
+
let(:output) { [['Some text...']] }
|
39
|
+
let(:stream) { 'Some text...' }
|
27
40
|
|
28
|
-
it { subject.must_equal(
|
41
|
+
it { subject.must_equal(stream) }
|
29
42
|
end
|
30
43
|
|
31
44
|
context 'and multi-line' do
|
32
|
-
let(:
|
45
|
+
let(:output) {
|
33
46
|
[
|
34
47
|
['Some text...'],
|
35
48
|
['Some more text...']
|
36
49
|
]
|
37
50
|
}
|
51
|
+
let(:stream) { "Some text...\nSome more text..." }
|
38
52
|
|
39
|
-
it { subject.must_equal(
|
53
|
+
it { subject.must_equal(stream) }
|
40
54
|
end
|
41
55
|
end
|
42
56
|
|
43
57
|
context 'when styled' do
|
44
58
|
context 'with colour pair' do
|
45
59
|
context 'and a single line' do
|
46
|
-
let(:
|
60
|
+
let(:output) {
|
47
61
|
[
|
48
62
|
[[:red, :white], 'Some text...']
|
49
63
|
]
|
50
64
|
}
|
65
|
+
let(:stream) { "\e[38;5;31m\e[48;5;47mSome text..." }
|
51
66
|
|
52
|
-
it { subject.must_equal(
|
67
|
+
it { subject.must_equal(stream) }
|
53
68
|
end
|
54
69
|
|
55
70
|
context 'and multi-line' do
|
56
|
-
let(:
|
71
|
+
let(:output) {
|
57
72
|
[
|
58
73
|
[[:red, :white], 'Some text...'],
|
59
74
|
[[:blue, :yellow], 'Some more text...']
|
60
75
|
]
|
61
76
|
}
|
77
|
+
let(:stream) {
|
78
|
+
"\e[38;5;31m\e[48;5;47mSome text...\n" \
|
79
|
+
"\e[38;5;34m\e[48;5;43mSome more text..."
|
80
|
+
}
|
62
81
|
|
63
|
-
it { subject.must_equal(
|
64
|
-
"\e[38;5;34m\e[48;5;43mSome more text...") }
|
82
|
+
it { subject.must_equal(stream) }
|
65
83
|
end
|
66
84
|
end
|
67
85
|
|
68
86
|
context 'with a style' do
|
69
87
|
context 'and a single line' do
|
70
|
-
let(:
|
88
|
+
let(:output) {
|
71
89
|
[
|
72
90
|
[:bold, 'Some text...']
|
73
91
|
]
|
74
92
|
}
|
93
|
+
let(:stream) {
|
94
|
+
"\e[1mSome text..."
|
95
|
+
}
|
75
96
|
|
76
|
-
it { subject.must_equal(
|
97
|
+
it { subject.must_equal(stream) }
|
77
98
|
end
|
78
99
|
|
79
100
|
context 'and multi-line' do
|
80
|
-
let(:
|
101
|
+
let(:output) {
|
81
102
|
[
|
82
103
|
[:inverse, 'Some text...'],
|
83
104
|
[:underline, 'Some more text...']
|
84
105
|
]
|
85
106
|
}
|
107
|
+
let(:stream) {
|
108
|
+
"\e[7mSome text...\n" \
|
109
|
+
"\e[4mSome more text..."
|
110
|
+
}
|
86
111
|
|
87
|
-
it { subject.must_equal(
|
88
|
-
"\e[4mSome more text...") }
|
112
|
+
it { subject.must_equal(stream) }
|
89
113
|
end
|
90
114
|
end
|
91
115
|
|
92
116
|
context 'with an unknown style' do
|
93
|
-
let(:
|
117
|
+
let(:output) {
|
94
118
|
[
|
95
119
|
[:unknown, 'Some text...']
|
96
120
|
]
|
97
121
|
}
|
122
|
+
let(:stream) {
|
123
|
+
"Some text..."
|
124
|
+
}
|
98
125
|
|
99
126
|
it 'renders in the default style' do
|
100
|
-
subject.must_equal(
|
127
|
+
subject.must_equal(stream)
|
101
128
|
end
|
102
129
|
end
|
103
130
|
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe Geometry do
|
5
|
+
let(:described_class) { Geometry }
|
6
|
+
let(:described_instance) { described_class.new(values) }
|
7
|
+
let(:values) { {} }
|
8
|
+
|
9
|
+
before do
|
10
|
+
Terminal.stubs(:width).returns(80)
|
11
|
+
Terminal.stubs(:height).returns(25)
|
12
|
+
end
|
13
|
+
|
14
|
+
it { described_instance.must_be_instance_of(Geometry) }
|
15
|
+
|
16
|
+
describe '#z' do
|
17
|
+
subject { described_instance.z }
|
18
|
+
|
19
|
+
context 'using a value' do
|
20
|
+
let(:values) { { z: 2 } }
|
21
|
+
|
22
|
+
it { subject.must_equal(2) }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'using the default' do
|
26
|
+
it { subject.must_equal(0) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#y' do
|
31
|
+
subject { described_instance.y }
|
32
|
+
|
33
|
+
context 'using a value' do
|
34
|
+
let(:values) { { y: 17 } }
|
35
|
+
|
36
|
+
it { subject.must_equal(17) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'using the default' do
|
40
|
+
it { subject.must_equal(1) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#x' do
|
45
|
+
subject { described_instance.x }
|
46
|
+
|
47
|
+
context 'using a value' do
|
48
|
+
let(:values) { { x: 33 } }
|
49
|
+
|
50
|
+
it { subject.must_equal(33) }
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'using the default' do
|
54
|
+
it { subject.must_equal(1) }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#width' do
|
59
|
+
subject { described_instance.width }
|
60
|
+
|
61
|
+
context 'using a value' do
|
62
|
+
let(:values) { { width: 50 } }
|
63
|
+
|
64
|
+
it { subject.must_equal(50) }
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'using the default' do
|
68
|
+
it { subject.must_equal(80) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#height' do
|
73
|
+
subject { described_instance.height }
|
74
|
+
|
75
|
+
context 'using a value' do
|
76
|
+
let(:values) { { height: 20 } }
|
77
|
+
|
78
|
+
it { subject.must_equal(20) }
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'using the default' do
|
82
|
+
it { subject.must_equal(25) }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#dy' do
|
87
|
+
subject { described_instance.dy }
|
88
|
+
|
89
|
+
context 'when the value is greater than the available terminal size' do
|
90
|
+
it 'clips the value to the terminal size' do
|
91
|
+
subject.must_equal(25)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'when the value is less than the available size' do
|
96
|
+
let(:values) { { y: 20, height: 4 } }
|
97
|
+
|
98
|
+
it { subject.must_equal(24) }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe '#dx' do
|
103
|
+
subject { described_instance.dx }
|
104
|
+
|
105
|
+
context 'when the value is greater than the available terminal size' do
|
106
|
+
it 'clips the value to the terminal size' do
|
107
|
+
subject.must_equal(80)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'when the value is less than the available size' do
|
112
|
+
let(:values) { { x: 17, width: 21 } }
|
113
|
+
|
114
|
+
it { subject.must_equal(38) }
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -8,6 +8,7 @@ module Vedeu
|
|
8
8
|
before do
|
9
9
|
IO.stubs(:console).returns(console)
|
10
10
|
console.stubs(:winsize).returns([25, 80])
|
11
|
+
console.stubs(:print)
|
11
12
|
end
|
12
13
|
|
13
14
|
describe '.input' do
|
@@ -19,7 +20,7 @@ module Vedeu
|
|
19
20
|
end
|
20
21
|
|
21
22
|
describe '.output' do
|
22
|
-
before { console.stubs(:
|
23
|
+
before { console.stubs(:print).returns("test") }
|
23
24
|
|
24
25
|
subject { described_class.output }
|
25
26
|
|
@@ -87,10 +88,7 @@ module Vedeu
|
|
87
88
|
end
|
88
89
|
|
89
90
|
describe '.clear_screen' do
|
90
|
-
before
|
91
|
-
Esc.stubs(:clear).returns('')
|
92
|
-
console.stubs(:puts)
|
93
|
-
end
|
91
|
+
before { Esc.stubs(:clear).returns('') }
|
94
92
|
|
95
93
|
subject { described_class.clear_screen }
|
96
94
|
|
@@ -110,8 +108,6 @@ module Vedeu
|
|
110
108
|
end
|
111
109
|
|
112
110
|
describe '.show_cursor' do
|
113
|
-
before { console.stubs(:puts) }
|
114
|
-
|
115
111
|
subject { described_class.show_cursor }
|
116
112
|
|
117
113
|
it { subject.must_be_instance_of(NilClass) }
|
@@ -124,8 +120,6 @@ module Vedeu
|
|
124
120
|
end
|
125
121
|
|
126
122
|
describe '.hide_cursor' do
|
127
|
-
before { console.stubs(:puts) }
|
128
|
-
|
129
123
|
subject { described_class.hide_cursor }
|
130
124
|
|
131
125
|
it { subject.must_be_instance_of(NilClass) }
|
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.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -164,7 +164,9 @@ files:
|
|
164
164
|
- lib/vedeu/output/directive.rb
|
165
165
|
- lib/vedeu/output/esc.rb
|
166
166
|
- lib/vedeu/output/foreground.rb
|
167
|
+
- lib/vedeu/output/geometry.rb
|
167
168
|
- lib/vedeu/output/position.rb
|
169
|
+
- lib/vedeu/output/renderer.rb
|
168
170
|
- lib/vedeu/output/style.rb
|
169
171
|
- lib/vedeu/output/translator.rb
|
170
172
|
- lib/vedeu/process/command.rb
|
@@ -183,7 +185,9 @@ files:
|
|
183
185
|
- test/lib/vedeu/output/directive_test.rb
|
184
186
|
- test/lib/vedeu/output/esc_test.rb
|
185
187
|
- test/lib/vedeu/output/foreground_test.rb
|
188
|
+
- test/lib/vedeu/output/geometry_test.rb
|
186
189
|
- test/lib/vedeu/output/position_test.rb
|
190
|
+
- test/lib/vedeu/output/renderer_test.rb
|
187
191
|
- test/lib/vedeu/output/style_test.rb
|
188
192
|
- test/lib/vedeu/output/translator_test.rb
|
189
193
|
- test/lib/vedeu/process/command_test.rb
|
@@ -191,7 +195,6 @@ files:
|
|
191
195
|
- test/lib/vedeu/process/exit_test.rb
|
192
196
|
- test/lib/vedeu/support/terminal_test.rb
|
193
197
|
- test/lib/vedeu/version_test.rb
|
194
|
-
- test/support/test_app/bin/testapp
|
195
198
|
- test/test_helper.rb
|
196
199
|
- vedeu.gemspec
|
197
200
|
homepage: http://www.gavinlaking.name/
|
@@ -230,7 +233,9 @@ test_files:
|
|
230
233
|
- test/lib/vedeu/output/directive_test.rb
|
231
234
|
- test/lib/vedeu/output/esc_test.rb
|
232
235
|
- test/lib/vedeu/output/foreground_test.rb
|
236
|
+
- test/lib/vedeu/output/geometry_test.rb
|
233
237
|
- test/lib/vedeu/output/position_test.rb
|
238
|
+
- test/lib/vedeu/output/renderer_test.rb
|
234
239
|
- test/lib/vedeu/output/style_test.rb
|
235
240
|
- test/lib/vedeu/output/translator_test.rb
|
236
241
|
- test/lib/vedeu/process/command_test.rb
|
@@ -238,6 +243,5 @@ test_files:
|
|
238
243
|
- test/lib/vedeu/process/exit_test.rb
|
239
244
|
- test/lib/vedeu/support/terminal_test.rb
|
240
245
|
- test/lib/vedeu/version_test.rb
|
241
|
-
- test/support/test_app/bin/testapp
|
242
246
|
- test/test_helper.rb
|
243
247
|
has_rdoc:
|
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
-> { its -> { a } }
|
4
|
-
trap('INT') { exit! }
|
5
|
-
|
6
|
-
require_relative '../../../../lib/vedeu'
|
7
|
-
|
8
|
-
class Fake
|
9
|
-
def self.dispatch
|
10
|
-
puts "Fake dispatched..."
|
11
|
-
[
|
12
|
-
[[17, 6], [:red, :white], "Fake executed...", :reset],
|
13
|
-
[[19, 5], [:green, :white], "Test executed...", :reset],
|
14
|
-
]
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Vedeu::Interfaces.default
|
19
|
-
|
20
|
-
Vedeu::Commands.define do |command|
|
21
|
-
command.add("test", Fake)
|
22
|
-
end
|
23
|
-
|
24
|
-
Vedeu::Application.start
|