vedeu 0.0.21 → 0.0.22
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/features/step_definitions/vedeu_steps.rb +2 -2
- data/lib/vedeu.rb +9 -0
- data/lib/vedeu/input/input.rb +2 -8
- data/lib/vedeu/output/geometry.rb +0 -6
- data/lib/vedeu/output/layer.rb +9 -0
- data/lib/vedeu/output/output.rb +2 -2
- data/lib/vedeu/output/position.rb +9 -1
- data/lib/vedeu/output/style.rb +13 -13
- data/lib/vedeu/repository/command.rb +0 -25
- data/lib/vedeu/repository/command_repository.rb +28 -11
- data/lib/vedeu/repository/interface.rb +9 -27
- data/lib/vedeu/repository/interface_repository.rb +32 -13
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/input/input_test.rb +8 -10
- data/test/lib/vedeu/output/compositor_test.rb +17 -1
- data/test/lib/vedeu/output/geometry_test.rb +0 -22
- data/test/lib/vedeu/output/layer_test.rb +35 -0
- data/test/lib/vedeu/output/output_test.rb +31 -1
- data/test/lib/vedeu/output/style_test.rb +8 -0
- data/test/lib/vedeu/process/process_test.rb +2 -1
- data/test/lib/vedeu/repository/command_repository_test.rb +16 -10
- data/test/lib/vedeu/repository/command_test.rb +0 -8
- data/test/lib/vedeu/repository/interface_repository_test.rb +21 -1
- data/test/lib/vedeu/repository/interface_test.rb +3 -11
- data/test/lib/vedeu/support/terminal_test.rb +1 -1
- data/vedeu.gemspec +3 -0
- metadata +33 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e848f5366e26266f101ad5e5fb0c3e0e724fc7f
|
4
|
+
data.tar.gz: e611d426fecc958f335acb8fc54c5a4d697e6638
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 165c47a59cfb6f52a3237c00b459c0aa0d38b8e797a3e8665c4686418da37aac4fc035f51aaee6e12e0c269fa04e276be15187acfa6b2546e692643726b0136c
|
7
|
+
data.tar.gz: 8e8e62514882dcfc5e71a6a4e425e3ac7633adc66ffae289e131535959751ac01a6a80a73712c399ed2c556e6441f510805f72cbf1ed1441f84df89173b83102
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Given(/^the interface "(.*?)" is defined$/) do |interface|
|
2
|
-
Vedeu::
|
2
|
+
Vedeu::InterfaceRepository.create({ name: interface, entity: Vedeu::DummyInterface, options: {} })
|
3
3
|
end
|
4
4
|
|
5
5
|
Given(/^the command "(.*?)" is defined$/) do |command|
|
6
|
-
Vedeu::
|
6
|
+
Vedeu::CommandRepository.create({ name: command, entity: Vedeu::DummyCommand, options: { keyword: command } })
|
7
7
|
end
|
8
8
|
|
9
9
|
When(/^the input "(.*?)" is entered$/) do |input|
|
data/lib/vedeu.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'logger'
|
3
3
|
require 'io/console'
|
4
|
+
require 'virtus'
|
5
|
+
require 'yajl'
|
4
6
|
|
5
7
|
require_relative 'vedeu/input/input'
|
6
8
|
|
@@ -16,6 +18,7 @@ require_relative 'vedeu/output/cursor'
|
|
16
18
|
require_relative 'vedeu/output/directive'
|
17
19
|
require_relative 'vedeu/output/foreground'
|
18
20
|
require_relative 'vedeu/output/geometry'
|
21
|
+
require_relative 'vedeu/output/layer'
|
19
22
|
require_relative 'vedeu/output/esc'
|
20
23
|
require_relative 'vedeu/output/colour'
|
21
24
|
require_relative 'vedeu/output/output'
|
@@ -50,6 +53,12 @@ module Vedeu
|
|
50
53
|
end
|
51
54
|
# :nocov:
|
52
55
|
|
56
|
+
# :nocov:
|
57
|
+
def self.included(receiver)
|
58
|
+
receiver.extend(ClassMethods)
|
59
|
+
end
|
60
|
+
# :nocov:
|
61
|
+
|
53
62
|
private
|
54
63
|
|
55
64
|
# :nocov:
|
data/lib/vedeu/input/input.rb
CHANGED
@@ -8,11 +8,6 @@ module Vedeu
|
|
8
8
|
Position.set(vy(index), vx)
|
9
9
|
end
|
10
10
|
|
11
|
-
def z
|
12
|
-
values[:z]
|
13
|
-
end
|
14
|
-
alias_method :layer, :z
|
15
|
-
|
16
11
|
def y
|
17
12
|
values[:y]
|
18
13
|
end
|
@@ -72,7 +67,6 @@ module Vedeu
|
|
72
67
|
{
|
73
68
|
width: Terminal.width,
|
74
69
|
height: Terminal.height,
|
75
|
-
z: 0,
|
76
70
|
y: 1,
|
77
71
|
x: 1
|
78
72
|
}
|
data/lib/vedeu/output/output.rb
CHANGED
@@ -9,8 +9,8 @@ module Vedeu
|
|
9
9
|
def initialize; end
|
10
10
|
|
11
11
|
def render
|
12
|
-
InterfaceRepository.refresh.
|
13
|
-
interface.
|
12
|
+
InterfaceRepository.refresh.each do |interface|
|
13
|
+
interface.each { |stream| Terminal.output(stream) if stream }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -12,7 +12,7 @@ module Vedeu
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def initialize(y =
|
15
|
+
def initialize(y = 1, x = 1)
|
16
16
|
@y, @x = y, x
|
17
17
|
end
|
18
18
|
|
@@ -23,5 +23,13 @@ module Vedeu
|
|
23
23
|
private
|
24
24
|
|
25
25
|
attr_accessor :y, :x
|
26
|
+
|
27
|
+
def y
|
28
|
+
@y == 0 ? 1 : @y
|
29
|
+
end
|
30
|
+
|
31
|
+
def x
|
32
|
+
@x == 0 ? 1 : @x
|
33
|
+
end
|
26
34
|
end
|
27
35
|
end
|
data/lib/vedeu/output/style.rb
CHANGED
@@ -12,19 +12,19 @@ module Vedeu
|
|
12
12
|
|
13
13
|
def set
|
14
14
|
case style
|
15
|
-
when :blink
|
16
|
-
when :blink_off
|
17
|
-
when :bold
|
18
|
-
when :bold_off
|
19
|
-
when :clear
|
20
|
-
when :hide_cursor
|
21
|
-
when :inverse
|
22
|
-
when :negative
|
23
|
-
when :positive
|
24
|
-
when :reset
|
25
|
-
when :normal
|
26
|
-
when :show_cursor
|
27
|
-
when :underline
|
15
|
+
when :blink then Esc.blink
|
16
|
+
when :blink_off then Esc.blink_off
|
17
|
+
when :bold then Esc.bold
|
18
|
+
when :bold_off then Esc.bold_off
|
19
|
+
when :clear then Esc.clear
|
20
|
+
when :hide_cursor then Cursor.hide
|
21
|
+
when :inverse then Esc.inverse
|
22
|
+
when :negative then Esc.negative
|
23
|
+
when :positive then Esc.positive
|
24
|
+
when :reset then Esc.reset
|
25
|
+
when :normal then Esc.reset
|
26
|
+
when :show_cursor then Cursor.show
|
27
|
+
when :underline then Esc.underline
|
28
28
|
when :underline_off then Esc.underline_off
|
29
29
|
else
|
30
30
|
''
|
@@ -2,12 +2,6 @@ module Vedeu
|
|
2
2
|
class Command
|
3
3
|
attr_accessor :attributes, :name, :entity, :keyword, :keypress
|
4
4
|
|
5
|
-
class << self
|
6
|
-
def create(attributes = {})
|
7
|
-
new(attributes).create
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
5
|
def initialize(attributes = {})
|
12
6
|
@attributes = attributes || {}
|
13
7
|
@name = attributes[:name]
|
@@ -16,11 +10,6 @@ module Vedeu
|
|
16
10
|
@keypress = attributes.fetch(:options, {}).fetch(:keypress, '')
|
17
11
|
end
|
18
12
|
|
19
|
-
def create
|
20
|
-
CommandRepository.create(self)
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
13
|
def execute(args = [])
|
25
14
|
executable.call(*args)
|
26
15
|
end
|
@@ -29,18 +18,4 @@ module Vedeu
|
|
29
18
|
proc { |*args| attributes[:entity].dispatch(*args) }
|
30
19
|
end
|
31
20
|
end
|
32
|
-
|
33
|
-
# :nocov:
|
34
|
-
module ClassMethods
|
35
|
-
def command(name, entity, options = {})
|
36
|
-
command_name = name.is_a?(Symbol) ? name.to_s : name
|
37
|
-
|
38
|
-
Command.create({ name: command_name, entity: entity, options: options })
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.included(receiver)
|
43
|
-
receiver.extend(ClassMethods)
|
44
|
-
end
|
45
|
-
# :nocov:
|
46
21
|
end
|
@@ -1,19 +1,36 @@
|
|
1
1
|
module Vedeu
|
2
|
-
|
2
|
+
module CommandRepository
|
3
3
|
extend Repository
|
4
|
+
extend self
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def by_keypress(input)
|
7
|
+
query(entity, :keypress, input)
|
8
|
+
end
|
9
|
+
|
10
|
+
def by_keyword(input)
|
11
|
+
query(entity, :keyword, input)
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(attributes)
|
15
|
+
super(Command.new(attributes))
|
16
|
+
end
|
17
|
+
|
18
|
+
def entity
|
19
|
+
Command
|
20
|
+
end
|
21
|
+
end
|
9
22
|
|
10
|
-
|
11
|
-
|
12
|
-
|
23
|
+
# :nocov:
|
24
|
+
module ClassMethods
|
25
|
+
def command(name, entity, options = {})
|
26
|
+
command_name = name.is_a?(Symbol) ? name.to_s : name
|
13
27
|
|
14
|
-
|
15
|
-
|
16
|
-
|
28
|
+
CommandRepository.create({
|
29
|
+
name: command_name,
|
30
|
+
entity: entity,
|
31
|
+
options: options
|
32
|
+
})
|
17
33
|
end
|
18
34
|
end
|
35
|
+
# :nocov:
|
19
36
|
end
|
@@ -4,12 +4,6 @@ module Vedeu
|
|
4
4
|
|
5
5
|
attr_accessor :attributes, :name, :cursor, :current
|
6
6
|
|
7
|
-
class << self
|
8
|
-
def create(attributes = {})
|
9
|
-
new(attributes).create
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
7
|
def initialize(attributes = {})
|
14
8
|
@attributes = attributes || {}
|
15
9
|
@name = attributes[:name]
|
@@ -17,12 +11,6 @@ module Vedeu
|
|
17
11
|
@current = []
|
18
12
|
end
|
19
13
|
|
20
|
-
def create
|
21
|
-
InterfaceRepository.create(self)
|
22
|
-
|
23
|
-
self
|
24
|
-
end
|
25
|
-
|
26
14
|
def refresh
|
27
15
|
if enqueued?
|
28
16
|
@current = dequeue
|
@@ -47,10 +35,18 @@ module Vedeu
|
|
47
35
|
@cursor ? Cursor.show : Cursor.hide
|
48
36
|
end
|
49
37
|
|
38
|
+
def layer
|
39
|
+
@layer ||= Layer.new(layer_attr).index
|
40
|
+
end
|
41
|
+
|
50
42
|
private
|
51
43
|
|
52
44
|
def initial_state
|
53
|
-
{ name => Array.new(geometry.height) { [
|
45
|
+
{ name => Array.new(geometry.height) { [''] } }
|
46
|
+
end
|
47
|
+
|
48
|
+
def layer_attr
|
49
|
+
attributes.fetch(:layer, 0)
|
54
50
|
end
|
55
51
|
|
56
52
|
def foreground
|
@@ -61,18 +57,4 @@ module Vedeu
|
|
61
57
|
attributes[:bg] || attributes[:background]
|
62
58
|
end
|
63
59
|
end
|
64
|
-
|
65
|
-
# :nocov:
|
66
|
-
module ClassMethods
|
67
|
-
def interface(name, options = {})
|
68
|
-
interface_name = name.is_a?(Symbol) ? name.to_s : name
|
69
|
-
|
70
|
-
Interface.create({ name: interface_name }.merge!(options))
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.included(receiver)
|
75
|
-
receiver.extend(ClassMethods)
|
76
|
-
end
|
77
|
-
# :nocov:
|
78
60
|
end
|
@@ -1,23 +1,42 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class UndefinedInterface < StandardError; end
|
3
3
|
|
4
|
-
|
4
|
+
module InterfaceRepository
|
5
5
|
extend Repository
|
6
|
+
extend self
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def create(attributes = {})
|
9
|
+
super(Interface.new(attributes))
|
10
|
+
end
|
11
|
+
|
12
|
+
def find(name)
|
13
|
+
result = super
|
14
|
+
raise UndefinedInterface unless result
|
15
|
+
result
|
16
|
+
end
|
17
|
+
|
18
|
+
def refresh
|
19
|
+
by_layer.map { |interface| interface.refresh }.compact
|
20
|
+
end
|
21
|
+
|
22
|
+
def by_layer
|
23
|
+
all.sort_by { |interface| interface.layer }
|
24
|
+
end
|
25
|
+
|
26
|
+
def entity
|
27
|
+
Interface
|
28
|
+
end
|
29
|
+
end
|
13
30
|
|
14
|
-
|
15
|
-
|
16
|
-
|
31
|
+
# :nocov:
|
32
|
+
module ClassMethods
|
33
|
+
def interface(name, options = {})
|
34
|
+
interface_name = name.is_a?(Symbol) ? name.to_s : name
|
17
35
|
|
18
|
-
|
19
|
-
|
20
|
-
|
36
|
+
InterfaceRepository.create({
|
37
|
+
name: interface_name
|
38
|
+
}.merge!(options))
|
21
39
|
end
|
22
40
|
end
|
41
|
+
# :nocov:
|
23
42
|
end
|
data/lib/vedeu/version.rb
CHANGED
@@ -2,25 +2,23 @@ require_relative '../../../test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
describe Input do
|
5
|
-
let(:
|
6
|
-
let(:input)
|
7
|
-
let(:subject) { described_class.new }
|
5
|
+
let(:described_module) { Input }
|
6
|
+
let(:input) { 'input' }
|
8
7
|
|
9
|
-
before
|
10
|
-
|
11
|
-
|
12
|
-
subject.must_be_instance_of(Input)
|
8
|
+
before do
|
9
|
+
Terminal.stubs(:input).returns(input)
|
10
|
+
Queue.stubs(:enqueue).returns([input])
|
13
11
|
end
|
14
12
|
|
15
13
|
describe '.capture' do
|
16
|
-
let(:subject) {
|
14
|
+
let(:subject) { described_module.capture }
|
17
15
|
|
18
16
|
it 'returns an Array' do
|
19
17
|
subject.must_be_instance_of(Array)
|
20
18
|
end
|
21
19
|
|
22
|
-
it 'returns the
|
23
|
-
subject.
|
20
|
+
it 'returns the enqueue input' do
|
21
|
+
subject.must_equal([input])
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -10,7 +10,7 @@ module Vedeu
|
|
10
10
|
let(:composition) {}
|
11
11
|
|
12
12
|
before do
|
13
|
-
|
13
|
+
InterfaceRepository.create({ name: 'dummy', width: 15, height: 2 })
|
14
14
|
end
|
15
15
|
|
16
16
|
after do
|
@@ -93,6 +93,22 @@ module Vedeu
|
|
93
93
|
subject.must_equal(composition)
|
94
94
|
end
|
95
95
|
end
|
96
|
+
|
97
|
+
context 'but is a string containing new-lines' do
|
98
|
+
let(:stream) { "Some text...\nSome more text..." }
|
99
|
+
let(:composition) {
|
100
|
+
[
|
101
|
+
[
|
102
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1HSome text...Some more tex...\e[0m\e[38;2;39m\e[48;2;49m\e[?25h",
|
103
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
104
|
+
]
|
105
|
+
]
|
106
|
+
}
|
107
|
+
|
108
|
+
it 'returns the enqueued composition' do
|
109
|
+
subject.must_equal(composition)
|
110
|
+
end
|
111
|
+
end
|
96
112
|
end
|
97
113
|
|
98
114
|
context 'when styled' do
|
@@ -15,28 +15,6 @@ module Vedeu
|
|
15
15
|
described_instance.must_be_instance_of(Geometry)
|
16
16
|
end
|
17
17
|
|
18
|
-
describe '#z' do
|
19
|
-
let(:subject) { described_instance.z }
|
20
|
-
|
21
|
-
it 'returns a Fixnum' do
|
22
|
-
subject.must_be_instance_of(Fixnum)
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'using a value' do
|
26
|
-
let(:values) { { z: 2 } }
|
27
|
-
|
28
|
-
it 'returns the value' do
|
29
|
-
subject.must_equal(2)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'using the default' do
|
34
|
-
it 'returns the default' do
|
35
|
-
subject.must_equal(0)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
18
|
describe '#y' do
|
41
19
|
let(:subject) { described_instance.y }
|
42
20
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe Layer do
|
5
|
+
let(:described_class) { Layer }
|
6
|
+
let(:described_instance) { described_class.new(index) }
|
7
|
+
let(:index) {}
|
8
|
+
|
9
|
+
it 'returns a Layer instance' do
|
10
|
+
described_instance.must_be_instance_of(Layer)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#index' do
|
14
|
+
let(:subject) { described_instance.index }
|
15
|
+
|
16
|
+
it 'returns a Fixnum' do
|
17
|
+
subject.must_be_instance_of(Fixnum)
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'using a index' do
|
21
|
+
let(:index) { 2 }
|
22
|
+
|
23
|
+
it 'returns the index' do
|
24
|
+
subject.must_equal(2)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'using the default' do
|
29
|
+
it 'returns the default' do
|
30
|
+
subject.must_equal(0)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -4,9 +4,11 @@ module Vedeu
|
|
4
4
|
describe Output do
|
5
5
|
let(:described_class) { Output }
|
6
6
|
let(:subject) { described_class.new }
|
7
|
+
let(:output) {}
|
7
8
|
|
8
9
|
before do
|
9
|
-
|
10
|
+
InterfaceRepository.create({ name: 'dummy', width: 15, height: 2, cursor: true })
|
11
|
+
Terminal.stubs(:output).returns(output)
|
10
12
|
end
|
11
13
|
|
12
14
|
after { InterfaceRepository.reset }
|
@@ -17,6 +19,34 @@ module Vedeu
|
|
17
19
|
|
18
20
|
describe '.render' do
|
19
21
|
let(:subject) { described_class.render }
|
22
|
+
|
23
|
+
context 'when the interfaces have content' do
|
24
|
+
let(:output) {
|
25
|
+
[
|
26
|
+
[
|
27
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1HTesting Outpu...\e[0m\e[38;2;39m\e[48;2;49m\e[?25h",
|
28
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
29
|
+
]
|
30
|
+
]
|
31
|
+
}
|
32
|
+
|
33
|
+
before { Compositor.arrange({ 'dummy' => 'Testing Output.render' }) }
|
34
|
+
|
35
|
+
it { subject.must_equal(output) }
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when the interfaces have no content' do
|
39
|
+
let(:output) {
|
40
|
+
[
|
41
|
+
[
|
42
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1H\e[38;2;39m\e[48;2;49m\e[?25h",
|
43
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
44
|
+
]
|
45
|
+
]
|
46
|
+
}
|
47
|
+
|
48
|
+
it { subject.must_equal(output) }
|
49
|
+
end
|
20
50
|
end
|
21
51
|
end
|
22
52
|
end
|
@@ -64,6 +64,14 @@ module Vedeu
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
context 'when the style is negative' do
|
68
|
+
let(:style) { :negative }
|
69
|
+
|
70
|
+
it 'returns an escape sequence' do
|
71
|
+
subject.must_equal("\e[7m")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
67
75
|
context 'when the style is inverse' do
|
68
76
|
let(:style) { :inverse }
|
69
77
|
|
@@ -16,11 +16,12 @@ module Vedeu
|
|
16
16
|
let(:command) { Command.new }
|
17
17
|
|
18
18
|
before do
|
19
|
-
|
19
|
+
InterfaceRepository.create({ name: 'dummy', width: 15, height: 2 })
|
20
20
|
Queue.stubs(:dequeue).returns(input)
|
21
21
|
CommandRepository.stubs(:by_keypress).returns(command)
|
22
22
|
CommandRepository.stubs(:by_keyword).returns(command)
|
23
23
|
command.stubs(:execute).returns(result)
|
24
|
+
Compositor.stubs(:arrange).returns([])
|
24
25
|
end
|
25
26
|
|
26
27
|
after do
|
@@ -3,20 +3,26 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
describe CommandRepository do
|
5
5
|
let(:described_class) { CommandRepository }
|
6
|
-
let(:input) {
|
6
|
+
let(:input) {}
|
7
7
|
|
8
8
|
before do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
CommandRepository.create({ name: 'apple',
|
10
|
+
entity: DummyCommand,
|
11
|
+
options: {
|
12
|
+
keypress: 'a',
|
13
|
+
keyword: 'apple'
|
14
|
+
}
|
15
|
+
})
|
16
|
+
CommandRepository.create({ name: 'banana',
|
17
|
+
entity: DummyCommand,
|
18
|
+
options: {
|
19
|
+
keypress: 'b',
|
20
|
+
keyword: 'banana'
|
21
|
+
}
|
22
|
+
})
|
15
23
|
end
|
16
24
|
|
17
|
-
after
|
18
|
-
CommandRepository.reset
|
19
|
-
end
|
25
|
+
after { CommandRepository.reset }
|
20
26
|
|
21
27
|
describe '.by_keypress' do
|
22
28
|
let(:subject) { described_class.by_keypress(input) }
|
@@ -40,14 +40,6 @@ module Vedeu
|
|
40
40
|
subject.instance_variable_get('@keypress').must_equal('d')
|
41
41
|
end
|
42
42
|
|
43
|
-
describe '#create' do
|
44
|
-
let(:subject) { described_class.create(attributes) }
|
45
|
-
|
46
|
-
it 'returns a Command instance' do
|
47
|
-
subject.must_be_instance_of(Command)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
43
|
describe '#execute' do
|
52
44
|
let(:subject) { described_instance.execute(args) }
|
53
45
|
let(:args) { [] }
|
@@ -4,7 +4,7 @@ module Vedeu
|
|
4
4
|
describe InterfaceRepository do
|
5
5
|
let(:described_class) { InterfaceRepository }
|
6
6
|
|
7
|
-
before {
|
7
|
+
before { InterfaceRepository.create({ name: 'dummy', width: 15, height: 2 }) }
|
8
8
|
after { InterfaceRepository.reset }
|
9
9
|
|
10
10
|
describe '.find' do
|
@@ -43,5 +43,25 @@ module Vedeu
|
|
43
43
|
subject.must_equal(Interface)
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
describe '.by_layer' do
|
48
|
+
let(:subject) { described_class.by_layer }
|
49
|
+
|
50
|
+
before do
|
51
|
+
InterfaceRepository.reset
|
52
|
+
@case_a = InterfaceRepository.create({ name: 'a', width: 15, height: 2, layer: 1 })
|
53
|
+
@case_b = InterfaceRepository.create({ name: 'b', width: 15, height: 2, layer: 0 })
|
54
|
+
@case_c = InterfaceRepository.create({ name: 'c', width: 15, height: 2, layer: 2 })
|
55
|
+
end
|
56
|
+
after { InterfaceRepository.reset }
|
57
|
+
|
58
|
+
it 'returns an Array' do
|
59
|
+
subject.must_be_instance_of(Array)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'returns the collection in order they should be drawn' do
|
63
|
+
subject.must_equal([@case_b, @case_a, @case_c])
|
64
|
+
end
|
65
|
+
end
|
46
66
|
end
|
47
67
|
end
|
@@ -8,8 +8,8 @@ module Vedeu
|
|
8
8
|
let(:attributes) {
|
9
9
|
{
|
10
10
|
name: 'dummy',
|
11
|
-
width:
|
12
|
-
height:
|
11
|
+
width: 15,
|
12
|
+
height: 2,
|
13
13
|
x: 1,
|
14
14
|
y: 1,
|
15
15
|
fg: :red,
|
@@ -19,7 +19,7 @@ module Vedeu
|
|
19
19
|
}
|
20
20
|
let(:result) {}
|
21
21
|
|
22
|
-
before {
|
22
|
+
before { InterfaceRepository.create(attributes) }
|
23
23
|
after { InterfaceRepository.reset }
|
24
24
|
|
25
25
|
it 'returns an Interface instance' do
|
@@ -34,14 +34,6 @@ module Vedeu
|
|
34
34
|
subject.instance_variable_get('@name').must_equal('dummy')
|
35
35
|
end
|
36
36
|
|
37
|
-
describe '#create' do
|
38
|
-
let(:subject) { described_class.create(attributes) }
|
39
|
-
|
40
|
-
it 'returns an Interface' do
|
41
|
-
subject.must_be_instance_of(Interface)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
37
|
describe '#refresh' do
|
46
38
|
let(:subject) { described_instance.refresh }
|
47
39
|
|
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.0.
|
4
|
+
version: 0.0.22
|
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-06-
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -192,6 +192,34 @@ dependencies:
|
|
192
192
|
- - '='
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 0.8.2
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: virtus
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: yajl-ruby
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :runtime
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
195
223
|
description:
|
196
224
|
email:
|
197
225
|
- gavinlaking@gmail.com
|
@@ -236,6 +264,7 @@ files:
|
|
236
264
|
- lib/vedeu/output/esc.rb
|
237
265
|
- lib/vedeu/output/foreground.rb
|
238
266
|
- lib/vedeu/output/geometry.rb
|
267
|
+
- lib/vedeu/output/layer.rb
|
239
268
|
- lib/vedeu/output/output.rb
|
240
269
|
- lib/vedeu/output/position.rb
|
241
270
|
- lib/vedeu/output/style.rb
|
@@ -267,6 +296,7 @@ files:
|
|
267
296
|
- test/lib/vedeu/output/esc_test.rb
|
268
297
|
- test/lib/vedeu/output/foreground_test.rb
|
269
298
|
- test/lib/vedeu/output/geometry_test.rb
|
299
|
+
- test/lib/vedeu/output/layer_test.rb
|
270
300
|
- test/lib/vedeu/output/output_test.rb
|
271
301
|
- test/lib/vedeu/output/position_test.rb
|
272
302
|
- test/lib/vedeu/output/style_test.rb
|
@@ -330,6 +360,7 @@ test_files:
|
|
330
360
|
- test/lib/vedeu/output/esc_test.rb
|
331
361
|
- test/lib/vedeu/output/foreground_test.rb
|
332
362
|
- test/lib/vedeu/output/geometry_test.rb
|
363
|
+
- test/lib/vedeu/output/layer_test.rb
|
333
364
|
- test/lib/vedeu/output/output_test.rb
|
334
365
|
- test/lib/vedeu/output/position_test.rb
|
335
366
|
- test/lib/vedeu/output/style_test.rb
|