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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd49dbbe4583758d2452063e9161fec5c9bc4d79
4
- data.tar.gz: f4eeeda050db0fc5e52a03dae4bbcc2176073d23
3
+ metadata.gz: e96b8a38c77ce3d42eefe14913a99fc23c36550d
4
+ data.tar.gz: d36aef73dfaec573586bf73f12ae96e78173c0a0
5
5
  SHA512:
6
- metadata.gz: cd89d6b6433e244b82c6333b25b308791c99668cb34af1bb26f559b36e41db0b0ac1409048fa4a1f97914f7f46b05d60171a610cf109e9a963003ea15db91a96
7
- data.tar.gz: 33269aa82e2aaf0759c7eb75795e5dd2ed1185fc14c61d14b4aea61eafe52f3b0a92507c0f41ac1bc465967b5ca67cce880e5e068328e346ac11f719b8bfb5ea
6
+ metadata.gz: d95ae5335653b81832224141bcf2033bee706970da29d1be8f4994f582d9e1674f4fce54c1c80285fca50ab21561aa1e3e0074ddc27f78c2e5e003f125f3775a
7
+ data.tar.gz: a4aa26a5b71ed54b661920472111a377c1ce47c3bb2df1a84901c1e208699f11b164366a1e19aa5a908b098577a040e00e25ea06a7341a1d68286205ff4b0d1c
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.0
3
+ - 2.3.1
4
4
  cache: bundler
5
5
  script: 'bundle exec rake'
6
6
  sudo: false
7
-
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/events/application.md
29
- docs/events/document.md
30
- docs/events/drb.md
31
- docs/events/focus.md
32
- docs/events/menu.md
33
- docs/events/movement.md
34
- docs/events/refresh.md
35
- docs/events/system.md
36
- docs/events/view.md
37
- docs/events/visibility.md
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
- view(:centre_interface) do
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
- view(:middle_interface) do
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
@@ -67,24 +67,22 @@ module Vedeu
67
67
  requires_block!(&block)
68
68
  requires_model!
69
69
 
70
- attrs = Vedeu::DSL::Attributes.build(self, model, nil, opts, &block)
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(line)
74
+ model.add(build_line(attrs, &block))
77
75
 
78
76
  else
79
- model.value = view.value
77
+ model.value = build_view(attrs, &block).value
80
78
 
81
79
  end
82
80
 
83
81
  elsif line_model?
84
- model.value = line.value
82
+ model.value = build_line(attrs, &block).value
85
83
 
86
84
  else
87
- model.value = view.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 = Vedeu::DSL::Attributes.build(self, model, value, opts, &block)
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
- stream = new_stream(attrs)
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 = Vedeu::DSL::Attributes.build(self, model, value, opts, &block)
150
+ attrs = build_attributes(value, opts, &block)
155
151
 
156
- l = if block_given?
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
- stream = new_stream(attrs)
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(l)
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 = Vedeu::DSL::Attributes.build(self, model, value, opts)
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(line)
241
+ model.add(new_line(attrs))
251
242
 
252
243
  elsif line_model?
253
- model.add(stream)
244
+ model.add(new_stream(attrs))
254
245
 
255
246
  elsif stream_model?
256
- model.add(stream.value)
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[:align] = :centre
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[:align] = :left
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[:align] = :right
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]
@@ -48,7 +48,8 @@ module Vedeu
48
48
  out << Vedeu::Cells::Char.new(
49
49
  name: name,
50
50
  position: Vedeu::Geometries::Position.new((by + iy), (bx + ix)),
51
- value: char)
51
+ value: char
52
+ )
52
53
  end
53
54
  end
54
55
 
@@ -85,7 +85,8 @@ module Vedeu
85
85
  Vedeu::Editor::Insert.into(collection,
86
86
  Vedeu::Editor::Line.new,
87
87
  index,
88
- size))
88
+ size)
89
+ )
89
90
  end
90
91
 
91
92
  # Returns the line at the given index.
@@ -111,8 +111,6 @@ module Vedeu
111
111
  eval('self', block.binding) if block_given?
112
112
  end
113
113
 
114
- private
115
-
116
114
  # @macro param_name
117
115
  # @return [Boolean]
118
116
  def keymap?(name)
@@ -102,7 +102,7 @@ module Vedeu
102
102
 
103
103
  # @return [String]
104
104
  def default_template
105
- ::File.dirname(__FILE__) + '/./templates/html_renderer.vedeu'
105
+ ::File.dirname(__FILE__) + '/../templates/html_renderer.vedeu'
106
106
  end
107
107
 
108
108
  # @return [String]
@@ -59,7 +59,9 @@ module Vedeu
59
59
  Vedeu::Views::Stream.build(
60
60
  colour: Vedeu::Colours::Colour.new(attributes),
61
61
  style: Vedeu::Presentation::Style.new(attributes[:style]),
62
- value: value))
62
+ value: value
63
+ )
64
+ )
63
65
  end
64
66
 
65
67
  # @param data [String]
@@ -3,6 +3,6 @@
3
3
  module Vedeu
4
4
 
5
5
  # The current version of Vedeu.
6
- VERSION = '0.8.28'
6
+ VERSION = '0.8.29'
7
7
 
8
8
  end # Vedeu
@@ -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
- # ttyrec -a -e ./material_colours_app.rb /tmp/ttyrecord
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
- ttyrecord = File.binread(Dir.tmpdir + '/ttyrecord')
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(Dir.tmpdir + '/ttyrecord_decoded', 'w') do |file|
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
@@ -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 = "vedeu"
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
- def rubygems_get(gem_name: "", endpoint: "")
14
- path = File.join("/api/v1/gems/", gem_name, endpoint).chomp("/") + ".json"
15
- JSON.parse(Net::HTTP.get("rubygems.org", path))
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: "reverse_dependencies")
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).each_with_index do |(k, v), i|
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}" }
@@ -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.13.0'
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.8.4'
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.39.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.28
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-06 00:00:00.000000000 Z
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.13.0
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.13.0
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.8.4
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.8.4
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.39.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.39.0
110
+ version: 0.40.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement