vedeu 0.0.29 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module Vedeu
17
17
  def parse
18
18
  return nil if empty?
19
19
 
20
- Composition.new(parsed_output) #.enqueue
20
+ Composition.enqueue(parsed_output)
21
21
  end
22
22
 
23
23
  private
@@ -1,6 +1,5 @@
1
1
  require 'io/console'
2
2
 
3
- require_relative '../support/cursor'
4
3
  require_relative '../support/esc'
5
4
 
6
5
  module Vedeu
@@ -9,15 +8,15 @@ module Vedeu
9
8
  # :nocov:
10
9
  def open(&block)
11
10
  console.cooked do
12
- output Esc.reset
13
- output Esc.clear
14
- output Cursor.hide
11
+ output Esc.string('reset')
12
+ output Esc.string('clear')
13
+ output Esc.string('hide_cursor')
15
14
 
16
15
  yield
17
16
  end if block_given?
18
17
  ensure
19
- output Cursor.show
20
- output Esc.reset
18
+ output Esc.string('show_cursor')
19
+ output Esc.string('reset')
21
20
  output Esc.clear_last_line
22
21
  end
23
22
  # :nocov:
@@ -11,6 +11,7 @@ module Vedeu
11
11
 
12
12
  def reformat
13
13
  return pruned if prune?
14
+
14
15
  wordwrapped
15
16
  end
16
17
 
@@ -51,11 +52,13 @@ module Vedeu
51
52
  def pruned
52
53
  if value.size <= pruned_width
53
54
  value
55
+
54
56
  else
55
57
  [
56
58
  value.chomp.slice(0..pruned_width),
57
59
  '...'
58
60
  ].join
61
+
59
62
  end
60
63
  end
61
64
 
data/lib/vedeu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vedeu
2
- VERSION = '0.0.29'
2
+ VERSION = '0.0.30'
3
3
  end
@@ -64,16 +64,16 @@ module Vedeu
64
64
  InterfaceRepository.create(name: 'enq2', width: 15, height: 2)
65
65
  end
66
66
 
67
- it 'returns an Array' do
68
- subject.must_be_instance_of(Array)
67
+ it 'returns an Composition' do
68
+ subject.must_be_instance_of(Composition)
69
69
  end
70
70
 
71
71
  it 'returns a collection of interfaces' do
72
- subject.first.must_be_instance_of(Interface)
72
+ subject.interfaces.first.must_be_instance_of(Interface)
73
73
  end
74
74
 
75
75
  it 'enqueues the interfaces for rendering' do
76
- subject.first.enqueued?.must_equal(true)
76
+ subject.interfaces.first.enqueued?.must_equal(true)
77
77
  end
78
78
  end
79
79
 
@@ -23,10 +23,14 @@ module Vedeu
23
23
  context 'when there is a single interface' do
24
24
  let(:interfaces) { { name: 'dummy' } }
25
25
 
26
- it 'returns an Interface' do
26
+ it 'returns an Array' do
27
27
  subject.must_be_instance_of(Array)
28
28
  end
29
29
 
30
+ it 'returns a collection of Interface objects' do
31
+ subject.first.must_be_instance_of(Interface)
32
+ end
33
+
30
34
  it 'contains a single Interface object' do
31
35
  subject.size.must_equal(1)
32
36
  end
@@ -233,7 +233,7 @@ module Vedeu
233
233
  end
234
234
 
235
235
  it 'returns an String' do
236
- subject.must_equal("{\"colour\":{\"foreground\":\"\\u001b[38;5;196m\",\"background\":\"\\u001b[48;5;16m\"},\"style\":\"\",\"name\":\"dummy\",\"lines\":[],\"y\":1,\"x\":1,\"z\":1,\"width\":7,\"height\":3,\"current\":\"\",\"cursor\":true}")
236
+ subject.must_equal("{\"colour\":{\"foreground\":\"\\u001b[38;5;196m\",\"background\":\"\\u001b[48;5;16m\"},\"style\":\"\",\"name\":\"dummy\",\"lines\":[],\"y\":1,\"x\":1,\"z\":1,\"width\":7,\"height\":3,\"cursor\":true}")
237
237
  end
