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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 471c1ceac680dd828ec4350a534b5fce10e98bc1
4
- data.tar.gz: dc875e0fecea6e2ad99c1eb3ee4f0be41caa3028
3
+ metadata.gz: 5988a18730b25eaf5cf4d1d81eb2adc7dd5823ce
4
+ data.tar.gz: 607c8b139e80f23ae5f5c0af7cbd883d07c46358
5
5
  SHA512:
6
- metadata.gz: dbdc5b0b33aa74ec0a9b04ef416d223dae0ffc6167ce0289490e3e3d906fe7977e181f73593d4a0a5f9471fc14740e9dc8baaa3dc68fff061be2d4b2d6bd2d43
7
- data.tar.gz: 7f1f5dbb00aa4542f2a026a5ef643fdbe7b9f4908c87518291ffae5a287e8e30b16772ad3c66bde75578699308a84d7115ac2478ecbb6b11d6bdeb86428a3660
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
- TODO: Write a gem description
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
- [ # interface
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 :status, geometry: { y: 1, x: 1, width: :auto, height: 1 }
103
- interface :main, geometry: { y: 2, x: 1, width: :auto, height: :auto }
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 :exit, Vedeu::Exit.dispatch, { keyword: "exit", keypress: "q" }
106
- command :help, MyApp.help, { keyword: "help", keypress: "h" }
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
@@ -15,7 +15,7 @@ module Vedeu
15
15
  def execute!
16
16
  $stdin, $stdout, $stderr = @stdin, @stdout, @stderr
17
17
 
18
- Vedeu::Application.start
18
+ Application.start
19
19
 
20
20
  @exit_code = 0
21
21
  ensure
@@ -13,8 +13,6 @@ module Vedeu
13
13
  end
14
14
 
15
15
  def main_sequence
16
- InterfaceRepository.initial_state
17
-
18
16
  while @running do
19
17
  Input.capture
20
18
 
@@ -1,4 +1,3 @@
1
1
  module Vedeu
2
- class DummyInterface
3
- end
2
+ class DummyInterface; end
4
3
  end
data/lib/vedeu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vedeu
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -6,6 +6,8 @@ module Vedeu
6
6
  let(:described_instance) { described_class.new(argv) }
7
7
  let(:argv) { [] }
8
8
 
9
+ before { Application.stubs(:start) }
10
+
9
11
  it { described_instance.must_be_instance_of(Launcher) }
10
12
 
11
13
  describe '#execute!' do
@@ -7,7 +7,8 @@ module Vedeu
7
7
  let(:subject) { described_class.new }
8
8
 
9
9
  before do
10
- Input.stubs(:evaluate)
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(:input) { "" }
7
- let(:args) { [] }
6
+ let(:subject) { described_class.new }
7
+ let(:result) {}
8
8
 
9
9
  before do
10
- Compositor.stubs(:arrange)
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
- let(:result) {}
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.enqueue(input)
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,7 @@ module Vedeu
4
4
  describe Queue do
5
5
  let(:described_class) { Queue }
6
6
 
7
- before do
8
- described_class.clear
9
- end
7
+ before { described_class.clear }
10
8
 
11
9
  describe '.dequeue' do
12
10
  let(:subject) { described_class.dequeue }
@@ -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(:attributes) { { name: :test_command } }
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 { described_instance.must_be_instance_of(Command) }
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) { :dummy }
7
- let(:value) { "dummy" }
6
+ let(:interface) { 'dummy' }
7
+ let(:value) { 'dummy' }
8
8
 
9
- before do
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(:attributes) { { name: :test_interface } }
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 { described_instance.must_be_instance_of(Interface) }
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) { Terminal }
6
- let(:console) { stub }
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 { console.stubs(:gets).returns("test\n") }
17
+ before { console.stubs(:gets).returns("test\n") }
18
18
 
19
19
  it { subject.must_be_instance_of(String) }
20
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking