vedeu 0.4.2 → 0.4.3
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/LICENSE.txt +3 -0
- data/Rakefile +16 -7
- data/examples/borders_app.rb +58 -55
- data/lib/vedeu/api.rb +1 -1
- data/lib/vedeu/application.rb +25 -25
- data/lib/vedeu/bindings.rb +5 -7
- data/lib/vedeu/configuration/api.rb +0 -2
- data/lib/vedeu/configuration/cli.rb +0 -2
- data/lib/vedeu/configuration/configuration.rb +0 -2
- data/lib/vedeu/cursor/cursor.rb +0 -2
- data/lib/vedeu/debug.rb +2 -2
- data/lib/vedeu/distributed/server.rb +0 -2
- data/lib/vedeu/dsl/components/border.rb +15 -19
- data/lib/vedeu/dsl/components/geometry.rb +14 -18
- data/lib/vedeu/dsl/components/keymap.rb +28 -32
- data/lib/vedeu/dsl/composition.rb +27 -9
- data/lib/vedeu/events/all.rb +1 -0
- data/lib/vedeu/events/event.rb +6 -8
- data/lib/vedeu/events/events.rb +10 -0
- data/lib/vedeu/events/trigger.rb +6 -12
- data/lib/vedeu/geometry/grid.rb +0 -2
- data/lib/vedeu/geometry/position.rb +0 -2
- data/lib/vedeu/geometry/position_validator.rb +0 -14
- data/lib/vedeu/input/input.rb +0 -2
- data/lib/vedeu/models/collection.rb +0 -2
- data/lib/vedeu/models/focus.rb +0 -1
- data/lib/vedeu/models/geometry.rb +7 -3
- data/lib/vedeu/models/group.rb +0 -2
- data/lib/vedeu/models/menu.rb +23 -29
- data/lib/vedeu/models/model.rb +0 -2
- data/lib/vedeu/models/view/char.rb +14 -10
- data/lib/vedeu/models/view/composition.rb +7 -9
- data/lib/vedeu/models/view/interface.rb +0 -1
- data/lib/vedeu/models/view/line.rb +2 -3
- data/lib/vedeu/models/view/stream.rb +0 -3
- data/lib/vedeu/output/all.rb +1 -0
- data/lib/vedeu/output/background.rb +0 -2
- data/lib/vedeu/output/colour.rb +0 -2
- data/lib/vedeu/output/compositor.rb +0 -2
- data/lib/vedeu/output/foreground.rb +0 -2
- data/lib/vedeu/output/html_renderer.rb +6 -0
- data/lib/vedeu/output/index_position.rb +35 -0
- data/lib/vedeu/output/output.rb +3 -1
- data/lib/vedeu/output/position_index.rb +2 -2
- data/lib/vedeu/output/presentation.rb +0 -2
- data/lib/vedeu/output/style.rb +0 -1
- data/lib/vedeu/output/translator.rb +18 -20
- data/lib/vedeu/output/viewport.rb +76 -51
- data/lib/vedeu/output/virtual_terminal.rb +2 -1
- data/lib/vedeu/repositories/all.rb +4 -4
- data/lib/vedeu/repositories/repository.rb +0 -2
- data/lib/vedeu/support/coercions.rb +0 -2
- data/lib/vedeu/support/common.rb +0 -2
- data/lib/vedeu/support/esc.rb +0 -2
- data/lib/vedeu/support/log.rb +86 -3
- data/lib/vedeu/support/refresh.rb +0 -2
- data/lib/vedeu/support/sentence.rb +5 -9
- data/lib/vedeu/support/terminal.rb +0 -2
- data/lib/vedeu/support/trace.rb +0 -2
- data/lib/vedeu/support/visible.rb +1 -1
- data/test/lib/vedeu/configuration/api_test.rb +14 -0
- data/test/lib/vedeu/configuration/configuration_test.rb +10 -0
- data/test/lib/vedeu/distributed/server_test.rb +5 -0
- data/test/lib/vedeu/dsl/components/border_test.rb +7 -0
- data/test/lib/vedeu/dsl/components/geometry_test.rb +8 -3
- data/test/lib/vedeu/dsl/interface_test.rb +5 -0
- data/test/lib/vedeu/dsl/line_test.rb +4 -0
- data/test/lib/vedeu/dsl/shared/colour_test.rb +7 -7
- data/test/lib/vedeu/dsl/shared/style_test.rb +5 -2
- data/test/lib/vedeu/dsl/stream_test.rb +4 -1
- data/test/lib/vedeu/events/event_test.rb +6 -0
- data/test/lib/vedeu/geometry/bounding_area_test.rb +30 -30
- data/test/lib/vedeu/geometry/position_test.rb +5 -0
- data/test/lib/vedeu/models/view/char_test.rb +1 -14
- data/test/lib/vedeu/output/index_position_test.rb +64 -0
- data/test/lib/vedeu/output/style_test.rb +4 -0
- data/test/lib/vedeu/output/translator_test.rb +4 -0
- data/test/lib/vedeu/output/virtual_terminal_test.rb +2 -0
- data/test/lib/vedeu/output/wordwrap_test.rb +5 -0
- data/test/lib/vedeu/repositories/all_test.rb +3 -3
- data/test/lib/vedeu/repositories/repository_test.rb +8 -0
- data/test/lib/vedeu/support/console_test.rb +14 -0
- data/test/lib/vedeu/support/esc_test.rb +6 -0
- data/test/lib/vedeu/support/terminal_test.rb +13 -0
- data/vedeu.gemspec +4 -4
- metadata +12 -24
- data/test/integration/distributed_test.rb +0 -16
- data/test/integration/dsl/compositions_test.rb +0 -19
- data/test/integration/dsl/interfaces_test.rb +0 -193
- data/test/integration/dsl/keymaps_test.rb +0 -30
- data/test/integration/dsl/lines_test.rb +0 -104
- data/test/integration/dsl/menus_test.rb +0 -59
- data/test/integration/dsl/streams_test.rb +0 -103
- data/test/integration/dsl/views_test.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f37a301576d737c906c07425d431588426023bbe
|
4
|
+
data.tar.gz: a8ed33815c9a7343b85470d6f88130495e7d93be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b2a87c244d2b5e3e2bd6d39f8eb6f72184065794e9897fa5bd39c0af08b2ac9add00ed93538d5685f9188c450994fa2b60d96f95ff7564cdf8dad8693a9edcf
|
7
|
+
data.tar.gz: 680a31c67bb5f046b09f52e8709e2ee8fa5a9e5f4cc63fc387d67608cab30ba364419c1beb0db343f753af216b34593934326e3549c9da6899718d0b07777fe9
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
Copyright (c) 2014 Gavin Laking
|
2
|
+
Copyright (c) 2013 Steve Klabnik - Monologger
|
3
|
+
(https://github.com/steveklabnik/mono_logger)
|
4
|
+
Note: Code used inline in Vedeu::Log.
|
2
5
|
Copyright (c) 2013 Michael Grosser - Ruco
|
3
6
|
(https://github.com/grosser/ruco)
|
4
7
|
Note: Code from ruco's Window class was used as basis of
|
data/Rakefile
CHANGED
@@ -3,21 +3,30 @@ require 'rake/testtask'
|
|
3
3
|
require 'cucumber'
|
4
4
|
require 'cucumber/rake/task'
|
5
5
|
require 'inch/rake'
|
6
|
+
require 'yard'
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# end
|
11
|
-
# Rake::Task['cucumber'].execute
|
8
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
9
|
+
t.cucumber_opts = "features --format progress"
|
10
|
+
end
|
12
11
|
|
13
|
-
Rake::TestTask.new do |t|
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
14
13
|
t.libs.push 'lib'
|
15
14
|
t.libs.push 'test'
|
16
15
|
t.pattern = 'test/**/*_test.rb'
|
17
16
|
t.verbose = false
|
18
17
|
end
|
19
18
|
|
20
|
-
|
19
|
+
YARD::Rake::YardocTask.new(:yard) do |t|
|
20
|
+
t.files = [
|
21
|
+
'lib/**/*.rb',
|
22
|
+
'-',
|
23
|
+
'docs/api.md',
|
24
|
+
'docs/getting_started.md',
|
25
|
+
'docs/views.md'
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
Inch::Rake::Suggest.new(:inch) do |suggest|
|
21
30
|
suggest.args << "--pedantic"
|
22
31
|
suggest.args << "--all"
|
23
32
|
end
|
data/examples/borders_app.rb
CHANGED
@@ -23,58 +23,58 @@ class VedeuBordersApp
|
|
23
23
|
geometry do
|
24
24
|
x 2
|
25
25
|
y 2
|
26
|
-
height
|
27
|
-
width
|
26
|
+
height 4
|
27
|
+
width 10
|
28
28
|
end
|
29
29
|
colour foreground: '#ffffff', background: '#ff0000'
|
30
30
|
end
|
31
31
|
|
32
32
|
interface 'border_off' do
|
33
33
|
geometry do
|
34
|
-
x
|
34
|
+
x 13
|
35
35
|
y 2
|
36
|
-
height
|
37
|
-
width
|
36
|
+
height 4
|
37
|
+
width 10
|
38
38
|
end
|
39
39
|
colour foreground: '#ffffff', background: '#ff0000'
|
40
40
|
end
|
41
41
|
|
42
42
|
interface 'no_top' do
|
43
43
|
geometry do
|
44
|
-
x
|
44
|
+
x 24
|
45
45
|
y 2
|
46
|
-
height
|
47
|
-
width
|
46
|
+
height 4
|
47
|
+
width 10
|
48
48
|
end
|
49
49
|
colour foreground: '#000000', background: '#ff5500'
|
50
50
|
end
|
51
51
|
|
52
52
|
interface 'no_bottom' do
|
53
53
|
geometry do
|
54
|
-
x
|
54
|
+
x 35
|
55
55
|
y 2
|
56
|
-
height
|
57
|
-
width
|
56
|
+
height 4
|
57
|
+
width 10
|
58
58
|
end
|
59
59
|
colour foreground: '#000000', background: '#ff5500'
|
60
60
|
end
|
61
61
|
|
62
62
|
interface 'no_left' do
|
63
63
|
geometry do
|
64
|
-
x
|
64
|
+
x 46
|
65
65
|
y 2
|
66
|
-
height
|
67
|
-
width
|
66
|
+
height 4
|
67
|
+
width 10
|
68
68
|
end
|
69
69
|
colour foreground: '#000000', background: '#ff5500'
|
70
70
|
end
|
71
71
|
|
72
72
|
interface 'no_right' do
|
73
73
|
geometry do
|
74
|
-
x
|
74
|
+
x 57
|
75
75
|
y 2
|
76
|
-
height
|
77
|
-
width
|
76
|
+
height 4
|
77
|
+
width 10
|
78
78
|
end
|
79
79
|
colour foreground: '#000000', background: '#ff5500'
|
80
80
|
end
|
@@ -83,58 +83,58 @@ class VedeuBordersApp
|
|
83
83
|
geometry do
|
84
84
|
x 2
|
85
85
|
y 7
|
86
|
-
height
|
87
|
-
width
|
86
|
+
height 4
|
87
|
+
width 10
|
88
88
|
end
|
89
89
|
colour foreground: '#ffffff', background: '#ff0000'
|
90
90
|
end
|
91
91
|
|
92
|
-
interface '
|
92
|
+
interface 'custom_sides' do
|
93
93
|
geometry do
|
94
|
-
x
|
94
|
+
x 13
|
95
95
|
y 7
|
96
|
-
height
|
97
|
-
width
|
96
|
+
height 4
|
97
|
+
width 10
|
98
98
|
end
|
99
99
|
colour foreground: '#ffffff', background: '#ff0000'
|
100
100
|
end
|
101
101
|
|
102
102
|
interface 'only_top' do
|
103
103
|
geometry do
|
104
|
-
x
|
104
|
+
x 24
|
105
105
|
y 7
|
106
|
-
height
|
107
|
-
width
|
106
|
+
height 4
|
107
|
+
width 10
|
108
108
|
end
|
109
109
|
colour foreground: '#ffffff', background: '#0000ff'
|
110
110
|
end
|
111
111
|
|
112
112
|
interface 'only_bottom' do
|
113
113
|
geometry do
|
114
|
-
x
|
114
|
+
x 35
|
115
115
|
y 7
|
116
|
-
height
|
117
|
-
width
|
116
|
+
height 4
|
117
|
+
width 10
|
118
118
|
end
|
119
119
|
colour foreground: '#ffffff', background: '#0000ff'
|
120
120
|
end
|
121
121
|
|
122
122
|
interface 'only_left' do
|
123
123
|
geometry do
|
124
|
-
x
|
124
|
+
x 46
|
125
125
|
y 7
|
126
|
-
height
|
127
|
-
width
|
126
|
+
height 4
|
127
|
+
width 10
|
128
128
|
end
|
129
129
|
colour foreground: '#ffffff', background: '#0000ff'
|
130
130
|
end
|
131
131
|
|
132
132
|
interface 'only_right' do
|
133
133
|
geometry do
|
134
|
-
x
|
134
|
+
x 57
|
135
135
|
y 7
|
136
|
-
height
|
137
|
-
width
|
136
|
+
height 4
|
137
|
+
width 10
|
138
138
|
end
|
139
139
|
colour foreground: '#ffffff', background: '#0000ff'
|
140
140
|
end
|
@@ -143,18 +143,18 @@ class VedeuBordersApp
|
|
143
143
|
geometry do
|
144
144
|
x 2
|
145
145
|
y 12
|
146
|
-
height
|
147
|
-
width
|
146
|
+
height 4
|
147
|
+
width 10
|
148
148
|
end
|
149
149
|
colour foreground: '#ffffff', background: '#ff0000'
|
150
150
|
end
|
151
151
|
|
152
152
|
interface 'negative' do
|
153
153
|
geometry do
|
154
|
-
x
|
154
|
+
x 13
|
155
155
|
y 12
|
156
|
-
height
|
157
|
-
width
|
156
|
+
height 4
|
157
|
+
width 10
|
158
158
|
end
|
159
159
|
colour foreground: '#000000', background: '#00ff00'
|
160
160
|
style 'normal'
|
@@ -188,32 +188,33 @@ class VedeuBordersApp
|
|
188
188
|
foreground '#ffffff'
|
189
189
|
end
|
190
190
|
lines do
|
191
|
-
line 'on'
|
191
|
+
line 'all on'
|
192
192
|
end
|
193
193
|
end
|
194
194
|
view('border_off') do
|
195
195
|
lines do
|
196
|
-
line 'off'
|
196
|
+
line 'all off'
|
197
197
|
end
|
198
198
|
end
|
199
199
|
view('no_top') do
|
200
200
|
lines do
|
201
|
-
line 'no
|
201
|
+
line 'no top'
|
202
202
|
end
|
203
203
|
end
|
204
204
|
view('no_bottom') do
|
205
205
|
lines do
|
206
|
-
line 'no
|
206
|
+
line 'no'
|
207
|
+
line 'bottom'
|
207
208
|
end
|
208
209
|
end
|
209
210
|
view('no_left') do
|
210
211
|
lines do
|
211
|
-
line 'no
|
212
|
+
line 'no left'
|
212
213
|
end
|
213
214
|
end
|
214
215
|
view('no_right') do
|
215
216
|
lines do
|
216
|
-
line 'no
|
217
|
+
line 'no right'
|
217
218
|
end
|
218
219
|
end
|
219
220
|
view('custom_corners') do
|
@@ -224,18 +225,18 @@ class VedeuBordersApp
|
|
224
225
|
bottom_left 'C'
|
225
226
|
end
|
226
227
|
lines do
|
227
|
-
line '
|
228
|
-
line '
|
228
|
+
line 'custom'
|
229
|
+
line 'corners'
|
229
230
|
end
|
230
231
|
end
|
231
|
-
view('
|
232
|
+
view('custom_sides') do
|
232
233
|
border do
|
233
234
|
horizontal '*'
|
234
235
|
vertical '$'
|
235
236
|
end
|
236
237
|
lines do
|
237
|
-
line '
|
238
|
-
line '
|
238
|
+
line 'custom'
|
239
|
+
line 'sides'
|
239
240
|
end
|
240
241
|
end
|
241
242
|
view('only_top') do
|
@@ -247,7 +248,7 @@ class VedeuBordersApp
|
|
247
248
|
end
|
248
249
|
lines do
|
249
250
|
line 'only'
|
250
|
-
line '
|
251
|
+
line 'top'
|
251
252
|
end
|
252
253
|
end
|
253
254
|
view('only_bottom') do
|
@@ -259,7 +260,7 @@ class VedeuBordersApp
|
|
259
260
|
end
|
260
261
|
lines do
|
261
262
|
line 'only'
|
262
|
-
line '
|
263
|
+
line 'bottom'
|
263
264
|
end
|
264
265
|
end
|
265
266
|
view('only_left') do
|
@@ -271,7 +272,7 @@ class VedeuBordersApp
|
|
271
272
|
end
|
272
273
|
lines do
|
273
274
|
line 'only'
|
274
|
-
line '
|
275
|
+
line 'left'
|
275
276
|
end
|
276
277
|
end
|
277
278
|
view('only_right') do
|
@@ -283,7 +284,7 @@ class VedeuBordersApp
|
|
283
284
|
end
|
284
285
|
lines do
|
285
286
|
line 'only'
|
286
|
-
line '
|
287
|
+
line 'right'
|
287
288
|
end
|
288
289
|
end
|
289
290
|
view('custom_colour') do
|
@@ -291,6 +292,7 @@ class VedeuBordersApp
|
|
291
292
|
colour foreground: '#ff5500', background: '#0000ff'
|
292
293
|
end
|
293
294
|
lines do
|
295
|
+
line 'custom'
|
294
296
|
line 'color'
|
295
297
|
end
|
296
298
|
end
|
@@ -299,6 +301,7 @@ class VedeuBordersApp
|
|
299
301
|
style 'negative'
|
300
302
|
end
|
301
303
|
lines do
|
304
|
+
line 'custom'
|
302
305
|
line 'style'
|
303
306
|
end
|
304
307
|
end
|
data/lib/vedeu/api.rb
CHANGED
@@ -24,7 +24,7 @@ module Vedeu
|
|
24
24
|
def_delegators Vedeu::Buffers, :buffers
|
25
25
|
def_delegators Vedeu::Cursors, :cursors
|
26
26
|
def_delegators Vedeu::Cursors, :cursor
|
27
|
-
def_delegators Vedeu::
|
27
|
+
def_delegators Vedeu::EventsRepository, :events
|
28
28
|
def_delegators Vedeu::Geometries, :geometries
|
29
29
|
def_delegators Vedeu::Groups, :groups
|
30
30
|
def_delegators Vedeu::InterfacesRepository, :interfaces
|
data/lib/vedeu/application.rb
CHANGED
@@ -2,36 +2,36 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Orchestrates the running of the main application loop.
|
4
4
|
#
|
5
|
-
# @api private
|
6
|
-
#
|
7
5
|
class Application
|
8
6
|
|
9
|
-
|
7
|
+
# @param configuration [Vedeu::Configuration]
|
8
|
+
# @return [void]
|
9
|
+
def self.start(configuration)
|
10
|
+
new(configuration).start
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Vedeu::MainLoop.stop!
|
29
|
-
end
|
13
|
+
# @param configuration [Vedeu::Configuration]
|
14
|
+
# @return [void]
|
15
|
+
def self.restart(configuration)
|
16
|
+
new(configuration).start
|
17
|
+
end
|
18
|
+
|
19
|
+
# Stops the application!
|
20
|
+
# - The `:_cleanup_` event is triggered, which in turn triggers the client
|
21
|
+
# event `:cleanup`; the client application may treat this event as Vedeu
|
22
|
+
# signalling that it is about to terminate. Client applications are
|
23
|
+
# encouraged to use this event to close any open buffers, save files,
|
24
|
+
# empty trash, etc.
|
25
|
+
#
|
26
|
+
# @return [void]
|
27
|
+
def self.stop
|
28
|
+
Vedeu.trigger(:_cleanup_)
|
30
29
|
|
31
|
-
|
30
|
+
Vedeu::MainLoop.stop!
|
31
|
+
end
|
32
32
|
|
33
33
|
# :nocov:
|
34
|
-
|
34
|
+
# @param configuration [Vedeu::Configuration]
|
35
35
|
# @return [Application]
|
36
36
|
def initialize(configuration)
|
37
37
|
@configuration = configuration
|
@@ -113,7 +113,7 @@ module Vedeu
|
|
113
113
|
|
114
114
|
Vedeu.trigger(:_drb_restart_)
|
115
115
|
|
116
|
-
Application.restart
|
116
|
+
Application.restart(configuration)
|
117
117
|
|
118
118
|
end
|
119
119
|
|
data/lib/vedeu/bindings.rb
CHANGED
@@ -2,12 +2,6 @@ require 'vedeu/events/event'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module API
|
6
|
-
|
7
|
-
def_delegators Vedeu::Event, :bind, :trigger, :unbind
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
5
|
# Creates system events which when called provide a variety of core functions
|
12
6
|
# and behaviours. They are soft-namespaced using underscores.
|
13
7
|
#
|
@@ -21,7 +15,11 @@ module Vedeu
|
|
21
15
|
module Bindings
|
22
16
|
|
23
17
|
# Clears the whole terminal space.
|
24
|
-
Vedeu.bind(:_clear_)
|
18
|
+
Vedeu.bind(:_clear_) do
|
19
|
+
Vedeu::Terminal.virtual.clear if Vedeu::Configuration.drb?
|
20
|
+
|
21
|
+
Vedeu::Terminal.clear
|
22
|
+
end
|
25
23
|
|
26
24
|
# Vedeu triggers this event when `:_exit_` is triggered. You can hook into
|
27
25
|
# this to perform a special action before the application terminates. Saving
|