vedeu 0.0.29 → 0.0.30
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 +27 -2
- data/lib/vedeu/application.rb +2 -0
- data/lib/vedeu/models/composition.rb +11 -1
- data/lib/vedeu/models/interface.rb +16 -2
- data/lib/vedeu/models/interface_collection.rb +3 -12
- data/lib/vedeu/models/line.rb +12 -1
- data/lib/vedeu/models/line_collection.rb +5 -13
- data/lib/vedeu/models/stream.rb +11 -1
- data/lib/vedeu/models/stream_collection.rb +5 -13
- data/lib/vedeu/models/style_collection.rb +5 -9
- data/lib/vedeu/output/output.rb +2 -6
- data/lib/vedeu/repository/repository.rb +0 -4
- data/lib/vedeu/support/esc.rb +23 -77
- data/lib/vedeu/support/parser.rb +1 -1
- data/lib/vedeu/support/terminal.rb +5 -6
- data/lib/vedeu/support/wordwrap.rb +3 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/models/composition_test.rb +4 -4
- data/test/lib/vedeu/models/interface_collection_test.rb +5 -1
- data/test/lib/vedeu/models/interface_test.rb +1 -1
- data/test/lib/vedeu/models/line_test.rb +10 -1
- data/test/lib/vedeu/models/presentation_test.rb +32 -1
- data/test/lib/vedeu/output/output_test.rb +3 -11
- data/test/lib/vedeu/repository/repository_test.rb +0 -9
- data/test/lib/vedeu/support/esc_test.rb +2 -158
- data/vedeu.gemspec +3 -3
- metadata +14 -25
- data/bin/composition +0 -14
- data/examples/single_interface_app.rb +0 -49
- data/lib/vedeu/models/coercions.rb +0 -21
- data/lib/vedeu/support/cursor.rb +0 -51
- data/test/lib/vedeu/support/cursor_test.rb +0 -176
- data/test/support/output_2.json +0 -1
- data/test/support/output_2.rb +0 -19
data/bin/composition
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
lib_dir = File.dirname(__FILE__) + '/../lib'
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
|
-
|
6
|
-
-> { its -> { a } }
|
7
|
-
trap('INT') { exit! }
|
8
|
-
|
9
|
-
require 'vedeu'
|
10
|
-
require 'pry'
|
11
|
-
|
12
|
-
json = File.read('../test/support/composition.json')
|
13
|
-
hash = Yajl::Parser.parse(json)
|
14
|
-
comp = Vedeu::Composition.new(hash)
|
@@ -1,49 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'vedeu'
|
4
|
-
|
5
|
-
class SingleInterfaceApp
|
6
|
-
include Vedeu
|
7
|
-
|
8
|
-
interface :main, {
|
9
|
-
y: 1,
|
10
|
-
x: 1,
|
11
|
-
z: 1,
|
12
|
-
width: :auto,
|
13
|
-
height: :auto,
|
14
|
-
colour: {
|
15
|
-
foreground: '#ffffff',
|
16
|
-
background: '#000000',
|
17
|
-
},
|
18
|
-
cursor: true
|
19
|
-
}
|
20
|
-
|
21
|
-
command :refresh, {
|
22
|
-
entity: SingleInterfaceApp,
|
23
|
-
keyword: 'refresh',
|
24
|
-
keypress: 'r',
|
25
|
-
arguments: [] }
|
26
|
-
command :exit, {
|
27
|
-
entity: Vedeu::Exit,
|
28
|
-
keyword: 'exit',
|
29
|
-
keypress: 'q',
|
30
|
-
arguments: [] }
|
31
|
-
|
32
|
-
def self.start
|
33
|
-
Vedeu::Launcher.new(ARGV.dup).execute!
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.dispatch
|
37
|
-
{
|
38
|
-
'main' => [
|
39
|
-
[
|
40
|
-
{
|
41
|
-
:text => "The time is: #{Time.now}.",
|
42
|
-
}
|
43
|
-
]
|
44
|
-
]
|
45
|
-
}
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
SingleInterfaceApp.start
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
module Coercions
|
3
|
-
private
|
4
|
-
|
5
|
-
def multiple?(values)
|
6
|
-
values.is_a?(::Array)
|
7
|
-
end
|
8
|
-
|
9
|
-
def single?(values)
|
10
|
-
values.is_a?(::Hash)
|
11
|
-
end
|
12
|
-
|
13
|
-
def just_text?(values)
|
14
|
-
values.is_a?(::String)
|
15
|
-
end
|
16
|
-
|
17
|
-
def empty?(values)
|
18
|
-
values.nil? || values.empty?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/vedeu/support/cursor.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require_relative 'esc'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
module Cursor
|
5
|
-
extend self
|
6
|
-
|
7
|
-
def show
|
8
|
-
[Esc.esc, '?25h'].join
|
9
|
-
end
|
10
|
-
|
11
|
-
def hide
|
12
|
-
[Esc.esc, '?25l'].join
|
13
|
-
end
|
14
|
-
|
15
|
-
def home
|
16
|
-
[Esc.esc, 'H'].join
|
17
|
-
end
|
18
|
-
|
19
|
-
def up(count = 1)
|
20
|
-
[Esc.esc, "#{count || 1}", 'A'].join
|
21
|
-
end
|
22
|
-
|
23
|
-
def down(count = 1)
|
24
|
-
[Esc.esc, "#{count || 1}", 'B'].join
|
25
|
-
end
|
26
|
-
|
27
|
-
def right(count = 1)
|
28
|
-
[Esc.esc, "#{count || 1}", 'C'].join
|
29
|
-
end
|
30
|
-
|
31
|
-
def left(count = 1)
|
32
|
-
[Esc.esc, "#{count || 1}", 'D'].join
|
33
|
-
end
|
34
|
-
|
35
|
-
def save
|
36
|
-
[Esc.esc, 's'].join
|
37
|
-
end
|
38
|
-
|
39
|
-
def restore
|
40
|
-
[Esc.esc, 'u'].join
|
41
|
-
end
|
42
|
-
|
43
|
-
def save_all
|
44
|
-
[Esc.esc, '7'].join
|
45
|
-
end
|
46
|
-
|
47
|
-
def restore_all
|
48
|
-
[Esc.esc, '8'].join
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,176 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
require_relative '../../../../lib/vedeu/support/cursor'
|
3
|
-
|
4
|
-
module Vedeu
|
5
|
-
describe Cursor do
|
6
|
-
let(:described_class) { Cursor }
|
7
|
-
|
8
|
-
describe '.hide' do
|
9
|
-
let(:subject) { described_class.hide }
|
10
|
-
|
11
|
-
it 'returns a String' do
|
12
|
-
subject.must_be_instance_of(String)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'returns an escape sequence' do
|
16
|
-
subject.must_equal("\e[?25l")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '.show' do
|
21
|
-
let(:subject) { described_class.show }
|
22
|
-
|
23
|
-
it 'returns a String' do
|
24
|
-
subject.must_be_instance_of(String)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'returns an escape sequence' do
|
28
|
-
subject.must_equal("\e[?25h")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '.home' do
|
33
|
-
let(:subject) { described_class.home }
|
34
|
-
|
35
|
-
it 'returns a String' do
|
36
|
-
subject.must_be_instance_of(String)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'returns an escape sequence' do
|
40
|
-
subject.must_equal("\e[H")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '.up' do
|
45
|
-
let(:subject) { described_class.up(count) }
|
46
|
-
let(:count) {}
|
47
|
-
|
48
|
-
it 'returns a String' do
|
49
|
-
subject.must_be_instance_of(String)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'returns an escape sequence' do
|
53
|
-
subject.must_equal("\e[1A")
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'with a count' do
|
57
|
-
let(:count) { 3 }
|
58
|
-
|
59
|
-
it 'returns an escape sequence' do
|
60
|
-
subject.must_equal("\e[3A")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '.down' do
|
66
|
-
let(:subject) { described_class.down(count) }
|
67
|
-
let(:count) {}
|
68
|
-
|
69
|
-
it 'returns a String' do
|
70
|
-
subject.must_be_instance_of(String)
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'returns an escape sequence' do
|
74
|
-
subject.must_equal("\e[1B")
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'with a count' do
|
78
|
-
let(:count) { 3 }
|
79
|
-
|
80
|
-
it 'returns an escape sequence' do
|
81
|
-
subject.must_equal("\e[3B")
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe '.right' do
|
87
|
-
let(:subject) { described_class.right(count) }
|
88
|
-
let(:count) {}
|
89
|
-
|
90
|
-
it 'returns a String' do
|
91
|
-
subject.must_be_instance_of(String)
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'returns an escape sequence' do
|
95
|
-
subject.must_equal("\e[1C")
|
96
|
-
end
|
97
|
-
|
98
|
-
context 'with a count' do
|
99
|
-
let(:count) { 3 }
|
100
|
-
|
101
|
-
it 'returns an escape sequence' do
|
102
|
-
subject.must_equal("\e[3C")
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe '.left' do
|
108
|
-
let(:subject) { described_class.left(count) }
|
109
|
-
let(:count) {}
|
110
|
-
|
111
|
-
it 'returns a String' do
|
112
|
-
subject.must_be_instance_of(String)
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'returns an escape sequence' do
|
116
|
-
subject.must_equal("\e[1D")
|
117
|
-
end
|
118
|
-
|
119
|
-
context 'with a count' do
|
120
|
-
let(:count) { 3 }
|
121
|
-
|
122
|
-
it 'returns an escape sequence' do
|
123
|
-
subject.must_equal("\e[3D")
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe '.save' do
|
129
|
-
let(:subject) { described_class.save }
|
130
|
-
|
131
|
-
it 'returns a String' do
|
132
|
-
subject.must_be_instance_of(String)
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'returns an escape sequence' do
|
136
|
-
subject.must_equal("\e[s")
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe '.restore' do
|
141
|
-
let(:subject) { described_class.restore }
|
142
|
-
|
143
|
-
it 'returns a String' do
|
144
|
-
subject.must_be_instance_of(String)
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'returns an escape sequence' do
|
148
|
-
subject.must_equal("\e[u")
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
describe '.save_all' do
|
153
|
-
let(:subject) { described_class.save_all }
|
154
|
-
|
155
|
-
it 'returns a String' do
|
156
|
-
subject.must_be_instance_of(String)
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'returns an escape sequence' do
|
160
|
-
subject.must_equal("\e[7")
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
describe '.restore_all' do
|
165
|
-
let(:subject) { described_class.restore_all }
|
166
|
-
|
167
|
-
it 'returns a String' do
|
168
|
-
subject.must_be_instance_of(String)
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'returns an escape sequence' do
|
172
|
-
subject.must_equal("\e[8")
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
data/test/support/output_2.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{":interface":{":name":"dummy",":lines":[{":text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit."},{":text":"Aliquam pellentesque metus id lacinia viverra. Cras malesuada"},{":text":"hendrerit neque, a pharetra risus posuere elementum. Ut felis elit,"},{":text":"semper vel ornare ut, vestibulum sit amet orci. Donec eu tortor."}]}}"
|
data/test/support/output_2.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
{
|
2
|
-
interface: {
|
3
|
-
name: 'dummy',
|
4
|
-
lines: [
|
5
|
-
{
|
6
|
-
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
|
7
|
-
},
|
8
|
-
{
|
9
|
-
text: 'Aliquam pellentesque metus id lacinia viverra. Cras malesuada'
|
10
|
-
},
|
11
|
-
{
|
12
|
-
text: 'hendrerit neque, a pharetra risus posuere elementum. Ut felis elit,'
|
13
|
-
},
|
14
|
-
{
|
15
|
-
text: 'semper vel ornare ut, vestibulum sit amet orci. Donec eu tortor.'
|
16
|
-
}
|
17
|
-
]
|
18
|
-
}
|
19
|
-
}
|