vedeu 0.6.17 → 0.6.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/docs/events/system.md +1 -1
- data/lib/vedeu/all.rb +0 -2
- data/lib/vedeu/dsl/text.rb +2 -3
- data/lib/vedeu/events/aliases.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +12 -32
- data/lib/vedeu/input/all.rb +2 -2
- data/lib/vedeu/input/{input.rb → capture.rb} +4 -4
- data/lib/vedeu/input/key.rb +6 -0
- data/lib/vedeu/input/store.rb +71 -0
- data/lib/vedeu/models/group.rb +1 -3
- data/lib/vedeu/output/wordwrap.rb +4 -10
- data/lib/vedeu/runtime/application.rb +1 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/bindings/drb_test.rb +4 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +5 -1
- data/test/lib/vedeu/cursors/refresh_test.rb +1 -0
- data/test/lib/vedeu/distributed/client_test.rb +1 -0
- data/test/lib/vedeu/distributed/server_test.rb +1 -0
- data/test/lib/vedeu/events/aliases_test.rb +1 -0
- data/test/lib/vedeu/events/event_test.rb +4 -0
- data/test/lib/vedeu/input/{input_test.rb → capture_test.rb} +4 -4
- data/test/lib/vedeu/input/key_test.rb +13 -0
- data/test/lib/vedeu/input/keymap_test.rb +4 -0
- data/test/lib/vedeu/input/mapper_test.rb +2 -0
- data/test/lib/vedeu/input/store_test.rb +138 -0
- data/test/lib/vedeu/models/focus_test.rb +2 -0
- data/test/lib/vedeu/models/group_test.rb +0 -3
- data/test/lib/vedeu/output/renderers/all_test.rb +4 -1
- data/test/lib/vedeu/plugins/plugins_test.rb +2 -0
- data/test/lib/vedeu/repositories/repositories_test.rb +4 -1
- data/test/lib/vedeu/repositories/repository_test.rb +4 -0
- data/test/lib/vedeu/repositories/store_test.rb +2 -0
- data/test/lib/vedeu/runtime/bootstrap_test.rb +1 -0
- data/test/lib/vedeu/runtime/launcher_test.rb +1 -0
- data/test/lib/vedeu/runtime/main_loop_test.rb +2 -0
- data/test/lib/vedeu/runtime/router_test.rb +6 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +2 -0
- data/vedeu.gemspec +1 -1
- metadata +10 -10
- data/lib/vedeu/input/keys.rb +0 -13
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8a4672068319df313bac858e6b6088ec8e01bd6
|
4
|
+
data.tar.gz: 79b17bce1d8aa635ece56f3b66bb7e16dd037aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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|
|
data/docs/events/system.md
CHANGED
@@ -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
|
46
|
+
{Vedeu::Input::Input}.
|
47
47
|
|
48
48
|
Vedeu.trigger(:_keypress_, key)
|
49
49
|
|
data/lib/vedeu/all.rb
CHANGED
data/lib/vedeu/dsl/text.rb
CHANGED
@@ -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;
|
15
|
-
#
|
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
|
data/lib/vedeu/events/aliases.rb
CHANGED
@@ -89,7 +89,7 @@ module Vedeu
|
|
89
89
|
def trigger(alias_name, *args)
|
90
90
|
return [] unless registered?(alias_name)
|
91
91
|
|
92
|
-
|
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:
|
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:
|
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:
|
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:
|
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
|
data/lib/vedeu/input/all.rb
CHANGED
@@ -9,10 +9,10 @@ module Vedeu
|
|
9
9
|
|
10
10
|
end # Vedeu
|
11
11
|
|
12
|
-
require 'vedeu/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
|
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.
|
15
|
-
new(reader).
|
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
|
32
|
+
def read
|
33
33
|
if reader.raw_mode?
|
34
34
|
Vedeu.trigger(:_keypress_, keypress)
|
35
35
|
|
data/lib/vedeu/input/key.rb
CHANGED
@@ -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
|
data/lib/vedeu/models/group.rb
CHANGED
@@ -31,9 +31,7 @@ module Vedeu
|
|
31
31
|
# visible or not.
|
32
32
|
# @return [Vedeu::Models::Group]
|
33
33
|
def initialize(attributes = {})
|
34
|
-
|
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
|
-
|
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([])
|
79
|
-
output << line.join(' ')
|
80
|
-
end
|
74
|
+
processed.reduce([]) { |output, line| output << line.join(' ') }
|
81
75
|
end
|
82
76
|
|
83
77
|
protected
|
data/lib/vedeu/version.rb
CHANGED
@@ -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 {
|
131
|
+
before {
|
132
|
+
Vedeu.stubs(:log)
|
133
|
+
Vedeu::Output::Output.stubs(:render)
|
134
|
+
}
|
131
135
|
|
132
136
|
subject { instance.render }
|
133
137
|
|
@@ -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
|
7
|
+
describe Capture do
|
8
8
|
|
9
9
|
let(:reader) { Vedeu::Terminal }
|
10
10
|
let(:keypress) { 'a' }
|
11
|
-
let(:described) { Vedeu::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 '.
|
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.
|
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
|
@@ -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
|
@@ -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 {
|
@@ -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
|
@@ -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) }
|
data/vedeu.gemspec
CHANGED
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.
|
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-
|
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.
|
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.
|
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/
|
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/
|
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/
|
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
|
data/lib/vedeu/input/keys.rb
DELETED
@@ -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
|