vedeu 0.4.6 → 0.4.7

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: 1d8e95a7608c18620329eb247fd9dc9049609b03
4
- data.tar.gz: 17184d93c7f354a0a8fda4669f49a9a118d4a8da
3
+ metadata.gz: 80640072b141fef605a79c9713e7e0b389fe7ef6
4
+ data.tar.gz: ff600f46a10489bd1369e7c3af9389d5265bf802
5
5
  SHA512:
6
- metadata.gz: d4a866ae01faf6cff714482e53b58bc142efc775b6ce71dd50948a0dfe730cece1a066113e0ed1c146515239a5c73c9ba440cc65696cb42d54a79e13b6637dfd
7
- data.tar.gz: 63369ed9af5b248f7137eb478ba82de72620dde0612b6bbd13231caa4cec28191534eb74c5d23f4a973fc2080c4fc0c34a68dc0cecfa0047460feb5e2b777f27
6
+ metadata.gz: a28c6ab1df05e903f03820ca75492ef060253f3122f4336e7bdf164db91571afbfd6c2f8c3a8983825eba2b2d3139badd88a2012ce5a3689e994132b9a1b6dde
7
+ data.tar.gz: 3968b584c4ad1161164dbc7b163f9f850fe5883255ccfa899fa3a1a3374d9d9cddace5f42e506c01c9f4d68fbfbb6d6eb306107e33d31a9eb006b880647765a4
@@ -0,0 +1 @@
1
+ command
@@ -0,0 +1 @@
1
+ output
@@ -0,0 +1 @@
1
+ status
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib_dir = File.dirname(__FILE__) + '/../../lib'
4
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
5
+
6
+ require 'vedeu'
7
+
8
+ class VedeuTypedCommands
9
+ include Vedeu
10
+
11
+ configure do
12
+ colour_mode 16777216
13
+ debug!
14
+ log '/tmp/vedeu_typed_commands_app.log'
15
+ end
16
+
17
+ bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
18
+
19
+ interface 'output' do
20
+ colour foreground: '#ff0000', background: '#000022'
21
+ cursor!
22
+ end
23
+
24
+ interface 'status' do
25
+ colour foreground: '#00ff00', background: '#003300'
26
+ cursor!
27
+ end
28
+
29
+ interface 'command' do
30
+ colour foreground: '#ffff00', background: '#111111'
31
+ cursor!
32
+ end
33
+
34
+ keymap('_global_') do
35
+ key(:up, 'k') { Vedeu.trigger(:_cursor_up_) }
36
+ key(:right, 'l') { Vedeu.trigger(:_cursor_right_) }
37
+ key(:down, 'j') { Vedeu.trigger(:_cursor_down_) }
38
+ key(:left, 'h') { Vedeu.trigger(:_cursor_left_) }
39
+ end
40
+
41
+ border('output') do
42
+ colour foreground: '#aadd00', background: '#000022'
43
+ hide_bottom!
44
+ end
45
+ border('status') do
46
+ colour foreground: '#aadd00', background: '#003300'
47
+ hide_top!
48
+ hide_bottom!
49
+ end
50
+ border('command') do
51
+ colour foreground: '#aadd00', background: '#111111'
52
+ hide_top!
53
+ end
54
+
55
+ geometry 'output' do
56
+ centred!
57
+ height 7
58
+ width 40
59
+ end
60
+
61
+ geometry('status') do
62
+ height 1
63
+ width 40
64
+ x Vedeu.use('output').left
65
+ y Vedeu.use('output').south(0)
66
+ end
67
+
68
+ geometry 'command' do
69
+ height 3
70
+ width 40
71
+ x Vedeu.use('status').left
72
+ y Vedeu.use('status').south(0)
73
+ end
74
+
75
+ focus_by_name 'command'
76
+
77
+ renders do
78
+ template_for('output', (File.dirname(__FILE__) + '/output.erb'), nil)
79
+ template_for('status', (File.dirname(__FILE__) + '/status.erb'), nil)
80
+ template_for('command', (File.dirname(__FILE__) + '/command.erb'), nil)
81
+ end
82
+
83
+ def self.start(argv = ARGV)
84
+ Vedeu::Launcher.execute!(argv)
85
+ end
86
+ end
87
+
88
+ VedeuTypedCommands.start(ARGV)
@@ -22,9 +22,13 @@ module Vedeu
22
22
  Vedeu.trigger(:cleanup)
23
23
  end
24
24
 
25
- Vedeu.bind(:_drb_input_) do |data|
26
- Vedeu.log(type: :drb, message: 'Sending input')
27
- Vedeu.trigger(:_keypress_, data)
25
+ Vedeu.bind(:_drb_input_) do |data, type|
26
+ Vedeu.log(type: :drb, message: "Sending input (#{type})")
27
+
28
+ case type
29
+ when :command then Vedeu.trigger(:_command_, data)
30
+ else Vedeu.trigger(:_keypress_, data)
31
+ end
28
32
  end
29
33
 
30
34
  Vedeu.bind(:_drb_retrieve_output_) do
@@ -62,6 +66,10 @@ module Vedeu
62
66
  Vedeu.keypress(key)
63
67
  end
64
68
 
69
+ # Will cause the triggering of the `:command` event; which you should define
70
+ # to 'do things'.
71
+ Vedeu.bind(:_command_) { |command| Vedeu.trigger(:command, command) }
72
+
65
73
  # When triggered with a message will cause Vedeu to log the message if
66
74
  # logging is enabled in the configuration.
67
75
  Vedeu.bind(:_log_) { |msg| Vedeu.log(type: :debug, message: msg) }
@@ -182,6 +190,10 @@ module Vedeu
182
190
  name ? Vedeu::Refresh.by_name(name) : Vedeu::Refresh.all
183
191
  end
184
192
 
193
+ # Will cause the named cursor to refresh, or the cursor of the interface
194
+ # which is currently in focus.
195
+ Vedeu.bind(:_refresh_cursor_) { |name| Vedeu::Refresh.cursor(name) }
196
+
185
197
  # Will cause all interfaces in the named group to refresh.
186
198
  Vedeu.bind(:_refresh_group_) { |name| Vedeu::Refresh.by_group(name) }
187
199
 
@@ -1,6 +1,7 @@
1
1
  require 'vedeu/repositories/all'
2
2
  require 'vedeu/cursor/cursor'
3
3
  require 'vedeu/cursor/move_cursor'
4
+ require 'vedeu/cursor/refresh_cursor'
4
5
  require 'vedeu/cursor/toggle_cursor'
5
6
 
6
7
  module Vedeu
@@ -77,6 +77,11 @@ module Vedeu
77
77
  @position = Vedeu::Position.new(@y, @x)
78
78
  end
79
79
 
80
+ # @return [String]
81
+ def inspect
82
+ "<Vedeu::Cursor (#{name}, #{state}, x:#{x}, y:#{y}, ox:#{ox}, oy:#{oy})>"
83
+ end
84
+
80
85
  # Returns an escape sequence to position the cursor and set its visibility.
81
86
  # When passed a block, will position the cursor, yield and return the
82
87
  # original position.
@@ -74,16 +74,17 @@ module Vedeu
74
74
  if name
75
75
  cursor = Vedeu.cursors.by_name(name)
76
76
  interface = Vedeu.interfaces.find(name)
77
- new_cursor = Vedeu::MoveCursor.send(direction, cursor, interface)
78
- Vedeu::Refresh.by_name(name)
79
77
 
80
78
  else
81
79
  cursor = Vedeu.cursor
82
80
  interface = Vedeu.interfaces.current
83
- new_cursor = Vedeu::MoveCursor.send(direction, cursor, interface)
84
- Vedeu::Refresh.by_focus
85
81
 
86
82
  end
83
+
84
+ new_cursor = Vedeu::MoveCursor.send(direction, cursor, interface)
85
+
86
+ Vedeu.trigger(:_refresh_cursor_, new_cursor.name)
87
+
87
88
  new_cursor
88
89
  end
89
90
 
@@ -0,0 +1,89 @@
1
+ module Vedeu
2
+
3
+ class RefreshCursor
4
+
5
+ # @param name [String] The name of the cursor.
6
+ # @return [Array]
7
+ def self.render(name)
8
+ new(name).render
9
+ end
10
+
11
+ # @param name [String] The name of the cursor.
12
+ # @return [Vedeu::RefreshCursor]
13
+ def initialize(name)
14
+ @name = name
15
+ end
16
+
17
+ # @return [Array]
18
+ def render
19
+ Vedeu::Refresh.by_name(name) if refresh_view?
20
+
21
+ Vedeu::Terminal.output(new_cursor.to_s)
22
+ end
23
+
24
+ private
25
+
26
+ # @!attribute [r] name
27
+ # @return [String]
28
+ attr_reader :name
29
+
30
+ # @return [Boolean]
31
+ def refresh_view?
32
+ new_cursor.ox >= interface_width || new_cursor.oy >= interface_height
33
+ end
34
+
35
+ # @return [Vedeu::Cursor]
36
+ def new_cursor
37
+ @new_cursor ||= Vedeu::Cursor.new(cursor.attributes.merge(position))
38
+ end
39
+
40
+ # @return [Hash]
41
+ def position
42
+ {
43
+ x: validated_position.x,
44
+ y: validated_position.y,
45
+ }
46
+ end
47
+
48
+ # @return [Vedeu::PositionValidator]
49
+ def validated_position
50
+ @position ||= Vedeu::PositionValidator.validate(interface,
51
+ cursor.x,
52
+ cursor.y)
53
+ end
54
+
55
+ # @return [Vedeu::Cursor]
56
+ def cursor
57
+ @cursor ||= Vedeu.cursors.find(name)
58
+ end
59
+
60
+ # @return [Fixnum]
61
+ def interface_height
62
+ if interface.border?
63
+ interface.border.height
64
+
65
+ else
66
+ interface.height
67
+
68
+ end
69
+ end
70
+
71
+ # @return [Fixnum]
72
+ def interface_width
73
+ if interface.border?
74
+ interface.border.width
75
+
76
+ else
77
+ interface.width
78
+
79
+ end
80
+ end
81
+
82
+ # @return [Vedeu::Interface]
83
+ def interface
84
+ @interface ||= Vedeu.interfaces.find(name)
85
+ end
86
+
87
+ end # RefreshCursor
88
+
89
+ end # Vedeu
@@ -13,10 +13,9 @@ module Vedeu
13
13
 
14
14
  include Singleton
15
15
 
16
- # @param data [String|Symbol]
17
- # @return [void]
18
- def self.input(data)
19
- instance.input(data)
16
+ # @see Vedeu::Distributed::Server#input
17
+ def self.input(data, type = :key)
18
+ instance.input(data, type)
20
19
  end
21
20
 
22
21
  # @return [void]
@@ -50,9 +49,10 @@ module Vedeu
50
49
  end
51
50
 
52
51
  # @param data [String|Symbol]
52
+ # @param type [Symbol] Either :keypress or :command.
53
53
  # @return [void]
54
- def input(data)
55
- Vedeu.trigger(:_drb_input_, data)
54
+ def input(data, type = :keypress)
55
+ Vedeu.trigger(:_drb_input_, data, type)
56
56
  end
57
57
  alias_method :read, :input
58
58
 
@@ -145,19 +145,16 @@ module Vedeu
145
145
  # @return [String]
146
146
  def group(name)
147
147
  return false unless defined_value?(name)
148
+ model.group = name
148
149
 
149
- if defined_value?(model.name)
150
- if Vedeu.groups.registered?(name)
151
- Vedeu.groups.find(name).add(model.name)
150
+ if Vedeu.groups.registered?(name)
151
+ Vedeu.groups.find(name).add(model.name)
152
152
 
