vedeu 0.0.13 → 0.0.14
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/README.md +8 -11
- data/lib/vedeu/launcher.rb +1 -1
- data/lib/vedeu/process/event_loop.rb +0 -2
- data/lib/vedeu/repository/dummy_interface.rb +1 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/launcher_test.rb +2 -0
- data/test/lib/vedeu/process/event_loop_test.rb +5 -2
- data/test/lib/vedeu/process/input_test.rb +3 -0
- data/test/lib/vedeu/process/output_test.rb +13 -5
- data/test/lib/vedeu/process/process_test.rb +4 -1
- data/test/lib/vedeu/process/queue_test.rb +1 -3
- data/test/lib/vedeu/repository/command_test.rb +21 -6
- data/test/lib/vedeu/repository/interface_repository_test.rb +3 -9
- data/test/lib/vedeu/repository/interface_test.rb +18 -5
- data/test/lib/vedeu/support/terminal_test.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5988a18730b25eaf5cf4d1d81eb2adc7dd5823ce
|
4
|
+
data.tar.gz: 607c8b139e80f23ae5f5c0af7cbd883d07c46358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 822d36a8a6d63c97b6525a5718dfa7216052d56fca170e5a07d3d8b90378afa3cf937792991aa78cd8126c5b39203ab14d323dacbe2de90729d708714a696a23
|
7
|
+
data.tar.gz: 51d17fa0372246e206f870fad75ac3c3075b14a7d996dd46c477190e8cacefd478ab5f40faf1c2699e8bd714d1a11e8a951844f0bf5ba3be1ddc81f4de5bc8b1
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
Vedeu is my attempt at creating a terminal based application framework without the need for Ncurses.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -14,10 +14,6 @@ And then execute:
|
|
14
14
|
|
15
15
|
$ bundle
|
16
16
|
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install vedeu
|
20
|
-
|
21
17
|
## Usage
|
22
18
|
|
23
19
|
TODO: Write detailed documentation
|
@@ -81,7 +77,8 @@ These numbers are based on the area available to the terminal. If the terminal i
|
|
81
77
|
|
82
78
|
### On Composition
|
83
79
|
|
84
|
-
|
80
|
+
{
|
81
|
+
main: # interface
|
85
82
|
[ # stream
|
86
83
|
[ # directive
|
87
84
|
34, 22 # position directive
|
@@ -92,18 +89,18 @@ These numbers are based on the area available to the terminal. If the terminal i
|
|
92
89
|
|
93
90
|
"Textual content..." # stream data
|
94
91
|
]
|
95
|
-
|
92
|
+
}
|
96
93
|
|
97
94
|
## Usage
|
98
95
|
|
99
96
|
class MyApp
|
100
97
|
include Vedeu
|
101
98
|
|
102
|
-
interface
|
103
|
-
interface
|
99
|
+
interface 'status', { y: 1, x: 1, width: :auto, height: 1 }
|
100
|
+
interface 'main', { y: 2, x: 1, width: :auto, height: :auto }
|
104
101
|
|
105
|
-
command
|
106
|
-
command
|
102
|
+
command 'exit', Vedeu::Exit.dispatch, { keyword: "exit", keypress: "q" }
|
103
|
+
command 'help', MyApp.help, { keyword: "help", keypress: "h" }
|
107
104
|
end
|
108
105
|
|
109
106
|
## Contributing
|
data/lib/vedeu/launcher.rb
CHANGED
data/lib/vedeu/version.rb
CHANGED
@@ -7,7 +7,8 @@ module Vedeu
|
|
7
7
|
let(:subject) { described_class.new }
|
8
8
|
|
9
9
|
before do
|
10
|
-
Input.stubs(:
|
10
|
+
Input.stubs(:capture)
|
11
|
+
Process.stubs(:evaluate).raises(Collapse)
|
11
12
|
Output.stubs(:render)
|
12
13
|
end
|
13
14
|
|
@@ -17,12 +18,14 @@ module Vedeu
|
|
17
18
|
|
18
19
|
describe '.main_sequence' do
|
19
20
|
let(:subject) { described_class.main_sequence }
|
21
|
+
|
22
|
+
# it { subject.must_be_instance_of(FalseClass) }
|
20
23
|
end
|
21
24
|
|
22
25
|
describe '#stop' do
|
23
26
|
let(:subject) { described_class.new.stop }
|
24
27
|
|
25
|
-
it { subject.must_be_instance_of(FalseClass) }
|
28
|
+
# it { subject.must_be_instance_of(FalseClass) }
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
@@ -4,9 +4,12 @@ module Vedeu
|
|
4
4
|
describe Input do
|
5
5
|
let(:described_class) { Input }
|
6
6
|
let(:input) { "" }
|
7
|
+
let(:subject) { described_class.new }
|
7
8
|
|
8
9
|
before { Terminal.stubs(:input).returns(input) }
|
9
10
|
|
11
|
+
it { subject.must_be_instance_of(Input) }
|
12
|
+
|
10
13
|
describe '.capture' do
|
11
14
|
let(:subject) { described_class.capture }
|
12
15
|
|
@@ -3,22 +3,30 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
describe Output do
|
5
5
|
let(:described_class) { Output }
|
6
|
-
let(:
|
7
|
-
let(:
|
6
|
+
let(:subject) { described_class.new }
|
7
|
+
let(:result) {}
|
8
8
|
|
9
9
|
before do
|
10
|
-
|
10
|
+
Interface.create({ name: 'dummy' })
|
11
|
+
Compositor.stubs(:arrange).returns([])
|
11
12
|
Queue.stubs(:dequeue).returns(result)
|
12
13
|
end
|
13
14
|
|
15
|
+
it { subject.must_be_instance_of(Output) }
|
16
|
+
|
14
17
|
describe '.render' do
|
15
18
|
let(:subject) { described_class.render }
|
16
|
-
let(:result) { }
|
17
19
|
|
18
20
|
it { subject.must_be_instance_of(NilClass) }
|
19
21
|
|
20
22
|
context 'when the result is empty' do
|
21
|
-
|
23
|
+
it { subject.must_be_instance_of(NilClass) }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when the result is not empty' do
|
27
|
+
let(:result) { { 'dummy' => [['test...']] } }
|
28
|
+
|
29
|
+
it { subject.must_be_instance_of(Array) }
|
22
30
|
end
|
23
31
|
end
|
24
32
|
end
|
@@ -5,13 +5,16 @@ module Vedeu
|
|
5
5
|
let(:described_class) { Process }
|
6
6
|
let(:input) { nil }
|
7
7
|
let(:result) {}
|
8
|
+
let(:subject) { described_class.new }
|
9
|
+
|
10
|
+
it { subject.must_be_instance_of(Process) }
|
8
11
|
|
9
12
|
describe '.evaluate' do
|
10
13
|
let(:subject) { described_class.evaluate }
|
11
14
|
let(:command) { Command.new }
|
12
15
|
|
13
16
|
before do
|
14
|
-
Queue.
|
17
|
+
Queue.stubs(:dequeue).returns(input)
|
15
18
|
CommandRepository.stubs(:by_keypress).returns(command)
|
16
19
|
CommandRepository.stubs(:by_keyword).returns(command)
|
17
20
|
command.stubs(:execute).returns(result)
|
@@ -4,9 +4,24 @@ module Vedeu
|
|
4
4
|
describe Command do
|
5
5
|
let(:described_class) { Command }
|
6
6
|
let(:described_instance) { described_class.new(attributes) }
|
7
|
-
let(:
|
7
|
+
let(:subject) { described_instance }
|
8
|
+
let(:attributes) {
|
9
|
+
{
|
10
|
+
name: 'dummy',
|
11
|
+
klass: DummyCommand,
|
12
|
+
options: {
|
13
|
+
keyword: "dummy",
|
14
|
+
keypress: "d"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
8
18
|
|
9
|
-
it {
|
19
|
+
it { subject.must_be_instance_of(Command) }
|
20
|
+
it { subject.instance_variable_get("@attributes").must_equal(attributes) }
|
21
|
+
it { subject.instance_variable_get("@name").must_equal('dummy') }
|
22
|
+
it { subject.instance_variable_get("@klass").must_equal(DummyCommand) }
|
23
|
+
it { subject.instance_variable_get("@keyword").must_equal('dummy') }
|
24
|
+
it { subject.instance_variable_get("@keypress").must_equal('d') }
|
10
25
|
|
11
26
|
describe '#create' do
|
12
27
|
let(:subject) { described_class.create(attributes) }
|
@@ -16,14 +31,14 @@ module Vedeu
|
|
16
31
|
|
17
32
|
describe '#execute' do
|
18
33
|
let(:subject) { described_instance.execute(args) }
|
34
|
+
let(:args) { [] }
|
35
|
+
|
36
|
+
it { subject.must_be_instance_of(Symbol) }
|
37
|
+
it { subject.must_equal(:dummy) }
|
19
38
|
end
|
20
39
|
|
21
40
|
describe '#executable' do
|
22
41
|
let(:subject) { described_instance.executable }
|
23
42
|
end
|
24
|
-
|
25
|
-
describe '#execute' do
|
26
|
-
let(:subject) { described_instance.execute }
|
27
|
-
end
|
28
43
|
end
|
29
44
|
end
|
@@ -3,16 +3,10 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
describe InterfaceRepository do
|
5
5
|
let(:described_class) { InterfaceRepository }
|
6
|
-
let(:interface) {
|
7
|
-
let(:value) {
|
6
|
+
let(:interface) { 'dummy' }
|
7
|
+
let(:value) { 'dummy' }
|
8
8
|
|
9
|
-
before
|
10
|
-
Interface.create({ name: "dummy" })
|
11
|
-
|
12
|
-
Terminal.stubs(:input)
|
13
|
-
Input.stubs(:evaluate)
|
14
|
-
Compositor.stubs(:arrange)
|
15
|
-
end
|
9
|
+
before { Interface.create({ name: 'dummy' }) }
|
16
10
|
|
17
11
|
describe '.activate' do
|
18
12
|
let(:subject) { described_class.activate(interface) }
|
@@ -4,16 +4,23 @@ module Vedeu
|
|
4
4
|
describe Interface do
|
5
5
|
let(:described_class) { Interface }
|
6
6
|
let(:described_instance) { described_class.new(attributes) }
|
7
|
-
let(:
|
7
|
+
let(:subject) { described_instance }
|
8
|
+
let(:attributes) {
|
9
|
+
{
|
10
|
+
name: 'dummy',
|
11
|
+
geometry: { width: 80, height: 25, x: 1, y: 1 }
|
12
|
+
}
|
13
|
+
}
|
8
14
|
let(:result) {}
|
9
15
|
|
10
16
|
before do
|
11
|
-
Terminal.stubs(:input).returns('stop')
|
12
|
-
Input.stubs(:evaluate).returns(result)
|
13
|
-
Compositor.stubs(:arrange).returns([])
|
14
17
|
end
|
15
18
|
|
16
|
-
it {
|
19
|
+
it { subject.must_be_instance_of(Interface) }
|
20
|
+
it { subject.instance_variable_get("@attributes").must_equal(attributes) }
|
21
|
+
it { subject.instance_variable_get("@active").must_equal(false) }
|
22
|
+
it { subject.instance_variable_get("@geometry").must_equal(attributes[:geometry]) }
|
23
|
+
it { subject.instance_variable_get("@name").must_equal('dummy') }
|
17
24
|
|
18
25
|
describe '#create' do
|
19
26
|
let(:subject) { described_class.create(attributes) }
|
@@ -26,5 +33,11 @@ module Vedeu
|
|
26
33
|
|
27
34
|
it { subject.must_be_instance_of(NilClass) }
|
28
35
|
end
|
36
|
+
|
37
|
+
describe '#geometry' do
|
38
|
+
let(:subject) { described_instance.geometry }
|
39
|
+
|
40
|
+
it { subject.must_be_instance_of(Geometry) }
|
41
|
+
end
|
29
42
|
end
|
30
43
|
end
|
@@ -2,8 +2,8 @@ require_relative '../../../test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
describe Terminal do
|
5
|
-
let(:described_class)
|
6
|
-
let(:console)
|
5
|
+
let(:described_class) { Terminal }
|
6
|
+
let(:console) { stub }
|
7
7
|
|
8
8
|
before do
|
9
9
|
IO.stubs(:console).returns(console)
|
@@ -14,7 +14,7 @@ module Vedeu
|
|
14
14
|
describe '.input' do
|
15
15
|
let(:subject) { described_class.input }
|
16
16
|
|
17
|
-
before
|
17
|
+
before { console.stubs(:gets).returns("test\n") }
|
18
18
|
|
19
19
|
it { subject.must_be_instance_of(String) }
|
20
20
|
|