238
238
  end
239
239
  end
@@ -8,9 +8,10 @@ module Vedeu
8
8
  let(:subject) { described_instance }
9
9
  let(:attributes) {
10
10
  {
11
+ model: {},
11
12
  style: 'normal',
12
13
  colour: { foreground: '#ff0000', background: '#000000' },
13
- stream: []
14
+ stream: [],
14
15
  }
15
16
  }
16
17
 
@@ -38,6 +39,14 @@ module Vedeu
38
39
  end
39
40
  end
40
41
 
42
+ describe '#model' do
43
+ let(:subject) { described_instance.model }
44
+
45
+ it 'has a model attribute' do
46
+ subject.must_be_instance_of(Hash)
47
+ end
48
+ end
49
+
41
50
  describe '#streams' do
42
51
  let(:subject) { described_instance.streams }
43
52
 
@@ -2,7 +2,38 @@ require_relative '../../../test_helper'
2
2
  require_relative '../../../../lib/vedeu/models/presentation'
3
3
 
4
4
  module Vedeu
5
+ class TestPresentation
6
+ include Presentation
7
+ end
8
+
5
9
  describe Presentation do
6
- let(:described_module) { Presentation }
10
+ let(:described_module) { Presentation }
11
+ let(:described_instance) { TestPresentation.new(attributes) }
12
+ let(:attributes) {
13
+ {
14
+ colour: {},
15
+ style: ['bold', 'underline']
16
+ }
17
+ }
18
+
19
+ describe '#colour' do
20
+ let(:subject) { described_instance.colour }
21
+
22
+ it 'returns a Colour instance' do
23
+ subject.must_be_instance_of(Colour)
24
+ end
25
+ end
26
+
27
+ describe '#style' do
28
+ let(:subject) { described_instance.style }
29
+
30
+ it 'returns a String' do
31
+ subject.must_be_instance_of(String)
32
+ end
33
+
34
+ it 'has a style attribute' do
35
+ subject.must_equal("\e[1m\e[4m")
36
+ end
37
+ end
7
38
  end
8
39
  end
@@ -3,8 +3,8 @@ require_relative '../../../../lib/vedeu/output/output'
3
3
 
4
4
  module Vedeu
5
5
  describe Output do
6
- let(:described_class) { Output }
7
- let(:output) {}
6
+ let(:described_module) { Output }
7
+ let(:output) {}
8
8
 
9
9
  before do
