vedeu 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -5
- data/lib/vedeu.rb +6 -6
- data/lib/vedeu/application.rb +1 -1
- data/lib/vedeu/{process → input}/input.rb +0 -0
- data/lib/vedeu/output/background.rb +6 -2
- data/lib/vedeu/output/base.rb +8 -0
- data/lib/vedeu/output/compositor.rb +1 -1
- data/lib/vedeu/output/cursor.rb +49 -53
- data/lib/vedeu/output/esc.rb +40 -40
- data/lib/vedeu/output/foreground.rb +6 -2
- data/lib/vedeu/output/output.rb +19 -0
- data/lib/vedeu/process/process.rb +1 -1
- data/lib/vedeu/repository/interface.rb +12 -5
- data/lib/vedeu/repository/interface_repository.rb +8 -8
- data/lib/vedeu/{process → support}/event_loop.rb +0 -0
- data/lib/vedeu/{process → support}/exit.rb +0 -0
- data/lib/vedeu/{process → support}/queue.rb +4 -0
- data/lib/vedeu/support/terminal.rb +2 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application_test.rb +1 -1
- data/test/lib/vedeu/{process → input}/input_test.rb +0 -0
- data/test/lib/vedeu/output/background_test.rb +1 -1
- data/test/lib/vedeu/output/colour_test.rb +2 -2
- data/test/lib/vedeu/output/compositor_test.rb +50 -35
- data/test/lib/vedeu/output/cursor_test.rb +0 -12
- data/test/lib/vedeu/output/foreground_test.rb +1 -1
- data/test/lib/vedeu/output/output_test.rb +26 -0
- data/test/lib/vedeu/process/process_test.rb +7 -3
- data/test/lib/vedeu/repository/interface_repository_test.rb +4 -10
- data/test/lib/vedeu/repository/interface_test.rb +4 -6
- data/test/lib/vedeu/{process → support}/event_loop_test.rb +0 -0
- data/test/lib/vedeu/{process → support}/exit_test.rb +0 -0
- data/test/lib/vedeu/{process → support}/queue_test.rb +25 -6
- data/test/lib/vedeu/support/terminal_test.rb +35 -43
- metadata +17 -20
- data/lib/vedeu/output/renderer.rb +0 -21
- data/lib/vedeu/process/output.rb +0 -25
- data/test/lib/vedeu/output/renderer_test.rb +0 -37
- data/test/lib/vedeu/process/output_test.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2bb1e7b3e6b2af51afa6ca62e74793542fc45ed
|
4
|
+
data.tar.gz: ea682085e35d4ff848ac4d91a7984e52c03306ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1578296de167f5b21d80e206c35e7cef51fa3ec9a0962ce1d1c0a363c683a6513cd9f3d060d0744709ea4ed182c8c12f8b7e5bb3a924f21df9137b253f1fb19
|
7
|
+
data.tar.gz: 215e9dd91bd325aae7d951d59a7a5687eedb569789bed8a05b8cad748f32c373da8f6b2d23865026191099f3eebaa3a1d4525391f81013da8232de91b374fc77
|
data/README.md
CHANGED
data/lib/vedeu.rb
CHANGED
@@ -2,6 +2,11 @@ require 'date'
|
|
2
2
|
require 'logger'
|
3
3
|
require 'io/console'
|
4
4
|
|
5
|
+
require_relative 'vedeu/input/input'
|
6
|
+
|
7
|
+
require_relative 'vedeu/support/event_loop'
|
8
|
+
require_relative 'vedeu/support/exit'
|
9
|
+
require_relative 'vedeu/support/queue'
|
5
10
|
require_relative 'vedeu/support/terminal'
|
6
11
|
|
7
12
|
require_relative 'vedeu/output/base'
|
@@ -14,18 +19,13 @@ require_relative 'vedeu/output/foreground'
|
|
14
19
|
require_relative 'vedeu/output/geometry'
|
15
20
|
require_relative 'vedeu/output/esc'
|
16
21
|
require_relative 'vedeu/output/colour'
|
22
|
+
require_relative 'vedeu/output/output'
|
17
23
|
require_relative 'vedeu/output/position'
|
18
|
-
require_relative 'vedeu/output/renderer'
|
19
24
|
require_relative 'vedeu/output/style'
|
20
25
|
require_relative 'vedeu/output/translator'
|
21
26
|
require_relative 'vedeu/output/wordwrap'
|
22
27
|
|
23
|
-
require_relative 'vedeu/process/event_loop'
|
24
|
-
require_relative 'vedeu/process/exit'
|
25
|
-
require_relative 'vedeu/process/input'
|
26
|
-
require_relative 'vedeu/process/output'
|
27
28
|
require_relative 'vedeu/process/process'
|
28
|
-
require_relative 'vedeu/process/queue'
|
29
29
|
|
30
30
|
require_relative 'vedeu/repository/repository'
|
31
31
|
require_relative 'vedeu/repository/command_repository'
|
data/lib/vedeu/application.rb
CHANGED
File without changes
|
data/lib/vedeu/output/base.rb
CHANGED
@@ -18,6 +18,10 @@ module Vedeu
|
|
18
18
|
|
19
19
|
attr_reader :colour
|
20
20
|
|
21
|
+
def prefix
|
22
|
+
named? || default? ? normal : custom
|
23
|
+
end
|
24
|
+
|
21
25
|
def code
|
22
26
|
no_colour || named || html || default
|
23
27
|
end
|
@@ -26,6 +30,10 @@ module Vedeu
|
|
26
30
|
default unless colour
|
27
31
|
end
|
28
32
|
|
33
|
+
def default?
|
34
|
+
colour.nil? || colour == :default
|
35
|
+
end
|
36
|
+
|
29
37
|
def named
|
30
38
|
codes[colour] || codes[:default] if named?
|
31
39
|
end
|
data/lib/vedeu/output/cursor.rb
CHANGED
@@ -1,57 +1,53 @@
|
|
1
1
|
module Vedeu
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
alias_method :restore_all, :unsave_all
|
51
|
-
|
52
|
-
def esc
|
53
|
-
[27.chr, '['].join
|
54
|
-
end
|
2
|
+
module Cursor
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def show
|
6
|
+
[Esc.esc, '?25h'].join
|
7
|
+
end
|
8
|
+
|
9
|
+
def hide
|
10
|
+
[Esc.esc, '?25l'].join
|
11
|
+
end
|
12
|
+
|
13
|
+
def home
|
14
|
+
[Esc.esc, 'H'].join
|
15
|
+
end
|
16
|
+
|
17
|
+
def up(count = 1)
|
18
|
+
[Esc.esc, "#{count || 1}", 'A'].join
|
19
|
+
end
|
20
|
+
|
21
|
+
def down(count = 1)
|
22
|
+
[Esc.esc, "#{count || 1}", 'B'].join
|
23
|
+
end
|
24
|
+
|
25
|
+
def right(count = 1)
|
26
|
+
[Esc.esc, "#{count || 1}", 'C'].join
|
27
|
+
end
|
28
|
+
alias_method :forward, :right
|
29
|
+
|
30
|
+
def left(count = 1)
|
31
|
+
[Esc.esc, "#{count || 1}", 'D'].join
|
32
|
+
end
|
33
|
+
alias_method :backward, :left
|
34
|
+
|
35
|
+
def save
|
36
|
+
[Esc.esc, 's'].join
|
37
|
+
end
|
38
|
+
|
39
|
+
def unsave
|
40
|
+
[Esc.esc, 'u'].join
|
41
|
+
end
|
42
|
+
alias_method :restore, :unsave
|
43
|
+
|
44
|
+
def save_all
|
45
|
+
[Esc.esc, '7'].join
|
46
|
+
end
|
47
|
+
|
48
|
+
def unsave_all
|
49
|
+
[Esc.esc, '8'].join
|
55
50
|
end
|
51
|
+
alias_method :restore_all, :unsave_all
|
56
52
|
end
|
57
53
|
end
|
data/lib/vedeu/output/esc.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
module Vedeu
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
2
|
+
module Esc
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def blink
|
6
|
+
[esc, '5m'].join
|
7
|
+
end
|
8
|
+
|
9
|
+
def bold
|
10
|
+
[esc, '1m'].join
|
11
|
+
end
|
12
|
+
alias_method :bright, :bold
|
13
|
+
|
14
|
+
def clear
|
15
|
+
[esc, '2J'].join
|
16
|
+
end
|
17
|
+
|
18
|
+
def clear_line
|
19
|
+
[esc, '2K'].join
|
20
|
+
end
|
21
|
+
|
22
|
+
def esc
|
23
|
+
[27.chr, '['].join
|
24
|
+
end
|
25
|
+
|
26
|
+
def inverse
|
27
|
+
[esc, '7m'].join
|
28
|
+
end
|
29
|
+
alias_method :reverse, :inverse
|
30
|
+
|
31
|
+
def normal
|
32
|
+
[esc, '2m'].join
|
33
|
+
end
|
34
|
+
alias_method :dim, :normal
|
35
|
+
|
36
|
+
def reset
|
37
|
+
[esc, '0m'].join
|
38
|
+
end
|
39
|
+
|
40
|
+
def underline
|
41
|
+
[esc, '4m'].join
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -0,0 +1,19 @@
|
|
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
|
+
InterfaceRepository.update.map do |interface|
|
13
|
+
interface.map do |stream|
|
14
|
+
Terminal.output(stream) unless stream.nil?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class Interface
|
3
|
+
include Queue
|
4
|
+
|
3
5
|
attr_accessor :id, :attributes, :active, :name
|
4
6
|
|
5
7
|
class << self
|
@@ -19,16 +21,17 @@ module Vedeu
|
|
19
21
|
def create
|
20
22
|
InterfaceRepository.create(self)
|
21
23
|
|
22
|
-
|
24
|
+
Compositor.arrange(initial_state)
|
23
25
|
|
24
26
|
self
|
25
27
|
end
|
26
28
|
|
27
|
-
def initial_state
|
28
|
-
Compositor.arrange([Array.new(geometry.height) { '' }], name)
|
29
|
-
end
|
30
|
-
|
31
29
|
def update
|
30
|
+
if enqueued?
|
31
|
+
dequeue
|
32
|
+
else
|
33
|
+
[cursor, colour.reset, geometry.origin]
|
34
|
+
end
|
32
35
|
end
|
33
36
|
|
34
37
|
def geometry
|
@@ -45,6 +48,10 @@ module Vedeu
|
|
45
48
|
|
46
49
|
private
|
47
50
|
|
51
|
+
def initial_state
|
52
|
+
{ name => [Array.new(geometry.height) { '' }] }
|
53
|
+
end
|
54
|
+
|
48
55
|
def foreground
|
49
56
|
attributes[:fg] || attributes[:foreground]
|
50
57
|
end
|
@@ -3,11 +3,15 @@ module Vedeu
|
|
3
3
|
extend Repository
|
4
4
|
|
5
5
|
class << self
|
6
|
-
def
|
6
|
+
def create(*args)
|
7
|
+
activate(super)
|
8
|
+
end
|
9
|
+
|
10
|
+
def activate(interface)
|
7
11
|
deactivate
|
8
12
|
|
9
|
-
all.map do |
|
10
|
-
|
13
|
+
all.map do |stored|
|
14
|
+
stored.active = true if stored == interface
|
11
15
|
end
|
12
16
|
end
|
13
17
|
|
@@ -27,12 +31,8 @@ module Vedeu
|
|
27
31
|
interface
|
28
32
|
end
|
29
33
|
|
30
|
-
def initial_state
|
31
|
-
all.map { |interface| interface.initial_state }
|
32
|
-
end
|
33
|
-
|
34
34
|
def update
|
35
|
-
all.map { |interface| interface.update }
|
35
|
+
all.map { |interface| interface.update }.compact
|
36
36
|
end
|
37
37
|
|
38
38
|
def klass
|
File without changes
|
File without changes
|