vedeu 0.4.63 → 0.4.64
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/lib/vedeu.rb +1 -0
- data/lib/vedeu/application/controller.rb +9 -3
- data/lib/vedeu/bindings/application.rb +1 -0
- data/lib/vedeu/bindings/system.rb +1 -1
- data/lib/vedeu/colours/colour.rb +1 -0
- data/lib/vedeu/configuration/configuration.rb +1 -0
- data/lib/vedeu/cursor/reposition.rb +2 -2
- data/lib/vedeu/distributed/client.rb +4 -3
- data/lib/vedeu/distributed/subprocess.rb +1 -0
- data/lib/vedeu/distributed/test_application.rb +1 -0
- data/lib/vedeu/dsl/geometry.rb +2 -2
- data/lib/vedeu/geometry/area.rb +14 -14
- data/lib/vedeu/geometry/geometry.rb +16 -2
- data/lib/vedeu/geometry/position_index.rb +2 -2
- data/lib/vedeu/geometry/position_validator.rb +2 -2
- data/lib/vedeu/output/style.rb +1 -0
- data/lib/vedeu/output/virtual_terminal.rb +4 -4
- data/lib/vedeu/runtime/bootstrap.rb +1 -0
- data/lib/vedeu/runtime/launcher.rb +5 -2
- data/lib/vedeu/runtime/router.rb +9 -0
- data/lib/vedeu/traps.rb +0 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/controller_test.rb +3 -1
- data/test/lib/vedeu/dsl/geometry_test.rb +2 -2
- data/vedeu.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32a9c9990ac18d631952547ac6fb6270fce65d3
|
4
|
+
data.tar.gz: c246ba1065c2cc51e843d8bac331fff26752ac0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f122e786688becea11c0709cbbb31f246d4beb9a9b37a0238d48e43fafa94e1282ee333942457ecff92096b2341684df300ef1b7d009dcd0acd7d37c507258e8
|
7
|
+
data.tar.gz: 2eccc4215c84e205cddf9bd6823bb3df16f0c380beb048d97c070d84fd69a70e7323e0e890df9050ff9f33851a309bb947daac9db04721494a8493f259681ac3
|
data/lib/vedeu.rb
CHANGED
@@ -43,6 +43,8 @@ module Vedeu
|
|
43
43
|
#
|
44
44
|
# action :show
|
45
45
|
# # or...
|
46
|
+
# actions :show, :list
|
47
|
+
# # or...
|
46
48
|
# action_name :show
|
47
49
|
#
|
48
50
|
# # ... some code
|
@@ -51,12 +53,16 @@ module Vedeu
|
|
51
53
|
#
|
52
54
|
# Vedeu.trigger(:_goto_, :your_controller, :show, { some: :args })
|
53
55
|
#
|
54
|
-
# @param
|
56
|
+
# @param action_names [Array<Symbol>, Symbol] A collection of action names
|
57
|
+
# or the name of the action.
|
55
58
|
# @return [void]
|
56
|
-
def action(
|
57
|
-
|
59
|
+
def action(*action_names)
|
60
|
+
action_names.each do |action_name|
|
61
|
+
Vedeu::Router.add_action(@controller_name, action_name)
|
62
|
+
end
|
58
63
|
end
|
59
64
|
alias_method :action_name, :action
|
65
|
+
alias_method :actions, :action
|
60
66
|
|
61
67
|
end # ClassMethods
|
62
68
|
|
data/lib/vedeu/colours/colour.rb
CHANGED
@@ -14,8 +14,8 @@ module Vedeu
|
|
14
14
|
#
|
15
15
|
# @param entity [void]
|
16
16
|
# @param name [String]
|
17
|
-
# @param y [Fixnum]
|
18
|
-
# @param x [Fixnum]
|
17
|
+
# @param y [Fixnum] The row/line position.
|
18
|
+
# @param x [Fixnum] The column/character position.
|
19
19
|
# @return [Vedeu::Reposition]
|
20
20
|
def initialize(entity, name, y, x)
|
21
21
|
@entity = entity
|
@@ -35,7 +35,8 @@ module Vedeu
|
|
35
35
|
drb_connection_error
|
36
36
|
|
37
37
|
rescue DRb::DRbBadURI
|
38
|
-
|
38
|
+
Vedeu.log_stdout(message: 'Could not connect to DRb server, URI may ' \
|
39
|
+
'be bad.')
|
39
40
|
|
40
41
|
:drb_bad_uri
|
41
42
|
end
|
@@ -79,7 +80,7 @@ module Vedeu
|
|
79
80
|
drb_connection_error
|
80
81
|
|
81
82
|
rescue Interrupt
|
82
|
-
|
83
|
+
Vedeu.log_stdout(message: 'Client application exited.')
|
83
84
|
|
84
85
|
ensure
|
85
86
|
:shutdown
|
@@ -100,7 +101,7 @@ module Vedeu
|
|
100
101
|
|
101
102
|
# @return [Symbol]
|
102
103
|
def drb_connection_error
|
103
|
-
|
104
|
+
Vedeu.log_stdout(message: 'Could not connect to DRb server.')
|
104
105
|
|
105
106
|
:drb_connection_error
|
106
107
|
end
|
data/lib/vedeu/dsl/geometry.rb
CHANGED
@@ -150,7 +150,7 @@ module Vedeu
|
|
150
150
|
# @param value [Fixnum]
|
151
151
|
# @return [Fixnum]
|
152
152
|
def height(value)
|
153
|
-
model.height = value
|
153
|
+
model.height = proc { value }
|
154
154
|
end
|
155
155
|
|
156
156
|
# Returns the height in characters for the number of rows specified.
|
@@ -182,7 +182,7 @@ module Vedeu
|
|
182
182
|
# @param value [Fixnum]
|
183
183
|
# @return [Fixnum]
|
184
184
|
def width(value)
|
185
|
-
model.width = value
|
185
|
+
model.width = proc { value }
|
186
186
|
end
|
187
187
|
|
188
188
|
# Specify the starting x position (column) of the interface.
|
data/lib/vedeu/geometry/area.rb
CHANGED
@@ -36,28 +36,28 @@ module Vedeu
|
|
36
36
|
# @option attributes options [Hash<Symbol => Boolean>]
|
37
37
|
# @return [Vedeu::Area]
|
38
38
|
def self.from_attributes(attributes = {})
|
39
|
-
y_yn = Vedeu::Dimension.pair(d:
|
40
|
-
dn:
|
41
|
-
d_dn:
|
42
|
-
default:
|
39
|
+
y_yn = Vedeu::Dimension.pair(d: attributes[:y],
|
40
|
+
dn: attributes[:yn],
|
41
|
+
d_dn: attributes[:y_yn],
|
42
|
+
default: attributes[:y_default],
|
43
43
|
maximised: attributes[:maximised],
|
44
|
-
centred:
|
45
|
-
x_xn = Vedeu::Dimension.pair(d:
|
46
|
-
dn:
|
47
|
-
d_dn:
|
48
|
-
default:
|
44
|
+
centred: attributes[:centred])
|
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
49
|
maximised: attributes[:maximised],
|
50
|
-
centred:
|
50
|
+
centred: attributes[:centred])
|
51
51
|
|
52
52
|
new(y: y_yn.first, yn: y_yn.last, x: x_xn.first, xn: x_xn.last)
|
53
53
|
end
|
54
54
|
|
55
55
|
# Returns a new instance of Vedeu::Area.
|
56
56
|
#
|
57
|
-
# @param y [Fixnum]
|
58
|
-
# @param yn [Fixnum]
|
59
|
-
# @param x [Fixnum]
|
60
|
-
# @param xn [Fixnum]
|
57
|
+
# @param y [Fixnum] The starting row/line position.
|
58
|
+
# @param yn [Fixnum] The ending row/line position.
|
59
|
+
# @param x [Fixnum] The starting column/character position.
|
60
|
+
# @param xn [Fixnum] The ending column/character position.
|
61
61
|
# @return [Vedeu::Area]
|
62
62
|
def initialize(y:, yn:, x:, xn:)
|
63
63
|
@y = y
|
@@ -153,11 +153,11 @@ module Vedeu
|
|
153
153
|
@area = Vedeu::Area.from_attributes(
|
154
154
|
y: _y,
|
155
155
|
yn: _yn,
|
156
|
-
y_yn:
|
156
|
+
y_yn: _height,
|
157
157
|
y_default: Vedeu.height,
|
158
158
|
x: _x,
|
159
159
|
xn: _xn,
|
160
|
-
x_xn:
|
160
|
+
x_xn: _width,
|
161
161
|
x_default: Vedeu.width,
|
162
162
|
centred: centred,
|
163
163
|
maximised: maximised,
|
@@ -192,6 +192,20 @@ module Vedeu
|
|
192
192
|
@xn.is_a?(Proc) ? @xn.call : @xn
|
193
193
|
end
|
194
194
|
|
195
|
+
# Returns the width of the interface.
|
196
|
+
#
|
197
|
+
# @return [Fixnum]
|
198
|
+
def _width
|
199
|
+
@width.is_a?(Proc) ? @width.call : @width
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the height of the interface.
|
203
|
+
#
|
204
|
+
# @return [Fixnum]
|
205
|
+
def _height
|
206
|
+
@height.is_a?(Proc) ? @height.call : @height
|
207
|
+
end
|
208
|
+
|
195
209
|
# Returns the default options/attributes for this class.
|
196
210
|
#
|
197
211
|
# @return [Hash]
|
@@ -14,8 +14,8 @@ module Vedeu
|
|
14
14
|
|
15
15
|
# Returns a new instance of Vedeu::PositionIndex.
|
16
16
|
#
|
17
|
-
# @param y [Fixnum]
|
18
|
-
# @param x [Fixnum]
|
17
|
+
# @param y [Fixnum] The row/line coordinate.
|
18
|
+
# @param x [Fixnum] The column/character coordinate.
|
19
19
|
# @return [Vedeu::PositionIndex]
|
20
20
|
def initialize(y, x)
|
21
21
|
@y = y
|
@@ -29,8 +29,8 @@ module Vedeu
|
|
29
29
|
# Returns a new instance of Vedeu::PositionValidator.
|
30
30
|
#
|
31
31
|
# @param name [String]
|
32
|
-
# @param
|
33
|
-
# @param
|
32
|
+
# @param y [Fixnum] The row/line coordinate.
|
33
|
+
# @param x [Fixnum] The column/character coordinate.
|
34
34
|
# @return [Vedeu::PositionValidator]
|
35
35
|
def initialize(name, x, y)
|
36
36
|
@name = name
|
data/lib/vedeu/output/style.rb
CHANGED
@@ -44,8 +44,8 @@ module Vedeu
|
|
44
44
|
# Convert to coordinate indices (cy, cx) e.g. (0, 0)
|
45
45
|
# Fetch the row at cy and return the cell from cx
|
46
46
|
#
|
47
|
-
# @param y [Fixnum]
|
48
|
-
# @param x [Fixnum]
|
47
|
+
# @param y [Fixnum] The row/line coordinate.
|
48
|
+
# @param x [Fixnum] The column/character coordinate.
|
49
49
|
# @return [Vedeu::Char]
|
50
50
|
def read(y, x)
|
51
51
|
cy, cx = Vedeu::PositionIndex[y, x]
|
@@ -89,8 +89,8 @@ module Vedeu
|
|
89
89
|
# If the position (y, x) is nil; we're out of bounds.
|
90
90
|
# Otherwise, write the data to (cy, cx).
|
91
91
|
#
|
92
|
-
# @param y [Fixnum]
|
93
|
-
# @param x [Fixnum]
|
92
|
+
# @param y [Fixnum] The row/line coordinate.
|
93
|
+
# @param x [Fixnum] The column/character coordinate.
|
94
94
|
# @param data [Vedeu::Char]
|
95
95
|
# @return [Vedeu::Char]
|
96
96
|
def write(y, x, data)
|
@@ -78,8 +78,11 @@ module Vedeu
|
|
78
78
|
@exit_code = 0
|
79
79
|
|
80
80
|
rescue StandardError => uncaught_exception
|
81
|
-
|
82
|
-
|
81
|
+
Vedeu.log_stdout(message: uncaught_exception.message)
|
82
|
+
|
83
|
+
if configuration.debug?
|
84
|
+
Vedeu.log_stdout(message: uncaught_exception.backtrace.join("\n"))
|
85
|
+
end
|
83
86
|
end
|
84
87
|
|
85
88
|
protected
|
data/lib/vedeu/runtime/router.rb
CHANGED
@@ -21,6 +21,9 @@ module Vedeu
|
|
21
21
|
'Cannot store controller without a name attribute.'
|
22
22
|
end
|
23
23
|
|
24
|
+
Vedeu.log(type: :create,
|
25
|
+
message: "Adding ':#{controller_name}'")
|
26
|
+
|
24
27
|
if registered?(controller_name)
|
25
28
|
storage[controller_name].merge!(klass: klass)
|
26
29
|
|
@@ -42,6 +45,9 @@ module Vedeu
|
|
42
45
|
# @return [void]
|
43
46
|
def add_action(controller_name, action_name)
|
44
47
|
if present?(controller_name) && present?(action_name)
|
48
|
+
Vedeu.log(type: :create,
|
49
|
+
message: "Adding ':#{action_name}' for ':#{controller_name}'")
|
50
|
+
|
45
51
|
if registered?(controller_name)
|
46
52
|
storage[controller_name][:actions] << action_name
|
47
53
|
|
@@ -73,6 +79,9 @@ module Vedeu
|
|
73
79
|
# @return [void]
|
74
80
|
def goto(controller_name, action_name, **args)
|
75
81
|
if action_defined?(action_name, controller_name)
|
82
|
+
Vedeu.log(type: :debug,
|
83
|
+
message: "Routing: #{controller_name} #{action_name}")
|
84
|
+
|
76
85
|
controller_with(controller_name).send(action_name, args)
|
77
86
|
end
|
78
87
|
end
|
data/lib/vedeu/traps.rb
CHANGED
data/lib/vedeu/version.rb
CHANGED
@@ -37,11 +37,13 @@ module Vedeu
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe '.action' do
|
40
|
-
subject { described_model.action(:some_action) }
|
40
|
+
subject { described_model.action(:some_action, :other_action) }
|
41
41
|
|
42
42
|
it {
|
43
43
|
Vedeu::Router.expects(:add_action).
|
44
44
|
with(:some_controller, :some_action)
|
45
|
+
Vedeu::Router.expects(:add_action).
|
46
|
+
with(:some_controller, :other_action)
|
45
47
|
subject
|
46
48
|
}
|
47
49
|
end
|
@@ -77,7 +77,7 @@ module Vedeu
|
|
77
77
|
subject { instance.height(6) }
|
78
78
|
|
79
79
|
it 'sets the attribute to the value' do
|
80
|
-
subject.must_equal(6)
|
80
|
+
subject.call.must_equal(6)
|
81
81
|
end
|
82
82
|
|
83
83
|
context 'DSL #height' do
|
@@ -136,7 +136,7 @@ module Vedeu
|
|
136
136
|
subject { instance.width(25) }
|
137
137
|
|
138
138
|
it 'sets the attribute to the value' do
|
139
|
-
subject.must_equal(25)
|
139
|
+
subject.call.must_equal(25)
|
140
140
|
end
|
141
141
|
|
142
142
|
context 'DSL #width' do
|
data/vedeu.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ['Gavin Laking']
|
11
11
|
spec.email = ['gavinlaking@gmail.com']
|
12
12
|
spec.summary = 'A terminal case of wonderland.'
|
13
|
-
spec.description = 'A
|
13
|
+
spec.description = 'A framework for building GUI/TUI terminal/console ' \
|
14
14
|
'applications.'
|
15
15
|
spec.homepage = 'https://github.com/gavinlaking/vedeu'
|
16
16
|
spec.license = 'MIT'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vedeu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.64
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
@@ -206,7 +206,7 @@ dependencies:
|
|
206
206
|
- - '='
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 0.19.1
|
209
|
-
description: A
|
209
|
+
description: A framework for building GUI/TUI terminal/console applications.
|
210
210
|
email:
|
211
211
|
- gavinlaking@gmail.com
|
212
212
|
executables:
|