10
10
  InterfaceRepository.create({
@@ -18,16 +18,8 @@ module Vedeu
18
18
 
19
19
  after { InterfaceRepository.reset }
20
20
 
21
- describe '#initialize' do
22
- let(:subject) { described_class.new }
23
-
24
- it 'returns an Output instance' do
25
- subject.must_be_instance_of(Output)
26
- end
27
- end
28
-
29
21
  describe '.render' do
30
- let(:subject) { described_class.render }
22
+ let(:subject) { described_module.render }
31
23
 
32
24
  it 'returns an Array' do
33
25
  subject.must_be_instance_of(Array)
@@ -72,15 +72,6 @@ module Vedeu
72
72
  end
73
73
  end
74
74
 
75
- describe '#delete' do
76
- let(:subject) { described_class.delete(model) }
77
- let(:model) { @dummy }
78
-
79
- it 'returns a Dummy' do
80
- subject.must_be_instance_of(Dummy)
81
- end
82
- end
83
-
84
75
  describe '#reset' do
85
76
  let(:subject) { described_class.reset }
86
77
 
@@ -17,66 +17,6 @@ module Vedeu
17
17
  end
18
18
  end
19
19
 
20
- describe '.blink' do
21
- let(:subject) { described_class.blink }
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[5m")
29
- end
30
- end
31
-
32
- describe '.blink_off' do
33
- let(:subject) { described_class.blink_off }
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[25m")
41
- end
42
- end
43
-
44
- describe '.bold' do
45
- let(:subject) { described_class.bold }
46
-
47
- it 'returns a String' do
48
- subject.must_be_instance_of(String)
49
- end
50
-
51
- it 'returns an escape sequence' do
52
- subject.must_equal("\e[1m")
53
- end
54
- end
55
-
56
- describe '.bold_off' do
57
- let(:subject) { described_class.bold_off }
58
-
59
- it 'returns a String' do
60
- subject.must_be_instance_of(String)
61
- end
62
-
63
- it 'returns an escape sequence' do
64
- subject.must_equal("\e[21m")
65
- end
66
- end
67
-
68
- describe '.clear' do
69
- let(:subject) { described_class.clear }
70
-
71
- it 'returns a String' do
72
- subject.must_be_instance_of(String)
73
- end
74
-
75
- it 'returns an escape sequence' do
76
- subject.must_equal("\e[2J")
77
- end
78
- end
79
-
80
20
  describe '.clear_line' do
81
21
  let(:subject) { described_class.clear_line }
82
22
 
@@ -89,18 +29,6 @@ module Vedeu
89
29
  end
90
30
  end
91
31
 
92
- describe '.esc' do
93
- let(:subject) { described_class.esc }
94
-
95
- it 'returns a String' do
96
- subject.must_be_instance_of(String)
97
- end
98
-
99
- it 'returns an escape sequence' do
100
- subject.must_equal("\e[")
101
- end
102
- end
103
-
104
32
  describe '.foreground_colour' do
105
33
  let(:subject) { described_class.foreground_colour }
106
34
 
@@ -113,66 +41,6 @@ module Vedeu
113
41
  end
114
42
  end
115
43
 
116
- describe '.negative' do
117
- let(:subject) { described_class.negative }
118
-
119
- it 'returns a String' do
120
- subject.must_be_instance_of(String)
121
- end
122
-
123
- it 'returns an escape sequence' do
124
- subject.must_equal("\e[7m")
125
- end
126
- end
127
-
128
- describe '.positive' do
129
- let(:subject) { described_class.positive }
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[27m")
137
- end
138
- end
139
-
140
- describe '.normal' do
141
- let(:subject) { described_class.normal }
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[24m\e[21m\e[27m")
149
- end
150
- end
151
-
152
- describe '.dim' do
153
- let(:subject) { described_class.dim }
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[2m")
161
- end
162
- end
163
-
164
- describe '.reset' do
165
- let(:subject) { described_class.reset }
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[0m")
173
- end
174
- end
175
-
176
44
  describe '.set_position' do
177
45
  let(:subject) { described_class.set_position(y, x) }
178
46
  let(:y) {}
@@ -194,8 +62,8 @@ module Vedeu
194
62
  end
195
63
  end
196
64
 
197
- describe '.stylize' do
198
- let(:subject) { described_class.stylize(style) }
65
+ describe '.string' do
66
+ let(:subject) { described_class.string(style) }
199
67
  let(:style) {}
200
68
 
201
69
  it 'returns a String' do
@@ -320,29 +188,5 @@ module Vedeu
320
188
  end
321
189
  end
322
190
  end
323
-
324
- describe '.underline' do
325
- let(:subject) { described_class.underline }
326
-
327
- it 'returns a String' do
328
- subject.must_be_instance_of(String)
329
- end
330
-
331
- it 'returns an escape sequence' do
332
- subject.must_equal("\e[4m")
333
- end
334
- end
335
-
336
- describe '.underline_off' do
337
- let(:subject) { described_class.underline_off }
338
-
339
- it 'returns a String' do
340
- subject.must_be_instance_of(String)
341
- end
342
-
343
- it 'returns an escape sequence' do
344
- subject.must_equal("\e[24m")
345
- end
346
- end
347
191
  end
348
192
  end
data/vedeu.gemspec CHANGED
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'mocha', '1.1.0'
26
26
  spec.add_development_dependency 'pry', '0.10.0'
27
27
  spec.add_development_dependency 'rake', '10.3.2'
28
- spec.add_development_dependency 'ruby-prof'
28
+ spec.add_development_dependency 'ruby-prof', '0.14.2'
29
29
  spec.add_development_dependency 'simplecov', '0.8.2'
30
30
 
31
- spec.add_dependency "oj"
32
- spec.add_dependency "virtus"
31
+ spec.add_dependency "oj", '2.9.8'
32
+ spec.add_dependency "virtus", '1.0.2'
33
33
  end
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.29
4
+ version: 0.0.30
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-07-09 00:00:00.000000000 Z
11
+ date: 2014-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: ruby-prof
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 0.14.2
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: 0.14.2
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: simplecov
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -154,35 +154,34 @@ dependencies:
154
154
  name: oj
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: 2.9.8
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: 2.9.8
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: virtus
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: 1.0.2
174
174
  type: :runtime
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: 1.0.2
181
181
  description:
182
182
  email:
183
183
  - gavinlaking@gmail.com
184
184
  executables:
185
- - composition
186
185
  - vedeu
187
186
  extensions: []
188
187
  extra_rdoc_files: []
@@ -195,16 +194,13 @@ files:
195
194
  - LICENSE.txt
196
195
  - README.md
197
196
  - Rakefile
198
- - bin/composition
199
197
  - bin/vedeu
200
- - examples/single_interface_app.rb
201
198
  - lib/vedeu.rb
202
199
  - lib/vedeu/application.rb
203
200
  - lib/vedeu/configuration.rb
204
201
  - lib/vedeu/input/input.rb
205
202
  - lib/vedeu/launcher.rb
206
203
  - lib/vedeu/models/background.rb
207
- - lib/vedeu/models/coercions.rb
208
204
  - lib/vedeu/models/colour.rb
209
205
  - lib/vedeu/models/command.rb
210
206
  - lib/vedeu/models/composition.rb
@@ -225,7 +221,6 @@ files:
225
221
  - lib/vedeu/repository/interface_repository.rb
226
222
  - lib/vedeu/repository/repository.rb
227
223
  - lib/vedeu/repository/storage.rb
228
- - lib/vedeu/support/cursor.rb
229
224
  - lib/vedeu/support/esc.rb
230
225
  - lib/vedeu/support/events.rb
231
226
  - lib/vedeu/support/exit.rb
@@ -264,7 +259,6 @@ files:
264
259
  - test/lib/vedeu/repository/interface_repository_test.rb
265
260
  - test/lib/vedeu/repository/repository_test.rb
266
261
  - test/lib/vedeu/repository/storage_test.rb
267
- - test/lib/vedeu/support/cursor_test.rb
268
262
  - test/lib/vedeu/support/esc_test.rb
269
263
  - test/lib/vedeu/support/events_test.rb
270
264
  - test/lib/vedeu/support/exit_test.rb
@@ -293,8 +287,6 @@ files:
293
287
  - test/support/json/int2_lin2_str3_styles.json
294
288
  - test/support/output_1.json
295
289
  - test/support/output_1.rb
296
- - test/support/output_2.json
297
- - test/support/output_2.rb
298
290
  - test/test_helper.rb
299
291
  - vedeu.gemspec
300
292
  homepage: http://www.gavinlaking.name/
@@ -347,7 +339,6 @@ test_files:
347
339
  - test/lib/vedeu/repository/interface_repository_test.rb
348
340
  - test/lib/vedeu/repository/repository_test.rb
349
341
  - test/lib/vedeu/repository/storage_test.rb
350
- - test/lib/vedeu/support/cursor_test.rb
351
342
  - test/lib/vedeu/support/esc_test.rb
352
343
  - test/lib/vedeu/support/events_test.rb
353
344
  - test/lib/vedeu/support/exit_test.rb
@@ -376,7 +367,5 @@ test_files:
376
367
  - test/support/json/int2_lin2_str3_styles.json
377
368
  - test/support/output_1.json
378
369
  - test/support/output_1.rb
379
- - test/support/output_2.json
380
- - test/support/output_2.rb
381
370
  - test/test_helper.rb
382
371
  has_rdoc: