vedeu 0.4.35 → 0.4.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Dockerfile +56 -35
- data/bin/vedeu +54 -13
- data/docs/applications.md +92 -0
- data/features/cli_vedeu.feature +5 -0
- data/features/start_stop.feature +1 -1
- data/features/step_definitions/vedeu_steps.rb +0 -0
- data/features/support/env.rb +3 -2
- data/lib/vedeu.rb +1 -0
- data/lib/vedeu/all.rb +6 -0
- data/lib/vedeu/application/all.rb +2 -0
- data/lib/vedeu/application/application_controller.rb +7 -0
- data/lib/vedeu/application/application_helper.rb +7 -0
- data/lib/vedeu/bootstrap.rb +73 -0
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +7 -14
- data/lib/vedeu/generator/all.rb +13 -0
- data/lib/vedeu/generator/application.rb +108 -0
- data/lib/vedeu/generator/helpers.rb +55 -0
- data/lib/vedeu/generator/templates/application/Gemfile +3 -0
- data/lib/vedeu/generator/templates/application/app/controllers/application_controller.erb +7 -0
- data/lib/vedeu/generator/templates/application/app/controllers/name.erb +10 -0
- data/lib/vedeu/generator/templates/application/app/helpers/application_helper.erb +9 -0
- data/lib/vedeu/generator/templates/application/app/helpers/name.erb +9 -0
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_global_.rb +2 -0
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_system_.rb +2 -0
- data/lib/vedeu/generator/templates/application/app/views/interfaces/name.erb +44 -0
- data/lib/vedeu/generator/templates/application/app/views/name.erb +0 -0
- data/lib/vedeu/generator/templates/application/app/views/templates/name.erb +0 -0
- data/lib/vedeu/generator/templates/application/application.rb +9 -0
- data/lib/vedeu/generator/templates/application/bin/name +7 -0
- data/lib/vedeu/generator/templates/application/config/app_name.erb +1 -0
- data/lib/vedeu/generator/templates/application/config/configuration.rb +22 -0
- data/lib/vedeu/generator/templates/application/lib/.gitkeep +0 -0
- data/lib/vedeu/generator/templates/application/test/.gitkeep +0 -0
- data/lib/vedeu/generator/templates/application/vendor/.gitkeep +0 -0
- data/lib/vedeu/generator/view.rb +71 -0
- data/lib/vedeu/geometry/area.rb +21 -21
- data/lib/vedeu/main_loop.rb +0 -1
- data/lib/vedeu/output/esc.rb +5 -4
- data/lib/vedeu/output/refresh.rb +9 -3
- data/lib/vedeu/output/view_helpers/all.rb +0 -2
- data/lib/vedeu/support/log.rb +1 -1
- data/lib/vedeu/support/template.rb +1 -1
- data/lib/vedeu/support/terminal.rb +10 -2
- data/lib/vedeu/tasks/application.rake +28 -0
- data/lib/vedeu/tasks/vedeu.rake +3 -0
- data/lib/vedeu/templating/directive.rb +1 -8
- data/lib/vedeu/traps.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_controller_test.rb +12 -0
- data/test/lib/vedeu/application/application_helper_test.rb +18 -0
- data/test/lib/vedeu/bootstrap_test.rb +30 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +7 -0
- data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -0
- data/test/lib/vedeu/configuration/api_test.rb +6 -0
- data/test/lib/vedeu/cursor/move_test.rb +7 -0
- data/test/lib/vedeu/distributed/client_test.rb +4 -0
- data/test/lib/vedeu/distributed/server_test.rb +9 -0
- data/test/lib/vedeu/dsl/use_test.rb +4 -0
- data/test/lib/vedeu/generator/application_test.rb +55 -0
- data/test/lib/vedeu/generator/helpers_test.rb +80 -0
- data/test/lib/vedeu/generator/view_test.rb +35 -0
- data/test/lib/vedeu/geometry/area_test.rb +8 -0
- data/test/lib/vedeu/launcher_test.rb +2 -0
- data/test/lib/vedeu/main_loop_test.rb +2 -0
- data/test/lib/vedeu/null/interface_test.rb +1 -0
- data/test/lib/vedeu/output/clear_test.rb +3 -0
- data/test/lib/vedeu/output/refresh_test.rb +1 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +1 -0
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +2 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repository_test.rb +3 -0
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +2 -0
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +2 -0
- data/test/lib/vedeu/repositories/repository_test.rb +1 -0
- data/test/lib/vedeu/support/log_test.rb +5 -0
- data/test/lib/vedeu/support/terminal_test.rb +1 -0
- data/test/lib/vedeu/traps_test.rb +1 -1
- data/test/lib/vedeu_test.rb +1 -0
- data/vedeu.gemspec +7 -4
- metadata +97 -25
data/lib/vedeu/geometry/area.rb
CHANGED
@@ -25,28 +25,28 @@ module Vedeu
|
|
25
25
|
attr_reader :xn
|
26
26
|
alias_method :right, :xn
|
27
27
|
|
28
|
-
# @param
|
29
|
-
# @
|
30
|
-
# @
|
31
|
-
# @
|
32
|
-
# @
|
33
|
-
# @
|
34
|
-
# @
|
35
|
-
# @
|
36
|
-
# @
|
28
|
+
# @param attributes [Hash]
|
29
|
+
# @option attributes y [Fixnum]
|
30
|
+
# @option attributes yn [Fixnum]
|
31
|
+
# @option attributes y_yn [Fixnum]
|
32
|
+
# @option attributes y_default [Fixnum]
|
33
|
+
# @option attributes x [Fixnum]
|
34
|
+
# @option attributes xn [Fixnum]
|
35
|
+
# @option attributes x_xn [Fixnum]
|
36
|
+
# @option attributes x_default [Fixnum]
|
37
|
+
# @option attributes options [Hash<Symbol => Boolean>]
|
37
38
|
# @return [Vedeu::Area]
|
38
|
-
def self.from_attributes(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
options: options)
|
39
|
+
def self.from_attributes(attributes = {})
|
40
|
+
y_yn = Vedeu::Dimension.pair(d: attributes[:y],
|
41
|
+
dn: attributes[:yn],
|
42
|
+
d_dn: attributes[:y_yn],
|
43
|
+
default: attributes[:y_default],
|
44
|
+
options: attributes[:options])
|
45
|
+
x_xn = Vedeu::Dimension.pair(d: attributes[:x],
|
46
|
+
dn: attributes[:xn],
|
47
|
+
d_dn: attributes[:x_xn],
|
48
|
+
default: attributes[:x_default],
|
49
|
+
options: attributes[:options])
|
50
50
|
|
51
51
|
from_dimensions(y_yn: y_yn, x_xn: x_xn)
|
52
52
|
end
|
data/lib/vedeu/main_loop.rb
CHANGED
data/lib/vedeu/output/esc.rb
CHANGED
@@ -56,7 +56,10 @@ module Vedeu
|
|
56
56
|
#
|
57
57
|
# @return [Hash<Symbol => Fixnum>]
|
58
58
|
def background_codes
|
59
|
-
|
59
|
+
hash = {}
|
60
|
+
Vedeu::Esc.codes.inject(hash) do |h, (k, v)|
|
61
|
+
h.merge!(k => v + 10)
|
62
|
+
end
|
60
63
|
end
|
61
64
|
|
62
65
|
# Dynamically creates methods for each terminal named colour. When a block
|
@@ -98,9 +101,7 @@ module Vedeu
|
|
98
101
|
}
|
99
102
|
end
|
100
103
|
|
101
|
-
actions.each
|
102
|
-
define_method(key) { code }
|
103
|
-
end
|
104
|
+
actions.each { |key, code| define_method(key) { code } }
|
104
105
|
|
105
106
|
# Return the stream with the escape sequences escaped so that they can be
|
106
107
|
# printed to the terminal instead of being interpreted by the terminal which
|
data/lib/vedeu/output/refresh.rb
CHANGED
@@ -27,6 +27,11 @@ module Vedeu
|
|
27
27
|
|
28
28
|
# Refresh an interface, or collection of interfaces belonging to a group.
|
29
29
|
#
|
30
|
+
# @note
|
31
|
+
# The group of interfaces will be refreshed in z-index order, meaning that
|
32
|
+
# interfaces with a lower z-index will be draw first. This means
|
33
|
+
# overlapping interfaces will be drawn as specified.
|
34
|
+
#
|
30
35
|
# @param group_name [String] The name of the group to be refreshed.
|
31
36
|
# @return [Array|ModelNotFound] A collection of the names of interfaces
|
32
37
|
# refreshed, or an exception if the group was not found.
|
@@ -34,9 +39,10 @@ module Vedeu
|
|
34
39
|
message = "Refreshing group: '#{group_name}'"
|
35
40
|
|
36
41
|
Vedeu.timer(message) do
|
37
|
-
Vedeu.groups.find!(group_name).members
|
38
|
-
|
39
|
-
|
42
|
+
members = Vedeu.groups.find!(group_name).members
|
43
|
+
interfaces = members.each { |name| Vedeu.interfaces.by_name(name) }
|
44
|
+
by_zindex = interfaces.sort { |a, b| a.zindex <=> b.zindex }
|
45
|
+
by_zindex.each { |name| by_name(name) }
|
40
46
|
end
|
41
47
|
end
|
42
48
|
|
data/lib/vedeu/support/log.rb
CHANGED
@@ -55,7 +55,7 @@ module Vedeu
|
|
55
55
|
fail MissingRequired, 'No path to template specified.' if @path.empty?
|
56
56
|
|
57
57
|
unless File.exist?(@path)
|
58
|
-
fail MissingRequired,
|
58
|
+
fail MissingRequired, "Template file cannot be found. (#{@path})"
|
59
59
|
end
|
60
60
|
|
61
61
|
@path
|
@@ -40,8 +40,16 @@ module Vedeu
|
|
40
40
|
keys = console.getch
|
41
41
|
|
42
42
|
if keys.ord == 27
|
43
|
-
|
44
|
-
|
43
|
+
begin
|
44
|
+
keys << console.read_nonblock(3)
|
45
|
+
rescue
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
begin
|
49
|
+
keys << console.read_nonblock(2)
|
50
|
+
rescue
|
51
|
+
nil
|
52
|
+
end
|
45
53
|
end
|
46
54
|
keys
|
47
55
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
desc 'Create a skeleton Vedeu client application.'
|
2
|
+
task :new do
|
3
|
+
app_name = ARGV[0]
|
4
|
+
|
5
|
+
if app_name
|
6
|
+
Vedeu::Generator::Application.generate(app_name)
|
7
|
+
|
8
|
+
else
|
9
|
+
print Vedeu::Esc.red { 'Error: ' }
|
10
|
+
print 'You did not specify a name for the new application.'
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# 'Specify the interface name lowercase snakecase; e.g. main_interface'
|
16
|
+
desc 'Create a new interface within the client application.'
|
17
|
+
task :view do
|
18
|
+
view_name = ARGV[0]
|
19
|
+
|
20
|
+
if view_name
|
21
|
+
Vedeu::Generator::View.generate(view_name)
|
22
|
+
|
23
|
+
else
|
24
|
+
print Vedeu::Esc.red { 'Error: ' }
|
25
|
+
print 'You did not specify a name for the name view.'
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -23,7 +23,7 @@ module Vedeu
|
|
23
23
|
|
24
24
|
# @return [Vedeu::Stream]
|
25
25
|
def process
|
26
|
-
eval(code, proc.binding)
|
26
|
+
eval(code, proc {}.binding)
|
27
27
|
end
|
28
28
|
|
29
29
|
protected
|
@@ -32,13 +32,6 @@ module Vedeu
|
|
32
32
|
# @return [String]
|
33
33
|
attr_reader :code
|
34
34
|
|
35
|
-
private
|
36
|
-
|
37
|
-
# @return [Proc]
|
38
|
-
def proc
|
39
|
-
@proc ||= Proc.new {}
|
40
|
-
end
|
41
|
-
|
42
35
|
end # Directive
|
43
36
|
|
44
37
|
end # Templating
|
data/lib/vedeu/traps.rb
CHANGED
data/lib/vedeu/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
class ApplicationHelperTestClass
|
6
|
+
|
7
|
+
include Vedeu::ApplicationHelper
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
describe ApplicationHelper do
|
12
|
+
|
13
|
+
let(:described) { Vedeu::ApplicationHelper }
|
14
|
+
let(:instance) { Vedeu::ApplicationHelperTestClass.new }
|
15
|
+
|
16
|
+
end # Application
|
17
|
+
|
18
|
+
end # Vedeu
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Bootstrap do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Bootstrap }
|
8
|
+
let(:instance) { described.new(argv) }
|
9
|
+
let(:argv) { [] }
|
10
|
+
|
11
|
+
describe '#initialize' do
|
12
|
+
subject { instance }
|
13
|
+
|
14
|
+
it { subject.must_be_instance_of(described) }
|
15
|
+
it { subject.instance_variable_get('@argv').must_equal(argv) }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.start' do
|
19
|
+
it { described.must_respond_to(:start) }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#start' do
|
23
|
+
subject { instance.start }
|
24
|
+
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end # Bootstrap
|
29
|
+
|
30
|
+
end # Vedeu
|
@@ -99,6 +99,7 @@ module Vedeu
|
|
99
99
|
|
100
100
|
context 'with content' do
|
101
101
|
# it { subject.must_equal(true) }
|
102
|
+
# it { skip }
|
102
103
|
end
|
103
104
|
|
104
105
|
context 'without content' do
|
@@ -117,6 +118,7 @@ module Vedeu
|
|
117
118
|
|
118
119
|
context 'with content' do
|
119
120
|
# it { subject.must_equal(true) }
|
121
|
+
# it { skip }
|
120
122
|
end
|
121
123
|
|
122
124
|
context 'without content' do
|
@@ -129,6 +131,7 @@ module Vedeu
|
|
129
131
|
|
130
132
|
context 'with content' do
|
131
133
|
# it { subject.must_equal(true) }
|
134
|
+
# it { skip }
|
132
135
|
end
|
133
136
|
|
134
137
|
context 'without content' do
|
@@ -140,6 +143,7 @@ module Vedeu
|
|
140
143
|
subject { instance.hide }
|
141
144
|
|
142
145
|
context 'when the interface is visible' do
|
146
|
+
# it { skip }
|
143
147
|
end
|
144
148
|
|
145
149
|
context 'when the interface is not visible' do
|
@@ -152,9 +156,11 @@ module Vedeu
|
|
152
156
|
|
153
157
|
context 'when the interface is visible' do
|
154
158
|
# it { subject.must_be_instance_of(NilClass) }
|
159
|
+
# it { skip }
|
155
160
|
end
|
156
161
|
|
157
162
|
context 'when the interface is not visible' do
|
163
|
+
# it { skip }
|
158
164
|
end
|
159
165
|
end
|
160
166
|
|
@@ -165,6 +171,7 @@ module Vedeu
|
|
165
171
|
|
166
172
|
it { instance.must_respond_to(:content) }
|
167
173
|
|
174
|
+
# it { skip }
|
168
175
|
# it { subject.must_be_instance_of(Array) }
|
169
176
|
|
170
177
|
# context 'when there is content on the back buffer' do
|
@@ -222,18 +222,24 @@ module Vedeu
|
|
222
222
|
let(:io) {}
|
223
223
|
|
224
224
|
subject { instance.stdin(io) }
|
225
|
+
|
226
|
+
# it { skip }
|
225
227
|
end
|
226
228
|
|
227
229
|
describe '#stdout' do
|
228
230
|
let(:io) {}
|
229
231
|
|
230
232
|
subject { instance.stdout(io) }
|
233
|
+
|
234
|
+
# it { skip }
|
231
235
|
end
|
232
236
|
|
233
237
|
describe '#stderr' do
|
234
238
|
let(:io) {}
|
235
239
|
|
236
240
|
subject { instance.stderr(io) }
|
241
|
+
|
242
|
+
# it { skip }
|
237
243
|
end
|
238
244
|
|
239
245
|
describe 'redefining system keys' do
|
@@ -75,6 +75,7 @@ module Vedeu
|
|
75
75
|
context 'when the name is not specified' do
|
76
76
|
let(:_name) {}
|
77
77
|
|
78
|
+
# it { skip }
|
78
79
|
end
|
79
80
|
|
80
81
|
context 'when the name is specified' do
|
@@ -245,6 +246,8 @@ module Vedeu
|
|
245
246
|
|
246
247
|
context 'when the entity is a Vedeu::Geometry' do
|
247
248
|
let(:entity) { Vedeu::Geometry }
|
249
|
+
|
250
|
+
# it { skip }
|
248
251
|
end
|
249
252
|
|
250
253
|
context 'when the entity is a Vedeu::Cursor' do
|
@@ -257,9 +260,12 @@ module Vedeu
|
|
257
260
|
|
258
261
|
context 'when the entity is a Vedeu::Geometry' do
|
259
262
|
let(:entity) { Vedeu::Geometry }
|
263
|
+
|
264
|
+
# it { skip }
|
260
265
|
end
|
261
266
|
|
262
267
|
context 'when the entity is a Vedeu::Cursor' do
|
268
|
+
# it { skip }
|
263
269
|
end
|
264
270
|
end
|
265
271
|
|
@@ -273,6 +279,7 @@ module Vedeu
|
|
273
279
|
end
|
274
280
|
|
275
281
|
context 'when the entity is a Vedeu::Cursor' do
|
282
|
+
# it { skip }
|
276
283
|
end
|
277
284
|
end
|
278
285
|
|
@@ -37,6 +37,7 @@ module Vedeu
|
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when the DRb server is available' do
|
40
|
+
# it { skip }
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
@@ -53,6 +54,7 @@ module Vedeu
|
|
53
54
|
end
|
54
55
|
|
55
56
|
context 'when the DRb server is available' do
|
57
|
+
# it { skip }
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
@@ -68,6 +70,7 @@ module Vedeu
|
|
68
70
|
end
|
69
71
|
|
70
72
|
context 'when the DRb server is available' do
|
73
|
+
# it { skip }
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
@@ -81,6 +84,7 @@ module Vedeu
|
|
81
84
|
end
|
82
85
|
|
83
86
|
context 'when the DRb server is available' do
|
87
|
+
# it { skip }
|
84
88
|
end
|
85
89
|
end
|
86
90
|
|