vedeu 0.4.15 → 0.4.16
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/examples/borders_app.rb +0 -2
- data/examples/colours_app.rb +0 -2
- data/examples/cursor_app.rb +0 -2
- data/examples/drb_app.rb +0 -2
- data/examples/focus_app.rb +0 -2
- data/examples/geometry_app.rb +0 -2
- data/examples/hello_world.rb +0 -2
- data/examples/lines_app.rb +0 -2
- data/examples/material_colours_app.rb +0 -2
- data/lib/vedeu/bindings.rb +2 -1
- data/lib/vedeu/buffers/buffer.rb +18 -10
- data/lib/vedeu/debug.rb +2 -1
- data/lib/vedeu/distributed/server.rb +14 -8
- data/lib/vedeu/dsl/composition.rb +3 -10
- data/lib/vedeu/dsl/line.rb +14 -11
- data/lib/vedeu/dsl/shared/colour.rb +2 -3
- data/lib/vedeu/geometry/coordinate.rb +0 -4
- data/lib/vedeu/geometry/position.rb +2 -1
- data/lib/vedeu/main_loop.rb +1 -1
- data/lib/vedeu/models/all.rb +2 -0
- data/lib/vedeu/models/char.rb +4 -6
- data/lib/vedeu/models/composition.rb +4 -2
- data/lib/vedeu/models/interface.rb +4 -18
- data/lib/vedeu/models/line.rb +4 -3
- data/lib/vedeu/models/null_interface.rb +15 -0
- data/lib/vedeu/models/stream.rb +4 -3
- data/lib/vedeu/output/border.rb +9 -12
- data/lib/vedeu/output/clear.rb +2 -2
- data/lib/vedeu/output/colour.rb +30 -8
- data/lib/vedeu/output/esc.rb +2 -1
- data/lib/vedeu/output/presentation.rb +37 -20
- data/lib/vedeu/output/renderers/all.rb +1 -0
- data/lib/vedeu/output/renderers/escape_sequence_renderer.rb +40 -0
- data/lib/vedeu/output/renderers/file_renderer.rb +9 -5
- data/lib/vedeu/output/renderers/html_renderer.rb +1 -1
- data/lib/vedeu/output/text.rb +1 -15
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/repositories/repositories/borders.rb +11 -11
- data/lib/vedeu/repositories/repositories/buffers.rb +11 -11
- data/lib/vedeu/repositories/repositories/cursors.rb +15 -15
- data/lib/vedeu/repositories/repositories/events_repository.rb +11 -11
- data/lib/vedeu/repositories/repositories/geometries.rb +11 -11
- data/lib/vedeu/repositories/repositories/groups.rb +11 -11
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +23 -10
- data/lib/vedeu/repositories/repositories/keymaps.rb +11 -11
- data/lib/vedeu/repositories/repositories/menus.rb +11 -11
- data/test/lib/vedeu/buffers/buffer_test.rb +4 -6
- data/test/lib/vedeu/distributed/server_test.rb +101 -3
- data/test/lib/vedeu/dsl/view_test.rb +6 -0
- data/test/lib/vedeu/input/input_test.rb +1 -1
- data/test/lib/vedeu/models/char_test.rb +18 -2
- data/test/lib/vedeu/models/composition_test.rb +0 -2
- data/test/lib/vedeu/models/interface_test.rb +12 -17
- data/test/lib/vedeu/models/line_test.rb +0 -2
- data/test/lib/vedeu/models/null_interface_test.rb +9 -0
- data/test/lib/vedeu/models/stream_test.rb +0 -2
- data/test/lib/vedeu/output/border_test.rb +2 -4
- data/test/lib/vedeu/output/clear_test.rb +17 -0
- data/test/lib/vedeu/output/colour_test.rb +139 -0
- data/test/lib/vedeu/output/output_test.rb +15 -13
- data/test/lib/vedeu/output/renderers/escape_sequence_renderer_test.rb +46 -0
- data/test/lib/vedeu/output/renderers/file_renderer_test.rb +27 -4
- data/test/lib/vedeu/output/renderers/html_renderer_test.rb +14 -3
- data/test/lib/vedeu/repositories/repositories/interfaces_repository_test.rb +8 -0
- data/test/test_helper.rb +3 -2
- data/vedeu.gemspec +4 -4
- metadata +18 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a9751fe9473165039b61060cd75848373362b2e
|
4
|
+
data.tar.gz: f26036519a3f79b436bbe48dc6ff56c0be95ee5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6cf213571c0d78127d30f13d5b7371e6f35ed841e5df29943082c43ecf2be8e6254a0959acfeddf119f1f4807a30540948d420399d727c8e3b365da2628c80c
|
7
|
+
data.tar.gz: 65f8b8ab0fe4bfec7074ac7d1c54294b04a764f9e9303fc2da3c27fec296c6c87897ee402f5d04e3289bd46efdc34de635eb6210ed06e1865516f78ddee3e7dd
|
data/.gitignore
CHANGED
data/examples/borders_app.rb
CHANGED
data/examples/colours_app.rb
CHANGED
data/examples/cursor_app.rb
CHANGED
data/examples/drb_app.rb
CHANGED
@@ -40,8 +40,6 @@ class VedeuTestApplication
|
|
40
40
|
# stderr File.open("/tmp/vedeu_error.log", "w+")
|
41
41
|
end
|
42
42
|
|
43
|
-
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
44
|
-
|
45
43
|
Vedeu.border 'test_interface' do
|
46
44
|
# Define colour and style of border
|
47
45
|
colour foreground: '#ffff00', background: '#0000ff'
|
data/examples/focus_app.rb
CHANGED
data/examples/geometry_app.rb
CHANGED
data/examples/hello_world.rb
CHANGED
data/examples/lines_app.rb
CHANGED
data/lib/vedeu/bindings.rb
CHANGED
@@ -176,7 +176,8 @@ module Vedeu
|
|
176
176
|
# if given.
|
177
177
|
Vedeu.bind(:_clear_) do |name|
|
178
178
|
if name && Vedeu.interfaces.registered?(name)
|
179
|
-
Vedeu::Clear.clear(Vedeu.interfaces.find(name)
|
179
|
+
Vedeu::Clear.clear(Vedeu.interfaces.find(name), clear_border: true,
|
180
|
+
use_terminal_colours: true)
|
180
181
|
|
181
182
|
else
|
182
183
|
Vedeu::Terminal.virtual.clear if Vedeu::Configuration.drb?
|
data/lib/vedeu/buffers/buffer.rb
CHANGED
@@ -110,21 +110,18 @@ module Vedeu
|
|
110
110
|
#
|
111
111
|
# @return [void]
|
112
112
|
def clear
|
113
|
-
|
114
|
-
front.clear.clear
|
113
|
+
Vedeu::Output.render(clear_buffer) unless clear_buffer.empty?
|
115
114
|
|
116
|
-
|
117
|
-
interface.clear.clear
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
Vedeu::Output.render(buffer) unless buffer.empty?
|
122
|
-
|
123
|
-
buffer
|
115
|
+
clear_buffer
|
124
116
|
end
|
125
117
|
|
126
118
|
private
|
127
119
|
|
120
|
+
# @return [void]
|
121
|
+
def clear_buffer
|
122
|
+
@clear_buffer ||= Vedeu::Clear.new(view).clear
|
123
|
+
end
|
124
|
+
|
128
125
|
# @return [Hash<Symbol => NilClass, String>]
|
129
126
|
def defaults
|
130
127
|
{
|
@@ -164,6 +161,17 @@ module Vedeu
|
|
164
161
|
@interface ||= Vedeu.interfaces.find(name)
|
165
162
|
end
|
166
163
|
|
164
|
+
# @return [Vedeu::Interface]
|
165
|
+
def view
|
166
|
+
if content_for?(:front)
|
167
|
+
front
|
168
|
+
|
169
|
+
else
|
170
|
+
interface
|
171
|
+
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
167
175
|
end # Buffer
|
168
176
|
|
169
177
|
end # Vedeu
|
data/lib/vedeu/debug.rb
CHANGED
@@ -66,17 +66,23 @@ module Vedeu
|
|
66
66
|
|
67
67
|
# @return [void]
|
68
68
|
def restart
|
69
|
-
|
69
|
+
log('Attempting to restart')
|
70
70
|
|
71
71
|
return not_enabled unless drb?
|
72
72
|
|
73
|
-
|
73
|
+
if drb_running?
|
74
|
+
log('Restarting')
|
75
|
+
|
76
|
+
stop
|
74
77
|
|
75
|
-
|
78
|
+
start
|
76
79
|
|
77
|
-
|
80
|
+
else
|
81
|
+
log('Not running')
|
78
82
|
|
79
|
-
|
83
|
+
start
|
84
|
+
|
85
|
+
end
|
80
86
|
end
|
81
87
|
|
82
88
|
# When called will stop the DRb server and attempt to terminate the client
|
@@ -99,7 +105,7 @@ module Vedeu
|
|
99
105
|
|
100
106
|
# @return [Vedeu::Distributed::Server]
|
101
107
|
def start
|
102
|
-
|
108
|
+
log('Attempting to start')
|
103
109
|
|
104
110
|
return not_enabled unless drb?
|
105
111
|
|
@@ -117,7 +123,7 @@ module Vedeu
|
|
117
123
|
|
118
124
|
# @return [Symbol]
|
119
125
|
def status
|
120
|
-
|
126
|
+
log('Fetching status')
|
121
127
|
|
122
128
|
return not_enabled unless drb?
|
123
129
|
|
@@ -136,7 +142,7 @@ module Vedeu
|
|
136
142
|
|
137
143
|
# @return [void]
|
138
144
|
def stop
|
139
|
-
|
145
|
+
log('Attempting to stop')
|
140
146
|
|
141
147
|
return not_enabled unless drb?
|
142
148
|
|
@@ -94,20 +94,13 @@ module Vedeu
|
|
94
94
|
# @param name [String] The name of the interface.
|
95
95
|
# @return [Hash]
|
96
96
|
def new_attributes(name)
|
97
|
-
attributes.merge!(
|
97
|
+
attributes.merge!(existing_attributes(name))
|
98
98
|
end
|
99
99
|
|
100
100
|
# @param name [String] The name of the interface.
|
101
101
|
# @return [Hash]
|
102
|
-
def
|
103
|
-
|
104
|
-
stored = model.repository.find(name)
|
105
|
-
stored.attributes
|
106
|
-
|
107
|
-
else
|
108
|
-
{ name: name }
|
109
|
-
|
110
|
-
end
|
102
|
+
def existing_attributes(name)
|
103
|
+
Vedeu.interfaces.by_name(name).attributes
|
111
104
|
end
|
112
105
|
|
113
106
|
# @return [Hash]
|
data/lib/vedeu/dsl/line.rb
CHANGED
@@ -66,22 +66,19 @@ module Vedeu
|
|
66
66
|
# @raise [InvalidSyntax] When no block or value is provided.
|
67
67
|
# @return [Vedeu::Lines]
|
68
68
|
def line(value = '', &block)
|
69
|
-
|
70
|
-
|
69
|
+
if block_given?
|
70
|
+
content = Vedeu::Line.build({ client: client,
|
71
71
|
parent: model.parent }, &block)
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
parent: model,
|
76
|
-
value: value)
|
77
|
-
Vedeu::Line.build(client: client,
|
73
|
+
elsif value
|
74
|
+
content = Vedeu::Line.build(client: client,
|
78
75
|
parent: model.parent,
|
79
|
-
streams: [
|
76
|
+
streams: [build_stream(value)])
|
80
77
|
|
81
|
-
|
82
|
-
|
78
|
+
else
|
79
|
+
fail InvalidSyntax, 'block not given'
|
83
80
|
|
84
|
-
|
81
|
+
end
|
85
82
|
|
86
83
|
model.parent.add(content)
|
87
84
|
end
|
@@ -129,6 +126,12 @@ module Vedeu
|
|
129
126
|
}
|
130
127
|
end
|
131
128
|
|
129
|
+
# @param value [String]
|
130
|
+
# @return [Vedeu::Stream]
|
131
|
+
def build_stream(value)
|
132
|
+
Vedeu::Stream.build(client: client, parent: model, value: value)
|
133
|
+
end
|
134
|
+
|
132
135
|
end # Line
|
133
136
|
|
134
137
|
end # DSL
|
@@ -70,13 +70,12 @@ module Vedeu
|
|
70
70
|
# colour background: '#000000', foreground: '#ffffff'
|
71
71
|
# # ...
|
72
72
|
#
|
73
|
-
# @return [
|
73
|
+
# @return [Vedeu::Colour]
|
74
74
|
def colour(attributes = {})
|
75
75
|
attributes.delete_if do |k, v|
|
76
76
|
[:background, :foreground].include?(k) == false || v.nil? || v.empty?
|
77
77
|
end
|
78
|
-
|
79
|
-
model.colour = Vedeu::Colour.new(attributes)
|
78
|
+
model.colour = Vedeu::Colour.coerce(attributes)
|
80
79
|
end
|
81
80
|
|
82
81
|
end # Colour
|
@@ -56,8 +56,9 @@ module Vedeu
|
|
56
56
|
# point on the screen. When passed a block, will do the aforementioned,
|
57
57
|
# call the block and then reposition to this location.
|
58
58
|
#
|
59
|
-
# @param block [Proc]
|
60
59
|
# @return [String]
|
60
|
+
# @yieldreturn [void] Returns the block wrapped in position escape
|
61
|
+
# sequences.
|
61
62
|
def to_s
|
62
63
|
if block_given?
|
63
64
|
[sequence, yield, sequence].join
|
data/lib/vedeu/main_loop.rb
CHANGED
data/lib/vedeu/models/all.rb
CHANGED
data/lib/vedeu/models/char.rb
CHANGED
@@ -23,6 +23,10 @@ module Vedeu
|
|
23
23
|
# @return [Vedeu::Line]
|
24
24
|
attr_accessor :parent
|
25
25
|
|
26
|
+
# @!attribute [r] attributes
|
27
|
+
# @return [Hash]
|
28
|
+
attr_reader :attributes
|
29
|
+
|
26
30
|
# @!attribute [w] value
|
27
31
|
# @return [String]
|
28
32
|
attr_writer :value
|
@@ -42,9 +46,7 @@ module Vedeu
|
|
42
46
|
@attributes = defaults.merge!(attributes)
|
43
47
|
|
44
48
|
@border = @attributes[:border]
|
45
|
-
@colour = @attributes[:colour]
|
46
49
|
@parent = @attributes[:parent]
|
47
|
-
@style = @attributes[:style]
|
48
50
|
@value = @attributes[:value]
|
49
51
|
end
|
50
52
|
|
@@ -139,10 +141,6 @@ module Vedeu
|
|
139
141
|
|
140
142
|
private
|
141
143
|
|
142
|
-
# @!attribute [r] attributes
|
143
|
-
# @return [Hash]
|
144
|
-
attr_reader :attributes
|
145
|
-
|
146
144
|
# @return [Hash]
|
147
145
|
def colour_to_hash
|
148
146
|
{
|
@@ -15,6 +15,10 @@ module Vedeu
|
|
15
15
|
collection Vedeu::Interfaces
|
16
16
|
member Vedeu::Interface
|
17
17
|
|
18
|
+
# @!attribute [r] attributes
|
19
|
+
# @return [Hash]
|
20
|
+
attr_reader :attributes
|
21
|
+
|
18
22
|
# Returns a new instance of Vedeu::Composition.
|
19
23
|
#
|
20
24
|
# @param attributes [Hash]
|
@@ -25,10 +29,8 @@ module Vedeu
|
|
25
29
|
def initialize(attributes = {})
|
26
30
|
@attributes = defaults.merge!(attributes)
|
27
31
|
|
28
|
-
@colour = @attributes[:colour]
|
29
32
|
@interfaces = @attributes[:interfaces]
|
30
33
|
@repository = Vedeu.interfaces
|
31
|
-
@style = @attributes[:style]
|
32
34
|
end
|
33
35
|
|
34
36
|
# @param child [Vedeu::Interface]
|
@@ -42,6 +42,10 @@ module Vedeu
|
|
42
42
|
attr_accessor :visible
|
43
43
|
alias_method :visible?, :visible
|
44
44
|
|
45
|
+
# @!attribute [r] attributes
|
46
|
+
# @return [Hash]
|
47
|
+
attr_reader :attributes
|
48
|
+
|
45
49
|
# @!attribute [w] lines
|
46
50
|
# @return [Array<Vedeu::Line>]
|
47
51
|
attr_writer :lines
|
@@ -81,14 +85,12 @@ module Vedeu
|
|
81
85
|
def initialize(attributes = {})
|
82
86
|
@attributes = defaults.merge!(attributes)
|
83
87
|
|
84
|
-
@colour = @attributes[:colour]
|
85
88
|
@delay = @attributes[:delay]
|
86
89
|
@group = @attributes[:group]
|
87
90
|
@lines = @attributes[:lines]
|
88
91
|
@name = @attributes[:name]
|
89
92
|
@parent = @attributes[:parent]
|
90
93
|
@repository = Vedeu.interfaces
|
91
|
-
@style = @attributes[:style]
|
92
94
|
@visible = @attributes[:visible]
|
93
95
|
end
|
94
96
|
|
@@ -98,22 +100,6 @@ module Vedeu
|
|
98
100
|
@lines = lines.add(child)
|
99
101
|
end
|
100
102
|
|
101
|
-
# @note
|
102
|
-
# This may be unused. (GL 2015-02-20)
|
103
|
-
#
|
104
|
-
# @return [Hash]
|
105
|
-
def attributes
|
106
|
-
{
|
107
|
-
colour: colour,
|
108
|
-
delay: delay,
|
109
|
-
group: group,
|
110
|
-
name: name,
|
111
|
-
parent: parent,
|
112
|
-
style: style,
|
113
|
-
visible: true,
|
114
|
-
}
|
115
|
-
end
|
116
|
-
|
117
103
|
# Returns the border object belonging to the interface.
|
118
104
|
#
|
119
105
|
# @return [Vedeu::Border|NilClass]
|