153
- else
154
- new_group = Vedeu::Group.new({ name: name })
155
- new_group.add(model.name)
153
+ else
154
+ new_group = Vedeu::Group.new({ name: name })
155
+ new_group.add(model.name)
156
156
 
157
- end
158
157
  end
159
-
160
- model.group = name
161
158
  end
162
159
 
163
160
  # @see Vedeu::DSL::Keymap.keymap
@@ -23,11 +23,18 @@ module Vedeu
23
23
  @reader = reader
24
24
  end
25
25
 
26
- # Triggers the keypress event with the key(s) pressed.
26
+ # Triggers either a ':_command_' event with the command if the reader is in
27
+ # cooked mode, or if raw mode, the keypress event with the key(s) pressed.
27
28
  #
28
29
  # @return [Array|String|Symbol]
29
30
  def capture
30
- Vedeu.trigger(:_keypress_, keypress)
31
+ if reader.raw_mode?
32
+ Vedeu.trigger(:_keypress_, keypress)
33
+
34
+ else
35
+ Vedeu.trigger(:_command_, command)
36
+
37
+ end
31
38
  end
32
39
 
33
40
  private
@@ -42,6 +49,7 @@ module Vedeu
42
49
  def input
43
50
  @input ||= reader.read
44
51
  end
52
+ alias_method :command, :input
45
53
 
46
54
  # Returns the translated (if possible) keypress(es) as either a String or a
47
55
  # Symbol.
@@ -113,14 +113,14 @@ module Vedeu
113
113
  def to_hash
