vedeu 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/application/controller.rb +2 -2
- data/lib/vedeu/cursor/refresh_cursor.rb +1 -1
- data/lib/vedeu/dsl/presentation.rb +3 -3
- data/lib/vedeu/dsl/use.rb +0 -34
- data/lib/vedeu/events/event.rb +2 -2
- data/lib/vedeu/events/trigger.rb +1 -1
- data/lib/vedeu/geometry/area.rb +1 -1
- data/lib/vedeu/geometry/dimension.rb +2 -2
- data/lib/vedeu/input/input.rb +1 -1
- data/lib/vedeu/log/log.rb +5 -3
- data/lib/vedeu/models/focus.rb +1 -1
- data/lib/vedeu/models/interfaces.rb +1 -1
- data/lib/vedeu/models/toggleable.rb +5 -5
- data/lib/vedeu/null/interface.rb +1 -8
- data/lib/vedeu/null/view.rb +1 -8
- data/lib/vedeu/output/refresh_group.rb +1 -1
- data/lib/vedeu/output/renderers/json.rb +1 -1
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/registerable.rb +1 -1
- data/lib/vedeu/templating/view_template.rb +3 -3
- data/lib/vedeu/terminal.rb +3 -3
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/bindings_test.rb +2 -2
- data/test/lib/vedeu/borders/border_test.rb +2 -6
- data/test/lib/vedeu/borders/render_border_test.rb +2 -2
- data/test/lib/vedeu/cli/generator/application_test.rb +2 -2
- data/test/lib/vedeu/cli/generator/view_test.rb +2 -2
- data/test/lib/vedeu/cli/main_test.rb +4 -4
- data/test/lib/vedeu/configuration/configuration_test.rb +6 -6
- data/test/lib/vedeu/cursor/cursor_test.rb +6 -6
- data/test/lib/vedeu/cursor/cursors_test.rb +4 -4
- data/test/lib/vedeu/cursor/move_test.rb +2 -2
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +2 -2
- data/test/lib/vedeu/cursor/reposition_test.rb +2 -2
- data/test/lib/vedeu/distributed/client_test.rb +2 -2
- data/test/lib/vedeu/distributed/server_test.rb +3 -5
- data/test/lib/vedeu/dsl/border_test.rb +2 -2
- data/test/lib/vedeu/dsl/composition_test.rb +3 -3
- data/test/lib/vedeu/dsl/interface_test.rb +8 -8
- data/test/lib/vedeu/dsl/line_test.rb +2 -2
- data/test/lib/vedeu/dsl/use_test.rb +0 -24
- data/test/lib/vedeu/events/event_aliases_test.rb +9 -0
- data/test/lib/vedeu/events/event_test.rb +5 -5
- data/test/lib/vedeu/geometry/coordinate_test.rb +2 -2
- data/test/lib/vedeu/input/input_test.rb +2 -2
- data/test/lib/vedeu/input/keymap_test.rb +2 -2
- data/test/lib/vedeu/log/timer_test.rb +2 -2
- data/test/lib/vedeu/models/focus_test.rb +16 -24
- data/test/lib/vedeu/models/interfaces_test.rb +2 -2
- data/test/lib/vedeu/null/view_test.rb +44 -0
- data/test/lib/vedeu/output/clear/named_interface_test.rb +2 -2
- data/test/lib/vedeu/output/output_test.rb +2 -2
- data/test/lib/vedeu/output/renderers_test.rb +2 -2
- data/test/lib/vedeu/output/viewport_test.rb +2 -2
- data/test/lib/vedeu/plugins/plugin_test.rb +9 -0
- data/test/lib/vedeu/runtime/application_test.rb +2 -2
- data/test/lib/vedeu/runtime/launcher_test.rb +2 -2
- data/test/lib/vedeu/runtime/router_test.rb +8 -8
- data/test/lib/vedeu/templating/template_test.rb +2 -2
- data/test/lib/vedeu/templating/view_template_test.rb +4 -3
- data/test/lib/vedeu/terminal_mode_test.rb +2 -2
- data/test/lib/vedeu/terminal_test.rb +6 -10
- data/vedeu.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adbde558d3cfb0668d3d05c5e21effc821b92ab4
|
4
|
+
data.tar.gz: 1bef10fb655bcbc83cee7796ba12269a114321f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24481b866de7f7aa5042a7575aa0e67bf99dd7230bb1085c22c2334a796309bd5a94095539e54b26d7e1c8bcb9450891d015b4eac65597b630038e619dad54a0
|
7
|
+
data.tar.gz: a8423cfe4e0c26e88e5a3ef60d0ed4f8b5dde4725b4a89492285dad0b1c3dfe0096d9f1a736f9ac7f81491b01d1f7b734cad345a747154e5017a9be4ca8ee56e
|
@@ -29,7 +29,7 @@ module Vedeu
|
|
29
29
|
def controller(controller_name = nil)
|
30
30
|
@controller_name = controller_name
|
31
31
|
|
32
|
-
Vedeu::Router.add_controller(controller_name, ancestors.
|
32
|
+
Vedeu::Router.add_controller(controller_name, ancestors[0].to_s)
|
33
33
|
end
|
34
34
|
alias_method :controller_name, :controller
|
35
35
|
|
@@ -72,7 +72,7 @@ module Vedeu
|
|
72
72
|
# @param klass [Class]
|
73
73
|
# @return [void]
|
74
74
|
def self.included(klass)
|
75
|
-
klass.send
|
75
|
+
klass.send(:extend, ClassMethods)
|
76
76
|
end
|
77
77
|
|
78
78
|
end # Controller
|
@@ -56,7 +56,7 @@ module Vedeu
|
|
56
56
|
# defined colour for a particular interface, line or stream overrides
|
57
57
|
# previously defined entries in the same block.
|
58
58
|
#
|
59
|
-
# @param
|
59
|
+
# @param attrs [Hash] See {Vedeu::Colour}
|
60
60
|
#
|
61
61
|
# @example
|
62
62
|
# interface 'my_interface' do
|
@@ -75,8 +75,8 @@ module Vedeu
|
|
75
75
|
# end
|
76
76
|
#
|
77
77
|
# @return [Vedeu::Colour]
|
78
|
-
def colour(
|
79
|
-
model.colour = Vedeu::Colour.coerce(colour_attributes.merge(
|
78
|
+
def colour(attrs = {})
|
79
|
+
model.colour = Vedeu::Colour.coerce(colour_attributes.merge!(attrs))
|
80
80
|
end
|
81
81
|
|
82
82
|
# Define a style or styles for an interface, line or a stream.
|
data/lib/vedeu/dsl/use.rb
CHANGED
@@ -6,40 +6,6 @@ module Vedeu
|
|
6
6
|
#
|
7
7
|
module Use
|
8
8
|
|
9
|
-
# Duplicate a stored model.
|
10
|
-
#
|
11
|
-
# This DSL method copies the attributes of a stored model, changes the
|
12
|
-
# name to that of the current model, and stores the duplicate as a new
|
13
|
-
# model in model's repository.
|
14
|
-
#
|
15
|
-
# @example
|
16
|
-
# # Here the attributes of 'my_geometry' are used to create the
|
17
|
-
# # new model 'my_other_geometry'.
|
18
|
-
# Vedeu.geometry 'my_other_geometry' do
|
19
|
-
# duplicate('my_geometry')
|
20
|
-
# end
|
21
|
-
#
|
22
|
-
# @note
|
23
|
-
# - Only models of the same repository can be used in this way.
|
24
|
-
# - If the stored model cannot be found, the duplicate may not have
|
25
|
-
# the values you required.
|
26
|
-
# - Values defined before will be overwritten by the new values from
|
27
|
-
# the stored model.
|
28
|
-
# - Values defined after will overwrite the values of the new
|
29
|
-
# duplicate model.
|
30
|
-
#
|
31
|
-
# @param name [String] The name of the model to duplicate.
|
32
|
-
# @return [void] The new model based on the original.
|
33
|
-
def duplicate(name)
|
34
|
-
original = use(name)
|
35
|
-
|
36
|
-
unless original.respond_to?(:null?)
|
37
|
-
duplicated = original.dup
|
38
|
-
duplicated.name = model.name
|
39
|
-
duplicated.store
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
9
|
# Use the attribute of stored model.
|
44
10
|
#
|
45
11
|
# This DSL method provides access to a stored model by name. You can
|
data/lib/vedeu/events/event.rb
CHANGED
@@ -80,7 +80,7 @@ module Vedeu
|
|
80
80
|
def bind(name, options = {}, &block)
|
81
81
|
Vedeu.log(type: :event, message: "Binding: '#{name.inspect}'")
|
82
82
|
|
83
|
-
new(name,
|
83
|
+
new(name, block, options).bind
|
84
84
|
end
|
85
85
|
alias_method :event, :bind
|
86
86
|
alias_method :register, :bind
|
@@ -125,7 +125,7 @@ module Vedeu
|
|
125
125
|
#
|
126
126
|
# @param (see Vedeu::Event.bind)
|
127
127
|
# @return [Vedeu::Event]
|
128
|
-
def initialize(name, options = {}
|
128
|
+
def initialize(name, closure, options = {})
|
129
129
|
@name = name
|
130
130
|
@options = options
|
131
131
|
@closure = closure
|
data/lib/vedeu/events/trigger.rb
CHANGED
data/lib/vedeu/geometry/area.rb
CHANGED
@@ -49,7 +49,7 @@ module Vedeu
|
|
49
49
|
maximised: attributes[:maximised],
|
50
50
|
centred: attributes[:centred])
|
51
51
|
|
52
|
-
new(y: y_yn
|
52
|
+
new(y: y_yn[0], yn: y_yn[-1], x: x_xn[0], xn: x_xn[-1])
|
53
53
|
end
|
54
54
|
|
55
55
|
# Returns a new instance of Vedeu::Area.
|
@@ -29,14 +29,14 @@ module Vedeu
|
|
29
29
|
#
|
30
30
|
# @return [Fixnum]
|
31
31
|
def d1
|
32
|
-
dimension
|
32
|
+
dimension[0] < 1 ? 1 : dimension[0]
|
33
33
|
end
|
34
34
|
|
35
35
|
# Fetch the ending coordinate.
|
36
36
|
#
|
37
37
|
# @return [Fixnum]
|
38
38
|
def d2
|
39
|
-
dimension
|
39
|
+
dimension[-1]
|
40
40
|
end
|
41
41
|
|
42
42
|
# Fetch the coordinates.
|
data/lib/vedeu/input/input.rb
CHANGED
data/lib/vedeu/log/log.rb
CHANGED
@@ -52,7 +52,9 @@ module Vedeu
|
|
52
52
|
|
53
53
|
# @return [void]
|
54
54
|
def close
|
55
|
-
@dev.close
|
55
|
+
@dev.close
|
56
|
+
rescue
|
57
|
+
nil
|
56
58
|
end
|
57
59
|
|
58
60
|
private
|
@@ -168,7 +170,7 @@ module Vedeu
|
|
168
170
|
# @param body [String] The log message itself.
|
169
171
|
# @return [String]
|
170
172
|
def message_body(type, body)
|
171
|
-
Vedeu::Esc.send(message_types.fetch(type, :default)
|
173
|
+
Vedeu::Esc.send(message_types.fetch(type, :default)[-1]) do
|
172
174
|
body
|
173
175
|
end
|
174
176
|
end
|
@@ -179,7 +181,7 @@ module Vedeu
|
|
179
181
|
# @param type [Symbol] The type of log message.
|
180
182
|
# @return [String]
|
181
183
|
def message_type(type)
|
182
|
-
Vedeu::Esc.send(message_types.fetch(type, :default)
|
184
|
+
Vedeu::Esc.send(message_types.fetch(type, :default)[0]) do
|
183
185
|
"[#{type}]".ljust(9)
|
184
186
|
end
|
185
187
|
end
|
data/lib/vedeu/models/focus.rb
CHANGED
@@ -53,7 +53,7 @@ module Vedeu
|
|
53
53
|
# @param name [String]
|
54
54
|
# @return [void]
|
55
55
|
def hide(name = nil)
|
56
|
-
model_by_name(
|
56
|
+
model_by_name(repository, name).hide
|
57
57
|
end
|
58
58
|
alias_method :hide_cursor, :hide
|
59
59
|
alias_method :hide_group, :hide
|
@@ -64,7 +64,7 @@ module Vedeu
|
|
64
64
|
# @param name [String]
|
65
65
|
# @return [void]
|
66
66
|
def show(name = nil)
|
67
|
-
model_by_name(
|
67
|
+
model_by_name(repository, name).show
|
68
68
|
end
|
69
69
|
alias_method :show_cursor, :show
|
70
70
|
alias_method :show_group, :show
|
@@ -75,7 +75,7 @@ module Vedeu
|
|
75
75
|
# @param name [String]
|
76
76
|
# @return [void]
|
77
77
|
def toggle(name = nil)
|
78
|
-
model_by_name(
|
78
|
+
model_by_name(repository, name).toggle
|
79
79
|
end
|
80
80
|
alias_method :toggle_cursor, :toggle
|
81
81
|
alias_method :toggle_group, :toggle
|
@@ -88,7 +88,7 @@ module Vedeu
|
|
88
88
|
# @param name [String]
|
89
89
|
# @param klass [void] The repository of the model.
|
90
90
|
# @return [void]
|
91
|
-
def model_by_name(name = nil
|
91
|
+
def model_by_name(klass, name = nil)
|
92
92
|
klass.by_name(name || Vedeu.focus)
|
93
93
|
end
|
94
94
|
|
@@ -100,7 +100,7 @@ module Vedeu
|
|
100
100
|
# @param klass [Class]
|
101
101
|
# @return [void]
|
102
102
|
def self.included(klass)
|
103
|
-
klass.send
|
103
|
+
klass.send(:extend, ClassMethods)
|
104
104
|
end
|
105
105
|
|
106
106
|
end # Toggleable
|
data/lib/vedeu/null/interface.rb
CHANGED
@@ -31,7 +31,7 @@ module Vedeu
|
|
31
31
|
def initialize(attributes = {})
|
32
32
|
@attributes = attributes
|
33
33
|
@name = @attributes[:name]
|
34
|
-
@visible =
|
34
|
+
@visible = false
|
35
35
|
end
|
36
36
|
|
37
37
|
# @return [NilClass]
|
@@ -56,13 +56,6 @@ module Vedeu
|
|
56
56
|
self
|
57
57
|
end
|
58
58
|
|
59
|
-
# The null interface should not be visible.
|
60
|
-
#
|
61
|
-
# @return [FalseClass]
|
62
|
-
def visible?
|
63
|
-
false
|
64
|
-
end
|
65
|
-
|
66
59
|
end # Interface
|
67
60
|
|
68
61
|
end # Null
|
data/lib/vedeu/null/view.rb
CHANGED
@@ -31,7 +31,7 @@ module Vedeu
|
|
31
31
|
def initialize(attributes = {})
|
32
32
|
@attributes = attributes
|
33
33
|
@name = @attributes[:name]
|
34
|
-
@visible =
|
34
|
+
@visible = false
|
35
35
|
end
|
36
36
|
|
37
37
|
# @return [NilClass]
|
@@ -53,13 +53,6 @@ module Vedeu
|
|
53
53
|
self
|
54
54
|
end
|
55
55
|
|
56
|
-
# The null interface should not be visible.
|
57
|
-
#
|
58
|
-
# @return [FalseClass]
|
59
|
-
def visible?
|
60
|
-
false
|
61
|
-
end
|
62
|
-
|
63
56
|
end # View
|
64
57
|
|
65
58
|
end # Null
|
@@ -50,7 +50,7 @@ module Vedeu
|
|
50
50
|
|
51
51
|
# @return [Vedeu::Colour|Hash<Symbol => Symbol>]
|
52
52
|
def default_colour
|
53
|
-
if
|
53
|
+
if options[:name]
|
54
54
|
interface.colour
|
55
55
|
|
56
56
|
else
|
@@ -64,7 +64,7 @@ module Vedeu
|
|
64
64
|
|
65
65
|
# @return [Symbol]
|
66
66
|
def default_style
|
67
|
-
if
|
67
|
+
if options[:name]
|
68
68
|
interface.style
|
69
69
|
|
70
70
|
else
|
@@ -75,7 +75,7 @@ module Vedeu
|
|
75
75
|
|
76
76
|
# @return [Vedeu::Interface]
|
77
77
|
def interface
|
78
|
-
Vedeu.interfaces.by_name(options[:name])
|
78
|
+
Vedeu.interfaces.by_name(options[:name])
|
79
79
|
end
|
80
80
|
alias_method :interface?, :interface
|
81
81
|
|
data/lib/vedeu/terminal.rb
CHANGED
@@ -135,7 +135,7 @@ module Vedeu
|
|
135
135
|
#
|
136
136
|
# @return [Fixnum]
|
137
137
|
def centre_y
|
138
|
-
centre
|
138
|
+
centre[0]
|
139
139
|
end
|
140
140
|
|
141
141
|
# Returns the `x` (column/character) component of the coodinate tuple
|
@@ -143,7 +143,7 @@ module Vedeu
|
|
143
143
|
#
|
144
144
|
# @return [Fixnum]
|
145
145
|
def centre_x
|
146
|
-
centre
|
146
|
+
centre[-1]
|
147
147
|
end
|
148
148
|
|
149
149
|
# Returns 1. This 1 is either the top-most or left-most coordinate of the
|
@@ -168,7 +168,7 @@ module Vedeu
|
|
168
168
|
def width
|
169
169
|
return Vedeu::Configuration.drb_width if Vedeu::Configuration.drb?
|
170
170
|
|
171
|
-
size
|
171
|
+
size[-1]
|
172
172
|
end
|
173
173
|
alias_method :xn, :width
|
174
174
|
alias_method :txn, :width
|
data/lib/vedeu/version.rb
CHANGED
@@ -7,14 +7,14 @@ module Vedeu
|
|
7
7
|
let(:described) { Vedeu::Bindings }
|
8
8
|
|
9
9
|
describe '.setup!' do
|
10
|
-
before
|
10
|
+
before do
|
11
11
|
Vedeu::Bindings::Application.stubs(:setup!)
|
12
12
|
Vedeu::Bindings::Visibility.stubs(:setup!)
|
13
13
|
Vedeu::Bindings::Movement.stubs(:setup!)
|
14
14
|
Vedeu::Bindings::Menus.stubs(:setup!)
|
15
15
|
Vedeu::Bindings::DRB.stubs(:setup!)
|
16
16
|
Vedeu::Bindings::System.stubs(:setup!)
|
17
|
-
|
17
|
+
end
|
18
18
|
|
19
19
|
subject { described.setup! }
|
20
20
|
|
@@ -29,9 +29,7 @@ module Vedeu
|
|
29
29
|
}
|
30
30
|
let(:geometry) {}
|
31
31
|
|
32
|
-
before {
|
33
|
-
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
34
|
-
}
|
32
|
+
before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
|
35
33
|
|
36
34
|
describe '.build' do
|
37
35
|
subject {
|
@@ -422,9 +420,7 @@ module Vedeu
|
|
422
420
|
}
|
423
421
|
let(:interface) { Vedeu::Interface.new(visible: visibility) }
|
424
422
|
|
425
|
-
before {
|
426
|
-
Vedeu.interfaces.stubs(:by_name).returns(interface)
|
427
|
-
}
|
423
|
+
before { Vedeu.interfaces.stubs(:by_name).returns(interface) }
|
428
424
|
|
429
425
|
subject { instance.render }
|
430
426
|
|