vedeu 0.4.32 → 0.4.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/bin/vedeu +3 -0
  3. data/docs/dsl.md +36 -2
  4. data/examples/borders_app.rb +5 -0
  5. data/examples/colours_app.rb +5 -0
  6. data/examples/configuration_app.rb +5 -0
  7. data/examples/drb_app.rb +4 -0
  8. data/examples/focus_app.rb +5 -0
  9. data/examples/geometry_app.rb +4 -0
  10. data/examples/hello_world.rb +5 -0
  11. data/examples/material_colours_app.rb +15 -8
  12. data/examples/panel_app.rb +5 -0
  13. data/examples/typed_commands/typed_commands_app.rb +4 -4
  14. data/examples/view_templates_app/view_templates_app.rb +4 -4
  15. data/lib/vedeu/application.rb +2 -0
  16. data/lib/vedeu/bindings.rb +1 -0
  17. data/lib/vedeu/buffers/buffer.rb +2 -0
  18. data/lib/vedeu/buffers/display_buffer.rb +1 -0
  19. data/lib/vedeu/configuration/api.rb +2 -0
  20. data/lib/vedeu/configuration/cli.rb +2 -0
  21. data/lib/vedeu/configuration/configuration.rb +1 -0
  22. data/lib/vedeu/cursor/cursor.rb +2 -0
  23. data/lib/vedeu/cursor/move.rb +2 -0
  24. data/lib/vedeu/cursor/refresh_cursor.rb +2 -0
  25. data/lib/vedeu/debug.rb +1 -0
  26. data/lib/vedeu/distributed/uri.rb +2 -0
  27. data/lib/vedeu/dsl/all.rb +1 -0
  28. data/lib/vedeu/dsl/border.rb +3 -0
  29. data/lib/vedeu/dsl/composition.rb +1 -0
  30. data/lib/vedeu/dsl/geometry.rb +1 -0
  31. data/lib/vedeu/dsl/group.rb +2 -0
  32. data/lib/vedeu/dsl/interface.rb +22 -1
  33. data/lib/vedeu/dsl/presentation.rb +0 -1
  34. data/lib/vedeu/dsl/text.rb +1 -0
  35. data/lib/vedeu/dsl/use.rb +3 -1
  36. data/lib/vedeu/events/event.rb +2 -0
  37. data/lib/vedeu/events/trigger.rb +2 -0
  38. data/lib/vedeu/geometry/area.rb +2 -0
  39. data/lib/vedeu/geometry/coordinate.rb +2 -0
  40. data/lib/vedeu/geometry/dimension.rb +2 -0
  41. data/lib/vedeu/geometry/geometry.rb +1 -0
  42. data/lib/vedeu/geometry/grid.rb +2 -0
  43. data/lib/vedeu/geometry/index_position.rb +2 -0
  44. data/lib/vedeu/geometry/position.rb +2 -0
  45. data/lib/vedeu/geometry/position_index.rb +2 -0
  46. data/lib/vedeu/geometry/position_validator.rb +2 -0
  47. data/lib/vedeu/input/input.rb +2 -0
  48. data/lib/vedeu/input/key.rb +2 -0
  49. data/lib/vedeu/input/keymap.rb +2 -0
  50. data/lib/vedeu/input/mapper.rb +2 -0
  51. data/lib/vedeu/main_loop.rb +1 -0
  52. data/lib/vedeu/models/cell.rb +2 -0
  53. data/lib/vedeu/models/char.rb +2 -0
  54. data/lib/vedeu/models/composition.rb +2 -0
  55. data/lib/vedeu/models/escape_char.rb +2 -0
  56. data/lib/vedeu/models/focus.rb +1 -0
  57. data/lib/vedeu/models/group.rb +2 -0
  58. data/lib/vedeu/models/interface.rb +2 -0
  59. data/lib/vedeu/models/line.rb +2 -0
  60. data/lib/vedeu/models/menu.rb +2 -0
  61. data/lib/vedeu/models/panel.rb +2 -0
  62. data/lib/vedeu/models/stream.rb +2 -0
  63. data/lib/vedeu/null/all.rb +2 -0
  64. data/lib/vedeu/null/border.rb +2 -0
  65. data/lib/vedeu/null/buffer.rb +2 -0
  66. data/lib/vedeu/null/generic.rb +2 -0
  67. data/lib/vedeu/null/geometry.rb +2 -0
  68. data/lib/vedeu/null/interface.rb +2 -0
  69. data/lib/vedeu/output/background.rb +2 -0
  70. data/lib/vedeu/output/border.rb +2 -0
  71. data/lib/vedeu/output/clear.rb +2 -0
  72. data/lib/vedeu/output/colour.rb +1 -0
  73. data/lib/vedeu/output/compressor.rb +2 -0
  74. data/lib/vedeu/output/esc.rb +1 -0
  75. data/lib/vedeu/output/foreground.rb +2 -0
  76. data/lib/vedeu/output/html_char.rb +2 -0
  77. data/lib/vedeu/output/output.rb +2 -0
  78. data/lib/vedeu/output/presentation.rb +1 -0
  79. data/lib/vedeu/output/refresh.rb +1 -0
  80. data/lib/vedeu/output/renderers/all.rb +3 -0
  81. data/lib/vedeu/output/renderers/escape_sequence.rb +2 -0
  82. data/lib/vedeu/output/renderers/file.rb +2 -0
  83. data/lib/vedeu/output/renderers/html.rb +2 -0
  84. data/lib/vedeu/output/renderers/json.rb +2 -0
  85. data/lib/vedeu/output/renderers/null.rb +2 -0
  86. data/lib/vedeu/output/renderers/terminal.rb +2 -0
  87. data/lib/vedeu/output/renderers/text.rb +2 -0
  88. data/lib/vedeu/output/style.rb +1 -0
  89. data/lib/vedeu/output/text.rb +2 -0
  90. data/lib/vedeu/output/translator.rb +2 -0
  91. data/lib/vedeu/output/viewport.rb +2 -0
  92. data/lib/vedeu/output/virtual_terminal.rb +2 -0
  93. data/lib/vedeu/output/wordwrap.rb +2 -0
  94. data/lib/vedeu/repositories/collection.rb +2 -0
  95. data/lib/vedeu/repositories/collections/all.rb +12 -0
  96. data/lib/vedeu/repositories/model.rb +2 -0
  97. data/lib/vedeu/repositories/registerable.rb +2 -0
  98. data/lib/vedeu/repositories/repositories/background_colours.rb +2 -0
  99. data/lib/vedeu/repositories/repositories/borders.rb +2 -0
  100. data/lib/vedeu/repositories/repositories/buffers.rb +2 -0
  101. data/lib/vedeu/repositories/repositories/colours.rb +2 -0
  102. data/lib/vedeu/repositories/repositories/cursors.rb +2 -0
  103. data/lib/vedeu/repositories/repositories/events_repository.rb +2 -0
  104. data/lib/vedeu/repositories/repositories/foreground_colours.rb +2 -0
  105. data/lib/vedeu/repositories/repositories/geometries.rb +2 -0
  106. data/lib/vedeu/repositories/repositories/groups.rb +2 -0
  107. data/lib/vedeu/repositories/repositories/interfaces_repository.rb +2 -0
  108. data/lib/vedeu/repositories/repositories/keymaps.rb +2 -0
  109. data/lib/vedeu/repositories/repositories/menus.rb +2 -0
  110. data/lib/vedeu/repositories/repository.rb +3 -3
  111. data/lib/vedeu/storage/associative_store.rb +2 -0
  112. data/lib/vedeu/storage/conveyor_store.rb +2 -0
  113. data/lib/vedeu/storage/fifo_store.rb +2 -0
  114. data/lib/vedeu/storage/store.rb +1 -0
  115. data/lib/vedeu/support/common.rb +1 -0
  116. data/lib/vedeu/support/log.rb +3 -0
  117. data/lib/vedeu/support/options.rb +2 -0
  118. data/lib/vedeu/support/template.rb +2 -0
  119. data/lib/vedeu/support/terminal.rb +1 -0
  120. data/lib/vedeu/support/timer.rb +2 -1
  121. data/lib/vedeu/support/visibility.rb +2 -0
  122. data/lib/vedeu/templating/directive.rb +3 -0
  123. data/lib/vedeu/templating/helpers.rb +2 -0
  124. data/lib/vedeu/templating/preprocessor.rb +4 -0
  125. data/lib/vedeu/traps.rb +1 -0
  126. data/lib/vedeu/version.rb +2 -1
  127. data/test/lib/vedeu/dsl/border_test.rb +19 -0
  128. data/test/lib/vedeu/dsl/geometry_test.rb +19 -0
  129. data/test/lib/vedeu/dsl/interface_test.rb +19 -0
  130. metadata +2 -2
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the creation of a lock-less log device.
4
+ #
5
+ # @api private
4
6
  class MonoLogger < Logger
