vedeu 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +0 -3
- data/examples/configuration_app.rb +50 -0
- data/examples/cursor_app/cursor_app.rb +8 -3
- data/examples/focus_app.rb +5 -5
- data/examples/hello_world.rb +4 -4
- data/examples/lines_app/lines_app.rb +8 -3
- data/lib/vedeu.rb +2 -0
- data/lib/vedeu/api/api.rb +2 -2
- data/lib/vedeu/application.rb +1 -1
- data/lib/vedeu/configuration/api.rb +24 -9
- data/lib/vedeu/configuration/cli.rb +13 -12
- data/lib/vedeu/configuration/configuration.rb +135 -131
- data/lib/vedeu/input/input.rb +2 -0
- data/lib/vedeu/models/colour.rb +2 -0
- data/lib/vedeu/models/event.rb +8 -0
- data/lib/vedeu/support/log.rb +18 -119
- data/lib/vedeu/support/registrar.rb +12 -3
- data/test/lib/vedeu/api/interface_test.rb +10 -2
- data/test/lib/vedeu/configuration/api_test.rb +13 -5
- data/test/lib/vedeu/configuration/cli_test.rb +88 -78
- data/test/lib/vedeu/configuration/configuration_test.rb +14 -5
- data/test/lib/vedeu/models/menu_test.rb +3 -1
- data/test/lib/vedeu/output/compositor_test.rb +12 -11
- data/test/lib/vedeu/support/position_test.rb +3 -1
- data/test/lib/vedeu/support/refresh_test.rb +2 -2
- data/test/lib/vedeu/support/registrar_test.rb +8 -0
- data/test/lib/vedeu/support/repository_test.rb +8 -3
- data/test/lib/vedeu/support/trace_test.rb +3 -1
- data/test/test_helper.rb +12 -4
- data/vedeu.gemspec +1 -1
- metadata +3 -2
@@ -4,13 +4,14 @@ module Vedeu
|
|
4
4
|
|
5
5
|
describe Configuration do
|
6
6
|
|
7
|
-
before { Configuration.reset }
|
8
|
-
after {
|
7
|
+
before { Configuration.reset! }
|
8
|
+
after { test_configuration }
|
9
9
|
|
10
10
|
describe '#colour_mode' do
|
11
11
|
it 'returns the value of the colour_mode option' do
|
12
|
-
|
12
|
+
skip
|
13
13
|
Configuration.colour_mode.must_equal(16777216)
|
14
|
+
Configuration.colour_mode.must_equal(256)
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
@@ -26,6 +27,13 @@ module Vedeu
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
30
|
+
describe '#log' do
|
31
|
+
it 'returns the value of the log option' do
|
32
|
+
skip
|
33
|
+
Configuration.log.must_match(/vedeu_test\.log/)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
29
37
|
describe '#once?' do
|
30
38
|
it 'returns the value of the once option' do
|
31
39
|
Configuration.once?.must_equal(false)
|
@@ -48,12 +56,13 @@ module Vedeu
|
|
48
56
|
it 'returns the options configured' do
|
49
57
|
Configuration.configure.must_equal(
|
50
58
|
{
|
51
|
-
colour_mode:
|
59
|
+
colour_mode: 256,
|
52
60
|
debug: false,
|
53
61
|
interactive: true,
|
62
|
+
log: '/tmp/vedeu.log',
|
54
63
|
once: false,
|
55
64
|
system_keys: {
|
56
|
-
exit:
|
65
|
+
exit: 'q',
|
57
66
|
focus_next: :tab,
|
58
67
|
focus_prev: :shift_tab,
|
59
68
|
mode_switch: :escape
|
@@ -35,9 +35,8 @@ module Vedeu
|
|
35
35
|
let(:back) {
|
36
36
|
{ name: 'indium', lines: [{ streams: [{ text: 'back' }] }] }
|
37
37
|
}
|
38
|
-
|
39
|
-
|
40
|
-
end
|
38
|
+
|
39
|
+
before { Buffers.add(back) }
|
41
40
|
|
42
41
|
it 'returns the current/front content' do
|
43
42
|
subject.must_equal([
|
@@ -57,7 +56,9 @@ module Vedeu
|
|
57
56
|
end
|
58
57
|
|
59
58
|
context 'when there is no new content' do
|
60
|
-
let(:front) {
|
59
|
+
let(:front) {
|
60
|
+
{ name: 'indium', lines: [{ streams: [{ text: 'front' }] }] }
|
61
|
+
}
|
61
62
|
|
62
63
|
before do
|
63
64
|
Buffers.add(front)
|
@@ -73,12 +74,14 @@ module Vedeu
|
|
73
74
|
end
|
74
75
|
|
75
76
|
context 'when there is no new or current content' do
|
76
|
-
let(:previous) {
|
77
|
+
let(:previous) {
|
78
|
+
{ name: 'indium', lines: [{ streams: [{ text: 'previous' }] }] }
|
79
|
+
}
|
77
80
|
|
78
81
|
before do
|
79
|
-
Buffers.add(previous)
|
80
|
-
Buffers.find('indium').swap
|
81
|
-
Buffers.find('indium').swap
|
82
|
+
Buffers.add(previous) # puts 'previous' on to 'back'
|
83
|
+
Buffers.find('indium').swap # puts 'back' ('previous') on to 'front'
|
84
|
+
Buffers.find('indium').swap # puts 'front' ('previous') on to 'previous'
|
82
85
|
end
|
83
86
|
|
84
87
|
it 'returns the previous content' do
|
@@ -92,9 +95,7 @@ module Vedeu
|
|
92
95
|
context 'when there is no new, current or previous content' do
|
93
96
|
let(:clear) { { name: 'indium', lines: [] } }
|
94
97
|
|
95
|
-
before
|
96
|
-
Buffers.add(clear)
|
97
|
-
end
|
98
|
+
before { Buffers.add(clear) }
|
98
99
|
|
99
100
|
it 'returns the escape sequences to clear the interface' do
|
100
101
|
subject.must_equal(["\e[1;1H \e[1;1H", "\e[1;1H\e[?25l"])
|
@@ -42,13 +42,18 @@ module Vedeu
|
|
42
42
|
|
43
43
|
describe '#find' do
|
44
44
|
it 'raises an exception when the entity cannot be found' do
|
45
|
-
proc {
|
46
|
-
|
45
|
+
proc {
|
46
|
+
RepositoryTestClass.new.find('terbium')
|
47
|
+
}.must_raise(EntityNotFound)
|
47
48
|
end
|
48
49
|
|
49
50
|
context 'when the entity is found' do
|
50
51
|
it 'returns the stored entity' do
|
51
|
-
|
52
|
+
entity = { key: :value }
|
53
|
+
repo = RepositoryTestClass.new
|
54
|
+
repo.add({ 'terbium' => entity })
|
55
|
+
|
56
|
+
repo.find('terbium').must_equal(entity)
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'simplecov'
|
2
2
|
require 'pry'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest/pride'
|
4
|
+
require 'minitest/pride' unless ENV['NO_COLOR']
|
5
5
|
require 'minitest/hell'
|
6
6
|
|
7
7
|
SimpleCov.start do
|
@@ -15,7 +15,7 @@ module MiniTest
|
|
15
15
|
|
16
16
|
class << self
|
17
17
|
alias_method :context, :describe
|
18
|
-
end
|
18
|
+
end # Spec eigenclass
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -23,10 +23,18 @@ require 'mocha/setup'
|
|
23
23
|
|
24
24
|
GC.disable
|
25
25
|
|
26
|
-
ENV['VEDEU_TESTMODE'] = '1'
|
27
|
-
|
28
26
|
require 'vedeu'
|
29
27
|
|
28
|
+
def test_configuration
|
29
|
+
Vedeu.configure do
|
30
|
+
debug!
|
31
|
+
colour_mode 16777216
|
32
|
+
log '/tmp/vedeu_test_helper.log'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
test_configuration
|
37
|
+
|
30
38
|
# commented out by default (makes tests slower)
|
31
39
|
# require 'minitest/reporters'
|
32
40
|
# Minitest::Reporters.use!(
|
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.2.
|
7
|
+
spec.version = '0.2.10'
|
8
8
|
spec.authors = ['Gavin Laking']
|
9
9
|
spec.email = ['gavinlaking@gmail.com']
|
10
10
|
spec.summary = %q{A terminal case of wonderland.}
|
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.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -186,6 +186,7 @@ files:
|
|
186
186
|
- docs/api.md
|
187
187
|
- docs/events.md
|
188
188
|
- docs/getting_started.md
|
189
|
+
- examples/configuration_app.rb
|
189
190
|
- examples/cursor_app/cursor_app.rb
|
190
191
|
- examples/focus_app.rb
|
191
192
|
- examples/hello_world.rb
|