vedeu 0.6.17 → 0.6.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/docs/events/system.md +1 -1
  4. data/lib/vedeu/all.rb +0 -2
  5. data/lib/vedeu/dsl/text.rb +2 -3
  6. data/lib/vedeu/events/aliases.rb +1 -1
  7. data/lib/vedeu/geometry/geometry.rb +12 -32
  8. data/lib/vedeu/input/all.rb +2 -2
  9. data/lib/vedeu/input/{input.rb → capture.rb} +4 -4
  10. data/lib/vedeu/input/key.rb +6 -0
  11. data/lib/vedeu/input/store.rb +71 -0
  12. data/lib/vedeu/models/group.rb +1 -3
  13. data/lib/vedeu/output/wordwrap.rb +4 -10
  14. data/lib/vedeu/runtime/application.rb +1 -1
  15. data/lib/vedeu/version.rb +1 -1
  16. data/test/lib/vedeu/bindings/drb_test.rb +4 -0
  17. data/test/lib/vedeu/buffers/buffer_test.rb +5 -1
  18. data/test/lib/vedeu/cursors/refresh_test.rb +1 -0
  19. data/test/lib/vedeu/distributed/client_test.rb +1 -0
  20. data/test/lib/vedeu/distributed/server_test.rb +1 -0
  21. data/test/lib/vedeu/events/aliases_test.rb +1 -0
  22. data/test/lib/vedeu/events/event_test.rb +4 -0
  23. data/test/lib/vedeu/input/{input_test.rb → capture_test.rb} +4 -4
  24. data/test/lib/vedeu/input/key_test.rb +13 -0
  25. data/test/lib/vedeu/input/keymap_test.rb +4 -0
  26. data/test/lib/vedeu/input/mapper_test.rb +2 -0
  27. data/test/lib/vedeu/input/store_test.rb +138 -0
  28. data/test/lib/vedeu/models/focus_test.rb +2 -0
  29. data/test/lib/vedeu/models/group_test.rb +0 -3
  30. data/test/lib/vedeu/output/renderers/all_test.rb +4 -1
  31. data/test/lib/vedeu/plugins/plugins_test.rb +2 -0
  32. data/test/lib/vedeu/repositories/repositories_test.rb +4 -1
  33. data/test/lib/vedeu/repositories/repository_test.rb +4 -0
  34. data/test/lib/vedeu/repositories/store_test.rb +2 -0
  35. data/test/lib/vedeu/runtime/bootstrap_test.rb +1 -0
  36. data/test/lib/vedeu/runtime/launcher_test.rb +1 -0
  37. data/test/lib/vedeu/runtime/main_loop_test.rb +2 -0
  38. data/test/lib/vedeu/runtime/router_test.rb +6 -0
  39. data/test/lib/vedeu/terminal/terminal_test.rb +2 -0
  40. data/vedeu.gemspec +1 -1
  41. metadata +10 -10
  42. data/lib/vedeu/input/keys.rb +0 -13
  43. data/test/lib/vedeu/input/keys_test.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1dedbb9669f830e16e76d6cc1fd36e663a8df852
4
- data.tar.gz: c70f1cee9ddf254058e4f321353cd56bf522c6ad
3
+ metadata.gz: e8a4672068319df313bac858e6b6088ec8e01bd6
4
+ data.tar.gz: 79b17bce1d8aa635ece56f3b66bb7e16dd037aed
5
5
  SHA512:
6
- metadata.gz: 52bf53d2726657214caa83cec14af8d55b579c15f7722d0edfa7b8ec1510ed14b604043d33d2ca54098f66e80f2a439252d31de07ceb229513e95d5f13b9c13e
7
- data.tar.gz: 45629d5e4229bd41d64eb0020f1e7093d4725a28dd8e3aaee4f4f8391d2616e361d7d0c401633a98a311054c5a76f511d5d52209391f06c5a624c30b5059a51e
6
+ metadata.gz: 0d38e15946f2980f3921e54d095dedbbc87e4750b2a9ef6253647188398c6e64fc40d2d07a05516e86467228cb668fcdf7e62e063f33cbfae76c7e6f96637ff3
7
+ data.tar.gz: 98b35105b71c94533ae0acb64d33aef998f0372848c833f8a782e16303868983d5aa5fe6aa24c4b50b0e6e35d59ca15be89e5161455132086a193dcb539f04f1
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ Rake::TestTask.new(:test) do |task|
8
8
  task.libs.push 'test'
