vedeu 0.4.45 → 0.4.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/Guardfile +1 -1
  4. data/docs/dsl.md +4 -4
  5. data/docs/events/drb.md +49 -0
  6. data/docs/events/main.md +109 -0
  7. data/docs/events/menus.md +72 -0
  8. data/docs/events/movement.md +105 -0
  9. data/docs/events/visibility.md +61 -0
  10. data/docs/events.md +13 -0
  11. data/lib/vedeu/api.rb +23 -0
  12. data/lib/vedeu/application/controller.rb +1 -0
  13. data/lib/vedeu/application.rb +25 -20
  14. data/lib/vedeu/bindings/bindings.rb +2 -41
  15. data/lib/vedeu/bindings/drb.rb +2 -11
  16. data/lib/vedeu/bindings/menus.rb +1 -19
  17. data/lib/vedeu/bindings/movement.rb +6 -18
  18. data/lib/vedeu/bindings/visibility.rb +5 -26
  19. data/lib/vedeu/configuration/configuration.rb +1 -1
  20. data/lib/vedeu/distributed/server.rb +15 -0
  21. data/lib/vedeu/dsl/presentation.rb +13 -7
  22. data/lib/vedeu/dsl/view.rb +1 -1
  23. data/lib/vedeu/events/event.rb +1 -1
  24. data/lib/vedeu/main_loop.rb +1 -1
  25. data/lib/vedeu/models/interface.rb +3 -0
  26. data/lib/vedeu/null/interface.rb +11 -0
  27. data/lib/vedeu/output/clear.rb +3 -1
  28. data/lib/vedeu/repositories/repositories/borders.rb +7 -3
  29. data/lib/vedeu/repositories/repositories/buffers.rb +7 -3
  30. data/lib/vedeu/repositories/repositories/cursors.rb +3 -2
  31. data/lib/vedeu/repositories/repositories/events.rb +3 -2
  32. data/lib/vedeu/repositories/repositories/geometries.rb +6 -2
  33. data/lib/vedeu/repositories/repositories/groups.rb +2 -1
  34. data/lib/vedeu/repositories/repositories/interfaces.rb +6 -2
  35. data/lib/vedeu/repositories/repositories/keymaps.rb +2 -1
  36. data/lib/vedeu/repositories/repositories/menus.rb +2 -1
  37. data/lib/vedeu/support/log.rb +1 -1
  38. data/lib/vedeu/support/timer.rb +1 -1
  39. data/lib/vedeu/support/visibility.rb +31 -3
  40. data/lib/vedeu/version.rb +1 -1
  41. data/test/lib/vedeu/bindings/bindings_test.rb +0 -3
  42. data/test/lib/vedeu/bindings/movement_test.rb +1 -0
  43. data/test/lib/vedeu/buffers/buffer_test.rb +9 -17
  44. data/test/lib/vedeu/null/interface_test.rb +6 -0
  45. data/test/lib/vedeu/repositories/repositories/borders_test.rb +5 -1
  46. data/test/lib/vedeu/repositories/repositories/buffers_test.rb +2 -0
  47. data/test/lib/vedeu/repositories/repositories/cursors_test.rb +2 -0
  48. data/test/lib/vedeu/repositories/repositories/events_test.rb +2 -0
  49. data/test/lib/vedeu/repositories/repositories/geometries_test.rb +2 -0
  50. data/test/lib/vedeu/repositories/repositories/groups_test.rb +2 -0
  51. data/test/lib/vedeu/repositories/repositories/interfaces_test.rb +2 -0
  52. data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +2 -0
  53. data/test/lib/vedeu/repositories/repositories/menus_test.rb +2 -0
  54. data/test/lib/vedeu/support/visibility_test.rb +14 -8
  55. data/test/test_helper.rb +12 -6
  56. metadata +8 -2
@@ -5,26 +5,52 @@ module Vedeu
5
5
  # @api private
6
6
  class Visibility
7
7
 
8
+ # Hide a named cursor, or without a name, the cursor of the currently
9
+ # focussed interface.
10
+ #
11
+ # @example
12
+ # Vedeu.hide_cursor(name)
13
+ #
14
+ # @param name [String]
15
+ # @return [Vedeu::Visibility]
16
+ def self.hide_cursor(name = nil)
17
+ model = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor
18
+
19
+ new(model).hide
20
+ end
21
+
22
+ # Show a named cursor, or without a name, the cursor of the currently
23
+ # focussed interface.
24
+ #
25
+ # @example
26
+ # Vedeu.show_cursor(name)
27
+ #
8
28
  # @param name [String]
9
29
  # @return [Vedeu::Visibility]
10
- def self.for_cursor(name = nil)
11
- named = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor
30
+ def self.show_cursor(name = nil)
31
+ model = name ? Vedeu.cursors.by_name(name) : Vedeu.cursor
12
32
 
13
- new(named)
33
+ new(model).show
14
34
  end
15
35
 
36
+ # Show the given model.
37
+ #
16
38
  # @param model [void]
17
39
  # @return [void]
18
40
  def self.show(model)
19
41
  new(model).show
20
42
  end
21
43
 
44
+ # Hide the given model.
45
+ #
22
46
  # @param model [void]
23
47
  # @return [void]
24
48
  def self.hide(model)
25
49
  new(model).hide
26
50
  end
27
51
 
52
+ # Toggle the visibility of the given model.
53
+ #
28
54
  # @param model [void]
29
55
  # @return [void]
30
56
  def self.toggle(model)
@@ -47,6 +73,7 @@ module Vedeu
47
73
  else
48
74
  model.visible = true
49
75
  model.store
76
+
50
77
  end
51
78
  end
52
79
 
@@ -73,6 +100,7 @@ module Vedeu
73
100
  end
74
101
  end
75
102
 
103
+
76
104
  # @return [void]
77
105
  def toggle
78
106
  if model.visible?
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.4.45'
4
+ VERSION = '0.4.46'
5
5
 
6
6
  end
@@ -20,10 +20,7 @@ module Vedeu
20
20
  it { Vedeu.events.registered?(:_resize_).must_equal(true) }
21
21
  end
22
22
 
23
- it { Vedeu.events.registered?(:_cursor_position_).must_equal(true) }
24
-
25
23
  context 'the geometry specific events are defined' do
26
-
27
24
  it { Vedeu.events.registered?(:_maximise_).must_equal(true) }
28
25
  it { Vedeu.events.registered?(:_unmaximise_).must_equal(true) }
29
26
  end
@@ -10,6 +10,7 @@ module Vedeu
10
10
  it { Vedeu.events.registered?(:_cursor_down_).must_equal(true) }
11
11
  it { Vedeu.events.registered?(:_cursor_left_).must_equal(true) }
12
12
  it { Vedeu.events.registered?(:_cursor_origin_).must_equal(true) }
13
+ it { Vedeu.events.registered?(:_cursor_position_).must_equal(true) }
13
14
  it { Vedeu.events.registered?(:_cursor_reposition_).must_equal(true) }
14
15
  it { Vedeu.events.registered?(:_cursor_reset_).must_equal(true) }
15
16
  it { Vedeu.events.registered?(:_cursor_right_).must_equal(true) }
@@ -23,8 +23,6 @@ module Vedeu
23
23
  before do
24
24
  Vedeu.stubs(:trigger)
25
25
  # Vedeu.interfaces.stubs(:by_name).returns(interface)
26
- Vedeu::Visibility.stubs(:show)
27
- Vedeu::Visibility.stubs(:hide)
28
26
  end
29
27
  after { Vedeu.interfaces.reset }
30
28
 
@@ -145,17 +143,14 @@ module Vedeu
145
143
 
146
144
  describe '#hide' do
147
145
  let(:interface) {
148
- Vedeu::Interface.new({ name: _name, visible: visible })
146
+ Vedeu::Interface.new({ name: _name, visible: visible }).store
149
147
  }
150
148
  let(:_name) { 'Buffer#hide' }
151
149
  let(:visible) {}
152
150
 
153
151
  before do
154
- interface.store
155
152
  Vedeu::Output.stubs(:render)
156
- end
157
- after do
158
- Vedeu.interfaces.reset
153
+ Vedeu::Visibility.stubs(:hide)
159
154
  end
160
155
 
161
156
  subject { instance.hide }
@@ -178,17 +173,14 @@ module Vedeu
178
173
 
179
174
  describe '#show' do
180
175
  let(:interface) {
181
- Vedeu::Interface.new({ name: _name, visible: visible })
176
+ Vedeu::Interface.new({ name: _name, visible: visible }).store
182
177
  }
183
178
  let(:_name) { 'Buffer#show' }
184
179
  let(:visible) {}
185
180
 
186
181
  before do
187
- interface.store
188
182
  Vedeu::Output.stubs(:render)
189
- end
190
- after do
191
- Vedeu.interfaces.reset
183
+ Vedeu::Visibility.stubs(:show)
192
184
  end
193
185
 
194
186
  subject { instance.show }
@@ -211,24 +203,22 @@ module Vedeu
211
203
 
212
204
  describe '#toggle' do
213
205
  let(:interface) {
214
- Vedeu::Interface.new({ name: _name, visible: visible })
206
+ Vedeu::Interface.new({ name: _name, visible: visible }).store
215
207
  }
216
208
  let(:_name) { 'Buffer#toggle' }
217
209
  let(:visible) {}
218
210
 
219
211
  before do
220
- interface.store
221
212
  Vedeu::Output.stubs(:render)
222
213
  end
223
- after do
224
- Vedeu.interfaces.reset
225
- end
226
214
 
227
215
  subject { instance.toggle }
228
216
 
229
217
  context 'when the interface is visible' do
230
218
  let(:visible) { true }
231
219
 
220
+ before { Vedeu::Visibility.stubs(:hide) }
221
+
232
222
  it {
233
223
  Vedeu::Visibility.expects(:hide).with(interface)
234
224
  subject
@@ -238,6 +228,8 @@ module Vedeu
238
228
  context 'when the interface is not visible' do
239
229
  let(:visible) { false }
240
230
 
231
+ before { Vedeu::Visibility.stubs(:show) }
232
+
241
233
  it {
242
234
  Vedeu::Visibility.expects(:show).with(interface)
243
235
  subject
@@ -21,6 +21,12 @@ module Vedeu
21
21
  it { subject.must_be_instance_of(Hash) }
22
22
  end
23
23
 
24
+ describe '#parent' do
25
+ subject { instance.parent }
26
+
27
+ it { subject.must_be_instance_of(NilClass) }
28
+ end
29
+
24
30
  describe '#store' do
25
31
  subject { instance.store }
26
32
 
@@ -6,13 +6,17 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Borders }
8
8
 
9
- after { Vedeu.borders.reset }
9
+ after { Vedeu.borders.reset! }
10
10
 
11
11
  it { described.must_respond_to(:borders) }
12
12
 
13
13
  describe '.reset!' do
14
14
  subject { described.reset! }
15
15
 
16
+ before { described.stubs(:register) }
17
+
18
+ it { described.must_respond_to(:reset) }
19
+
16
20
  it {
17
21
  described.expects(:register).with(Vedeu::Border)
18
22
  subject
@@ -12,6 +12,8 @@ module Vedeu
12
12
  describe '#reset!' do
13
13
  subject { described.reset! }
14
14
 
15
+ it { described.must_respond_to(:reset) }
16
+
15
17
  it {
16
18
  described.expects(:register).with(Vedeu::Buffer)
17
19
  subject
@@ -33,6 +33,8 @@ module Vedeu
33
33
  describe '.reset!' do
34
34
  subject { described.reset! }
35
35
 
36
+ it { described.must_respond_to(:reset) }
37
+
36
38
  it {
37
39
  described.expects(:register).with(Vedeu::Cursor)
38
40
  subject
@@ -11,6 +11,8 @@ module Vedeu
11
11
  describe '.reset!' do
12
12
  subject { described.reset! }
13
13
 
14
+ it { described.must_respond_to(:reset) }
15
+
14
16
  it {
15
17
  described.expects(:new).with(Vedeu::EventCollection)
16
18
  subject
@@ -13,6 +13,8 @@ module Vedeu
13
13
  describe '.reset!' do
14
14
  subject { described.reset! }
15
15
 
16
+ it { described.must_respond_to(:reset) }
17
+
16
18
  it {
17
19
  described.expects(:register).with(Vedeu::Geometry)
18
20
  subject
@@ -11,6 +11,8 @@ module Vedeu
11
11
  describe '.reset!' do
12
12
  subject { described.reset! }
13
13
 
14
+ it { described.must_respond_to(:reset) }
15
+
14
16
  it {
15
17
  described.expects(:register).with(Vedeu::Group)
16
18
  subject
@@ -11,6 +11,8 @@ module Vedeu
11
11
  describe '.reset!' do
12
12
  subject { described.reset! }
13
13
 
14
+ it { described.must_respond_to(:reset) }
15
+
14
16
  it {
15
17
  described.expects(:register).with(Vedeu::Interface)
16
18
  subject
@@ -11,6 +11,8 @@ module Vedeu
11
11
  describe '.reset!' do
12
12
  subject { described.reset! }
13
13
 
14
+ it { described.must_respond_to(:reset) }
15
+
14
16
  it {
15
17
  described.expects(:register).with(Vedeu::Keymap)
16
18
  subject
@@ -11,6 +11,8 @@ module Vedeu
11
11
  describe '.reset!' do
12
12
  subject { described.reset! }
13
13
 
14
+ it { described.must_respond_to(:reset) }
15
+
14
16
  it {
15
17
  described.expects(:register).with(Vedeu::Menu)
16
18
  subject
@@ -21,20 +21,13 @@ module Vedeu
21
21
  let(:instance) { described.new(model) }
22
22
  let(:model) { VisibilityTestModel.new(visible) }
23
23
  let(:visible) { true }
24
+ let(:_name) { 'Vedeu::Visibility' }
24
25
 
25
26
  describe '#initialize' do
26
27
  it { instance.must_be_instance_of(described) }
27
28
  it { instance.instance_variable_get('@model').must_equal(model) }
28
29
  end
29
30
 
30
- describe '.for_cursor' do
31
- let(:_name) {}
32
-
33
- subject { described.for_cursor(_name) }
34
-
35
- it { subject.must_be_instance_of(described) }
36
- end
37
-
38
31
  describe '.show' do
39
32
  subject { described.show(model) }
40
33
 
@@ -51,6 +44,19 @@ module Vedeu
51
44
  it { subject; instance.state.must_equal(:invisible) }
52
45
  end
53
46
 
47
+ describe '.show_cursor' do
48
+ subject { described.show_cursor(_name) }
49
+
50
+ it { subject; instance.state.must_equal(:visible) }
51
+ end
52
+
53
+ describe '.hide_cursor' do
54
+ subject { described.hide_cursor(_name) }
55
+
56
+ # it { subject; instance.state.must_equal(:invisible) }
57
+ # it { skip }
58
+ end
59
+
54
60
  describe '.toggle' do
55
61
  subject { described.toggle(model) }
56
62
 
data/test/test_helper.rb CHANGED
@@ -29,7 +29,7 @@ SimpleCov.start do
29
29
  add_group 'storage', 'vedeu/storage'
30
30
  add_group 'support', 'vedeu/support'
31
31
  add_group 'templating', 'vedeu/templating'
32
- end unless ENV['no_simplecov']
32
+ end unless ENV['NO_SIMPLECOV']
33
33
 
34
34
  module VedeuMiniTestPlugin
35
35
  # def before_setup
@@ -49,20 +49,26 @@ module VedeuMiniTestPlugin
49
49
  # super
50
50
  # Vedeu::Repositories.reset!
51
51
  # end
52
- end
52
+ end # VedeuMiniTestPlugin
53
53
 
54
54
  module MiniTest
55
+
55
56
  class Spec
57
+
56
58
  # parallelize_me! # uncomment to unleash hell
57
59
  # i_suck_and_my_tests_are_order_dependent! # just incase
58
60
 
59
- # include VedeuMiniTestPlugin
61
+ include VedeuMiniTestPlugin
60
62
 
61
63
  class << self
64
+
62
65
  alias_method :context, :describe
63
- end
64
- end
65
- end
66
+
67
+ end # Eigenclass
68
+
69
+ end # Spec
70
+
71
+ end # MiniTest
66
72
 
67
73
  require 'mocha/setup'
68
74
  require 'vedeu'
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.45
4
+ version: 0.4.46
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-07-08 00:00:00.000000000 Z
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -265,6 +265,12 @@ files:
265
265
  - docs/api.md
266
266
  - docs/applications.md
267
267
  - docs/dsl.md
268
+ - docs/events.md
269
+ - docs/events/drb.md
270
+ - docs/events/main.md
271
+ - docs/events/menus.md
272
+ - docs/events/movement.md
273
+ - docs/events/visibility.md
268
274
  - docs/getting_started.md
269
275
  - docs/object_graph.md
270
276
  - docs/views.md