vedeu 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/lib/vedeu/application.rb +3 -3
- data/lib/vedeu/interface/{dummy.rb → dummy_interface.rb} +1 -1
- data/lib/vedeu/interface/interface.rb +9 -4
- data/lib/vedeu/interface/interfaces.rb +11 -3
- data/lib/vedeu/output/compositor.rb +24 -19
- data/lib/vedeu/process/commands.rb +1 -1
- data/lib/vedeu/process/dummy_command.rb +7 -0
- data/lib/vedeu/process/event_loop.rb +12 -14
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu.rb +19 -1
- data/test/lib/vedeu/application_test.rb +1 -1
- data/test/lib/vedeu/interface/dummy_test.rb +2 -2
- data/test/lib/vedeu/interface/interface_test.rb +4 -4
- data/test/lib/vedeu/interface/interfaces_test.rb +45 -9
- data/test/lib/vedeu/output/compositor_test.rb +3 -2
- data/test/lib/vedeu/process/command_test.rb +0 -6
- data/test/lib/vedeu/process/commands_test.rb +2 -8
- data/test/lib/vedeu/process/dummy_command_test.rb +16 -0
- data/test/lib/vedeu/process/event_loop_test.rb +7 -4
- metadata +6 -6
- data/examples/3_interfaces +0 -44
- data/examples/3_lines +0 -23
- data/examples/composition +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f3422a6093ab6c6c7cf502bc9cec28cb3834d84
|
4
|
+
data.tar.gz: c42685a3bdb1aa694e46665daccc70355e949ef3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 548489372e87fd7001f8dd805d21d9328f345306c65e055a58f1a078aa0736267d5f467871f719d39c2de089b8c5e6004ec742010fc26fc2c803fbe71d4ebb08
|
7
|
+
data.tar.gz: 479d851256aa4961463fa0c7158e1b142c781fc529f29ea0075213aef661a9f6207a0abb4fce0fa50621af0aafff6deb90e7e686881313233e89489fd3b33f59
|
data/.gitignore
CHANGED
data/README.md
CHANGED
data/lib/vedeu/application.rb
CHANGED
@@ -2,7 +2,7 @@ module Vedeu
|
|
2
2
|
class Application
|
3
3
|
class << self
|
4
4
|
def start(options = {})
|
5
|
-
new(options).
|
5
|
+
new(options).start
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -10,11 +10,11 @@ module Vedeu
|
|
10
10
|
@options = options
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def start
|
14
14
|
Terminal.open(options) do
|
15
15
|
Interfaces.initial_state
|
16
16
|
|
17
|
-
EventLoop.
|
17
|
+
EventLoop.main_sequence
|
18
18
|
end
|
19
19
|
ensure
|
20
20
|
Terminal.close
|
@@ -4,6 +4,7 @@ module Vedeu
|
|
4
4
|
class Interface
|
5
5
|
def initialize(options = {})
|
6
6
|
@options = options
|
7
|
+
@output = []
|
7
8
|
end
|
8
9
|
|
9
10
|
def initial_state
|
@@ -11,11 +12,11 @@ module Vedeu
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def input
|
14
|
-
evaluate
|
15
|
+
raise Collapse if evaluate == :stop
|
15
16
|
end
|
16
17
|
|
17
|
-
def output
|
18
|
-
|
18
|
+
def output
|
19
|
+
write
|
19
20
|
end
|
20
21
|
|
21
22
|
def geometry
|
@@ -27,13 +28,17 @@ module Vedeu
|
|
27
28
|
attr_reader :options
|
28
29
|
|
29
30
|
def evaluate
|
30
|
-
Commands.execute(read)
|
31
|
+
@output = Commands.execute(read)
|
31
32
|
end
|
32
33
|
|
33
34
|
def read
|
34
35
|
Terminal.input
|
35
36
|
end
|
36
37
|
|
38
|
+
def write
|
39
|
+
Compositor.arrange(@output, self)
|
40
|
+
end
|
41
|
+
|
37
42
|
def options
|
38
43
|
defaults.merge!(@options)
|
39
44
|
end
|
@@ -21,11 +21,19 @@ module Vedeu
|
|
21
21
|
interfaces.inspect
|
22
22
|
end
|
23
23
|
|
24
|
-
def add(name, options = {}, klass =
|
24
|
+
def add(name, options = {}, klass = DummyInterface)
|
25
25
|
interfaces[name] = klass.new(options) if valid?(klass)
|
26
26
|
self
|
27
27
|
end
|
28
28
|
|
29
|
+
def reset
|
30
|
+
@interfaces = {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def find(name)
|
34
|
+
interfaces[name] || nil
|
35
|
+
end
|
36
|
+
|
29
37
|
def initial_state
|
30
38
|
interfaces.values.map { |io| io.initial_state }
|
31
39
|
end
|
@@ -34,8 +42,8 @@ module Vedeu
|
|
34
42
|
interfaces.values.map { |io| io.input }
|
35
43
|
end
|
36
44
|
|
37
|
-
def output
|
38
|
-
interfaces.values.map { |io| io.output
|
45
|
+
def output
|
46
|
+
interfaces.values.map { |io| io.output }
|
39
47
|
end
|
40
48
|
|
41
49
|
private
|
@@ -1,14 +1,20 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class Compositor
|
3
3
|
class << self
|
4
|
-
def arrange(output = [], interface =
|
4
|
+
def arrange(output = [], interface = :dummy)
|
5
5
|
return if output.nil? || output.empty?
|
6
6
|
|
7
|
-
|
7
|
+
if output.is_a?(Array)
|
8
|
+
new(output, interface).arrange
|
9
|
+
elsif output.is_a?(Hash)
|
10
|
+
output.map do |i, o|
|
11
|
+
new(o, i).arrange
|
12
|
+
end
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
11
|
-
def initialize(output = [], interface =
|
17
|
+
def initialize(output = [], interface = :dummy)
|
12
18
|
@output, @interface = output, interface
|
13
19
|
end
|
14
20
|
|
@@ -18,14 +24,12 @@ module Vedeu
|
|
18
24
|
|
19
25
|
private
|
20
26
|
|
21
|
-
attr_reader :interface
|
22
|
-
|
23
27
|
def composition
|
24
28
|
container = []
|
25
29
|
streams = []
|
26
30
|
output.map do |line|
|
27
31
|
line.each_with_index do |stream, index|
|
28
|
-
streams <<
|
32
|
+
streams << clear(index)
|
29
33
|
streams << Directive.enact(stream)
|
30
34
|
end
|
31
35
|
container << streams.join
|
@@ -34,16 +38,12 @@ module Vedeu
|
|
34
38
|
container
|
35
39
|
end
|
36
40
|
|
37
|
-
def
|
38
|
-
[
|
41
|
+
def clear(index)
|
42
|
+
[origin(index), (' ' * width), origin(index)].join
|
39
43
|
end
|
40
44
|
|
41
|
-
def
|
42
|
-
geometry.
|
43
|
-
end
|
44
|
-
|
45
|
-
def vy(index = 0)
|
46
|
-
geometry.vy(index)
|
45
|
+
def origin(index)
|
46
|
+
Position.set(geometry.vy(index), geometry.vx)
|
47
47
|
end
|
48
48
|
|
49
49
|
def width
|
@@ -51,16 +51,21 @@ module Vedeu
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def geometry
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def position(y, x)
|
58
|
-
Position.set(y, x)
|
54
|
+
target_interface.geometry
|
59
55
|
end
|
60
56
|
|
61
57
|
def output
|
62
58
|
return @output.split if @output.is_a?(String)
|
63
59
|
@output
|
64
60
|
end
|
61
|
+
|
62
|
+
def target_interface
|
63
|
+
raise UndefinedInterface if interface.nil?
|
64
|
+
interface
|
65
|
+
end
|
66
|
+
|
67
|
+
def interface
|
68
|
+
@_interface ||= Interfaces.defined.find(@interface)
|
69
|
+
end
|
65
70
|
end
|
66
71
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Vedeu
|
2
|
+
class Collapse < StandardError; end
|
3
|
+
|
2
4
|
class EventLoop
|
3
5
|
class << self
|
4
|
-
def
|
5
|
-
new.
|
6
|
+
def main_sequence
|
7
|
+
new.main_sequence
|
6
8
|
end
|
7
9
|
end
|
8
10
|
|
@@ -10,22 +12,18 @@ module Vedeu
|
|
10
12
|
@running = true
|
11
13
|
end
|
12
14
|
|
13
|
-
def
|
14
|
-
|
15
|
+
def main_sequence
|
16
|
+
while @running do
|
17
|
+
Interfaces.defined.input
|
18
|
+
|
19
|
+
Interfaces.defined.output
|
20
|
+
end
|
21
|
+
rescue Collapse
|
22
|
+
stop
|
15
23
|
end
|
16
24
|
|
17
25
|
def stop
|
18
26
|
@running = false
|
19
27
|
end
|
20
|
-
|
21
|
-
def tick
|
22
|
-
while @running do
|
23
|
-
command = Interfaces.defined.input
|
24
|
-
|
25
|
-
stop if command == "stop"
|
26
|
-
|
27
|
-
Interfaces.defined.output(command)
|
28
|
-
end
|
29
|
-
end
|
30
28
|
end
|
31
29
|
end
|
data/lib/vedeu/version.rb
CHANGED
data/lib/vedeu.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'logger'
|
1
3
|
require 'io/console'
|
2
4
|
|
3
5
|
require_relative 'vedeu/support/terminal'
|
@@ -18,8 +20,9 @@ require_relative 'vedeu/output/wordwrap'
|
|
18
20
|
|
19
21
|
require_relative 'vedeu/interface/interfaces'
|
20
22
|
require_relative 'vedeu/interface/interface'
|
21
|
-
require_relative 'vedeu/interface/
|
23
|
+
require_relative 'vedeu/interface/dummy_interface'
|
22
24
|
|
25
|
+
require_relative 'vedeu/process/dummy_command'
|
23
26
|
require_relative 'vedeu/process/commands'
|
24
27
|
require_relative 'vedeu/process/command'
|
25
28
|
require_relative 'vedeu/process/event_loop'
|
@@ -27,3 +30,18 @@ require_relative 'vedeu/process/exit'
|
|
27
30
|
|
28
31
|
require_relative 'vedeu/application'
|
29
32
|
require_relative 'vedeu/version'
|
33
|
+
|
34
|
+
module Vedeu
|
35
|
+
def self.logger
|
36
|
+
@logger ||= Logger
|
37
|
+
.new(root_path + '/logs/vedeu.log').tap do |log|
|
38
|
+
log.formatter = proc do |mode, time, prog, msg|
|
39
|
+
"\n#{time.iso8601}: #{msg}\n"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.root_path
|
45
|
+
File.expand_path('../..', __FILE__)
|
46
|
+
end
|
47
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Vedeu
|
4
|
-
describe
|
5
|
-
let(:described_class) {
|
4
|
+
describe DummyInterface do
|
5
|
+
let(:described_class) { DummyInterface }
|
6
6
|
let(:described_instance) { described_class.new }
|
7
7
|
|
8
8
|
describe '#initial_state' do
|
@@ -18,15 +18,15 @@ module Vedeu
|
|
18
18
|
let(:subject) { described_instance.input }
|
19
19
|
|
20
20
|
before do
|
21
|
-
Terminal.stubs(:input).returns('
|
22
|
-
Commands.stubs(:execute)
|
21
|
+
Terminal.stubs(:input).returns('stop')
|
22
|
+
Commands.stubs(:execute)
|
23
23
|
end
|
24
24
|
|
25
|
-
it { subject.must_be_instance_of(
|
25
|
+
it { subject.must_be_instance_of(NilClass) }
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '#output' do
|
29
|
-
let(:subject) { described_instance.output
|
29
|
+
let(:subject) { described_instance.output }
|
30
30
|
let(:command) { mock }
|
31
31
|
|
32
32
|
before { Compositor.stubs(:arrange).returns([]) }
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Vedeu
|
4
|
-
class DummyInterface < Interface
|
5
|
-
def initial_state; end
|
6
|
-
|
7
|
-
def event_loop; end
|
8
|
-
end
|
9
|
-
|
10
4
|
describe Interfaces do
|
11
5
|
let(:described_class) { Interfaces }
|
12
6
|
|
@@ -42,6 +36,12 @@ module Vedeu
|
|
42
36
|
end
|
43
37
|
end
|
44
38
|
|
39
|
+
describe '.list' do
|
40
|
+
let(:subject) { described_class.list }
|
41
|
+
|
42
|
+
it { subject.must_be_instance_of(String) }
|
43
|
+
end
|
44
|
+
|
45
45
|
describe '.add' do
|
46
46
|
let(:subject) { described_class.add(interface, options, klass) }
|
47
47
|
let(:interface) {}
|
@@ -57,10 +57,32 @@ module Vedeu
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
describe '.
|
61
|
-
let(:subject) { described_class.
|
60
|
+
describe '.reset' do
|
61
|
+
let(:subject) { described_class.reset }
|
62
|
+
let(:interface) { :dummy }
|
62
63
|
|
63
|
-
|
64
|
+
before { described_class.add(:dummy) }
|
65
|
+
|
66
|
+
it { subject.must_be_instance_of(Hash) }
|
67
|
+
|
68
|
+
it { subject.must_be_empty }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '.find' do
|
72
|
+
let(:subject) { described_class.find(interface) }
|
73
|
+
let(:interface) { :dummy }
|
74
|
+
|
75
|
+
context 'when the interface exists' do
|
76
|
+
before { described_class.add(:dummy) }
|
77
|
+
|
78
|
+
it { subject.must_be_instance_of(DummyInterface) }
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'when the interface does not exist' do
|
82
|
+
before { described_class.reset }
|
83
|
+
|
84
|
+
it { subject.must_be_instance_of(NilClass) }
|
85
|
+
end
|
64
86
|
end
|
65
87
|
|
66
88
|
describe '.initial_state' do
|
@@ -68,5 +90,19 @@ module Vedeu
|
|
68
90
|
|
69
91
|
it { subject.must_be_instance_of(Array) }
|
70
92
|
end
|
93
|
+
|
94
|
+
describe '.input' do
|
95
|
+
let(:subject) { described_class.input }
|
96
|
+
|
97
|
+
before { Terminal.stubs(:input).returns("some input") }
|
98
|
+
|
99
|
+
it { subject.must_be_instance_of(Array) }
|
100
|
+
end
|
101
|
+
|
102
|
+
describe '.output' do
|
103
|
+
let(:subject) { described_class.output }
|
104
|
+
|
105
|
+
it { subject.must_be_instance_of(Array) }
|
106
|
+
end
|
71
107
|
end
|
72
108
|
end
|
@@ -3,7 +3,7 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
describe Compositor do
|
5
5
|
let(:described_class) { Compositor }
|
6
|
-
let(:described_instance) { described_class.new(output
|
6
|
+
let(:described_instance) { described_class.new(output) }
|
7
7
|
let(:output) { [[]] }
|
8
8
|
let(:stream) {}
|
9
9
|
let(:interface) {
|
@@ -18,6 +18,7 @@ module Vedeu
|
|
18
18
|
}
|
19
19
|
|
20
20
|
before do
|
21
|
+
Interfaces.defined
|
21
22
|
Terminal.stubs(:output)
|
22
23
|
Renderer.stubs(:write).returns(stream)
|
23
24
|
end
|
@@ -25,7 +26,7 @@ module Vedeu
|
|
25
26
|
it { described_instance.must_be_instance_of(Compositor) }
|
26
27
|
|
27
28
|
describe '.arrange' do
|
28
|
-
let(:subject) { described_class.arrange(output
|
29
|
+
let(:subject) { described_class.arrange(output) }
|
29
30
|
|
30
31
|
context 'when empty' do
|
31
32
|
let(:output) { [] }
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Vedeu
|
4
|
-
class DummyCommand
|
5
|
-
class << self
|
6
|
-
def dispatch; end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
describe Command do
|
11
5
|
let(:described_class) { Command }
|
12
6
|
let(:described_instance) { described_class.new(cmd_name, cmd_klass, cmd_args, cmd_options) }
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Vedeu
|
4
|
-
class DummyCommand
|
5
|
-
def self.dispatch
|
6
|
-
:noop
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
describe Commands do
|
11
5
|
let(:described_class) { Commands }
|
12
6
|
|
@@ -35,7 +29,7 @@ module Vedeu
|
|
35
29
|
end
|
36
30
|
|
37
31
|
context 'when the command exists' do
|
38
|
-
let(:command) {
|
32
|
+
let(:command) { "exit" }
|
39
33
|
|
40
34
|
before { Exit.stubs(:dispatch).returns(true) }
|
41
35
|
|
@@ -51,7 +45,7 @@ module Vedeu
|
|
51
45
|
|
52
46
|
describe '.add' do
|
53
47
|
let(:subject) { described_class.add(command_name, command_klass, args, options) }
|
54
|
-
let(:command_name) {
|
48
|
+
let(:command_name) { "some_name" }
|
55
49
|
let(:command_klass) { DummyCommand }
|
56
50
|
let(:args) { [] }
|
57
51
|
let(:options) { {} }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
describe DummyCommand do
|
5
|
+
let(:described_class) { DummyCommand }
|
6
|
+
let(:subject) { described_class.new }
|
7
|
+
|
8
|
+
it { subject.must_be_instance_of(DummyCommand) }
|
9
|
+
|
10
|
+
describe '.dispatch' do
|
11
|
+
let(:subject) { described_class.dispatch }
|
12
|
+
|
13
|
+
it { subject.must_be_instance_of(String) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -3,7 +3,8 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
describe EventLoop do
|
5
5
|
let(:described_class) { EventLoop }
|
6
|
-
let(:defined)
|
6
|
+
let(:defined) { mock }
|
7
|
+
let(:subject) { described_class.new }
|
7
8
|
|
8
9
|
before do
|
9
10
|
Interfaces.stubs(:defined).returns(defined)
|
@@ -11,10 +12,12 @@ module Vedeu
|
|
11
12
|
defined.stubs(:output).returns(NilClass)
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
-
let(:subject) { described_class.start }
|
15
|
+
it { subject.must_be_instance_of(EventLoop) }
|
16
16
|
|
17
|
-
|
17
|
+
describe '.main_sequence' do
|
18
|
+
let(:subject) { described_class.main_sequence }
|
19
|
+
|
20
|
+
# it { subject.must_be_instance_of(NilClass) }
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
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.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
|
+
date: 2014-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -152,12 +152,9 @@ files:
|
|
152
152
|
- README.md
|
153
153
|
- Rakefile
|
154
154
|
- bin/vedeu
|
155
|
-
- examples/3_interfaces
|
156
|
-
- examples/3_lines
|
157
|
-
- examples/composition
|
158
155
|
- lib/vedeu.rb
|
159
156
|
- lib/vedeu/application.rb
|
160
|
-
- lib/vedeu/interface/
|
157
|
+
- lib/vedeu/interface/dummy_interface.rb
|
161
158
|
- lib/vedeu/interface/interface.rb
|
162
159
|
- lib/vedeu/interface/interfaces.rb
|
163
160
|
- lib/vedeu/output/background.rb
|
@@ -175,6 +172,7 @@ files:
|
|
175
172
|
- lib/vedeu/output/wordwrap.rb
|
176
173
|
- lib/vedeu/process/command.rb
|
177
174
|
- lib/vedeu/process/commands.rb
|
175
|
+
- lib/vedeu/process/dummy_command.rb
|
178
176
|
- lib/vedeu/process/event_loop.rb
|
179
177
|
- lib/vedeu/process/exit.rb
|
180
178
|
- lib/vedeu/support/terminal.rb
|
@@ -198,6 +196,7 @@ files:
|
|
198
196
|
- test/lib/vedeu/output/wordwrap_test.rb
|
199
197
|
- test/lib/vedeu/process/command_test.rb
|
200
198
|
- test/lib/vedeu/process/commands_test.rb
|
199
|
+
- test/lib/vedeu/process/dummy_command_test.rb
|
201
200
|
- test/lib/vedeu/process/event_loop_test.rb
|
202
201
|
- test/lib/vedeu/process/exit_test.rb
|
203
202
|
- test/lib/vedeu/support/terminal_test.rb
|
@@ -248,6 +247,7 @@ test_files:
|
|
248
247
|
- test/lib/vedeu/output/wordwrap_test.rb
|
249
248
|
- test/lib/vedeu/process/command_test.rb
|
250
249
|
- test/lib/vedeu/process/commands_test.rb
|
250
|
+
- test/lib/vedeu/process/dummy_command_test.rb
|
251
251
|
- test/lib/vedeu/process/event_loop_test.rb
|
252
252
|
- test/lib/vedeu/process/exit_test.rb
|
253
253
|
- test/lib/vedeu/support/terminal_test.rb
|
data/examples/3_interfaces
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
-
|
4
|
-
-> { its -> { a } }
|
5
|
-
trap('INT') { exit! }
|
6
|
-
|
7
|
-
require 'vedeu'
|
8
|
-
print Vedeu::Esc.clear
|
9
|
-
|
10
|
-
geometry = {
|
11
|
-
geometry: {
|
12
|
-
y: 2,
|
13
|
-
x: 2,
|
14
|
-
width: 20,
|
15
|
-
height: 10
|
16
|
-
}
|
17
|
-
}
|
18
|
-
interface = Vedeu::Interface.new(geometry)
|
19
|
-
Vedeu::Renderer.new(interface).clear_interface_rows
|
20
|
-
|
21
|
-
geometry = {
|
22
|
-
geometry: {
|
23
|
-
y: 2,
|
24
|
-
x: 23,
|
25
|
-
width: 20,
|
26
|
-
height: 10
|
27
|
-
}
|
28
|
-
}
|
29
|
-
interface = Vedeu::Interface.new(geometry)
|
30
|
-
Vedeu::Renderer.new(interface).clear_interface_rows
|
31
|
-
|
32
|
-
geometry = {
|
33
|
-
geometry: {
|
34
|
-
y: 2,
|
35
|
-
x: 44,
|
36
|
-
width: 20,
|
37
|
-
height: 10
|
38
|
-
}
|
39
|
-
}
|
40
|
-
interface = Vedeu::Interface.new(geometry)
|
41
|
-
Vedeu::Renderer.new(interface).clear_interface_rows
|
42
|
-
|
43
|
-
print Vedeu::Esc.reset
|
44
|
-
print Vedeu::Position.reset
|
data/examples/3_lines
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
-
|
4
|
-
-> { its -> { a } }
|
5
|
-
trap('INT') { exit! }
|
6
|
-
|
7
|
-
require 'vedeu'
|
8
|
-
print Vedeu::Esc.clear
|
9
|
-
|
10
|
-
geometry = {
|
11
|
-
geometry: {
|
12
|
-
y: 2,
|
13
|
-
x: 2,
|
14
|
-
width: 20,
|
15
|
-
height: 10
|
16
|
-
}
|
17
|
-
}
|
18
|
-
interface = Vedeu::Interface.new(geometry)
|
19
|
-
|
20
|
-
Vedeu::Renderer.new(interface).write
|
21
|
-
|
22
|
-
print Vedeu::Esc.reset
|
23
|
-
print Vedeu::Position.reset
|
data/examples/composition
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
-
|
4
|
-
-> { its -> { a } }
|
5
|
-
trap('INT') { exit! }
|
6
|
-
|
7
|
-
require 'vedeu'
|
8
|
-
|
9
|
-
# stream = [
|
10
|
-
# [
|
11
|
-
# [
|
12
|
-
# [],
|
13
|
-
# 'Lorem ipsum dolor sit amet, consectetur adipiscing'
|
14
|
-
# ],[
|
15
|
-
# [],
|
16
|
-
# 'elit. Cras sed ipsum ut purus imperdiet molestie'
|
17
|
-
# ],[
|
18
|
-
# [],
|
19
|
-
# 'in id neque. Sed auctor venenatis ultrices. Morbi'
|
20
|
-
# ],[
|
21
|
-
# [],
|
22
|
-
# 'ullamcorper libero et euismod malesuada. Aliquam'
|
23
|
-
# ],[
|
24
|
-
# [],
|
25
|
-
# 'dignissim metus eget tellus condimentum, ac dictum'
|
26
|
-
# ],[
|
27
|
-
# [],
|
28
|
-
# 'enim posuere. Curabitur posuere arcu elementum'
|
29
|
-
# ],[
|
30
|
-
# [],
|
31
|
-
# 'rutrum pulvinar. Nullam et dui eu lectus'
|
32
|
-
# ],[
|
33
|
-
# [],
|
34
|
-
# 'sollicitudin hendrerit eu at nibh. Cum sociis.'
|
35
|
-
# ]
|
36
|
-
# ]
|
37
|
-
# ]
|
38
|
-
|
39
|
-
stream = [
|
40
|
-
[
|
41
|
-
[[:underline, "test1"],
|
42
|
-
[[[:red, :black]], "test2"],
|
43
|
-
[[], "test3"]
|
44
|
-
]
|
45
|
-
]
|
46
|
-
|
47
|
-
geometry = { geometry: { y: 0, x: 0, width: 50, height: 15 } }
|
48
|
-
interface = Vedeu::Interface.new(geometry)
|
49
|
-
|
50
|
-
Vedeu::Compositor.write(stream, interface)
|
51
|
-
|
52
|
-
print "\n"
|