vedeu 0.6.28 → 0.6.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/README.md +1 -0
  4. data/docs/dsl.md +4 -4
  5. data/docs/keymaps.md +25 -0
  6. data/lib/vedeu/all.rb +1 -1
  7. data/lib/vedeu/borders/border.rb +1 -1
  8. data/lib/vedeu/borders/refresh.rb +1 -1
  9. data/lib/vedeu/common.rb +1 -1
  10. data/lib/vedeu/dsl/all.rb +0 -2
  11. data/lib/vedeu/dsl/presentation.rb +1 -1
  12. data/lib/vedeu/dsl/shared.rb +1 -1
  13. data/lib/vedeu/dsl/text.rb +1 -1
  14. data/lib/vedeu/dsl/view.rb +11 -13
  15. data/lib/vedeu/editor/cropper.rb +1 -1
  16. data/lib/vedeu/editor/document.rb +6 -8
  17. data/lib/vedeu/geometry/geometry.rb +6 -0
  18. data/lib/vedeu/geometry/position.rb +2 -0
  19. data/lib/vedeu/groups/group.rb +1 -1
  20. data/lib/vedeu/input/all.rb +1 -0
  21. data/lib/vedeu/{dsl/keymap.rb → input/dsl.rb} +6 -6
  22. data/lib/vedeu/interfaces/all.rb +12 -0
  23. data/lib/vedeu/{dsl/interface.rb → interfaces/dsl.rb} +10 -10
  24. data/lib/vedeu/{models → interfaces}/interface.rb +6 -6
  25. data/lib/vedeu/{null/interface.rb → interfaces/null.rb} +6 -6
  26. data/lib/vedeu/{models/interfaces.rb → interfaces/repository.rb} +10 -10
  27. data/lib/vedeu/logging/log.rb +18 -12
  28. data/lib/vedeu/models/focus.rb +1 -1
  29. data/lib/vedeu/models/toggleable.rb +1 -1
  30. data/lib/vedeu/models/views/all.rb +0 -2
  31. data/lib/vedeu/models/views/composition.rb +12 -7
  32. data/lib/vedeu/models/views/line.rb +1 -0
  33. data/lib/vedeu/models/views/stream.rb +1 -0
  34. data/lib/vedeu/null/all.rb +0 -1
  35. data/lib/vedeu/output/clear/interface.rb +1 -1
  36. data/lib/vedeu/output/output.rb +28 -10
  37. data/lib/vedeu/output/refresh/refresh.rb +1 -1
  38. data/lib/vedeu/output/renderers/all.rb +11 -2
  39. data/lib/vedeu/output/text.rb +9 -2
  40. data/lib/vedeu/repositories/model.rb +9 -7
  41. data/lib/vedeu/repositories/repositories.rb +7 -7
  42. data/lib/vedeu/runtime/main_loop.rb +2 -0
  43. data/lib/vedeu/templating/view_template.rb +1 -1
  44. data/lib/vedeu/terminal/buffer.rb +2 -0
  45. data/lib/vedeu/version.rb +1 -1
  46. data/test/lib/vedeu/borders/refresh_test.rb +1 -1
  47. data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
  48. data/test/lib/vedeu/dsl/text_test.rb +2 -1
  49. data/test/lib/vedeu/editor/cropper_test.rb +1 -1
  50. data/test/lib/vedeu/editor/document_test.rb +1 -1
  51. data/test/lib/vedeu/geometry/geometry_test.rb +3 -0
  52. data/test/lib/vedeu/groups/group_test.rb +3 -3
  53. data/test/lib/vedeu/{dsl/keymap_test.rb → input/dsl_test.rb} +5 -5
  54. data/test/lib/vedeu/{dsl/interface_test.rb → interfaces/dsl_test.rb} +7 -7
  55. data/test/lib/vedeu/{models → interfaces}/interface_test.rb +3 -3
  56. data/test/lib/vedeu/{null/interface_test.rb → interfaces/null_test.rb} +5 -5
  57. data/test/lib/vedeu/{models/interfaces_test.rb → interfaces/repository_test.rb} +5 -5
  58. data/test/lib/vedeu/logging/log_test.rb +2 -2
  59. data/test/lib/vedeu/models/views/view_test.rb +1 -1
  60. data/test/lib/vedeu/output/clear/interface_test.rb +1 -1
  61. data/test/lib/vedeu/output/output_test.rb +5 -10
  62. data/test/lib/vedeu/output/presentation/presentation_test.rb +1 -1
  63. data/test/lib/vedeu/output/refresh/refresh_test.rb +1 -1
  64. data/test/lib/vedeu/output/renderers/all_test.rb +2 -0
  65. data/test/lib/vedeu/output/viewport_test.rb +1 -1
  66. data/test/lib/vedeu/terminal/buffer_test.rb +1 -1
  67. data/test/test_helper.rb +1 -0
  68. metadata +19 -20
  69. data/lib/vedeu/output/direct.rb +0 -64
  70. data/test/lib/vedeu/output/direct_test.rb +0 -76
@@ -12,10 +12,6 @@ module Vedeu
12
12
  collection Vedeu::Views::ViewCollection
13
13
  member Vedeu::Views::View
14
14
 
15
- # @!attribute [r] attributes
16
- # @return [Hash]
17
- attr_reader :attributes
18
-
19
15
  # @!attribute [r] parent
20
16
  # @return [NilClass] Composition objects do not have a parent.
21
17
  attr_reader :parent
@@ -29,9 +25,7 @@ module Vedeu
29
25
  # @option attributes value [Vedeu::Views::ViewCollection]
30
26
  # @return [Vedeu::Views::Composition]
31
27
  def initialize(attributes = {})
32
- @attributes = defaults.merge!(attributes)
33
-
34
- @attributes.each do |key, value|
28
+ defaults.merge!(attributes).each do |key, value|
35
29
  instance_variable_set("@#{key}", value)
36
30
  end
37
31
  end
@@ -43,6 +37,17 @@ module Vedeu
43
37
  end
44
38
  alias_method :<<, :add
45
39
 
40
+ # @return [Hash]
41
+ def attributes
42
+ {
43
+ client: @client,
44
+ colour: @colour,
45
+ parent: @parent,
46
+ style: @style,
47
+ value: value,
48
+ }
49
+ end
50
+
46
51
  # @return [Vedeu::Views::ViewCollection]
47
52
  def value
48
53
  collection.coerce(@value, self)
@@ -32,6 +32,7 @@ module Vedeu
32
32
  # Returns a new instance of Vedeu::Views::Line.
33
33
  #
34
34
  # @param attributes [Hash]
35
+ # @option attributes client [void]
35
36
  # @option attributes colour [Vedeu::Colours::Colour]
36
37
  # @option attributes parent [Vedeu::Views::View]
37
38
  # @option attributes style [Vedeu::Presentation::Style]
@@ -38,6 +38,7 @@ module Vedeu
38
38
  # Returns a new instance of Vedeu::Views::Stream.
39
39
  #
40
40
  # @param attributes [Hash]
41
+ # @option attributes client [void]
41
42
  # @option attributes colour [Vedeu::Colours::Colour]
42
43
  # @option attributes style [Vedeu::Presentation::Style]
43
44
  # @option attributes parent [Vedeu::Views::Line]
@@ -11,5 +11,4 @@ module Vedeu
11
11
  end # Vedeu
12
12
 
13
13
  require 'vedeu/null/generic'
14
- require 'vedeu/null/interface'
15
14
  require 'vedeu/null/view'
@@ -96,7 +96,7 @@ module Vedeu
96
96
  geometry.height
97
97
  end
98
98
 
99
- # @see Vedeu::Models::Interfaces#by_name
99
+ # @see Vedeu::Interfaces::Repository#by_name
100
100
  def interface
101
101
  @interface ||= Vedeu.interfaces.by_name(name)
102
102
  end
@@ -11,9 +11,11 @@ module Vedeu
11
11
 
12
12
  # Writes output to the defined renderers.
13
13
  #
14
- # @return [Array|String]
14
+ # @return [Array|NilClass|String]
15
15
  # @see #initialize
16
16
  def self.render_output(output)
17
+ return nil if output.nil?
18
+
17
19
  new(output).render_output
18
20
  end
19
21
 
@@ -32,23 +34,39 @@ module Vedeu
32
34
  # because escape sequences only make sense to the terminal and
33
35
  # not other renderers.
34
36
  #
35
- # @return [Array|NilClass]
37
+ # @return [Array|String|NilClass]
36
38
  def render_output
37
- return nil if output.nil?
38
- return render_terminal_buffer unless output.is_a?(Vedeu::Models::Escape)
39
+ if escape_sequence?
40
+ direct_write!
39
41
 
40
- Vedeu::Output::Direct.write(value: output.value,
41
- x: output.position.x,
42
- y: output.position.y)
42
+ else
43
+ buffer_write!
44
+
45
+ end
43
46
  end
44
47
 
48
+ protected
49
+
45
50
  # @!attribute [r] output
46
- # @return [Array<Array<Vedeu::Views::Char>>]
51
+ # @return [Array<Array<Vedeu::Views::Char>>|
52
+ # NilClass|Vedeu::Models::Escape]
47
53
  attr_reader :output
48
54
 
55
+ private
56
+
49
57
  # @return [Array]
50
- def render_terminal_buffer
51
- Vedeu::Terminal::Buffer.write(output).render
58
+ def buffer_write!
59
+ Vedeu::Terminal::Buffer.write(output)
60
+ end
61
+
62
+ # @return [Array<String>]
63
+ def direct_write!
64
+ Vedeu::Terminal.output(output.to_s)
65
+ end
66
+
67
+ # @return [Boolean]
68
+ def escape_sequence?
69
+ output.is_a?(Vedeu::Models::Escape)
52
70
  end
53
71
 
54
72
  end # Output
@@ -17,7 +17,7 @@ module Vedeu
17
17
 
18
18
  # Refresh all registered interfaces.
19
19
  #
20
- # @return [Array<Vedeu::Models::Interface>]
20
+ # @return [Array<Vedeu::Interfaces::Interface>]
21
21
  def all
22
22
  Vedeu.timer('Refreshing all'.freeze) do
23
23
  Vedeu.interfaces.zindexed.each do |interface|
@@ -20,7 +20,7 @@ module Vedeu
20
20
  threads = storage.map do |renderer|
21
21
  Thread.new(renderer) do
22
22
  mutex.synchronize do
23
- renderer.clear
23
+ toggle_cursor { renderer.clear }
24
24
  end
25
25
  end
26
26
  end
@@ -51,7 +51,7 @@ module Vedeu
51
51
  threads = storage.map do |renderer|
52
52
  Thread.new(renderer) do
53
53
  mutex.synchronize do
54
- renderer.render(output)
54
+ toggle_cursor { renderer.render(output) }
55
55
  end
56
56
  end
57
57
  end
@@ -101,6 +101,15 @@ module Vedeu
101
101
  @storage ||= in_memory
102
102
  end
103
103
 
104
+ # @return [void]
105
+ def toggle_cursor
106
+ Vedeu.hide_cursor(Vedeu.focus)
107
+
108
+ yield
109
+
110
+ Vedeu.show_cursor(Vedeu.focus)
111
+ end
112
+
104
113
  end # Renderers
105
114
 
106
115
  # @example
@@ -83,6 +83,11 @@ module Vedeu
83
83
  string.center(width, pad)
84
84
  end
85
85
 
86
+ # @return [Object]
87
+ def client
88
+ options[:client]
89
+ end
90
+
86
91
  # If a colour, background or foreground option is set, use them
87
92
  # as the colour settings for the new Vedeu::Views::Stream.
88
93
  #
@@ -114,6 +119,7 @@ module Vedeu
114
119
  # @return [Hash<Symbol => NilClass, String, Symbol>]
115
120
  def defaults
116
121
  {
122
+ client: nil,
117
123
  anchor: :left,
118
124
  colour: nil,
119
125
  model: nil,
@@ -131,7 +137,7 @@ module Vedeu
131
137
 
132
138
  # @return [Vedeu::Views::Line]
133
139
  def line
134
- @line ||= Vedeu::Views::Line.build(parent: parent)
140
+ @line ||= Vedeu::Views::Line.build(parent: parent, client: client)
135
141
  end
136
142
 
137
143
  # Returns the model option when set.
@@ -169,7 +175,8 @@ module Vedeu
169
175
  #
170
176
  # @return [void]
171
177
  def stream
172
- @stream ||= Vedeu::Views::Stream.build(colour: colour,
178
+ @stream ||= Vedeu::Views::Stream.build(client: client,
179
+ colour: colour,
173
180
  parent: parent,
174
181
  style: style,
175
182
  value: aligned)
@@ -79,8 +79,8 @@ module Vedeu
79
79
  # @return [Hash<Symbol => NilClass, String>]
80
80
  def defaults
81
81
  {
82
- client: nil,
83
- name: '',
82
+ client: nil,
83
+ name: '',
84
84
  }
85
85
  end
86
86
 
@@ -126,11 +126,13 @@ module Vedeu
126
126
  # @return [String]
127
127
  def dsl_class
128
128
  case demodulize(self.class.name)
129
- when 'Border'.freeze then 'Vedeu::Borders::DSL'.freeze
130
- when 'Buffer'.freeze then 'Vedeu::Buffers::DSL'.freeze
131
- when 'Geometry'.freeze then 'Vedeu::Geometry::DSL'.freeze
132
- when 'Group'.freeze then 'Vedeu::Groups::DSL'.freeze
133
- when 'Menu'.freeze then 'Vedeu::Menus::DSL'.freeze
129
+ when 'Border'.freeze then 'Vedeu::Borders::DSL'.freeze
130
+ when 'Buffer'.freeze then 'Vedeu::Buffers::DSL'.freeze
131
+ when 'Geometry'.freeze then 'Vedeu::Geometry::DSL'.freeze
132
+ when 'Group'.freeze then 'Vedeu::Groups::DSL'.freeze
133
+ when 'Interface'.freeze then 'Vedeu::Interfaces::DSL'.freeze
134
+ when 'Keymap'.freeze then 'Vedeu::Keymaps::DSL'.freeze
135
+ when 'Menu'.freeze then 'Vedeu::Menus::DSL'.freeze
134
136
  # when 'ModelTestClass' then 'Vedeu::Repositories::ModelTestClass::DSL'
135
137
  else
136
138
  'Vedeu::DSL::'.freeze + demodulize(self.class.name)
@@ -6,6 +6,13 @@ module Vedeu
6
6
 
7
7
  extend self
8
8
 
9
+ # Access all the repositories stored.
10
+ #
11
+ # @return [Array]
12
+ def all
13
+ storage.map(&:repository)
14
+ end
15
+
9
16
  # Register a repository with the collection of Vedeu repositories.
10
17
  #
11
18
  # @param klass [Class]
@@ -40,13 +47,6 @@ module Vedeu
40
47
 
41
48
  private
42
49
 
43
- # Access all the repositories stored.
44
- #
45
- # @return [Array]
46
- def all
47
- storage.map(&:repository)
48
- end
49
-
50
50
  # Access to the storage for this repository.
51
51
  #
52
52
  # @return [Array]
@@ -25,6 +25,8 @@ module Vedeu
25
25
  Vedeu.trigger(:_refresh_cursor_, Vedeu.focus)
26
26
 
27
27
  while @loop
28
+ Vedeu.refresh
29
+
28
30
  yield
29
31
 
30
32
  safe_exit_point!
@@ -74,7 +74,7 @@ module Vedeu
74
74
 
75
75
  # Fetch the interface by name.
76
76
  #
77
- # @return [Vedeu::Models::Interface]
77
+ # @return [Vedeu::Interfaces::Interface]
78
78
  def interface
79
79
  Vedeu.interfaces.by_name(options[:name])
80
80
  end
@@ -70,6 +70,7 @@ module Vedeu
70
70
  def render
71
71
  Vedeu.renderers.render(output) if Vedeu.ready?
72
72
  end
73
+ alias_method :refresh, :render
73
74
 
74
75
  # Removes all content from the virtual terminal; effectively
75
76
  # clearing it.
@@ -142,5 +143,6 @@ module Vedeu
142
143
  # @!method clear
143
144
  # @see Vedeu::Terminal::Buffer#clear
144
145
  def_delegators Vedeu::Terminal::Buffer, :clear
146
+ def_delegators Vedeu::Terminal::Buffer, :refresh
145
147
 
146
148
  end # Vedeu
data/lib/vedeu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.6.28'.freeze
4
+ VERSION = '0.6.29'.freeze
5
5
 
6
6
  end
@@ -42,7 +42,7 @@ module Vedeu
42
42
  Vedeu::Geometry::Geometry.new(name: _name, x: 1, xn: 7, y: 1, yn: 4)
43
43
  }
44
44
  let(:interface) {
45
- Vedeu::Models::Interface.new(name: _name, visible: true)
45
+ Vedeu::Interfaces::Interface.new(name: _name, visible: true)
46
46
  }
47
47
  before do
48
48
  Vedeu.borders.stubs(:by_name).returns(border)
@@ -7,8 +7,8 @@ module Vedeu
7
7
  describe Presentation do
8
8
 
9
9
  let(:described) { Vedeu::DSL::Presentation }
10
- let(:instance) { Vedeu::DSL::Interface.new(model) }
11
- let(:model) { Vedeu::Models::Interface.new }
10
+ let(:instance) { Vedeu::Interfaces::DSL.new(model) }
11
+ let(:model) { Vedeu::Interfaces::Interface.new }
12
12
  let(:background) { '#00ff00' }
13
13
  let(:foreground) { '#ff00ff' }
14
14
 
@@ -13,6 +13,7 @@ module Vedeu
13
13
  {
14
14
  anchor: anchor,
15
15
  model: model,
16
+ client: nil,
16
17
  }
17
18
  }
18
19
  let(:anchor) { :text }
@@ -30,7 +31,7 @@ module Vedeu
30
31
 
31
32
  context 'when the model is a Vedeu::Views::View' do
32
33
  let(:model) { Vedeu::Views::View.new }
33
- let(:instance) { Vedeu::DSL::Interface.new(model) }
34
+ let(:instance) { Vedeu::Interfaces::DSL.new(model) }
34
35
 
35
36
  it { subject.must_be_instance_of(Vedeu::Views::Lines) }
36
37
 
@@ -26,7 +26,7 @@ module Vedeu
26
26
  yn: 3)
27
27
  }
28
28
  let(:interface) {
29
- Vedeu::Models::Interface.new(name: _name)
29
+ Vedeu::Interfaces::Interface.new(name: _name)
30
30
  }
31
31
 
32
32
  before do
@@ -27,7 +27,7 @@ module Vedeu
27
27
  Vedeu::Geometry::Geometry.new({ name: _name, x: 1, xn: 5, y: 1, yn: 5 })
28
28
  }
29
29
  let(:interface) {
30
- Vedeu::Models::Interface.new({ name: _name })
30
+ Vedeu::Interfaces::Interface.new({ name: _name })
31
31
  }
32
32
 
33
33
  before {
@@ -11,6 +11,7 @@ module Vedeu
11
11
  let(:attributes) {
12
12
  {
13
13
  centred: centred,
14
+ client: client,
14
15
  height: height,
15
16
  maximised: maximised,
16
17
  name: _name,
@@ -23,6 +24,7 @@ module Vedeu
23
24
  }
24
25
  }
25
26
  let(:centred) { false }
27
+ let(:client) {}
26
28
  let(:height) {}
27
29
  let(:maximised) { false }
28
30
  let(:_name) { 'vedeu_geometry_geometry' }
@@ -40,6 +42,7 @@ module Vedeu
40
42
  instance.instance_variable_get('@attributes').must_equal(attributes)
41
43
  }
42
44
  it { instance.instance_variable_get('@centred').must_equal(centred) }
45
+ it { instance.instance_variable_get('@client').must_equal(client) }
43
46
  it { instance.instance_variable_get('@height').must_equal(height) }
44
47
  it { instance.instance_variable_get('@maximised').must_equal(maximised) }
45
48
  it { instance.instance_variable_get('@name').must_equal(_name) }
@@ -72,9 +72,9 @@ module Vedeu
72
72
  describe '#by_zindex' do
73
73
  let(:interfaces) {
74
74
  [
75
- Vedeu::Models::Interface.new(zindex: 3, name: 'c'),
76
- Vedeu::Models::Interface.new(zindex: 1, name: 'a'),
77
- Vedeu::Models::Interface.new(zindex: 2, name: 'b'),
75
+ Vedeu::Interfaces::Interface.new(zindex: 3, name: 'c'),
76
+ Vedeu::Interfaces::Interface.new(zindex: 1, name: 'a'),
77
+ Vedeu::Interfaces::Interface.new(zindex: 2, name: 'b'),
78
78
  ]
79
79
  }
80
80
 
@@ -2,11 +2,11 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module DSL
5
+ module Keymaps
6
6
 
7
- describe Keymap do
7
+ describe DSL do
8
8
 
9
- let(:described) { Vedeu::DSL::Keymap }
9
+ let(:described) { Vedeu::Keymaps::DSL }
10
10
  let(:instance) { described.new(model) }
11
11
  let(:model) { Vedeu::Input::Keymap.new(name: '_test_') }
12
12
 
@@ -64,8 +64,8 @@ module Vedeu
64
64
  end
65
65
  end
66
66
 
67
- end # Keymap
67
+ end # DSL
68
68
 
69
- end # DSL
69
+ end # Keymaps
70
70
 
71
71
  end # Vedeu
@@ -2,14 +2,14 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module DSL
5
+ module Interfaces
6
6
 
7
- describe Interface do
7
+ describe DSL do
8
8
 
9
- let(:described) { Vedeu::DSL::Interface }
9
+ let(:described) { Vedeu::Interfaces::DSL }
10
10
  let(:instance) { described.new(model, client) }
11
11
  let(:model) {
12
- Vedeu::Models::Interface.new(name: _name)
12
+ Vedeu::Interfaces::Interface.new(name: _name)
13
13
  }
14
14
  let(:_name) { 'actinium' }
15
15
  let(:client) {}
@@ -23,7 +23,7 @@ module Vedeu
23
23
  end
24
24
  }
25
25
 
26
- it { subject.must_be_instance_of(Vedeu::Models::Interface) }
26
+ it { subject.must_be_instance_of(Vedeu::Interfaces::Interface) }
27
27
 
28
28
  context 'when the block is not given' do
29
29
  subject { described.interface('fluorine') }
@@ -322,8 +322,8 @@ module Vedeu
322
322
  it { instance.must_respond_to(:z) }
323
323
  end
324
324
 
325
- end # Interface
325
+ end # DSL
326
326
 
327
- end # DSL
327
+ end # Interfaces
328
328
 
329
329
  end # Vedeu
@@ -2,11 +2,11 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module Models
5
+ module Interfaces
6
6
 
7
7
  describe Interface do
8
8
 
9
- let(:described) { Vedeu::Models::Interface }
9
+ let(:described) { Vedeu::Interfaces::Interface }
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
@@ -93,6 +93,6 @@ module Vedeu
93
93
 
94
94
  end # Interface
95
95
 
96
- end # Models
96
+ end # Interfaces
97
97
 
98
98
  end # Vedeu
@@ -2,11 +2,11 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module Null
5
+ module Interfaces
6
6
 
7
- describe Interface do
7
+ describe Null do
8
8
 
9
- let(:described) { Vedeu::Null::Interface }
9
+ let(:described) { Vedeu::Interfaces::Null }
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:_name) { 'null_interface' }
12
12
  let(:attributes) {
@@ -23,8 +23,8 @@ module Vedeu
23
23
  it { instance.instance_variable_get('@name').must_equal(_name) }
24
24
  end
25
25
 
26
- end # Interface
26
+ end # Null
27
27
 
28
- end # Null
28
+ end # Interfaces
29
29
 
30
30
  end # Vedeu
@@ -2,11 +2,11 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module Models
5
+ module Interfaces
6
6
 
7
- describe Interfaces do
7
+ describe Repository do
8
8
 
9
- let(:described) { Vedeu::Models::Interfaces }
9
+ let(:described) { Vedeu::Interfaces::Repository }
10
10
 
11
11
  it { described.must_respond_to(:interfaces) }
12
12
 
@@ -31,8 +31,8 @@ module Vedeu
31
31
  it { subject.must_equal([@lithium, @hydrogen, @helium]) }
32
32
  end
33
33
 
34
- end # Interfaces
34
+ end # Repository
35
35
 
36
- end # Models
36
+ end # Interfaces
37
37
 
38
38
  end # Vedeu
@@ -27,7 +27,7 @@ module Vedeu
27
27
 
28
28
  it {
29
29
  capture_io { subject }.must_equal(
30
- ["\e[92m[create] \e[39m\e[32mLogging to stdout...\e[39m\n", ""]
30
+ ["\e[96m[create] \e[39m\e[36mLogging to stdout...\e[39m\n", ""]
31
31
  )
32
32
  }
33
33
  end
@@ -40,7 +40,7 @@ module Vedeu
40
40
 
41
41
  it {
42
42
  capture_io { subject }.must_equal(
43
- ["", "\e[91m[debug] \e[39m\e[31mLogging to stderr...\e[39m\n"]
43
+ ["", "\e[97m[debug] \e[39m\e[39mLogging to stderr...\e[39m\n"]
44
44
  )
45
45
  }
46
46
  end
@@ -88,7 +88,7 @@ module Vedeu
88
88
  subject { instance.visible? }
89
89
 
90
90
  context 'when the interface is visible' do
91
- let(:interface) { Vedeu::Models::Interface.new(visible: true) }
91
+ let(:interface) { Vedeu::Interfaces::Interface.new(visible: true) }
92
92
 
93
93
  before do
94
94
  Vedeu.interfaces.stubs(:by_name).with(_name).returns(interface)
@@ -29,7 +29,7 @@ module Vedeu
29
29
 
30
30
  describe '#render' do
31
31
  let(:interface) {
32
- Vedeu::Models::Interface.new(name: _name, visible: visible)
32
+ Vedeu::Interfaces::Interface.new(name: _name, visible: visible)
33
33
  }
34
34
  let(:visible) { true }
35
35
  let(:geometry) {
@@ -29,22 +29,17 @@ module Vedeu
29
29
  Vedeu::Models::Escape.new(value: "\e[?25h", position: [1, 1])
30
30
  }
31
31
 
32
- before { Vedeu::Output::Direct.stubs(:write).returns(output.to_s) }
33
-
34
- it { subject.must_equal("\e[1;1H\e[?25h") }
32
+ it {
33
+ Vedeu::Terminal.expects(:output)
34
+ subject
35
+ }
35
36
  end
36
37
 
37
38
  context 'and the output is not an escape sequence' do
38
39
  let(:output) { Vedeu::Models::Page.new }
39
- let(:buffer) { mock('Vedeu::Terminal::Buffer') }
40
-
41
- before do
42
- Vedeu::Terminal::Buffer.stubs(:write)
43
- buffer.expects(:render).returns(output)
44
- end
45
40
 
46
41
  it {
47
- Vedeu::Terminal::Buffer.expects(:write).with(output).returns(buffer)
42
+ Vedeu::Terminal::Buffer.expects(:write).with(output)
48
43
  subject
49
44
  }
50
45
  end
@@ -53,7 +53,7 @@ module Vedeu
53
53
  }
54
54
  let(:line) {
55
55
  Vedeu::Views::Line.new(value: [],
56
- parent: Vedeu::Models::Interface.new,
56
+ parent: Vedeu::Interfaces::Interface.new,
57
57
  colour: green,
58
58
  style: Vedeu::Presentation::Style.new('normal'))
59
59
  }
@@ -24,7 +24,7 @@ module Vedeu
24
24
 
25
25
  context 'when there are registered interfaces' do
26
26
  let(:interface) {
27
- Vedeu::Models::Interface.new(name: 'Vedeu::Output::Refresh')
27
+ Vedeu::Interfaces::Interface.new(name: 'Vedeu::Output::Refresh')
28
28
  }
29
29
  let(:interfaces) { [interface] }
30
30
 
@@ -63,6 +63,8 @@ module Vedeu
63
63
  before do
64
64
  Vedeu::Renderers.reset
65
65
  Vedeu::Renderers.renderer(DummyRenderer)
66
+ Vedeu.stubs(:hide_cursor)
67
+ Vedeu.stubs(:show_cursor)
66
68
  end
67
69
 
68
70
  subject { described.render(output) }