5
7
 
6
8
  # Create a trappable Logger instance.
@@ -76,6 +78,7 @@ module Vedeu
76
78
 
77
79
  # Provides the ability to log anything to the Vedeu log file.
78
80
  #
81
+ # @api public
79
82
  class Log
80
83
 
81
84
  class << self
@@ -3,6 +3,8 @@ module Vedeu
3
3
  # Converts an options Hash into a class containing methods for each of the
4
4
  # keys, which when called returns the value associated. When the value is
5
5
  # either true or false, an additional predicate method is created.
6
+ #
7
+ # @api private
6
8
  class Options
7
9
 
8
10
  # @!attribute [r] _defined
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Generic class to loading a template and parsing it via ERb.
4
+ #
5
+ # @api private
4
6
  class Template
5
7
 
6
8
  # @param (see Vedeu::Template#new)
@@ -5,6 +5,7 @@ module Vedeu
5
5
  # This module is the direct interface between Vedeu and your terminal/
6
6
  # console, via Ruby's IO core library.
7
7
  #
8
+ # @api public
8
9
  module Terminal
9
10
 
10
11
  extend self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Measure the duration. Used for debugging.
4
+ #
5
+ # @api public
4
6
  class Timer
5
7
 
6
8
  class << self
@@ -21,7 +23,6 @@ module Vedeu
21
23
  @started = Time.now.to_f