114
114
  {
115
115
  parent: {
116
- background: parent_background,
117
- foreground: parent_foreground,
118
- style: parent_style,
116
+ background: parent_background.to_s,
117
+ foreground: parent_foreground.to_s,
118
+ style: parent_style.to_s,
119
119
  },
120
- background: '',
121
- border: '',
122
- foreground: '',
123
- style: '',
120
+ background: background.to_s,
121
+ border: border.to_s,
122
+ foreground: foreground.to_s,
123
+ style: style.to_s,
124
124
  value: value,
125
125
  x: x,
126
126
  y: y,
@@ -40,7 +40,7 @@ module Vedeu
40
40
  Vedeu::HTMLRenderer.to_file(Vedeu::VirtualBuffer.retrieve)
41
41
  end
42
42
 
43
- Vedeu::Terminal.output(Vedeu::Renderer.render(virtual_view, interface.cursor))
43
+ Vedeu::Terminal.output(Vedeu::Renderer.render(virtual_view))
44
44
  end
45
45
 
46
46
  private
@@ -42,6 +42,17 @@ module Vedeu
42
42
  Vedeu::Compositor.compose(name)
43
43
  end
44
44
 
45
+ # Refresh a cursor by name.
46
+ #
47
+ # @param name [String]
48
+ # @return [Array]
49
+ def cursor(name = Vedeu.focus)
50
+ if name
51
+ Vedeu.log(type: :info, message: "Refreshing cursor: '#{name}'")
52
+ Vedeu::RefreshCursor.render(name)
53
+ end
54
+ end
55
+
45
56
  end # Refresh
46
57
 
47
58
  end # Vedeu
@@ -104,16 +104,6 @@ module Vedeu
104
104
  text.split(/\n/)
105
105
  end
106
106
 
107
- # @note
108
- # This may be unused. (GL 2015-02-20)
109
- #
110
- # @return [String]
111
- def output
112
- processed.reduce([]) do |output, line|
113
- output << line.join(' ')
114
- end.join("\n")
115
- end
116
-
117
107
  # @param string [String]
118
108
  # @return [String]
119
109
  def ellipsis_string(string)
@@ -33,6 +33,11 @@ module Vedeu
33
33
  end
34
34
  end
35
35
 
36
+ # @return [String]
37
+ def to_s
38
+ visible? ? 'visible' : 'invisible'
39
+ end
40
+
36
41
  # @return [String]
37
42
  def cursor
38
43
  if visible?
@@ -39,6 +39,13 @@ module Vedeu
39
39
  it { instance.instance_variable_get('@position').must_be_instance_of(Vedeu::Position) }
40
40
  end
41
41
 
42
+ describe '#inspect' do
43
+ subject { instance.inspect }
44
+
45
+ it { subject.must_be_instance_of(String) }
46
+ it { subject.must_equal("<Vedeu::Cursor (silver, visible, x:19, y:8, ox:3, oy:2)>") }
47
+ end
48
+
42
49
  describe '#to_s' do
43
50
  let(:state) { true }
44
51
 
@@ -53,7 +53,10 @@ module Vedeu
53
53
  let(:dy) { 0 }
54
54
  let(:dx) { 0 }
55
55
 
56
- before { IO.console.stubs(:winsize).returns([25, 80]) }
56
+ before do
57
+ IO.console.stubs(:winsize).returns([25, 80])
58
+ IO.console.stubs(:print)
59
+ end
57
60
 
58
61
  describe '#initialize' do
59
62
  it { instance.must_be_instance_of(Vedeu::MoveCursor) }
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ describe RefreshCursor do
6
+
7
+ let(:described) { Vedeu::RefreshCursor }
8
+ let(:instance) { described.new(_name) }
9
+ let(:_name) { 'refresh_cursor' }
10
+
11
+ before do
12
+ Vedeu::Terminal.stubs(:output)
13
+ end
14
+
15
+ describe '#initialize' do
16
+ it { instance.must_be_instance_of(Vedeu::RefreshCursor) }
17
+ it { instance.instance_variable_get('@name').must_equal(_name) }
18
+ end
19
+
20
+ end # RefreshCursor
21
+
22
+ end # Vedeu
@@ -171,15 +171,35 @@ module Vedeu
171
171
  describe '#group' do
172
172
  let(:value) { 'elements' }
173
173
 
174
+ before { Vedeu.groups.reset }
175
+
174
176
  subject { instance.group(value) }
175
177
 
176
- it { subject.must_be_instance_of(String) }
178
+ it { subject.must_be_instance_of(Vedeu::Group) }
177
179
 
178
180
  context 'when the value is empty or nil' do
179
181
  let(:value) { '' }
180
182
 
181
183
  it { subject.must_equal(false) }
182
184
  end
185
+
186
+ context 'when the named group exists' do
187
+ before do
188
+ Vedeu::Group.new({ name: 'elements', members: ['lanthanum'] }).store
189
+ end
190
+
191
+ it {
192
+ subject
193
+ Vedeu.groups.find('elements').members.must_equal(Set['actinium', 'lanthanum'])
194
+ }
195
+ end
196
+
197
+ context 'when the named group does not exist' do
198
+ it {
199
+ subject
200
+ Vedeu.groups.find('elements').members.must_equal(Set['actinium'])
201
+ }
202
+ end
183
203
  end
184
204
 
185
205
  describe '#keymap' do
@@ -8,8 +8,12 @@ module Vedeu
8
8
  let(:keypress) { 'a' }
9
9
  let(:described) { Vedeu::Input }
10
10
  let(:instance) { described.new(reader) }
11
+ let(:raw_mode) { true }
11
12
 
12
- before { reader.stubs(:read).returns(keypress) }
13
+ before do
14
+ reader.stubs(:raw_mode?).returns(raw_mode)
15
+ Vedeu.stubs(:trigger).returns([false])
16
+ end
13
17
 
14
18
  describe '#initialize' do
15
19
  it { instance.must_be_instance_of(Input) }
@@ -17,21 +21,40 @@ module Vedeu
17
21
  end
18
22
 
19
23
  describe '.capture' do
20
- context 'when the key is not special' do
21
- before { Vedeu.stubs(:trigger).returns([false]) }
24
+ subject { instance.capture }
25
+
26
+ context 'when in cooked mode' do
27
+ let(:raw_mode) { false }
28
+ let(:command) { 'help' }
29
+
30
+ before { reader.stubs(:read).returns(command) }
22
31
 
23
- it 'triggers an event associated with the key pressed' do
24
- Input.capture(reader).must_equal([false])
32
+ it 'triggers an event with the command' do
33
+ Vedeu.expects(:trigger).with(:_command_, command)
34
+ subject
25
35
  end
26
36
  end
27
37
 
28
- context 'when the key is special' do
29
- let(:keypress) { "\e" }
38
+ context 'when in raw mode' do
39
+ let(:raw_mode) { true }
40
+ let(:keypress) { 'a' }
41
+
42
+ before { reader.stubs(:read).returns(keypress) }
43
+
44
+ context 'when the key is not special' do
45
+ it 'triggers an event with the keypress' do
46
+ Vedeu.expects(:trigger).with(:_keypress_, keypress)
47
+ subject
48
+ end
49
+ end
30
50
 
31
- before { Vedeu.stubs(:trigger).raises(ModeSwitch) }
51
+ context 'when the key is special' do
52
+ let(:keypress) { "\e[A" }
32
53
 
33
- it 'switches the terminal mode when escape is pressed' do
34
- proc { Input.capture(reader) }.must_raise(ModeSwitch)
54
+ it 'triggers an event with the keypress' do
55
+ Vedeu.expects(:trigger).with(:_keypress_, :up)
56
+ subject
57
+ end
35
58
  end
36
59
  end
37
60
  end
@@ -57,6 +57,25 @@ module Vedeu
57
57
  ) }
58
58
  end
59
59
 
60
+ describe '#to_hash' do
61
+ subject { instance.to_hash }
62
+
63
+ it { subject.must_be_instance_of(Hash) }
64
+
65
+ it { subject.must_equal({ parent: {
66
+ background: '',
67
+ foreground: '',
68
+ style: '',
69
+ },
70
+ background: '',
71
+ border: '',
72
+ foreground: '',
73
+ style: '',
74
+ value: value,
75
+ x: nil,
76
+ y: nil }) }
77
+ end
78
+
60
79
  describe '#to_html' do
61
80
  subject { instance.to_html }
62
81
 
@@ -34,6 +34,19 @@ module Vedeu
34
34
  it { instance.instance_variable_get('@repository').must_equal(Vedeu.interfaces) }
35
35
  end
36
36
 
37
+ describe '#attributes' do
38
+ subject { instance.attributes }
39
+
40
+ it { subject.must_be_instance_of(Hash) }
41
+
42
+ it { subject.must_equal({ colour: nil,
43
+ delay: 0.0,
44
+ group: '',
45
+ name: 'hydrogen',
46
+ parent: nil,
47
+ style: nil }) }
48
+ end
49
+
37
50
  describe '#border?' do
38
51
  subject { instance.border? }
39
52
 
@@ -59,6 +59,29 @@ module Vedeu
59
59
  end
60
60
  end
61
61
 
62
+ {
63
+ top_horizontal: "border-top:1px #222 solid;",
64
+ left_vertical: "border-left:1px #222 solid;",
65
+ right_vertical: "border-right:1px #222 solid;",
66
+ bottom_horizontal: "border-bottom:1px #222 solid;",
67
+ top_left: "border-top:1px #222 solid;border-left:1px #222 solid;",
68
+ top_right: "border-top:1px #222 solid;border-right:1px #222 solid;",
69
+ bottom_left: "border-bottom:1px #222 solid;border-left:1px #222 solid;",
70
+ bottom_right: "border-bottom:1px #222 solid;border-right:1px #222 solid;",
71
+ horizontal: '',
72
+ vertical: ''
73
+ }.each do |border_style, result|
74
+ context "when there is a border (#{border_style.inspect})" do
75
+ let(:border) { border_style }
76
+
77
+ it { subject.must_equal(
78
+ "<td style='background:#000;color:#222;border:1px #000 solid;" +
79
+ result +
80
+ "'>&nbsp;</td>"
81
+ ) }
82
+ end
83
+ end
84
+
62
85
  context 'when there is no border' do
63
86
  context 'when there is no value' do
64
87
  it { subject.must_equal("<td>&nbsp;</td>") }
@@ -24,7 +24,7 @@ module Vedeu
24
24
  context 'when there are no registered interfaces' do
25
25
  before { Vedeu.focusable.reset }
26
26
 
27
- it { Refresh.by_focus.must_equal(nil) }
27
+ it { described.by_focus.must_equal(nil) }
28
28
  end
29
29
 
30
30
  context 'when there are registered interfaces' do
@@ -35,7 +35,7 @@ module Vedeu
35
35
  context 'when there are no registered groups' do
36
36
  before { Vedeu.groups.reset }
37
37
 
38
- it { proc { Refresh.by_group('') }.must_raise(ModelNotFound) }
38
+ it { proc { described.by_group('') }.must_raise(ModelNotFound) }
39
39
  end
40
40
 
41
41
  context 'when there are registered groups' do
@@ -45,18 +45,39 @@ module Vedeu
45
45
  describe '.by_name' do
46
46
  let(:interface_name) { 'aluminium' }
47
47
 
48
- subject { Refresh.by_name(interface_name) }
48
+ subject { described.by_name(interface_name) }
49
49
 
50
50
  context 'when the interface or buffer is not found' do
51
51
  let(:interface_name) { '' }
52
52
 
53
- it { proc { Refresh.by_name('') }.must_raise(ModelNotFound) }
53
+ it { proc { described.by_name('') }.must_raise(ModelNotFound) }
54
54
  end
55
55
 
56
56
  context 'when the interface or buffer is found' do
57
57
  end
58
58
  end
59
59
 
60
+ describe '.cursor' do
61
+ let(:_name) {}
62
+
63
+ subject { described.cursor(_name) }
64
+
65
+ before { Vedeu::RefreshCursor.stubs(:render) }
66
+
67
+ context 'when there is a name' do
68
+ let(:_name) { 'refresh_cursor' }
69
+
70
+ it {
71
+ Vedeu::RefreshCursor.expects(:render).with(_name)
72
+ subject
73
+ }
74
+ end
75
+
76
+ context 'when there is no name' do
77
+ it { subject.must_equal(nil) }
78
+ end
79
+ end
80
+
60
81
  end # Refresh
61
82
 
62
83
  end # Vedeu
@@ -62,6 +62,22 @@ module Vedeu
62
62
  end
63
63
  end
64
64
 
65
+ describe '#to_s' do
66
+ subject { instance.to_s }
67
+
68
+ it { subject.must_be_instance_of(String) }
69
+
70
+ context 'when visible' do
71
+ it { subject.must_equal('visible') }
72
+ end
73
+
74
+ context 'when not visible' do
75
+ let(:visible) { false }
76
+
77
+ it { subject.must_equal('invisible') }
78
+ end
79
+ end
80
+
65
81
  describe '#cursor' do
66
82
  subject { instance.cursor }
67
83
 
data/test/test_helper.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'simplecov'
2
- require 'simplecov-console'
3
2
  require 'pry'
4
3
  require 'minitest/autorun'
5
4
  require 'minitest/pride' unless ENV['NO_COLOR']
@@ -8,7 +7,6 @@ require 'minitest/hell'
8
7
  # GC.disable # uncomment to remove ~20ms from test run speed
9
8
 
10
9
  SimpleCov.start do
11
- formatter SimpleCov::Formatter::Console
12
10
  command_name 'MiniTest::Spec'
13
11
  add_filter '/test/'
14
12
  add_group 'api', 'vedeu/api'
data/vedeu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.4.6'
7
+ spec.version = '0.4.7'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = %q{A terminal case of wonderland.}
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'cucumber', '1.3.19'
23
23
  spec.add_development_dependency 'guard', '2.12.4'
24
24
  spec.add_development_dependency 'guard-bundler', '2.1.0'
25
- spec.add_development_dependency 'guard-cucumber', '1.5.3'
25
+ spec.add_development_dependency 'guard-cucumber', '1.5.4'
26
26
  spec.add_development_dependency 'guard-minitest', '2.4.4'
27
27
  spec.add_development_dependency 'inch', '0.5.10'
28
28
  spec.add_development_dependency 'minitest', '5.5.1'
@@ -33,6 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rake', '10.4.2'
34
34
  spec.add_development_dependency 'ruby-prof', '0.15.6'
35
35
  spec.add_development_dependency 'simplecov', '0.9.2'
36
- spec.add_development_dependency 'simplecov-console', '0.2.0'
37
36
  spec.add_development_dependency 'yard', '0.8.7.6'
38
37
  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.4.6
4
+ version: 0.4.7
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-03-11 00:00:00.000000000 Z
11
+ date: 2015-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 1.5.3
89
+ version: 1.5.4
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.5.3
96
+ version: 1.5.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: guard-minitest
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -234,20 +234,6 @@ dependencies:
234
234
  - - '='
235
235
  - !ruby/object:Gem::Version
236
236
  version: 0.9.2
237
- - !ruby/object:Gem::Dependency
238
- name: simplecov-console
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - '='
242
- - !ruby/object:Gem::Version
243
- version: 0.2.0
244
- type: :development
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - '='
249
- - !ruby/object:Gem::Version
250
- version: 0.2.0
251
237
  - !ruby/object:Gem::Dependency
252
238
  name: yard
253
239
  requirement: !ruby/object:Gem::Requirement
@@ -301,6 +287,10 @@ files:
301
287
  - examples/geometry_app.rb
302
288
  - examples/hello_world.rb
303
289
  - examples/lines_app.rb
290
+ - examples/typed_commands/command.erb
291
+ - examples/typed_commands/output.erb
292
+ - examples/typed_commands/status.erb
293
+ - examples/typed_commands/typed_commands_app.rb
304
294
  - examples/view_templates_app/template.erb
305
295
  - examples/view_templates_app/view_templates_app.rb
306
296
  - features/start_stop.feature
@@ -321,6 +311,7 @@ files:
321
311
  - lib/vedeu/cursor/all.rb
322
312
  - lib/vedeu/cursor/cursor.rb
323
313
  - lib/vedeu/cursor/move_cursor.rb
314
+ - lib/vedeu/cursor/refresh_cursor.rb
324
315
  - lib/vedeu/cursor/toggle_cursor.rb
325
316
  - lib/vedeu/debug.rb
326
317
  - lib/vedeu/distributed/all.rb
@@ -435,6 +426,7 @@ files:
435
426
  - test/lib/vedeu/configuration/configuration_test.rb
436
427
  - test/lib/vedeu/cursor/cursor_test.rb
437
428
  - test/lib/vedeu/cursor/move_cursor_test.rb
429
+ - test/lib/vedeu/cursor/refresh_cursor_test.rb
438
430
  - test/lib/vedeu/cursor/toggle_cursor_test.rb
439
431
  - test/lib/vedeu/distributed/client_test.rb
440
432
  - test/lib/vedeu/distributed/server_test.rb
@@ -564,6 +556,7 @@ test_files:
564
556
  - test/lib/vedeu/configuration/configuration_test.rb
565
557
  - test/lib/vedeu/cursor/cursor_test.rb
566
558
  - test/lib/vedeu/cursor/move_cursor_test.rb
559
+ - test/lib/vedeu/cursor/refresh_cursor_test.rb
567
560
  - test/lib/vedeu/cursor/toggle_cursor_test.rb
568
561
  - test/lib/vedeu/distributed/client_test.rb
569
562
  - test/lib/vedeu/distributed/server_test.rb