vedeu 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -2
- data/lib/vedeu.rb +5 -2
- data/lib/vedeu/launcher.rb +1 -1
- data/lib/vedeu/output/compositor.rb +5 -4
- data/lib/vedeu/output/geometry.rb +5 -1
- data/lib/vedeu/process/event_loop.rb +6 -2
- data/lib/vedeu/process/input.rb +5 -20
- data/lib/vedeu/process/output.rb +25 -0
- data/lib/vedeu/process/process.rb +63 -0
- data/lib/vedeu/process/queue.rb +32 -0
- data/lib/vedeu/repository/command_repository.rb +4 -12
- data/lib/vedeu/repository/dummy_command.rb +1 -1
- data/lib/vedeu/repository/interface.rb +8 -26
- data/lib/vedeu/repository/interface_repository.rb +0 -14
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/launcher_test.rb +15 -0
- data/test/lib/vedeu/process/event_loop_test.rb +9 -3
- data/test/lib/vedeu/process/input_test.rb +4 -7
- data/test/lib/vedeu/process/output_test.rb +25 -0
- data/test/lib/vedeu/process/process_test.rb +67 -0
- data/test/lib/vedeu/process/queue_test.rb +54 -0
- data/test/lib/vedeu/repository/command_repository_test.rb +6 -2
- data/test/lib/vedeu/repository/command_test.rb +1 -11
- data/test/lib/vedeu/repository/dummy_command_test.rb +21 -0
- data/test/lib/vedeu/repository/dummy_interface_test.rb +7 -0
- data/test/lib/vedeu/repository/interface_repository_test.rb +0 -18
- data/test/lib/vedeu/repository/interface_test.rb +0 -35
- data/test/lib/vedeu/repository/repository_test.rb +0 -2
- data/test/lib/vedeu/repository/storage_test.rb +0 -12
- data/test/lib/vedeu/support/terminal_test.rb +0 -10
- data/test/test_helper.rb +0 -6
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3489de1de7dba2be8959a6f31fedda506ab98d9
|
4
|
+
data.tar.gz: 86ccc8058d098ecadee5ce5b921858a9894df14b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b04a568a44e0c7eb891f10ffb72f94f19370e9652ad17850291665f7873b9b3901117a01353d2429f74bfa94f7d068a1aa52eff9eaf87adcde4eb39f983ed4dc
|
7
|
+
data.tar.gz: 996e9e94f5009f3e75d994a397b17bb83545332f370efcad301a1553d58c870e42407d0d61bb9386916aeaba1c70e99143c11ba9672bf21dccfe568130cbbe38
|
data/Rakefile
CHANGED
@@ -7,13 +7,15 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
|
|
7
7
|
t.cucumber_opts = "features --format progress"
|
8
8
|
end
|
9
9
|
|
10
|
-
Rake::TestTask.new do |t|
|
10
|
+
Rake::TestTask.new(:minitest) do |t|
|
11
11
|
t.libs << 'lib/vedeu'
|
12
12
|
t.test_files = FileList["test/lib/vedeu/*_test.rb",
|
13
13
|
"test/lib/vedeu/**/*_test.rb"]
|
14
14
|
t.verbose = false
|
15
15
|
end
|
16
16
|
|
17
|
-
task :default => :
|
17
|
+
task :default => :minitest
|
18
|
+
|
19
|
+
Rake::Task['minitest'].execute
|
18
20
|
|
19
21
|
Rake::Task['cucumber'].execute
|
data/lib/vedeu.rb
CHANGED
@@ -21,6 +21,9 @@ require_relative 'vedeu/output/wordwrap'
|
|
21
21
|
require_relative 'vedeu/process/event_loop'
|
22
22
|
require_relative 'vedeu/process/exit'
|
23
23
|
require_relative 'vedeu/process/input'
|
24
|
+
require_relative 'vedeu/process/output'
|
25
|
+
require_relative 'vedeu/process/process'
|
26
|
+
require_relative 'vedeu/process/queue'
|
24
27
|
|
25
28
|
require_relative 'vedeu/repository/repository'
|
26
29
|
require_relative 'vedeu/repository/command_repository'
|
@@ -37,10 +40,10 @@ require_relative 'vedeu/version'
|
|
37
40
|
|
38
41
|
module Vedeu
|
39
42
|
module ClassMethods
|
40
|
-
def interface(name,
|
43
|
+
def interface(name, geometry = {})
|
41
44
|
interface_name = name.is_a?(Symbol) ? name.to_s : name
|
42
45
|
|
43
|
-
Interface.create({ name: interface_name,
|
46
|
+
Interface.create({ name: interface_name, geometry: geometry })
|
44
47
|
end
|
45
48
|
|
46
49
|
def command(name, klass, options = {})
|
data/lib/vedeu/launcher.rb
CHANGED
@@ -9,9 +9,7 @@ module Vedeu
|
|
9
9
|
if output.is_a?(Array)
|
10
10
|
new(output, interface).arrange
|
11
11
|
elsif output.is_a?(Hash)
|
12
|
-
output.map
|
13
|
-
new(o, i).arrange
|
14
|
-
end
|
12
|
+
output.map { |i, o| new(o, i).arrange }
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
@@ -30,14 +28,17 @@ module Vedeu
|
|
30
28
|
def composition
|
31
29
|
container = []
|
32
30
|
streams = []
|
31
|
+
|
33
32
|
output.map do |line|
|
34
33
|
line.each_with_index do |stream, index|
|
35
34
|
streams << clear(index)
|
36
35
|
streams << Directive.enact(stream)
|
37
36
|
end
|
37
|
+
|
38
38
|
container << streams.join
|
39
39
|
streams = []
|
40
40
|
end
|
41
|
+
|
41
42
|
container
|
42
43
|
end
|
43
44
|
|
@@ -46,7 +47,7 @@ module Vedeu
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def origin(index)
|
49
|
-
|
50
|
+
geometry.origin(index)
|
50
51
|
end
|
51
52
|
|
52
53
|
def width
|
@@ -4,6 +4,10 @@ module Vedeu
|
|
4
4
|
@values = values || {}
|
5
5
|
end
|
6
6
|
|
7
|
+
def origin(index = 0)
|
8
|
+
Position.set(vy(index), vx)
|
9
|
+
end
|
10
|
+
|
7
11
|
def z
|
8
12
|
values[:z]
|
9
13
|
end
|
@@ -56,7 +60,7 @@ module Vedeu
|
|
56
60
|
end
|
57
61
|
|
58
62
|
def values
|
59
|
-
defaults.merge(auto)
|
63
|
+
defaults.merge!(auto)
|
60
64
|
end
|
61
65
|
|
62
66
|
def auto
|
@@ -13,10 +13,14 @@ module Vedeu
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def main_sequence
|
16
|
+
InterfaceRepository.initial_state
|
17
|
+
|
16
18
|
while @running do
|
17
|
-
|
19
|
+
Input.capture
|
20
|
+
|
21
|
+
Process.evaluate
|
18
22
|
|
19
|
-
|
23
|
+
Output.render
|
20
24
|
end
|
21
25
|
rescue Collapse
|
22
26
|
stop
|
data/lib/vedeu/process/input.rb
CHANGED
@@ -1,30 +1,15 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class Input
|
3
3
|
class << self
|
4
|
-
def
|
5
|
-
new
|
4
|
+
def capture
|
5
|
+
new.capture
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
@input = input
|
11
|
-
@args = args || []
|
12
|
-
end
|
13
|
-
|
14
|
-
def evaluate
|
15
|
-
command.execute(*args) if exists?
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_reader :input, :args
|
21
|
-
|
22
|
-
def exists?
|
23
|
-
command.is_a?(Command)
|
24
|
-
end
|
9
|
+
def initialize; end
|
25
10
|
|
26
|
-
def
|
27
|
-
|
11
|
+
def capture
|
12
|
+
Terminal.input
|
28
13
|
end
|
29
14
|
end
|
30
15
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Vedeu
|
2
|
+
class Output
|
3
|
+
class << self
|
4
|
+
def render
|
5
|
+
new.render
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize; end
|
10
|
+
|
11
|
+
def render
|
12
|
+
Compositor.arrange(result) unless empty?
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def empty?
|
18
|
+
result.nil? || result.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
def result
|
22
|
+
@result ||= Queue.dequeue
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Vedeu
|
2
|
+
class Process
|
3
|
+
class << self
|
4
|
+
def evaluate
|
5
|
+
new.evaluate
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize; end
|
10
|
+
|
11
|
+
def evaluate
|
12
|
+
raise Collapse if result == :stop
|
13
|
+
|
14
|
+
Queue.enqueue(result) unless no_result?
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def result
|
20
|
+
@result ||= command.execute(*args) unless not_found?
|
21
|
+
end
|
22
|
+
|
23
|
+
def no_result?
|
24
|
+
result.nil? || result.empty?
|
25
|
+
end
|
26
|
+
|
27
|
+
def not_found?
|
28
|
+
command.nil?
|
29
|
+
end
|
30
|
+
|
31
|
+
def command
|
32
|
+
@command ||= find_by_keypress || find_by_keyword
|
33
|
+
end
|
34
|
+
|
35
|
+
def find_by_keypress
|
36
|
+
CommandRepository.by_keypress(input) if keypress?
|
37
|
+
end
|
38
|
+
|
39
|
+
def find_by_keyword
|
40
|
+
CommandRepository.by_keyword(input) if keyword?
|
41
|
+
end
|
42
|
+
|
43
|
+
def keypress?
|
44
|
+
input? && input.size == 1
|
45
|
+
end
|
46
|
+
|
47
|
+
def keyword?
|
48
|
+
input? && input.size > 1
|
49
|
+
end
|
50
|
+
|
51
|
+
def input?
|
52
|
+
!!(input)
|
53
|
+
end
|
54
|
+
|
55
|
+
def input
|
56
|
+
@input ||= Queue.dequeue
|
57
|
+
end
|
58
|
+
|
59
|
+
def args
|
60
|
+
[]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Vedeu
|
2
|
+
module Queue
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def dequeue
|
6
|
+
store.pop
|
7
|
+
end
|
8
|
+
|
9
|
+
def enqueue(result)
|
10
|
+
store.unshift(result)
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def size
|
15
|
+
store.size
|
16
|
+
end
|
17
|
+
|
18
|
+
def clear
|
19
|
+
store.clear
|
20
|
+
end
|
21
|
+
|
22
|
+
def view
|
23
|
+
store.inspect
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def store
|
29
|
+
@store ||= Array.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -3,18 +3,6 @@ module Vedeu
|
|
3
3
|
extend Repository
|
4
4
|
|
5
5
|
class << self
|
6
|
-
def find_by_input(input)
|
7
|
-
return nil if input.nil? || input.empty?
|
8
|
-
return by_keypress(input) if input.size == 1
|
9
|
-
return by_keyword(input) if input.size > 1
|
10
|
-
end
|
11
|
-
|
12
|
-
def klass
|
13
|
-
Command
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
6
|
def by_keypress(input)
|
19
7
|
query(klass, :keypress, input)
|
20
8
|
end
|
@@ -22,6 +10,10 @@ module Vedeu
|
|
22
10
|
def by_keyword(input)
|
23
11
|
query(klass, :keyword, input)
|
24
12
|
end
|
13
|
+
|
14
|
+
def klass
|
15
|
+
Command
|
16
|
+
end
|
25
17
|
end
|
26
18
|
end
|
27
19
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class Interface
|
3
|
-
attr_accessor :id, :
|
3
|
+
attr_accessor :id, :attributes, :active, :geometry, :name, :result
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def create(attributes = {})
|
@@ -10,9 +10,11 @@ module Vedeu
|
|
10
10
|
|
11
11
|
def initialize(attributes = {})
|
12
12
|
@attributes = attributes || {}
|
13
|
-
|
13
|
+
|
14
14
|
@active = false
|
15
|
-
@geometry =
|
15
|
+
@geometry = attributes[:geometry]
|
16
|
+
@name = attributes[:name]
|
17
|
+
@result = nil
|
16
18
|
end
|
17
19
|
|
18
20
|
def create
|
@@ -23,30 +25,10 @@ module Vedeu
|
|
23
25
|
self
|
24
26
|
end
|
25
27
|
|
26
|
-
def
|
27
|
-
Position.set(geometry.vy(index), geometry.vx)
|
28
|
-
end
|
29
|
-
|
30
|
-
def initial_state
|
31
|
-
# raise NotImplementedError, 'Subclasses implement this method.'
|
32
|
-
end
|
33
|
-
|
34
|
-
def input
|
35
|
-
raise Collapse if evaluate == :stop
|
36
|
-
end
|
37
|
-
|
38
|
-
def output
|
39
|
-
Compositor.arrange(@result, self) unless @result.nil? || @result.empty?
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def evaluate
|
45
|
-
@result = Input.evaluate(read)
|
46
|
-
end
|
28
|
+
def initial_state; end
|
47
29
|
|
48
|
-
def
|
49
|
-
|
30
|
+
def geometry
|
31
|
+
Geometry.new(@geometry)
|
50
32
|
end
|
51
33
|
end
|
52
34
|
end
|
@@ -27,20 +27,6 @@ module Vedeu
|
|
27
27
|
all.map { |interface| interface.initial_state }
|
28
28
|
end
|
29
29
|
|
30
|
-
def update; end
|
31
|
-
|
32
|
-
def input
|
33
|
-
all.map do |interface|
|
34
|
-
interface.origin
|
35
|
-
|
36
|
-
interface.input
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def output
|
41
|
-
all.map { |interface| interface.output }
|
42
|
-
end
|
43
|
-
|
44
30
|
def klass
|
45
31
|
Interface
|
46
32
|
end
|
data/lib/vedeu/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe Launcher do
|
5
|
+
let(:described_class) { Launcher }
|
6
|
+
let(:described_instance) { described_class.new(argv) }
|
7
|
+
let(:argv) { [] }
|
8
|
+
|
9
|
+
it { described_instance.must_be_instance_of(Launcher) }
|
10
|
+
|
11
|
+
describe '#execute!' do
|
12
|
+
let(:subject) { described_instance.execute! }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -7,16 +7,22 @@ module Vedeu
|
|
7
7
|
let(:subject) { described_class.new }
|
8
8
|
|
9
9
|
before do
|
10
|
-
|
11
|
-
|
10
|
+
Input.stubs(:evaluate)
|
11
|
+
Output.stubs(:render)
|
12
12
|
end
|
13
13
|
|
14
14
|
it { subject.must_be_instance_of(EventLoop) }
|
15
15
|
|
16
|
+
it { subject.instance_variable_get("@running").must_equal(true) }
|
17
|
+
|
16
18
|
describe '.main_sequence' do
|
17
19
|
let(:subject) { described_class.main_sequence }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#stop' do
|
23
|
+
let(:subject) { described_class.new.stop }
|
18
24
|
|
19
|
-
|
25
|
+
it { subject.must_be_instance_of(FalseClass) }
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
@@ -4,16 +4,13 @@ module Vedeu
|
|
4
4
|
describe Input do
|
5
5
|
let(:described_class) { Input }
|
6
6
|
let(:input) { "" }
|
7
|
-
let(:args) { [] }
|
8
7
|
|
9
|
-
before
|
10
|
-
CommandRepository.stubs(:find_by_input)
|
11
|
-
end
|
8
|
+
before { Terminal.stubs(:input).returns(input) }
|
12
9
|
|
13
|
-
describe '.
|
14
|
-
let(:subject) { described_class.
|
10
|
+
describe '.capture' do
|
11
|
+
let(:subject) { described_class.capture }
|
15
12
|
|
16
|
-
it { subject.must_be_instance_of(
|
13
|
+
it { subject.must_be_instance_of(String) }
|
17
14
|
end
|
18
15
|
end
|
19
16
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe Output do
|
5
|
+
let(:described_class) { Output }
|
6
|
+
let(:input) { "" }
|
7
|
+
let(:args) { [] }
|
8
|
+
|
9
|
+
before do
|
10
|
+
Compositor.stubs(:arrange)
|
11
|
+
Queue.stubs(:dequeue).returns(result)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.render' do
|
15
|
+
let(:subject) { described_class.render }
|
16
|
+
let(:result) { }
|
17
|
+
|
18
|
+
it { subject.must_be_instance_of(NilClass) }
|
19
|
+
|
20
|
+
context 'when the result is empty' do
|
21
|
+
let(:result) {}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe Process do
|
5
|
+
let(:described_class) { Process }
|
6
|
+
let(:input) { nil }
|
7
|
+
let(:result) {}
|
8
|
+
|
9
|
+
describe '.evaluate' do
|
10
|
+
let(:subject) { described_class.evaluate }
|
11
|
+
let(:command) { Command.new }
|
12
|
+
|
13
|
+
before do
|
14
|
+
Queue.enqueue(input)
|
15
|
+
CommandRepository.stubs(:by_keypress).returns(command)
|
16
|
+
CommandRepository.stubs(:by_keyword).returns(command)
|
17
|
+
command.stubs(:execute).returns(result)
|
18
|
+
end
|
19
|
+
|
20
|
+
after { Queue.clear }
|
21
|
+
|
22
|
+
context 'when there is no input' do
|
23
|
+
it { subject.must_be_instance_of(NilClass) }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when the input is a keypress' do
|
27
|
+
let(:input) { "q" }
|
28
|
+
|
29
|
+
context 'but there is no result' do
|
30
|
+
it { subject.must_be_instance_of(NilClass) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'or the result is :stop' do
|
34
|
+
let(:result) { :stop }
|
35
|
+
|
36
|
+
it { proc { subject }.must_raise(Collapse) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'or the result is anything else' do
|
40
|
+
let(:result) { :something_else }
|
41
|
+
|
42
|
+
it { subject.must_be_instance_of(Module) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when the input is a keyword' do
|
47
|
+
let(:input) { "quit" }
|
48
|
+
|
49
|
+
context 'but there is no result' do
|
50
|
+
it { subject.must_be_instance_of(NilClass) }
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'or the result is :stop' do
|
54
|
+
let(:result) { :stop }
|
55
|
+
|
56
|
+
it { proc { subject }.must_raise(Collapse) }
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'or the result is anything else' do
|
60
|
+
let(:result) { :something_else }
|
61
|
+
|
62
|
+
it { subject.must_be_instance_of(Module) }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe Queue do
|
5
|
+
let(:described_class) { Queue }
|
6
|
+
|
7
|
+
before do
|
8
|
+
described_class.clear
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '.dequeue' do
|
12
|
+
let(:subject) { described_class.dequeue }
|
13
|
+
|
14
|
+
context 'when the queue is empty' do
|
15
|
+
it { subject.must_be_instance_of(NilClass) }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when the queue is not empty' do
|
19
|
+
before { described_class.enqueue(:result) }
|
20
|
+
|
21
|
+
it { subject.must_be_instance_of(Symbol) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.enqueue' do
|
26
|
+
let(:subject) { described_class.enqueue(result) }
|
27
|
+
let(:result) { :result }
|
28
|
+
|
29
|
+
it { subject.must_be_instance_of(Module) }
|
30
|
+
|
31
|
+
it { subject.size.must_equal(1) }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '.size' do
|
35
|
+
let(:subject) { described_class.size }
|
36
|
+
|
37
|
+
it { subject.must_be_instance_of(Fixnum) }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '.clear' do
|
41
|
+
let(:subject) { described_class.clear }
|
42
|
+
|
43
|
+
it { subject.must_be_instance_of(Array) }
|
44
|
+
|
45
|
+
it { subject.must_be_empty }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '.view' do
|
49
|
+
let(:subject) { described_class.view }
|
50
|
+
|
51
|
+
it { subject.must_be_instance_of(String) }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -18,8 +18,8 @@ module Vedeu
|
|
18
18
|
CommandRepository.reset
|
19
19
|
end
|
20
20
|
|
21
|
-
describe '.
|
22
|
-
let(:subject) { described_class.
|
21
|
+
describe '.by_keypress' do
|
22
|
+
let(:subject) { described_class.by_keypress(input) }
|
23
23
|
|
24
24
|
context 'when the command was found by keypress' do
|
25
25
|
let(:input) { 'b' }
|
@@ -32,6 +32,10 @@ module Vedeu
|
|
32
32
|
|
33
33
|
it { subject.keypress.must_equal('b') }
|
34
34
|
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.by_keyword' do
|
38
|
+
let(:subject) { described_class.by_keyword(input) }
|
35
39
|
|
36
40
|
context 'when the command was found by keyword' do
|
37
41
|
let(:input) { 'apple' }
|
@@ -1,10 +1,6 @@
|
|
1
1
|
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Vedeu
|
4
|
-
class DummyCommand
|
5
|
-
def self.dispatch; end
|
6
|
-
end
|
7
|
-
|
8
4
|
describe Command do
|
9
5
|
let(:described_class) { Command }
|
10
6
|
let(:described_instance) { described_class.new(attributes) }
|
@@ -19,21 +15,15 @@ module Vedeu
|
|
19
15
|
end
|
20
16
|
|
21
17
|
describe '#execute' do
|
22
|
-
let(:subject) {
|
23
|
-
|
24
|
-
it { skip }
|
18
|
+
let(:subject) { described_instance.execute(args) }
|
25
19
|
end
|
26
20
|
|
27
21
|
describe '#executable' do
|
28
22
|
let(:subject) { described_instance.executable }
|
29
|
-
|
30
|
-
it { skip }
|
31
23
|
end
|
32
24
|
|
33
25
|
describe '#execute' do
|
34
26
|
let(:subject) { described_instance.execute }
|
35
|
-
|
36
|
-
it { skip }
|
37
27
|
end
|
38
28
|
end
|
39
29
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe DummyCommand do
|
5
|
+
let(:described_class) { DummyCommand }
|
6
|
+
let(:subject) { described_class.dispatch(command) }
|
7
|
+
let(:command) {}
|
8
|
+
|
9
|
+
it { subject.must_be_instance_of(Symbol) }
|
10
|
+
|
11
|
+
context 'when the value exists' do
|
12
|
+
let(:command) { :test_command }
|
13
|
+
|
14
|
+
it { subject.must_equal(:test_command) }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when the value does not exist' do
|
18
|
+
it { subject.must_equal(:dummy) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -44,24 +44,6 @@ module Vedeu
|
|
44
44
|
it { subject.must_be_instance_of(Array) }
|
45
45
|
end
|
46
46
|
|
47
|
-
describe '.input' do
|
48
|
-
let(:subject) { described_class.input }
|
49
|
-
|
50
|
-
it { subject.must_be_instance_of(Array) }
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '.output' do
|
54
|
-
let(:subject) { described_class.output }
|
55
|
-
|
56
|
-
it { subject.must_be_instance_of(Array) }
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '.update' do
|
60
|
-
let(:subject) { described_class.update }
|
61
|
-
|
62
|
-
it { skip }
|
63
|
-
end
|
64
|
-
|
65
47
|
describe '.klass' do
|
66
48
|
let(:subject) { described_class.klass }
|
67
49
|
|
@@ -24,42 +24,7 @@ module Vedeu
|
|
24
24
|
describe '#initial_state' do
|
25
25
|
let(:subject) { described_instance.initial_state }
|
26
26
|
|
27
|
-
# it { proc { subject }.must_raise(NotImplementedError) }
|
28
|
-
|
29
27
|
it { subject.must_be_instance_of(NilClass) }
|
30
28
|
end
|
31
|
-
|
32
|
-
describe '#origin' do
|
33
|
-
it { skip }
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '#initial_state' do
|
37
|
-
it { skip }
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#input' do
|
41
|
-
let(:subject) { described_instance.input }
|
42
|
-
|
43
|
-
context 'when the command evaluates to :stop' do
|
44
|
-
let(:result) { :stop }
|
45
|
-
|
46
|
-
it { proc { subject }.must_raise(Collapse) }
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'when the command evaluates to anything else' do
|
50
|
-
let(:result) { :something_else }
|
51
|
-
|
52
|
-
it { subject.must_be_instance_of(NilClass) }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#output' do
|
57
|
-
let(:subject) { described_instance.output }
|
58
|
-
let(:command) { mock }
|
59
|
-
|
60
|
-
it 'sends the output of the command to the compositor' do
|
61
|
-
subject.must_be_instance_of(NilClass)
|
62
|
-
end
|
63
|
-
end
|
64
29
|
end
|
65
30
|
end
|
@@ -11,40 +11,28 @@ module Vedeu
|
|
11
11
|
|
12
12
|
describe '#create' do
|
13
13
|
let(:subject) { described_class.new.create(record) }
|
14
|
-
|
15
|
-
it { skip }
|
16
14
|
end
|
17
15
|
|
18
16
|
describe '#delete' do
|
19
17
|
let(:subject) { described_class.new.delete(record) }
|
20
|
-
|
21
|
-
it { skip }
|
22
18
|
end
|
23
19
|
|
24
20
|
describe '#reset' do
|
25
21
|
let(:subject) { described_class.new.reset(klass) }
|
26
|
-
|
27
|
-
it { skip }
|
28
22
|
end
|
29
23
|
|
30
24
|
describe '#find' do
|
31
25
|
let(:subject) { described_class.new.find(klass, id) }
|
32
|
-
|
33
|
-
it { skip }
|
34
26
|
end
|
35
27
|
|
36
28
|
describe '#all' do
|
37
29
|
let(:subject) { described_class.new.all(klass) }
|
38
|
-
|
39
|
-
it { skip }
|
40
30
|
end
|
41
31
|
|
42
32
|
describe '#query' do
|
43
33
|
let(:subject) { described_class.new.query(klass, attribute, value) }
|
44
34
|
let(:attribute) {}
|
45
35
|
let(:value) {}
|
46
|
-
|
47
|
-
it { skip }
|
48
36
|
end
|
49
37
|
end
|
50
38
|
end
|
@@ -61,32 +61,22 @@ module Vedeu
|
|
61
61
|
|
62
62
|
describe '.open' do
|
63
63
|
let(:subject) { described_class.open }
|
64
|
-
|
65
|
-
it { skip }
|
66
64
|
end
|
67
65
|
|
68
66
|
describe '.close' do
|
69
67
|
let(:subject) { described_class.close }
|
70
|
-
|
71
|
-
it { skip }
|
72
68
|
end
|
73
69
|
|
74
70
|
describe '.cooked' do
|
75
71
|
let(:subject) { described_class.cooked }
|
76
|
-
|
77
|
-
it { skip }
|
78
72
|
end
|
79
73
|
|
80
74
|
describe '.raw' do
|
81
75
|
let(:subject) { described_class.raw }
|
82
|
-
|
83
|
-
it { skip }
|
84
76
|
end
|
85
77
|
|
86
78
|
describe '.console' do
|
87
79
|
let(:subject) { described_class.console }
|
88
|
-
|
89
|
-
it { skip }
|
90
80
|
end
|
91
81
|
|
92
82
|
describe '.clear_screen' do
|
data/test/test_helper.rb
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.12
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -217,6 +217,9 @@ files:
|
|
217
217
|
- lib/vedeu/process/event_loop.rb
|
218
218
|
- lib/vedeu/process/exit.rb
|
219
219
|
- lib/vedeu/process/input.rb
|
220
|
+
- lib/vedeu/process/output.rb
|
221
|
+
- lib/vedeu/process/process.rb
|
222
|
+
- lib/vedeu/process/queue.rb
|
220
223
|
- lib/vedeu/repository/command.rb
|
221
224
|
- lib/vedeu/repository/command_repository.rb
|
222
225
|
- lib/vedeu/repository/dummy_command.rb
|
@@ -228,6 +231,7 @@ files:
|
|
228
231
|
- lib/vedeu/support/terminal.rb
|
229
232
|
- lib/vedeu/version.rb
|
230
233
|
- test/lib/vedeu/application_test.rb
|
234
|
+
- test/lib/vedeu/launcher_test.rb
|
231
235
|
- test/lib/vedeu/output/background_test.rb
|
232
236
|
- test/lib/vedeu/output/base_test.rb
|
233
237
|
- test/lib/vedeu/output/colour_test.rb
|
@@ -244,8 +248,13 @@ files:
|
|
244
248
|
- test/lib/vedeu/process/event_loop_test.rb
|
245
249
|
- test/lib/vedeu/process/exit_test.rb
|
246
250
|
- test/lib/vedeu/process/input_test.rb
|
251
|
+
- test/lib/vedeu/process/output_test.rb
|
252
|
+
- test/lib/vedeu/process/process_test.rb
|
253
|
+
- test/lib/vedeu/process/queue_test.rb
|
247
254
|
- test/lib/vedeu/repository/command_repository_test.rb
|
248
255
|
- test/lib/vedeu/repository/command_test.rb
|
256
|
+
- test/lib/vedeu/repository/dummy_command_test.rb
|
257
|
+
- test/lib/vedeu/repository/dummy_interface_test.rb
|
249
258
|
- test/lib/vedeu/repository/interface_repository_test.rb
|
250
259
|
- test/lib/vedeu/repository/interface_test.rb
|
251
260
|
- test/lib/vedeu/repository/repository_test.rb
|
@@ -283,6 +292,7 @@ test_files:
|
|
283
292
|
- features/step_definitions/vedeu_steps.rb
|
284
293
|
- features/support/env.rb
|
285
294
|
- test/lib/vedeu/application_test.rb
|
295
|
+
- test/lib/vedeu/launcher_test.rb
|
286
296
|
- test/lib/vedeu/output/background_test.rb
|
287
297
|
- test/lib/vedeu/output/base_test.rb
|
288
298
|
- test/lib/vedeu/output/colour_test.rb
|
@@ -299,8 +309,13 @@ test_files:
|
|
299
309
|
- test/lib/vedeu/process/event_loop_test.rb
|
300
310
|
- test/lib/vedeu/process/exit_test.rb
|
301
311
|
- test/lib/vedeu/process/input_test.rb
|
312
|
+
- test/lib/vedeu/process/output_test.rb
|
313
|
+
- test/lib/vedeu/process/process_test.rb
|
314
|
+
- test/lib/vedeu/process/queue_test.rb
|
302
315
|
- test/lib/vedeu/repository/command_repository_test.rb
|
303
316
|
- test/lib/vedeu/repository/command_test.rb
|
317
|
+
- test/lib/vedeu/repository/dummy_command_test.rb
|
318
|
+
- test/lib/vedeu/repository/dummy_interface_test.rb
|
304
319
|
- test/lib/vedeu/repository/interface_repository_test.rb
|
305
320
|
- test/lib/vedeu/repository/interface_test.rb
|
306
321
|
- test/lib/vedeu/repository/repository_test.rb
|