vedeu 0.8.28 → 0.8.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/.yardopts +11 -10
- data/examples/dsl_horizontal_alignment.rb +5 -17
- data/examples/dsl_vertical_alignment.rb +5 -17
- data/lib/vedeu/dsl/elements.rb +39 -33
- data/lib/vedeu/editor/cropper.rb +2 -1
- data/lib/vedeu/editor/lines.rb +2 -1
- data/lib/vedeu/interfaces/dsl.rb +0 -2
- data/lib/vedeu/renderers/support/options.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +3 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/support/ttyrec.rb +18 -3
- data/test/support/who.rb +16 -9
- data/vedeu.gemspec +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e96b8a38c77ce3d42eefe14913a99fc23c36550d
|
4
|
+
data.tar.gz: d36aef73dfaec573586bf73f12ae96e78173c0a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d95ae5335653b81832224141bcf2033bee706970da29d1be8f4994f582d9e1674f4fce54c1c80285fca50ab21561aa1e3e0074ddc27f78c2e5e003f125f3775a
|
7
|
+
data.tar.gz: a4aa26a5b71ed54b661920472111a377c1ce47c3bb2df1a84901c1e208699f11b164366a1e19aa5a908b098577a040e00e25ea06a7341a1d68286205ff4b0d1c
|
data/.travis.yml
CHANGED
data/.yardopts
CHANGED
@@ -12,6 +12,7 @@ docs/colours_styles.md
|
|
12
12
|
docs/configuration.md
|
13
13
|
docs/cursors.md
|
14
14
|
docs/dsl.md
|
15
|
+
docs/dsl_elements.md
|
15
16
|
docs/events.md
|
16
17
|
docs/geometry.md
|
17
18
|
docs/getting_started.md
|
@@ -25,13 +26,13 @@ docs/output.md
|
|
25
26
|
docs/streams.md
|
26
27
|
docs/template.md
|
27
28
|
docs/view.md
|
28
|
-
docs/
|
29
|
-
docs/
|
30
|
-
docs/
|
31
|
-
docs/
|
32
|
-
docs/
|
33
|
-
docs/
|
34
|
-
docs/
|
35
|
-
docs/events/
|
36
|
-
docs/events/
|
37
|
-
docs/events
|
29
|
+
docs/applications/*.md
|
30
|
+
docs/cli/*.md
|
31
|
+
docs/configuration/*.md
|
32
|
+
docs/dsl/by_method/geometry/*.md
|
33
|
+
docs/dsl/by_method/keymap/*.md
|
34
|
+
docs/dsl/by_method/view/*.md
|
35
|
+
docs/dsl/*.md
|
36
|
+
docs/events/by_name/aliases/*.md
|
37
|
+
docs/events/by_name/*.md
|
38
|
+
docs/events/*.md
|
@@ -33,7 +33,10 @@ class HorizontalAlignmentApp
|
|
33
33
|
line ""
|
34
34
|
line "The 'h', 'j', 'k' and 'l' keys will"
|
35
35
|
line "move this view left, down, up, and"
|
36
|
-
line "right respectively."
|
36
|
+
line "right respectively. The coordinates"
|
37
|
+
line "will not change in this example"
|
38
|
+
line "because they have not been"
|
39
|
+
line "instructed to do so."
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
@@ -145,22 +148,7 @@ class HorizontalAlignmentApp
|
|
145
148
|
end
|
146
149
|
end
|
147
150
|
|
148
|
-
|
149
|
-
lines do
|
150
|
-
line "x:#{gc.x}, xn:#{gc.xn} (w:#{gc.width})"
|
151
|
-
line "y:#{gc.y}, yn:#{gc.yn} (h:#{gc.height})"
|
152
|
-
line ""
|
153
|
-
line "bx:#{gc.bx}, bxn:#{gc.bxn} (bw:#{gc.width})"
|
154
|
-
line "by:#{gc.by}, byn:#{gc.byn} (bh:#{gc.height})"
|
155
|
-
line ""
|
156
|
-
line "The 'h', 'j', 'k' and 'l' keys will"
|
157
|
-
line "move this view left, down, up, and"
|
158
|
-
line "right respectively. The coordinates"
|
159
|
-
line "will not change in this example"
|
160
|
-
line "because they have not been"
|
161
|
-
line "instructed to do so."
|
162
|
-
end
|
163
|
-
end
|
151
|
+
HorizontalAlignmentApp::CentreHorizontalAlignmentView.new.render
|
164
152
|
|
165
153
|
view(:right_interface) do
|
166
154
|
lines do
|
@@ -33,7 +33,10 @@ class VerticalAlignmentApp
|
|
33
33
|
line ""
|
34
34
|
line "The 'h', 'j', 'k' and 'l' keys will"
|
35
35
|
line "move this view left, down, up, and"
|
36
|
-
line "right respectively."
|
36
|
+
line "right respectively. The coordinates"
|
37
|
+
line "will not change in this example"
|
38
|
+
line "because they have not been"
|
39
|
+
line "instructed to do so."
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
@@ -157,22 +160,7 @@ class VerticalAlignmentApp
|
|
157
160
|
end
|
158
161
|
end
|
159
162
|
|
160
|
-
|
161
|
-
lines do
|
162
|
-
line "x:#{gc.x}, xn:#{gc.xn} (w:#{gc.width})"
|
163
|
-
line "y:#{gc.y}, yn:#{gc.yn} (h:#{gc.height})"
|
164
|
-
line ""
|
165
|
-
line "bx:#{gc.bx}, bxn:#{gc.bxn} (bw:#{gc.width})"
|
166
|
-
line "by:#{gc.by}, byn:#{gc.byn} (bh:#{gc.height})"
|
167
|
-
line ""
|
168
|
-
line "The 'h', 'j', 'k' and 'l' keys will"
|
169
|
-
line "move this view left, down, up, and"
|
170
|
-
line "right respectively. The coordinates"
|
171
|
-
line "will not change in this example"
|
172
|
-
line "because they have not been"
|
173
|
-
line "instructed to do so."
|
174
|
-
end
|
175
|
-
end
|
163
|
+
VerticalAlignmentApp::CentreVerticalAlignmentView.new.render
|
176
164
|
|
177
165
|
view(:bottom_interface) do
|
178
166
|
lines do
|
data/lib/vedeu/dsl/elements.rb
CHANGED
@@ -67,24 +67,22 @@ module Vedeu
|
|
67
67
|
requires_block!(&block)
|
68
68
|
requires_model!
|
69
69
|
|
70
|
-
attrs =
|
71
|
-
line = build_line(attrs, &block)
|
72
|
-
view = build_view(attrs, &block)
|
70
|
+
attrs = build_attributes(nil, opts, &block)
|
73
71
|
|
74
72
|
if view_model?
|
75
73
|
if model.lines?
|
76
|
-
model.add(
|
74
|
+
model.add(build_line(attrs, &block))
|
77
75
|
|
78
76
|
else
|
79
|
-
model.value =
|
77
|
+
model.value = build_view(attrs, &block).value
|
80
78
|
|
81
79
|
end
|
82
80
|
|
83
81
|
elsif line_model?
|
84
|
-
model.value =
|
82
|
+
model.value = build_line(attrs, &block).value
|
85
83
|
|
86
84
|
else
|
87
|
-
model.value =
|
85
|
+
model.value = build_view(attrs, &block).value
|
88
86
|
|
89
87
|
end
|
90
88
|
end
|
@@ -116,15 +114,13 @@ module Vedeu
|
|
116
114
|
def line(value = '', opts = {}, &block)
|
117
115
|
requires_model!
|
118
116
|
|
119
|
-
attrs =
|
117
|
+
attrs = build_attributes(value, opts, &block)
|
120
118
|
|
121
119
|
l = if block_given?
|
122
120
|
build_line(attrs, &block)
|
123
121
|
|
124
122
|
else
|
125
|
-
|
126
|
-
streams = Vedeu::Views::Streams.coerce([stream])
|
127
|
-
Vedeu::Views::Line.new(attrs.merge!(value: streams))
|
123
|
+
new_line(attrs)
|
128
124
|
|
129
125
|
end
|
130
126
|
|
@@ -151,9 +147,9 @@ module Vedeu
|
|
151
147
|
def stream(value = '', opts = {}, &block)
|
152
148
|
requires_model!
|
153
149
|
|
154
|
-
attrs =
|
150
|
+
attrs = build_attributes(value, opts, &block)
|
155
151
|
|
156
|
-
|
152
|
+
m = if block_given?
|
157
153
|
if view_model?
|
158
154
|
build_line(attrs, &block)
|
159
155
|
|
@@ -163,14 +159,12 @@ module Vedeu
|
|
163
159
|
end
|
164
160
|
|
165
161
|
else
|
166
|
-
|
167
|
-
streams = Vedeu::Views::Streams.coerce([stream])
|
168
|
-
Vedeu::Views::Line.new(attrs.merge!(value: streams))
|
162
|
+
new_line(attrs)
|
169
163
|
|
170
164
|
end
|
171
165
|
|
172
166
|
if view_model? || line_model? || stream_model?
|
173
|
-
model.add(
|
167
|
+
model.add(m)
|
174
168
|
|
175
169
|
else
|
176
170
|
raise Vedeu::Error::Fatal,
|
@@ -241,19 +235,16 @@ module Vedeu
|
|
241
235
|
def text(value = '', opts = {})
|
242
236
|
requires_model!
|
243
237
|
|
244
|
-
attrs
|
245
|
-
stream = new_stream(attrs)
|
246
|
-
streams = Vedeu::Views::Streams.coerce([stream])
|
247
|
-
line = Vedeu::Views::Line.new(attrs.merge!(value: streams))
|
238
|
+
attrs = build_attributes(value, opts)
|
248
239
|
|
249
240
|
if view_model?
|
250
|
-
model.add(
|
241
|
+
model.add(new_line(attrs))
|
251
242
|
|
252
243
|
elsif line_model?
|
253
|
-
model.add(
|
244
|
+
model.add(new_stream(attrs))
|
254
245
|
|
255
246
|
elsif stream_model?
|
256
|
-
model.add(
|
247
|
+
model.add(new_stream(attrs).value)
|
257
248
|
|
258
249
|
else
|
259
250
|
raise Vedeu::Error::Fatal,
|
@@ -265,30 +256,33 @@ module Vedeu
|
|
265
256
|
# @param (see #text)
|
266
257
|
# @return (see #text)
|
267
258
|
def centre(value = '', opts = {})
|
268
|
-
opts
|
269
|
-
|
270
|
-
text(value, opts)
|
259
|
+
text(value, opts.merge(align: :centre))
|
271
260
|
end
|
272
261
|
alias center centre
|
273
262
|
|
274
263
|
# @param (see #text)
|
275
264
|
# @return (see #text)
|
276
265
|
def left(value = '', opts = {})
|
277
|
-
opts
|
278
|
-
|
279
|
-
text(value, opts)
|
266
|
+
text(value, opts.merge(align: :left))
|
280
267
|
end
|
281
268
|
|
282
269
|
# @param (see #text)
|
283
270
|
# @return (see #text)
|
284
271
|
def right(value = '', opts = {})
|
285
|
-
opts
|
286
|
-
|
287
|
-
text(value, opts)
|
272
|
+
text(value, opts.merge(align: :right))
|
288
273
|
end
|
289
274
|
|
290
275
|
private
|
291
276
|
|
277
|
+
# @param value [String] The value for the stream.
|
278
|
+
# @param opts [Hash]
|
279
|
+
# @option opts ... [void]
|
280
|
+
# @macro param_block
|
281
|
+
# @return [Vedeu::DSL::Attributes]
|
282
|
+
def build_attributes(value = '', opts = {}, &block)
|
283
|
+
Vedeu::DSL::Attributes.build(self, model, value, opts, &block)
|
284
|
+
end
|
285
|
+
|
292
286
|
# @param attrs [Vedeu::DSL::Attributes]
|
293
287
|
# @macro param_block
|
294
288
|
# @return [Vedeu::Views::Line]
|
@@ -310,12 +304,24 @@ module Vedeu
|
|
310
304
|
Vedeu::Views::View.build(attrs, &block)
|
311
305
|
end
|
312
306
|
|
307
|
+
# @param attrs [Vedeu::DSL::Attributes]
|
308
|
+
# @return [Vedeu::Views::Line]
|
309
|
+
def new_line(attrs)
|
310
|
+
Vedeu::Views::Line.new(attrs.merge(value: new_streams(attrs)))
|
311
|
+
end
|
312
|
+
|
313
313
|
# @param attrs [Vedeu::DSL::Attributes]
|
314
314
|
# @return [Vedeu::Views::Stream]
|
315
315
|
def new_stream(attrs)
|
316
316
|
Vedeu::Views::Stream.new(attrs)
|
317
317
|
end
|
318
318
|
|
319
|
+
# @param attrs [Vedeu::DSL::Attributes]
|
320
|
+
# @return [Vedeu::Views::Streams]
|
321
|
+
def new_streams(attrs)
|
322
|
+
Vedeu::Views::Streams.coerce([new_stream(attrs)])
|
323
|
+
end
|
324
|
+
|
319
325
|
# @macro param_block
|
320
326
|
# @macro raise_requires_block
|
321
327
|
# @return [NilClass]
|
data/lib/vedeu/editor/cropper.rb
CHANGED
data/lib/vedeu/editor/lines.rb
CHANGED
data/lib/vedeu/interfaces/dsl.rb
CHANGED
data/lib/vedeu/version.rb
CHANGED
data/test/support/ttyrec.rb
CHANGED
@@ -2,11 +2,26 @@
|
|
2
2
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
+
# Install 'ttyrec':
|
6
|
+
# sudo apt install ttyrec
|
5
7
|
#
|
6
|
-
#
|
8
|
+
# Run 'ttyrec' against an example:
|
9
|
+
# ttyrec -a -e ./examples/material_colours_app.rb /tmp/ttyrecord
|
7
10
|
#
|
11
|
+
# Parse the recording:
|
12
|
+
# ./ttyrec.rb
|
13
|
+
#
|
14
|
+
# View the decoded recording:
|
15
|
+
# less /tmp/ttyrecord_decoded
|
16
|
+
#
|
17
|
+
# or
|
18
|
+
# cat /tmp/ttyrecord_decoded
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'tmpdir'
|
8
22
|
|
9
|
-
|
23
|
+
tmpdir = Dir.tmpdir
|
24
|
+
ttyrecord = File.binread(tmpdir + '/ttyrecord')
|
10
25
|
ttyrecord.force_encoding('BINARY') if ttyrecord.respond_to?(:force_encoding)
|
11
26
|
|
12
27
|
offset = 0
|
@@ -30,7 +45,7 @@ while offset < ttyrecord.size
|
|
30
45
|
offset = data_start + data_length
|
31
46
|
end
|
32
47
|
|
33
|
-
File.open(
|
48
|
+
File.open(tmpdir + '/ttyrecord_decoded', 'w') do |file|
|
34
49
|
chunks.each do |chunk|
|
35
50
|
file.write("---\n" + chunk[:data] + "\n")
|
36
51
|
end
|
data/test/support/who.rb
CHANGED
@@ -2,20 +2,28 @@
|
|
2
2
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
-
require 'net/http'
|
6
5
|
require 'json'
|
6
|
+
require 'net/http'
|
7
|
+
require 'uri'
|
7
8
|
|
8
9
|
# Find out which projects are currently using Vedeu:
|
9
10
|
# (from: http://www.schneems.com/blogs/2015-09-30-reverse-rubygems/)
|
10
11
|
|
11
|
-
gem_name =
|
12
|
+
gem_name = 'vedeu'
|
13
|
+
|
14
|
+
def rubygems_get(gem_name: '', endpoint: '')
|
15
|
+
path = File.join('/api/v1/gems/', gem_name, endpoint).chomp('/') + '.json'
|
16
|
+
uri = URI('https://rubygems.org' + path)
|
17
|
+
opts = { use_ssl: true }
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
response = Net::HTTP.start(uri.host, uri.port, opts) do |http|
|
20
|
+
http.request(Net::HTTP::Get.new(uri))
|
21
|
+
end
|
22
|
+
|
23
|
+
JSON.parse(response.body)
|
16
24
|
end
|
17
25
|
|
18
|
-
results = rubygems_get(gem_name: gem_name, endpoint:
|
26
|
+
results = rubygems_get(gem_name: gem_name, endpoint: 'reverse_dependencies')
|
19
27
|
|
20
28
|
weighted_results = {}
|
21
29
|
results.each do |name|
|
@@ -26,6 +34,5 @@ results.each do |name|
|
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
29
|
-
weighted_results.sort {|(k1, v1), (k2, v2)| v2 <=> v1 }.first(50).
|
30
|
-
puts "#{i}) #{k}: #{v}"
|
31
|
-
end
|
37
|
+
weighted_results.sort { |(k1, v1), (k2, v2)| v2 <=> v1 }.first(50).
|
38
|
+
each_with_index { |(k, v), i| puts "#{i}) #{k}: #{v}" }
|
data/vedeu.gemspec
CHANGED
@@ -21,13 +21,13 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_development_dependency 'guard', '2.
|
24
|
+
spec.add_development_dependency 'guard', '2.14.0'
|
25
25
|
spec.add_development_dependency 'guard-minitest', '2.4.4'
|
26
26
|
spec.add_development_dependency 'guard-rubocop', '1.2.0'
|
27
|
-
spec.add_development_dependency 'minitest', '5.
|
27
|
+
spec.add_development_dependency 'minitest', '5.9.0'
|
28
28
|
spec.add_development_dependency 'minitest-reporters', '1.1.9'
|
29
29
|
spec.add_development_dependency 'mocha', '1.1.0'
|
30
|
-
spec.add_development_dependency 'rubocop', '0.
|
30
|
+
spec.add_development_dependency 'rubocop', '0.40.0'
|
31
31
|
spec.add_development_dependency 'simplecov', '0.11.2'
|
32
32
|
spec.add_development_dependency 'simplecov-console', '0.3.0'
|
33
33
|
spec.add_development_dependency 'yard', '0.8.7.6'
|
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.8.
|
4
|
+
version: 0.8.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.14.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.14.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: guard-minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 5.
|
61
|
+
version: 5.9.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 5.
|
68
|
+
version: 5.9.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest-reporters
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.40.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.40.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|