9
9
  task.pattern = 'test/**/*_test.rb'
10
10
  task.verbose = false
11
- task.warning = true # set to true for Ruby warnings (ruby -w)
11
+ task.warning = false # set to true for Ruby warnings (ruby -w)
12
12
  end
13
13
 
14
14
  YARD::Rake::YardocTask.new(:yard) do |task|
@@ -43,7 +43,7 @@ to 'do things'. If the `escape` key is pressed, then `key` is triggered
43
43
  with the argument `:escape`, also an internal event `_mode_switch_` is
44
44
  triggered. Vedeu recognises most key presses and some 'extended'
45
45
  keypress (eg. Ctrl+J), a list of supported keypresses can be found here:
46
- {Vedeu::Input::Input#specials} and {Vedeu::Input::Input#f_keys}.
46
+ {Vedeu::Input::Input}.
47
47
 
48
48
  Vedeu.trigger(:_keypress_, key)
49
49
 
data/lib/vedeu/all.rb CHANGED
@@ -12,8 +12,6 @@ require 'vedeu/configuration/configuration'
12
12
  require 'vedeu/terminal/all'
13
13
  require 'vedeu/repositories/all'
14
14
 
15
- require 'vedeu/input/keys'
16
-
17
15
  require 'vedeu/models/toggleable'
18
16
 
19
17
  require 'vedeu/output/presentation/presentation'
@@ -11,9 +11,8 @@ module Vedeu
11
11
  # string (or object responding to `to_s`), and add it as a Line
12
12
  # or to the Stream.
13
13
  #
14
- # @note If using the convenience methods; {left}, {centre},
15
- # {center} or {right}, then a specified anchor will be
16
- # ignored.
14
+ # @note If using the convenience methods; left, centre, center
15
+ # or right, then a specified anchor will be ignored.
17
16
  #
18
17
  # @example
19
18
  # lines do
@@ -89,7 +89,7 @@ module Vedeu
89
89
  def trigger(alias_name, *args)
90
90
  return [] unless registered?(alias_name)
91
91
 
92
- storage[alias_name].map do |event_name|
92
+ find(alias_name).map do |event_name|
93
93
  Vedeu.log(type: :debug, message: "#{event_name}")
94
94
  Vedeu::Events::Trigger.trigger(event_name, *args)
95
95
  end
@@ -135,15 +135,10 @@ module Vedeu
135
135
  # TODO: Move cursor also.
136
136
  # @return [Vedeu::Geometry::Geometry]
137
137
  def move_down
138
- if yn + 1 > Vedeu.height
139
- dy = y
140
- dyn = yn
141
- else
142
- dy = y + 1
143
- dyn = yn + 1
144
- end
138
+ return self if yn + 1 > Vedeu.height
145
139
 
146
- Vedeu::Geometry::Geometry.store(move_attributes.merge!(y: dy, yn: dyn))
140
+ Vedeu::Geometry::Geometry.store(move_attributes.merge!(y: y + 1,
141
+ yn: yn + 1))
147
142
  end
148
143
 
149
144
  # Moves the geometry left by one column.
@@ -151,15 +146,10 @@ module Vedeu
151
146
  # TODO: Move cursor also.
152
147
  # @return [Vedeu::Geometry::Geometry]
153
148
  def move_left
154
- if x - 1 < 1
155
- dx = x
156
- dxn = xn
157
- else
158
- dx = x - 1
159
- dxn = xn - 1
160
- end
149
+ return self if x - 1 < 1
161
150
 
162
- Vedeu::Geometry::Geometry.store(move_attributes.merge!(x: dx, xn: dxn))
151
+ Vedeu::Geometry::Geometry.store(move_attributes.merge!(x: x - 1,
152
+ xn: xn - 1))
163
153
  end
164
154
 
165
155
  # Moves the geometry to the top left of the terminal.
@@ -179,15 +169,10 @@ module Vedeu
179
169
  # TODO: Move cursor also.
180
170
  # @return [Vedeu::Geometry::Geometry]
181
171
  def move_right
182
- if xn + 1 > Vedeu.width
183
- dx = x
184
- dxn = xn
185
- else
186
- dx = x + 1
187
- dxn = xn + 1
188
- end
172
+ return self if xn + 1 > Vedeu.width
189
173
 
190
- Vedeu::Geometry::Geometry.store(move_attributes.merge!(x: dx, xn: dxn))
174
+ Vedeu::Geometry::Geometry.store(move_attributes.merge!(x: x + 1,
175
+ xn: xn + 1))
191
176
  end
192
177
 
193
178
  # Moves the geometry up by one column.
@@ -195,15 +180,10 @@ module Vedeu
195
180
  # TODO: Move cursor also.
196
181
  # @return [Vedeu::Geometry::Geometry]
197
182
  def move_up
198
- if y - 1 < 1
199
- dy = y
200
- dyn = yn
201
- else
202
- dy = y - 1
203
- dyn = yn - 1
204
- end
183
+ return self if y - 1 < 1
205
184
 
206
- Vedeu::Geometry::Geometry.store(move_attributes.merge!(y: dy, yn: dyn))
185
+ Vedeu::Geometry::Geometry.store(move_attributes.merge!(y: y - 1,
186
+ yn: yn - 1))
207
187
  end
208
188
 
209
189
  # Will unmaximise the named interface geometry. Previously, when
@@ -9,10 +9,10 @@ module Vedeu
9
9
 
10
10
  end # Vedeu
11
11
 
12
- require 'vedeu/input/input'
12
+ require 'vedeu/input/capture'
13
13
  require 'vedeu/input/key'
14
14
  require 'vedeu/input/keymap'
15
15
  require 'vedeu/input/keymaps'
16
- require 'vedeu/input/keys'
17
16
  require 'vedeu/input/mapper'
17
+ require 'vedeu/input/store'
18
18
  require 'vedeu/input/translator'
@@ -5,14 +5,14 @@ module Vedeu
5
5
  # Captures input from the user via {Vedeu::Terminal#input} and
6
6
  # translates special characters into symbols.
7
7
  #
8
- class Input
8
+ class Capture
9
9
 
10
10
  # Instantiate Vedeu::Input::Input and capture keypress(es).
11
11
  #
12
12
  # @param (see #initialize)
13
13
  # @return [String|Symbol]
14
- def self.capture(reader)
15
- new(reader).capture
14
+ def self.read(reader)
15
+ new(reader).read
16
16
  end
17
17
 
18
18
  # Returns a new instance of Vedeu::Input::Input.
@@ -29,7 +29,7 @@ module Vedeu
29
29
  # event with the key(s) pressed.
30
30
  #
31
31
  # @return [Array|String|Symbol]
32
- def capture
32
+ def read
33
33
  if reader.raw_mode?
34
34
  Vedeu.trigger(:_keypress_, keypress)
35
35
 
@@ -2,6 +2,12 @@ module Vedeu
2
2
 
3
3
  module Input
4
4
 
5
+ # A collection of {Vedeu::Input::Key} instances.
6
+ #
7
+ class Keys < Vedeu::Repositories::Collection
8
+
9
+ end # Keys
10
+
5
11
  # A single keypress or combination of keypresses bound to a
6
12
  # specific action.
7
13
  #
@@ -0,0 +1,71 @@
1
+ module Vedeu
2
+
3
+ module Input
4
+
5
+ # Stores each keypress or command to be retrieved later.
6
+ #
7
+ class Store
8
+
9
+ def initialize
10
+ end
11
+
12
+ # @return [Hash<Symbol => Array<Symbol|String>>]
13
+ def add_command(command)
14
+ all_commands << command
15
+ end
16
+
17
+ # @return [Hash<Symbol => Array<Symbol|String>>]
18
+ def add_keypress(keypress)
19
+ all_keypresses << keypress
20
+ end
21
+
22
+ # @return [Hash<Symbol => Array<Symbol|String>>]
23
+ def all
24
+ storage
25
+ end
26
+
27
+ # @return [Array<Symbol|String>]
28
+ def all_commands
29
+ storage[:commands]
30
+ end
31
+
32
+ # @return [Array<Symbol|String>]
33
+ def all_keypresses
34
+ storage[:keypresses]
35
+ end
36
+
37
+ # @return [NilClass|Symbol|String]
38
+ def last_command
39
+ all_commands.last
40
+ end
41
+
42
+ # @return [NilClass|Symbol|String]
43
+ def last_keypress
44
+ all_keypresses.last
45
+ end
46
+
47
+ # @return [Hash<Symbol => Array<Symbol|String>>]
48
+ def reset
49
+ @storage = in_memory
50
+ end
51
+
52
+ private
53
+
54
+ # @return [Hash<Symbol => Array<Symbol|String>>]
55
+ def storage
56
+ @storage ||= in_memory
57
+ end
58
+
59
+ # @return [Hash<Symbol => Array<Symbol|String>>]
60
+ def in_memory
61
+ {
62
+ commands: [],
63
+ keypresses: [],
64
+ }
65
+ end
66
+
67
+ end # Store
68
+
69
+ end # Input
70
+
71
+ end # Vedeu
@@ -31,9 +31,7 @@ module Vedeu
31
31
  # visible or not.
32
32
  # @return [Vedeu::Models::Group]
33
33
  def initialize(attributes = {})
34
- @attributes = defaults.merge!(attributes)
35
-
36
- @attributes.each do |key, value|
34
+ defaults.merge!(attributes).each do |key, value|
37
35
  instance_variable_set("@#{key}", value)
38
36
  end
39
37
  end
@@ -38,19 +38,15 @@ module Vedeu
38
38
  def prune
39
39
  return text if text.size <= pruned_width
40
40
 
41
- processed = []
42
-
43
- if split_lines.size > 1
44
- processed = split_lines.reduce([]) do |acc, line|
41
+ processed = if split_lines.size > 1
42
+ split_lines.reduce([]) do |acc, line|
45
43
  acc << ellipsis_string(line)
46
44
  end
47
45
 
48
46
  else
49
- processed = ellipsis_string(text)
47
+ ellipsis_string(text)
50
48
 
51
49
  end
52
-
53
- processed
54
50
  end
55
51
 
56
52
  # @return [String]
@@ -75,9 +71,7 @@ module Vedeu
75
71
  processed << reformatted
76
72
  end
77
73
 
78
- processed.reduce([]) do |output, line|
79
- output << line.join(' ')
80
- end
74
+ processed.reduce([]) { |output, line| output << line.join(' ') }
81
75
  end
82
76
 
83
77
  protected
@@ -102,7 +102,7 @@ module Vedeu
102
102
  # @return [void]
103
103
  def main_sequence
104
104
  if configuration.interactive?
105
- Vedeu::Input::Input.capture(Terminal)
105
+ Vedeu::Input::Capture.read(Terminal)
106
106
 
107
107
  else
108
108
  Vedeu.trigger(:_standalone_)
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.17'
4
+ VERSION = '0.6.18'
5
5
 
6
6
  end
@@ -6,6 +6,10 @@ module Vedeu
6
6
 
7
7
  describe DRB do
8
8
 
9
+ before do
10
+ Vedeu.stubs(:log)
11
+ end
12
+
9
13
  context 'the drb specific events are defined' do
10
14
  it { Vedeu.bound?(:_drb_input_).must_equal(true) }
11
15
  it { Vedeu.bound?(:_drb_retrieve_output_).must_equal(true) }
@@ -114,6 +114,7 @@ module Vedeu
114
114
 
115
115
  describe '#show' do
116
116
  before do
117
+ Vedeu.stubs(:log)
117
118
  # Vedeu::Clear::Interface.stubs(:render)
118
119
  Vedeu::Output::Output.stubs(:render)
119
120
  end
@@ -127,7 +128,10 @@ module Vedeu
127
128
  end
128
129
 
129
130
  describe '#render' do
130
- before { Vedeu::Output::Output.stubs(:render) }
131
+ before {
132
+ Vedeu.stubs(:log)
133
+ Vedeu::Output::Output.stubs(:render)
134
+ }
131
135
 
132
136
  subject { instance.render }
133
137
 
@@ -20,6 +20,7 @@ module Vedeu
20
20
 
21
21
  describe '.by_name' do
22
22
  before do
23
+ Vedeu.stubs(:log)
23
24
  Vedeu.geometry 'refresh_cursor' do
24
25
  x 1
25
26
  xn 3
@@ -12,6 +12,7 @@ module Vedeu
12
12
  let(:server) {}
13
13
 
14
14
  before do
15
+ Vedeu.stubs(:log)
15
16
  $stdout.stubs(:puts)
16
17
  DRbObject.stubs(:new_with_uri).returns(server)
17
18
  end
@@ -13,6 +13,7 @@ module Vedeu
13
13
  let(:running) { false }
14
14
 
15
15
  before do
16
+ Vedeu.stubs(:log)
16
17
  Vedeu::Configuration.stubs(:drb?).returns(enabled)
17
18
  DRb.stubs(:thread).returns(running)
18
19
  end
@@ -111,6 +111,7 @@ module Vedeu
111
111
 
112
112
  context 'when the alias name is registered' do
113
113
  before do
114
+ Vedeu.stubs(:log)
114
115
  Vedeu::Events::Trigger.stubs(:trigger)
115
116
 
116
117
  described.add(:some_alias, :some_event)
@@ -13,6 +13,8 @@ module Vedeu
13
13
  let(:options) { {} }
14
14
 
15
15
  describe '.bind' do
16
+ before { Vedeu.stubs(:log) }
17
+
16
18
  subject { described.bind(event_name, options) { :event_triggered } }
17
19
 
18
20
  it { described.must_respond_to(:event) }
@@ -95,6 +97,8 @@ module Vedeu
95
97
  end
96
98
 
97
99
  describe '#unbind' do
100
+ before { Vedeu.stubs(:log) }
101
+
98
102
  context 'when the event exists' do
99
103
  before { Vedeu.bind(:gallium) { :some_action } }
100
104
 
@@ -4,11 +4,11 @@ module Vedeu
4
4
 
5
5
  module Input
6
6
 
7
- describe Input do
7
+ describe Capture do
8
8
 
9
9
  let(:reader) { Vedeu::Terminal }
10
10
  let(:keypress) { 'a' }
11
- let(:described) { Vedeu::Input::Input }
11
+ let(:described) { Vedeu::Input::Capture }
12
12
  let(:instance) { described.new(reader) }
13
13
  let(:raw_mode) { true }
14
14
 
@@ -17,14 +17,14 @@ module Vedeu
17
17
  it { instance.instance_variable_get('@reader').must_equal(reader) }
18
18
  end
19
19
 
20
- describe '.capture' do
20
+ describe '.read' do
21
21
  before do
22
22
  reader.stubs(:raw_mode?).returns(raw_mode)
23
23
  reader.stubs(:fake_mode?).returns(fake_mode)
24
24
  Vedeu.stubs(:trigger).returns([false])
25
25
  end
26
26
 
27
- subject { described.capture(reader) }
27
+ subject { described.read(reader) }
28
28
 
29
29
  context 'when in cooked mode' do
30
30
  let(:raw_mode) { false }
@@ -4,6 +4,19 @@ module Vedeu
4
4
 
5
5
  module Input
6
6
 
7
+ describe Keys do
8
+
9
+ let(:described) { Vedeu::Input::Keys }
10
+ let(:instance) { described.new }
11
+
12
+ it { described.superclass.must_equal(Vedeu::Repositories::Collection) }
13
+
14
+ describe '#initialize' do
15
+ it { instance.must_be_instance_of(described) }
16
+ end
17
+
18
+ end # Keys
19
+
7
20
  describe Key do
8
21
 
9
22
  let(:described) { Vedeu::Input::Key }
@@ -33,6 +33,8 @@ module Vedeu
33
33
  end
34
34
 
35
35
  describe '#add' do
36
+ before { Vedeu.stubs(:log) }
37
+
36
38
  subject { instance.add(key) }
37
39
 
38
40
  context 'when the key is already defined' do
@@ -68,6 +70,8 @@ module Vedeu
68
70
  describe '#use' do
69
71
  let(:input) { 'b' }
70
72
 
73
+ before { Vedeu.stubs(:log) }
74
+
71
75
  subject { instance.use(input) }
72
76
 
73
77
  context 'when the input is defined' do
@@ -34,6 +34,8 @@ module Vedeu
34
34
  describe '.keypress' do
35
35
  let(:keymap) { 'test' }
36
36
 
37
+ before { Vedeu.stubs(:log) }
38
+
37
39
  subject { described.keypress(key, keymap) }
38
40
 
39
41
  context 'when the key is not provided' do
@@ -0,0 +1,138 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Input
6
+
7
+ describe Store do
8
+
9
+ let(:described) { Vedeu::Input::Store }
10
+ let(:instance) { described.new }
11
+
12
+ before { instance.reset }
13
+
14
+ describe '#add_command' do
15
+ let(:command) { 'command_1' }
16
+
17
+ subject { instance.add_command(command) }
18
+
19
+ it { subject.must_equal(['command_1']) }
20
+ end
21
+
22
+ describe '#add_keypress' do
23
+ let(:keypress) { 'a' }
24
+
25
+ subject { instance.add_keypress(keypress) }
26
+
27
+ it { subject.must_equal(['a']) }
28
+ end
29
+
30
+ describe '#all' do
31
+ subject { instance.all }
32
+
33
+ context 'when empty' do
34
+ it { subject.must_equal({ commands: [], keypresses: [] }) }
35
+ end
36
+
37
+ context 'when not empty' do
38
+ let(:expected) {
39
+ {
40
+ commands: ['command_1', 'command_2'],
41
+ keypresses: ['a', 'b'],
42
+ }
43
+ }
44
+
45
+ before do
46
+ instance.add_command('command_1')
47
+ instance.add_command('command_2')
48
+ instance.add_keypress('a')
49
+ instance.add_keypress('b')
50
+ end
51
+
52
+ it { subject.must_equal(expected) }
53
+ end
54
+ end
55
+
56
+ describe '#all_commands' do
57
+ subject { instance.all_commands }
58
+
59
+ context 'when there are no stored commands' do
60
+ it { subject.must_equal([]) }
61
+ end
62
+
63
+ context 'when there are stored commands' do
64
+ before do
65
+ instance.add_command('command_1')
66
+ instance.add_command('command_2')
67
+ instance.add_command('command_3')
68
+ end
69
+
70
+ it { subject.must_equal(['command_1', 'command_2', 'command_3']) }
71
+ end
72
+ end
73
+
74
+ describe '#all_keypresses' do
75
+ subject { instance.all_keypresses }
76
+
77
+ context 'when there are no stored keypresses' do
78
+ it { subject.must_equal([]) }
79
+ end
80
+
81
+ context 'when there are stored keypresses' do
82
+ before do
83
+ instance.add_keypress('a')
84
+ instance.add_keypress('b')
85
+ instance.add_keypress('c')
86
+ end
87
+
88
+ it { subject.must_equal(['a', 'b', 'c']) }
89
+ end
90
+ end
91
+
92
+ describe '#last_command' do
93
+ subject { instance.last_command }
94
+
95
+ context 'when there are no stored commands' do
96
+ it { subject.must_equal(nil) }
97
+ end
98
+
99
+ context 'when there are stored commands' do
100
+ before do
101
+ instance.add_command('command_1')
102
+ instance.add_command('command_2')
103
+ instance.add_command('command_3')
104
+ end
105
+
106
+ it { subject.must_equal('command_3') }
107
+ end
108
+ end
109
+
110
+ describe '#last_keypress' do
111
+ subject { instance.last_keypress }
112
+
113
+ context 'when there are no stored keypresses' do
114
+ it { subject.must_equal(nil) }
115
+ end
116
+
117
+ context 'when there are stored keypresses' do
118
+ before do
119
+ instance.add_keypress('a')
120
+ instance.add_keypress('b')
121
+ instance.add_keypress('c')
122
+ end
123
+
124
+ it { subject.must_equal('c') }
125
+ end
126
+ end
127
+
128
+ describe '#reset' do
129
+ subject { instance.reset }
130
+
131
+ it { subject.must_equal({ commands: [], keypresses: [] }) }
132
+ end
133
+
134
+ end # Store
135
+
136
+ end # Input
137
+
138
+ end # Vedeu
@@ -9,6 +9,8 @@ module Vedeu
9
9
  let(:described) { Vedeu::Models::Focus }
10
10
 
11
11
  before do
12
+ Vedeu.stubs(:log)
13
+
12
14
  Vedeu::Models::Focus.reset
13
15
  Vedeu.interfaces.reset
14
16
 
@@ -23,9 +23,6 @@ module Vedeu
23
23
 
24
24
  describe '#initialize' do
25
25
  it { instance.must_be_instance_of(described) }
26
- it {
27
- instance.instance_variable_get('@attributes').must_be_instance_of(Hash)
28
- }
29
26
  it { instance.instance_variable_get('@members').must_equal(members) }
30
27
  it { instance.instance_variable_get('@name').must_equal(_name) }
31
28
  it {
@@ -19,7 +19,10 @@ module Vedeu
19
19
  let(:described) { Vedeu::Renderers }
20
20
  let(:output) {}
21
21
 
22
- before { Vedeu::Renderers.reset }
22
+ before {
23
+ Vedeu.stubs(:log)
24
+ Vedeu::Renderers.reset
25
+ }
23
26
  after { Vedeu::Renderers.reset }
24
27
 
25
28
  describe '.renderers' do
@@ -23,6 +23,8 @@ module Vedeu
23
23
  let(:_name) {}
24
24
  let(:plugin) { false }
25
25
 
26
+ before { Vedeu.stubs(:log) }
27
+
26
28
  subject { instance.register(_name, plugin) }
27
29
 
28
30
  # @todo Add more tests.
@@ -23,7 +23,10 @@ module Vedeu
23
23
  end
24
24
 
25
25
  describe '.registered' do
26
- before { described.reset! }
26
+ before {
27
+ Vedeu.stubs(:log)
28
+ described.reset!
29
+ }
27
30
 
28
31
  subject { described.registered }
29
32
 
@@ -166,6 +166,8 @@ module Vedeu
166
166
  describe '#find_or_create' do
167
167
  let(:model_instance) { Vedeu::Repositories::TestModel.new('niobium') }
168
168
 
169
+ before { Vedeu.stubs(:log) }
170
+
169
171
  subject { instance.find_or_create(model_name) }
170
172
 
171
173
  context 'when the model exists' do
@@ -251,6 +253,8 @@ module Vedeu
251
253
  describe '#store' do
252
254
  subject { instance.store(model_instance) }
253
255
 
256
+ before { Vedeu.stubs(:log) }
257
+
254
258
  it { instance.must_respond_to(:register) }
255
259
 
256
260
  context 'when a name attribute is empty or nil' do
@@ -127,6 +127,8 @@ module Vedeu
127
127
  end
128
128
 
129
129
  describe '#reset' do
130
+ before { Vedeu.stubs(:log) }
131
+
130
132
  it 'returns a Hash' do
131
133
  instance.reset.must_be_instance_of(Hash)
132
134
  end
@@ -24,6 +24,7 @@ module Vedeu
24
24
 
25
25
  describe '.start' do
26
26
  before do
27
+ Vedeu.stubs(:log)
27
28
  Vedeu::Configuration.stubs(:root).
28
29
  returns([:controller, :action, :args])
29
30
  Vedeu.stubs(:trigger)
@@ -37,6 +37,7 @@ module Vedeu
37
37
 
38
38
  describe '#execute!' do
39
39
  before do
40
+ Vedeu.stubs(:log_stdout)
40
41
  Vedeu::Runtime::Application.stubs(:start)
41
42
  Kernel.stubs(:exit)
42
43
  Kernel.stubs(:puts)
@@ -9,6 +9,8 @@ module Vedeu
9
9
  let(:described) { Vedeu::Runtime::MainLoop }
10
10
 
11
11
  describe '.start!' do
12
+ before { Vedeu.stubs(:log) }
13
+
12
14
  subject { described.start! { } }
13
15
  end
14
16
 
@@ -25,6 +25,8 @@ module Vedeu
25
25
  let(:controller) {}
26
26
  let(:klass) { "SomeController" }
27
27
 
28
+ before { Vedeu.stubs(:log) }
29
+
28
30
  subject { described.add_controller(controller, klass) }
29
31
 
30
32
  context 'when a name is not given' do
@@ -68,6 +70,8 @@ module Vedeu
68
70
  let(:controller) {}
69
71
  let(:action) {}
70
72
 
73
+ before { Vedeu.stubs(:log) }
74
+
71
75
  subject { described.add_action(controller, action) }
72
76
 
73
77
  context 'when the controller is not given' do
@@ -125,6 +129,8 @@ module Vedeu
125
129
  }
126
130
  }
127
131
 
132
+ before { Vedeu.stubs(:log) }
133
+
128
134
  subject { described.goto(controller, action, **args) }
129
135
 
130
136
  it { described.must_respond_to(:action) }
@@ -41,6 +41,8 @@ module Vedeu
41
41
  end
42
42
 
43
43
  describe '.input' do
44
+ before { Vedeu.stubs(:log) }
45
+
44
46
  subject { Vedeu::Terminal.input }
45
47
 
46
48
  it { described.must_respond_to(:read) }
data/vedeu.gemspec CHANGED
@@ -35,5 +35,5 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_dependency 'bundler', '~> 1.10'
37
37
  spec.add_dependency 'rake', '~> 10.4'
38
- spec.add_dependency 'vedeu_cli', '0.0.5'
38
+ spec.add_dependency 'vedeu_cli', '0.0.6'
39
39
  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.6.17
4
+ version: 0.6.18
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-09-26 00:00:00.000000000 Z
11
+ date: 2015-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 0.0.5
215
+ version: 0.0.6
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 0.0.5
222
+ version: 0.0.6
223
223
  description: A framework for building GUI/TUI terminal/console applications.
224
224
  email:
225
225
  - gavinlaking@gmail.com
@@ -376,12 +376,12 @@ files:
376
376
  - lib/vedeu/geometry/position.rb
377
377
  - lib/vedeu/geometry/repository.rb
378
378
  - lib/vedeu/input/all.rb
379
- - lib/vedeu/input/input.rb
379
+ - lib/vedeu/input/capture.rb
380
380
  - lib/vedeu/input/key.rb
381
381
  - lib/vedeu/input/keymap.rb
382
382
  - lib/vedeu/input/keymaps.rb
383
- - lib/vedeu/input/keys.rb
384
383
  - lib/vedeu/input/mapper.rb
384
+ - lib/vedeu/input/store.rb
385
385
  - lib/vedeu/input/translator.rb
386
386
  - lib/vedeu/logging/all.rb
387
387
  - lib/vedeu/logging/debug.rb
@@ -558,12 +558,12 @@ files:
558
558
  - test/lib/vedeu/geometry/null_test.rb
559
559
  - test/lib/vedeu/geometry/position_test.rb
560
560
  - test/lib/vedeu/geometry/repository_test.rb
561
- - test/lib/vedeu/input/input_test.rb
561
+ - test/lib/vedeu/input/capture_test.rb
562
562
  - test/lib/vedeu/input/key_test.rb
563
563
  - test/lib/vedeu/input/keymap_test.rb
564
564
  - test/lib/vedeu/input/keymaps_test.rb
565
- - test/lib/vedeu/input/keys_test.rb
566
565
  - test/lib/vedeu/input/mapper_test.rb
566
+ - test/lib/vedeu/input/store_test.rb
567
567
  - test/lib/vedeu/input/translator_test.rb
568
568
  - test/lib/vedeu/logging/debug_test.rb
569
569
  - test/lib/vedeu/logging/lockless_log_device_test.rb
@@ -776,12 +776,12 @@ test_files:
776
776
  - test/lib/vedeu/geometry/null_test.rb
777
777
  - test/lib/vedeu/geometry/position_test.rb
778
778
  - test/lib/vedeu/geometry/repository_test.rb
779
- - test/lib/vedeu/input/input_test.rb
779
+ - test/lib/vedeu/input/capture_test.rb
780
780
  - test/lib/vedeu/input/key_test.rb
781
781
  - test/lib/vedeu/input/keymap_test.rb
782
782
  - test/lib/vedeu/input/keymaps_test.rb
783
- - test/lib/vedeu/input/keys_test.rb
784
783
  - test/lib/vedeu/input/mapper_test.rb
784
+ - test/lib/vedeu/input/store_test.rb
785
785
  - test/lib/vedeu/input/translator_test.rb
786
786
  - test/lib/vedeu/logging/debug_test.rb
787
787
  - test/lib/vedeu/logging/lockless_log_device_test.rb
@@ -1,13 +0,0 @@
1
- module Vedeu
2
-
3
- module Input
4
-
5
- # A collection of {Vedeu::Input::Key} instances.
6
- #
7
- class Keys < Vedeu::Repositories::Collection
8
-
9
- end # Keys
10
-
11
- end # Input
12
-
13
- end # Vedeu
@@ -1,22 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- module Input
6
-
7
- describe Keys do
8
-
9
- let(:described) { Vedeu::Input::Keys }
10
- let(:instance) { described.new }
11
-
12
- it { described.superclass.must_equal(Vedeu::Repositories::Collection) }
13
-
14
- describe '#initialize' do
15
- it { instance.must_be_instance_of(described) }
16
- end
17
-
18
- end # Keys
19
-
20
- end # Input
21
-
22
- end # Vedeu