vedeu 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -17
- data/documentation/composition.ebnf +7 -0
- data/documentation/diagram/ColourDirective.png +0 -0
- data/documentation/diagram/Directive.png +0 -0
- data/documentation/diagram/Interface.png +0 -0
- data/documentation/diagram/Output.png +0 -0
- data/documentation/diagram/PositionDirective.png +0 -0
- data/documentation/diagram/Stream.png +0 -0
- data/documentation/diagram/StyleDirective.png +0 -0
- data/documentation/diagram/rr-1.35.837.png +0 -0
- data/documentation/index.html +325 -0
- data/lib/vedeu.rb +2 -0
- data/lib/vedeu/output/compositor.rb +3 -3
- data/lib/vedeu/output/directive.rb +17 -5
- data/lib/vedeu/repository/command_repository.rb +2 -10
- data/lib/vedeu/repository/interface_repository.rb +1 -1
- data/lib/vedeu/repository/storage.rb +2 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/output/directive_test.rb +12 -2
- data/test/lib/vedeu/repository/interface_repository_test.rb +3 -1
- data/test/lib/vedeu/repository/storage_test.rb +2 -2
- data/test/lib/vedeu_test.rb +11 -0
- data/test/test_helper.rb +3 -2
- metadata +13 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2f4d3d8682b701ed87f0984fefae3f3a4e62e7a
|
4
|
+
data.tar.gz: d1dbc4ba626a7f719ba6789905f51688fbdb1ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ec2bfeee749b873c1a768cabe45574aa98378a67402959dd0189aa0b181cebae81d8dadeb32a0f40d32a7c736880565c553b6ed78b9fd8d751d0ccd776ef927
|
7
|
+
data.tar.gz: 13fc99fc61a854fd5923034e663868da7070ffa54c3b6eabb784c42daba9eecf306a6c39a11c7f8662134d2bd5e62d9a22026eaf99fe9961366ee4925d46544c
|
data/README.md
CHANGED
@@ -20,12 +20,23 @@ TODO: Write detailed documentation
|
|
20
20
|
|
21
21
|
## Notes
|
22
22
|
|
23
|
-
|
24
|
-
|--
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
Launcher
|
24
|
+
|-- Application
|
25
|
+
|-- EventLoop
|
26
|
+
| |-- Input
|
27
|
+
| | |-- Queue
|
28
|
+
| | |-- Terminal
|
29
|
+
| |
|
30
|
+
| |-- Process
|
31
|
+
| | |-- CommandRepository
|
32
|
+
| | |-- Queue
|
33
|
+
| |
|
34
|
+
| |-- Output
|
35
|
+
| |-- Compositor
|
36
|
+
| |-- Queue
|
37
|
+
|
|
38
|
+
|-- InterfaceRepository
|
39
|
+
|-- Terminal
|
29
40
|
|
30
41
|
Base
|
31
42
|
|-- Translator
|
@@ -70,6 +81,8 @@ TODO: Write detailed documentation
|
|
70
81
|
|-- Position
|
71
82
|
|-- Esc
|
72
83
|
|
84
|
+
Wordwrap
|
85
|
+
|
73
86
|
### On Interfaces
|
74
87
|
|
75
88
|
When we create the interface we define it's width, height, and origin (y, x).
|
@@ -77,19 +90,17 @@ These numbers are based on the area available to the terminal. If the terminal i
|
|
77
90
|
|
78
91
|
### On Composition
|
79
92
|
|
80
|
-
|
81
|
-
main: # interface
|
82
|
-
[ # stream
|
83
|
-
[ # directive
|
84
|
-
34, 22 # position directive
|
85
|
-
:red, :black # colour directive
|
86
|
-
],
|
93
|
+
To compose data suitable for output in Vedeu, you can use this EBNF. Diagrams are available in the `documentation` directory.
|
87
94
|
|
88
|
-
|
95
|
+
Output ::= (('{' (Interface '=>' Stream) '}' (',' | ))* | ('[' (Stream (',' | ))* ']' (',' | ))* | ('[' (String (',' | ))* ']') (',' | ))*
|
96
|
+
Stream ::= ('[' (Directive (',' | ) | String (',' | ))* ']' (',' | ))*
|
97
|
+
Interface ::= String
|
98
|
+
Directive ::= PositionDirective | ColourDirective | StyleDirective
|
99
|
+
PositionDirective ::= '[' Fixnum ',' Fixnum ']'
|
100
|
+
StyleDirective ::= Symbol
|
101
|
+
ColourDirective ::= '[' Symbol ',' Symbol ']'
|
89
102
|
|
90
|
-
|
91
|
-
]
|
92
|
-
}
|
103
|
+
Diagrams were produced using the Railroad Diagram Generator at `http://bottlecaps.de/rr/ui`.
|
93
104
|
|
94
105
|
## Usage
|
95
106
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Output ::= (('{' (Interface '=>' Stream) '}' (',' | ))* | ('[' (Stream (',' | ))* ']' (',' | ))* | ('[' (String (',' | ))* ']') (',' | ))*
|
2
|
+
Stream ::= ('[' (Directive (',' | ) | String (',' | ))* ']' (',' | ))*
|
3
|
+
Interface ::= String
|
4
|
+
Directive ::= PositionDirective | ColourDirective | StyleDirective
|
5
|
+
PositionDirective ::= '[' Fixnum ',' Fixnum ']'
|
6
|
+
StyleDirective ::= Symbol
|
7
|
+
ColourDirective ::= '[' Symbol ',' Symbol ']'
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,325 @@
|
|
1
|
+
<!DOCTYPE html
|
2
|
+
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
6
|
+
<meta content="Railroad Diagram Generator 1.35.837" name="generator"><style type="text/css" xml:space="preserve">
|
7
|
+
::-moz-selection
|
8
|
+
{
|
9
|
+
color: #FFFCF0;
|
10
|
+
background: #0F0C00;
|
11
|
+
}
|
12
|
+
::selection
|
13
|
+
{
|
14
|
+
color: #FFFCF0;
|
15
|
+
background: #0F0C00;
|
16
|
+
}
|
17
|
+
.ebnf a
|
18
|
+
{
|
19
|
+
text-decoration: none;
|
20
|
+
}
|
21
|
+
.ebnf a:hover
|
22
|
+
{
|
23
|
+
color: #050400;
|
24
|
+
text-decoration: underline;
|
25
|
+
}
|
26
|
+
.signature
|
27
|
+
{
|
28
|
+
color: #806600;
|
29
|
+
font-size: 11px;
|
30
|
+
text-align: right;
|
31
|
+
}
|
32
|
+
body
|
33
|
+
{
|
34
|
+
font: normal 12px Verdana, sans-serif;
|
35
|
+
color: #0F0C00;
|
36
|
+
background: #FFFCF0;
|
37
|
+
}
|
38
|
+
a:link, a:visited
|
39
|
+
{
|
40
|
+
color: #0F0C00;
|
41
|
+
}
|
42
|
+
a:link.signature, a:visited.signature
|
43
|
+
{
|
44
|
+
color: #806600;
|
45
|
+
}
|
46
|
+
a.button, #tabs li a
|
47
|
+
{
|
48
|
+
padding: 0.25em 0.5em;
|
49
|
+
border: 1px solid #806600;
|
50
|
+
background: #F1E8C6;
|
51
|
+
color: #806600;
|
52
|
+
text-decoration: none;
|
53
|
+
font-weight: bold;
|
54
|
+
}
|
55
|
+
a.button:hover, #tabs li a:hover
|
56
|
+
{
|
57
|
+
color: #050400;
|
58
|
+
background: #FFF6D1;
|
59
|
+
border-color: #050400;
|
60
|
+
}
|
61
|
+
#tabs
|
62
|
+
{
|
63
|
+
padding: 3px 10px;
|
64
|
+
margin-left: 0;
|
65
|
+
margin-top: 58px;
|
66
|
+
border-bottom: 1px solid #0F0C00;
|
67
|
+
}
|
68
|
+
#tabs li
|
69
|
+
{
|
70
|
+
list-style: none;
|
71
|
+
margin-left: 5px;
|
72
|
+
display: inline;
|
73
|
+
}
|
74
|
+
#tabs li a
|
75
|
+
{
|
76
|
+
border-bottom: 1px solid #0F0C00;
|
77
|
+
}
|
78
|
+
#tabs li a.active
|
79
|
+
{
|
80
|
+
color: #0F0C00;
|
81
|
+
background: #FFFCF0;
|
82
|
+
border-color: #0F0C00;
|
83
|
+
border-bottom: 1px solid #FFFCF0;
|
84
|
+
outline: none;
|
85
|
+
}
|
86
|
+
#divs div
|
87
|
+
{
|
88
|
+
display: none;
|
89
|
+
overflow:auto;
|
90
|
+
}
|
91
|
+
#divs div.active
|
92
|
+
{
|
93
|
+
display: block;
|
94
|
+
}
|
95
|
+
#text
|
96
|
+
{
|
97
|
+
border-color: #806600;
|
98
|
+
background: #FFFEFA;
|
99
|
+
color: #050400;
|
100
|
+
}
|
101
|
+
.small
|
102
|
+
{
|
103
|
+
vertical-align: top;
|
104
|
+
text-align: right;
|
105
|
+
font-size: 9px;
|
106
|
+
font-weight: normal;
|
107
|
+
line-height: 120%;
|
108
|
+
}
|
109
|
+
td.small
|
110
|
+
{
|
111
|
+
padding-top: 0px;
|
112
|
+
}
|
113
|
+
.hidden
|
114
|
+
{
|
115
|
+
visibility: hidden;
|
116
|
+
}
|
117
|
+
td:hover .hidden
|
118
|
+
{
|
119
|
+
visibility: visible;
|
120
|
+
}
|
121
|
+
div.download
|
122
|
+
{
|
123
|
+
display: none;
|
124
|
+
background: #FFFCF0;
|
125
|
+
position: absolute;
|
126
|
+
right: 34px;
|
127
|
+
top: 94px;
|
128
|
+
padding: 10px;
|
129
|
+
border: 1px dotted #0F0C00;
|
130
|
+
}
|
131
|
+
#divs div.ebnf, div.ebnf
|
132
|
+
{
|
133
|
+
display: block;
|
134
|
+
padding-left: 16px;
|
135
|
+
padding-top: 2px;
|
136
|
+
padding-bottom: 2px;
|
137
|
+
background: #FFF6D1;
|
138
|
+
}
|
139
|
+
table.palette
|
140
|
+
{
|
141
|
+
border-top: 1px solid #050400;
|
142
|
+
border-right: 1px solid #050400;
|
143
|
+
margin-bottom: 4px
|
144
|
+
}
|
145
|
+
td.palette
|
146
|
+
{
|
147
|
+
border-bottom: 1px solid #050400;
|
148
|
+
border-left: 1px solid #050400;
|
149
|
+
}
|
150
|
+
a.palette
|
151
|
+
{
|
152
|
+
padding: 2px 3px 2px 10px;
|
153
|
+
text-decoration: none;
|
154
|
+
}
|
155
|
+
.palette
|
156
|
+
{
|
157
|
+
-webkit-user-select: none;
|
158
|
+
-khtml-user-select: none;
|
159
|
+
-moz-user-select: none;
|
160
|
+
-o-user-select: none;
|
161
|
+
-ms-user-select: none;
|
162
|
+
}
|
163
|
+
</style></head>
|
164
|
+
<body>
|
165
|
+
|
166
|
+
<p style="font-size: 14px; font-weight:bold"><a name="Output">Output:</a></p>
|
167
|
+
<img border="0" height="328" src="diagram/Output.png" usemap="#Output.map" width="622"><map name="Output.map">
|
168
|
+
<area coords="157,33,233,65" href="#Interface" shape="rect" title="Interface">
|
169
|
+
<area coords="313,33,377,65" href="#Stream" shape="rect" title="Stream">
|
170
|
+
<area coords="195,131,259,163" href="#Stream" shape="rect" title="Stream">
|
171
|
+
<area coords="175,229,231,261" href="#String" shape="rect" title="String"></map>
|
172
|
+
|
173
|
+
<p>
|
174
|
+
|
175
|
+
<div class="ebnf"><pre><a href="#Output" shape="rect" title="Output">Output</a> ::= ( ( '{' <a href="#Interface" shape="rect" title="Interface">Interface</a> '=>' <a href="#Stream" shape="rect" title="Stream">Stream</a> '}' ( ',' | ) )* | ( '[' ( <a href="#Stream" shape="rect" title="Stream">Stream</a> ( ',' | ) )* ']' ( ',' | ) )* | '[' ( <a href="#String" shape="rect" title="String">String</a> ( ',' | ) )* ']' ( ',' | ) )*</pre></div>
|
176
|
+
|
177
|
+
</p>
|
178
|
+
|
179
|
+
<p>no references</p><br><p style="font-size: 14px; font-weight:bold"><a name="Stream">Stream:</a></p>
|
180
|
+
<img border="0" height="182" src="diagram/Stream.png" usemap="#Stream.map" width="592"><map name="Stream.map">
|
181
|
+
<area coords="175,33,249,65" href="#Directive" shape="rect" title="Directive">
|
182
|
+
<area coords="175,99,231,131" href="#String" shape="rect" title="String"></map>
|
183
|
+
|
184
|
+
<p>
|
185
|
+
|
186
|
+
<div class="ebnf"><pre><a href="#Stream" shape="rect" title="Stream">Stream</a> ::= ( '[' ( <a href="#Directive" shape="rect" title="Directive">Directive</a> ( ',' | ) | <a href="#String" shape="rect" title="String">String</a> ( ',' | ) )* ']' ( ',' | ) )*</pre></div>
|
187
|
+
|
188
|
+
</p>
|
189
|
+
|
190
|
+
<p>referenced by:
|
191
|
+
|
192
|
+
<ul>
|
193
|
+
|
194
|
+
<li><a href="#Output" title="Output">Output</a></li>
|
195
|
+
|
196
|
+
</ul>
|
197
|
+
|
198
|
+
</p><br><p style="font-size: 14px; font-weight:bold"><a name="Interface">Interface:</a></p>
|
199
|
+
<img border="0" height="36" src="diagram/Interface.png" usemap="#Interface.map" width="114"><map name="Interface.map">
|
200
|
+
<area coords="29,1,85,33" href="#String" shape="rect" title="String"></map>
|
201
|
+
|
202
|
+
<p>
|
203
|
+
|
204
|
+
<div class="ebnf"><pre><a href="#Interface" shape="rect" title="Interface">Interface</a>
|
205
|
+
::= <a href="#String" shape="rect" title="String">String</a></pre></div>
|
206
|
+
|
207
|
+
</p>
|
208
|
+
|
209
|
+
<p>referenced by:
|
210
|
+
|
211
|
+
<ul>
|
212
|
+
|
213
|
+
<li><a href="#Output" title="Output">Output</a></li>
|
214
|
+
|
215
|
+
</ul>
|
216
|
+
|
217
|
+
</p><br><p style="font-size: 14px; font-weight:bold"><a name="Directive">Directive:</a></p>
|
218
|
+
<img border="0" height="124" src="diagram/Directive.png" usemap="#Directive.map" width="222"><map name="Directive.map">
|
219
|
+
<area coords="49,1,173,33" href="#PositionDirective" shape="rect" title="PositionDirective">
|
220
|
+
<area coords="49,45,163,77" href="#ColourDirective" shape="rect" title="ColourDirective">
|
221
|
+
<area coords="49,89,153,121" href="#StyleDirective" shape="rect" title="StyleDirective"></map>
|
222
|
+
|
223
|
+
<p>
|
224
|
+
|
225
|
+
<div class="ebnf"><pre><a href="#Directive" shape="rect" title="Directive">Directive</a>
|
226
|
+
::= <a href="#PositionDirective" shape="rect" title="PositionDirective">PositionDirective</a>
|
227
|
+
| <a href="#ColourDirective" shape="rect" title="ColourDirective">ColourDirective</a>
|
228
|
+
| <a href="#StyleDirective" shape="rect" title="StyleDirective">StyleDirective</a></pre></div>
|
229
|
+
|
230
|
+
</p>
|
231
|
+
|
232
|
+
<p>referenced by:
|
233
|
+
|
234
|
+
<ul>
|
235
|
+
|
236
|
+
<li><a href="#Stream" title="Stream">Stream</a></li>
|
237
|
+
|
238
|
+
</ul>
|
239
|
+
|
240
|
+
</p><br><p style="font-size: 14px; font-weight:bold"><a name="PositionDirective">PositionDirective:</a></p>
|
241
|
+
<img border="0" height="36" src="diagram/PositionDirective.png" usemap="#PositionDirective.map" width="342"><map name="PositionDirective.map">
|
242
|
+
<area coords="75,1,139,33" href="#Fixnum" shape="rect" title="Fixnum">
|
243
|
+
<area coords="203,1,267,33" href="#Fixnum" shape="rect" title="Fixnum"></map>
|
244
|
+
|
245
|
+
<p>
|
246
|
+
|
247
|
+
<div class="ebnf"><pre><a href="#PositionDirective" shape="rect" title="PositionDirective">PositionDirective</a>
|
248
|
+
::= '[' <a href="#Fixnum" shape="rect" title="Fixnum">Fixnum</a> ',' <a href="#Fixnum" shape="rect" title="Fixnum">Fixnum</a> ']'</pre></div>
|
249
|
+
|
250
|
+
</p>
|
251
|
+
|
252
|
+
<p>referenced by:
|
253
|
+
|
254
|
+
<ul>
|
255
|
+
|
256
|
+
<li><a href="#Directive" title="Directive">Directive</a></li>
|
257
|
+
|
258
|
+
</ul>
|
259
|
+
|
260
|
+
</p><br><p style="font-size: 14px; font-weight:bold"><a name="StyleDirective">StyleDirective:</a></p>
|
261
|
+
<img border="0" height="36" src="diagram/StyleDirective.png" usemap="#StyleDirective.map" width="122"><map name="StyleDirective.map">
|
262
|
+
<area coords="29,1,93,33" href="#Symbol" shape="rect" title="Symbol"></map>
|
263
|
+
|
264
|
+
<p>
|
265
|
+
|
266
|
+
<div class="ebnf"><pre><a href="#StyleDirective" shape="rect" title="StyleDirective">StyleDirective</a>
|
267
|
+
::= <a href="#Symbol" shape="rect" title="Symbol">Symbol</a></pre></div>
|
268
|
+
|
269
|
+
</p>
|
270
|
+
|
271
|
+
<p>referenced by:
|
272
|
+
|
273
|
+
<ul>
|
274
|
+
|
275
|
+
<li><a href="#Directive" title="Directive">Directive</a></li>
|
276
|
+
|
277
|
+
</ul>
|
278
|
+
|
279
|
+
</p><br><p style="font-size: 14px; font-weight:bold"><a name="ColourDirective">ColourDirective:</a></p>
|
280
|
+
<img border="0" height="36" src="diagram/ColourDirective.png" usemap="#ColourDirective.map" width="342"><map name="ColourDirective.map">
|
281
|
+
<area coords="75,1,139,33" href="#Symbol" shape="rect" title="Symbol">
|
282
|
+
<area coords="203,1,267,33" href="#Symbol" shape="rect" title="Symbol"></map>
|
283
|
+
|
284
|
+
<p>
|
285
|
+
|
286
|
+
<div class="ebnf"><pre><a href="#ColourDirective" shape="rect" title="ColourDirective">ColourDirective</a>
|
287
|
+
::= '[' <a href="#Symbol" shape="rect" title="Symbol">Symbol</a> ',' <a href="#Symbol" shape="rect" title="Symbol">Symbol</a> ']'</pre></div>
|
288
|
+
|
289
|
+
</p>
|
290
|
+
|
291
|
+
<p>referenced by:
|
292
|
+
|
293
|
+
<ul>
|
294
|
+
|
295
|
+
<li><a href="#Directive" title="Directive">Directive</a></li>
|
296
|
+
|
297
|
+
</ul>
|
298
|
+
|
299
|
+
</p><br><hr>
|
300
|
+
|
301
|
+
<p>
|
302
|
+
|
303
|
+
<table border="0" class="signature">
|
304
|
+
|
305
|
+
<tr>
|
306
|
+
|
307
|
+
<td style="width: 100%"> </td>
|
308
|
+
|
309
|
+
<td valign="top">
|
310
|
+
|
311
|
+
<nobr class="signature">... generated by <a class="signature" href="http://www.bottlecaps.de/rr/ui" name="Railroad-Diagram-Generator" target="_blank" title="http://www.bottlecaps.de/rr/ui">Railroad Diagram Generator</a></nobr>
|
312
|
+
|
313
|
+
</td>
|
314
|
+
|
315
|
+
<td><a href="http://www.bottlecaps.de/rr/ui" name="Railroad-Diagram-Generator" target="_blank" title="http://www.bottlecaps.de/rr/ui">
|
316
|
+
<img border="0" height="16" src="diagram/rr-1.35.837.png" width="16"></a></td>
|
317
|
+
|
318
|
+
</tr>
|
319
|
+
|
320
|
+
</table>
|
321
|
+
|
322
|
+
</p>
|
323
|
+
|
324
|
+
</body>
|
325
|
+
</html>
|
data/lib/vedeu.rb
CHANGED
@@ -32,14 +32,14 @@ module Vedeu
|
|
32
32
|
container << colour.set
|
33
33
|
|
34
34
|
output.map do |lines|
|
35
|
-
if lines.size <
|
36
|
-
remaining =
|
35
|
+
if lines.size < height
|
36
|
+
remaining = height - lines.size
|
37
37
|
remaining.times { |i| lines << "" }
|
38
38
|
end
|
39
39
|
|
40
40
|
lines.each_with_index do |stream, index|
|
41
41
|
streams << clear(index)
|
42
|
-
streams << Directive.enact(stream)
|
42
|
+
streams << Directive.enact(interface, stream)
|
43
43
|
end
|
44
44
|
|
45
45
|
container << streams.join
|
@@ -3,23 +3,28 @@ module Vedeu
|
|
3
3
|
|
4
4
|
class Directive
|
5
5
|
class << self
|
6
|
-
def enact(directives = {})
|
7
|
-
new(directives).enact
|
6
|
+
def enact(interface, directives = {})
|
7
|
+
new(interface, directives).enact
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def initialize(directives = {})
|
11
|
+
def initialize(interface, directives = {})
|
12
|
+
@interface = interface
|
12
13
|
@directives = directives || {}
|
13
14
|
end
|
14
15
|
|
15
16
|
def enact
|
16
|
-
return
|
17
|
+
return wordwrap if string?
|
17
18
|
[set_position, set_colour, set_style].join
|
18
19
|
end
|
19
20
|
|
20
21
|
private
|
21
22
|
|
22
|
-
attr_reader :directives
|
23
|
+
attr_reader :interface, :directives
|
24
|
+
|
25
|
+
def wordwrap
|
26
|
+
Wordwrap.this(directives, options)
|
27
|
+
end
|
23
28
|
|
24
29
|
def string?
|
25
30
|
directives.is_a?(String)
|
@@ -48,5 +53,12 @@ module Vedeu
|
|
48
53
|
def style
|
49
54
|
directives.fetch(:style, [])
|
50
55
|
end
|
56
|
+
|
57
|
+
def options
|
58
|
+
{
|
59
|
+
width: interface.geometry.width,
|
60
|
+
prune: true
|
61
|
+
}
|
62
|
+
end
|
51
63
|
end
|
52
64
|
end
|
@@ -4,19 +4,11 @@ module Vedeu
|
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def by_keypress(input)
|
7
|
-
|
8
|
-
|
9
|
-
return nil if command.nil? || command.is_a?(Hash)
|
10
|
-
|
11
|
-
command
|
7
|
+
query(klass, :keypress, input)
|
12
8
|
end
|
13
9
|
|
14
10
|
def by_keyword(input)
|
15
|
-
|
16
|
-
|
17
|
-
return nil if command.nil? || command.is_a?(Hash)
|
18
|
-
|
19
|
-
command
|
11
|
+
query(klass, :keyword, input)
|
20
12
|
end
|
21
13
|
|
22
14
|
def klass
|
data/lib/vedeu/version.rb
CHANGED
@@ -3,7 +3,9 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
describe Directive do
|
5
5
|
let(:described_class) { Directive }
|
6
|
-
let(:described_instance) { described_class.new(directives) }
|
6
|
+
let(:described_instance) { described_class.new(interface, directives) }
|
7
|
+
let(:subject) { described_instance }
|
8
|
+
let(:interface) { Interface.new }
|
7
9
|
let(:directives) {
|
8
10
|
{
|
9
11
|
position: position,
|
@@ -19,8 +21,16 @@ module Vedeu
|
|
19
21
|
described_instance.must_be_instance_of(Directive)
|
20
22
|
end
|
21
23
|
|
24
|
+
it 'sets an instance variable' do
|
25
|
+
subject.instance_variable_get("@interface").must_be_instance_of(Interface)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'sets an instance variable' do
|
29
|
+
subject.instance_variable_get("@directives").must_be_instance_of(Hash)
|
30
|
+
end
|
31
|
+
|
22
32
|
describe '.enact' do
|
23
|
-
let(:subject) { described_class.enact(directives) }
|
33
|
+
let(:subject) { described_class.enact(interface, directives) }
|
24
34
|
|
25
35
|
it 'returns a String' do
|
26
36
|
subject.must_be_instance_of(String)
|
@@ -43,8 +43,10 @@ module Vedeu
|
|
43
43
|
describe '.initial_state' do
|
44
44
|
let(:subject) { described_class.initial_state }
|
45
45
|
|
46
|
+
before { Compositor.stubs(:arrange) }
|
47
|
+
|
46
48
|
it 'returns an Array' do
|
47
|
-
|
49
|
+
subject.must_be_instance_of(Array)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'simplecov'
|
2
2
|
require 'minitest/autorun'
|
3
3
|
require 'minitest/pride'
|
4
|
-
require 'minitest/reporters'
|
5
4
|
require 'pry'
|
6
5
|
require 'pry-nav'
|
7
6
|
|
@@ -22,7 +21,9 @@ Minitest.after_run do
|
|
22
21
|
print [27.chr, '[', '?25h'].join # show cursor
|
23
22
|
end
|
24
23
|
|
25
|
-
|
24
|
+
# commented out by default (makes tests slower)
|
25
|
+
# require 'minitest/reporters'
|
26
|
+
# Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)
|
26
27
|
|
27
28
|
require_relative '../lib/vedeu.rb'
|
28
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
@@ -209,6 +209,16 @@ files:
|
|
209
209
|
- Rakefile
|
210
210
|
- bin/vedeu
|
211
211
|
- config/cucumber.yml
|
212
|
+
- documentation/composition.ebnf
|
213
|
+
- documentation/diagram/ColourDirective.png
|
214
|
+
- documentation/diagram/Directive.png
|
215
|
+
- documentation/diagram/Interface.png
|
216
|
+
- documentation/diagram/Output.png
|
217
|
+
- documentation/diagram/PositionDirective.png
|
218
|
+
- documentation/diagram/Stream.png
|
219
|
+
- documentation/diagram/StyleDirective.png
|
220
|
+
- documentation/diagram/rr-1.35.837.png
|
221
|
+
- documentation/index.html
|
212
222
|
- features/getting_started.feature
|
213
223
|
- features/step_definitions/vedeu_steps.rb
|
214
224
|
- features/support/env.rb
|
@@ -275,6 +285,7 @@ files:
|
|
275
285
|
- test/lib/vedeu/repository/storage_test.rb
|
276
286
|
- test/lib/vedeu/support/terminal_test.rb
|
277
287
|
- test/lib/vedeu/version_test.rb
|
288
|
+
- test/lib/vedeu_test.rb
|
278
289
|
- test/test_helper.rb
|
279
290
|
- vedeu.gemspec
|
280
291
|
homepage: http://www.gavinlaking.name/
|
@@ -336,5 +347,6 @@ test_files:
|
|
336
347
|
- test/lib/vedeu/repository/storage_test.rb
|
337
348
|
- test/lib/vedeu/support/terminal_test.rb
|
338
349
|
- test/lib/vedeu/version_test.rb
|
350
|
+
- test/lib/vedeu_test.rb
|
339
351
|
- test/test_helper.rb
|
340
352
|
has_rdoc:
|