22
24
  end
23
25
 
24
- # @param block [Proc]
25
26
  # @return [void]
26
27
  def measure
27
28
  work = yield
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Change the visibility of the given model.
4
+ #
5
+ # @api private
4
6
  class Visibility
5
7
 
6
8
  # @param name [String]
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Templating
4
4
 
5
5
  # Converts a directive found in a template into a Vedeu::Stream object.
6
+ #
7
+ # @api private
6
8
  class Directive
7
9
 
8
10
  include Vedeu::Templating::Helpers
@@ -14,6 +16,7 @@ module Vedeu
14
16
  end
15
17
 
16
18
  # @param code [String]
19
+ # @return [Vedeu::Templating::Directive]
17
20
  def initialize(code)
18
21
  @code = code
19
22
  end
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Templating
4
4
 
5
5
  # Provide helpers to be used with your Vedeu templates.
6
+ #
7
+ # @api private
6
8
  module Helpers
7
9
 
8
10
  # @example
@@ -14,14 +14,18 @@ module Vedeu
14
14
  #
15
15
  # Pre-processes a template, to convert all lines and lines with directives
16
16
  # into Vedeu::Streams.
17
+ #
18
+ # @api private
17
19
  class Preprocessor
18
20
 
19
21
  # @param lines [Array<String>]
22
+ # @return [Array<Vedeu::Stream>]
20
23
  def self.process(lines)
21
24
  new(lines).process
22
25
  end
23
26
 
24
27
  # @param lines [Array<String>]
28
+ # @return [Vedeu::Templating::Preprocessor]
25
29
  def initialize(lines)
26
30
  @lines = lines
27
31
  end
data/lib/vedeu/traps.rb CHANGED
@@ -2,6 +2,7 @@ module Vedeu
2
2
 
3
3
  # Vedeu can respond to various signals which are handled here.
4
4
  #
5
+ # @api private
5
6
  module Traps
6
7
 
7
8
  Signal.trap('INT') { exit! }
data/lib/vedeu/version.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Vedeu
2
2
 
3
- VERSION = '0.4.32'
3
+ # The current version of Vedeu.
4
+ VERSION = '0.4.33'
4
5
 
5
6
  end
@@ -201,6 +201,25 @@ module Vedeu
201
201
  it { subject.must_equal('B') }
202
202
  end
203
203
 
204
+ describe '#use' do
205
+ before do
206
+ Vedeu.border 'some_border' do
207
+ title 'Some border'
208
+ end
209
+ Vedeu.border 'other_border' do
210
+ title use('some_border').title
211
+ end
212
+ end
213
+ after { Vedeu.borders.reset }
214
+
215
+ subject { instance.use('other_border').title }
216
+
217
+ it 'allows the use of another models attributes' do
218
+ subject
219
+ Vedeu.borders.by_name('other_border').title.must_equal('Some border')
220
+ end
221
+ end
222
+
204
223
  describe '#vertical' do
205
224
  let(:char) { 'V' }
206
225
 
@@ -87,6 +87,25 @@ module Vedeu
87
87
  it { subject.must_equal(6) }
88
88
  end
89
89
 
90
+ describe '#use' do
91
+ before do
92
+ Vedeu.geometry 'some_geometry' do
93
+ x 5
94
+ end
95
+ Vedeu.geometry 'other_geometry' do
96
+ x use('some_geometry').x
97
+ end
98
+ end
99
+ after { Vedeu.geometries.reset }
100
+
101
+ subject { instance.use('other_geometry').x }
102
+
103
+ it 'allows the use of another models attributes' do
104
+ subject
105
+ Vedeu.geometries.by_name('other_geometry').x.must_equal(5)
106
+ end
107
+ end
108
+
90
109
  describe '#width' do
91
110
  subject { instance.width(25) }
92
111
 
@@ -303,6 +303,25 @@ module Vedeu
303
303
  it { subject.visible.must_equal(false) }
304
304
  end
305
305
 
306
+ describe '#use' do
307
+ before do
308
+ Vedeu.interface 'some_interface' do
309
+ delay 0.75
310
+ end
311
+ Vedeu.interface 'other_interface' do
312
+ delay use('some_interface').delay
313
+ end
314
+ end
315
+ after { Vedeu.interfaces.reset }
316
+
317
+ subject { instance.use('other_interface').delay }
318
+
319
+ it 'allows the use of another models attributes' do
320
+ subject
321
+ Vedeu.interfaces.by_name('other_interface').delay.must_equal(0.75)
322
+ end
323
+ end
324
+
306
325
  describe '#visible' do
307
326
  it { instance.visible(false).must_equal(false) }
308
327
  it { instance.visible(true).must_equal(true) }
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.4.32
4
+ version: 0.4.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-21 00:00:00.000000000 Z
11
+ date: 2015-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler