vedeu 0.4.58 → 0.4.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -558
- data/README.md +2 -0
- data/docs/dsl.md +66 -54
- data/lib/vedeu/all.rb +44 -16
- data/lib/vedeu/api.rb +0 -2
- data/lib/vedeu/bindings/drb.rb +0 -1
- data/lib/vedeu/bindings/menus.rb +0 -1
- data/lib/vedeu/bindings/movement.rb +0 -1
- data/lib/vedeu/bindings/system.rb +0 -1
- data/lib/vedeu/bindings/visibility.rb +0 -1
- data/lib/vedeu/bootstrap.rb +2 -2
- data/lib/vedeu/buffers/buffers.rb +0 -4
- data/lib/vedeu/cli/generator/all.rb +0 -4
- data/lib/vedeu/cli/generator/helpers.rb +0 -2
- data/lib/vedeu/cli/generator/templates/application/application.erb +8 -5
- data/lib/vedeu/cli/generator/view.rb +4 -2
- data/lib/vedeu/cli/main.rb +0 -2
- data/lib/vedeu/colours/backgrounds.rb +0 -1
- data/lib/vedeu/colours/colours.rb +0 -1
- data/lib/vedeu/colours/foregrounds.rb +0 -1
- data/lib/vedeu/configuration/api.rb +19 -6
- data/lib/vedeu/configuration/cli.rb +9 -1
- data/lib/vedeu/configuration/configuration.rb +9 -0
- data/lib/vedeu/cursor/cursor.rb +0 -2
- data/lib/vedeu/cursor/cursors.rb +0 -3
- data/lib/vedeu/debug.rb +0 -1
- data/lib/vedeu/dsl.rb +0 -1
- data/lib/vedeu/dsl/border.rb +69 -106
- data/lib/vedeu/dsl/composition.rb +1 -2
- data/lib/vedeu/dsl/geometry.rb +102 -67
- data/lib/vedeu/dsl/group.rb +21 -9
- data/lib/vedeu/dsl/interface.rb +0 -1
- data/lib/vedeu/dsl/keymap.rb +26 -36
- data/lib/vedeu/dsl/line.rb +5 -10
- data/lib/vedeu/dsl/menu.rb +7 -13
- data/lib/vedeu/dsl/presentation.rb +0 -1
- data/lib/vedeu/dsl/stream.rb +0 -1
- data/lib/vedeu/dsl/text.rb +0 -1
- data/lib/vedeu/dsl/use.rb +0 -1
- data/lib/vedeu/dsl/view.rb +28 -31
- data/lib/vedeu/events/event.rb +0 -3
- data/lib/vedeu/events/events.rb +0 -1
- data/lib/vedeu/events/trigger.rb +0 -1
- data/lib/vedeu/geometry/geometries.rb +0 -4
- data/lib/vedeu/geometry/geometry.rb +0 -2
- data/lib/vedeu/geometry/grid.rb +2 -25
- data/lib/vedeu/input/keymap.rb +0 -3
- data/lib/vedeu/input/keymaps.rb +0 -3
- data/lib/vedeu/launcher.rb +0 -1
- data/lib/vedeu/log.rb +0 -1
- data/lib/vedeu/models/char.rb +0 -5
- data/lib/vedeu/models/group.rb +0 -2
- data/lib/vedeu/models/groups.rb +0 -3
- data/lib/vedeu/models/interface.rb +0 -19
- data/lib/vedeu/models/interfaces.rb +0 -4
- data/lib/vedeu/models/menus.rb +0 -3
- data/lib/vedeu/null/interface.rb +6 -7
- data/lib/vedeu/output/border.rb +0 -2
- data/lib/vedeu/output/borders.rb +0 -4
- data/lib/vedeu/output/esc.rb +0 -1
- data/lib/vedeu/output/html_char.rb +0 -2
- data/lib/vedeu/output/refresh.rb +0 -3
- data/lib/vedeu/output/refresh_group.rb +0 -2
- data/lib/vedeu/output/renderers.rb +0 -13
- data/lib/vedeu/repositories.rb +2 -15
- data/lib/vedeu/repositories/model.rb +0 -2
- data/lib/vedeu/repositories/repository.rb +0 -2
- data/lib/vedeu/templating/template.rb +0 -2
- data/lib/vedeu/terminal.rb +0 -3
- data/lib/vedeu/timer.rb +0 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/bootstrap_test.rb +8 -1
- data/test/lib/vedeu/configuration/api_test.rb +14 -0
- data/test/lib/vedeu/configuration/cli_test.rb +15 -0
- data/test/lib/vedeu/cursor/cursor_test.rb +0 -1
- data/test/lib/vedeu/models/interface_test.rb +12 -4
- data/test/lib/vedeu/null/interface_test.rb +3 -12
- data/test/support/helpers/model_test_class.rb +0 -3
- data/test/test_helper.rb +0 -2
- data/vedeu.gemspec +1 -1
- metadata +4 -4
data/lib/vedeu/dsl/line.rb
CHANGED
@@ -4,7 +4,6 @@ module Vedeu
|
|
4
4
|
|
5
5
|
# Provides methods to be used to define views.
|
6
6
|
#
|
7
|
-
# @example
|
8
7
|
# Vedeu.renders do
|
9
8
|
# view 'my_interface' do
|
10
9
|
# lines do
|
@@ -31,7 +30,6 @@ module Vedeu
|
|
31
30
|
# end
|
32
31
|
# end
|
33
32
|
#
|
34
|
-
# @api public
|
35
33
|
class Line
|
36
34
|
|
37
35
|
include Vedeu::DSL
|
@@ -50,14 +48,13 @@ module Vedeu
|
|
50
48
|
|
51
49
|
# Specify a single line in a view.
|
52
50
|
#
|
53
|
-
# @example
|
54
51
|
# Vedeu.renders do
|
55
52
|
# view 'my_interface' do
|
56
53
|
# line 'some text...'
|
57
|
-
# # ...
|
54
|
+
# # ... some code
|
58
55
|
#
|
59
56
|
# line do
|
60
|
-
# # ...
|
57
|
+
# # ... some code
|
61
58
|
# end
|
62
59
|
# end
|
63
60
|
# end
|
@@ -85,23 +82,21 @@ module Vedeu
|
|
85
82
|
# Define multiple streams (a stream is a subset of a line).
|
86
83
|
# Uses {Vedeu::DSL::Stream} for all directives within the required block.
|
87
84
|
#
|
88
|
-
# @param block [Proc]
|
89
|
-
#
|
90
|
-
# @example
|
91
85
|
# Vedeu.renders do
|
92
86
|
# view 'my_interface' do
|
93
87
|
# line do
|
94
88
|
# streams do
|
95
|
-
# # ...
|
89
|
+
# # ... some code
|
96
90
|
# end
|
97
91
|
#
|
98
92
|
# stream do
|
99
|
-
# # ...
|
93
|
+
# # ... some code
|
100
94
|
# end
|
101
95
|
# end
|
102
96
|
# end
|
103
97
|
# end
|
104
98
|
#
|
99
|
+
# @param block [Proc]
|
105
100
|
# @raise [Vedeu::InvalidSyntax] The required block was not given.
|
106
101
|
# @return [Vedeu::Streams<Vedeu::Stream>]
|
107
102
|
# @see Vedeu::DSL::Stream for subdirectives.
|
data/lib/vedeu/dsl/menu.rb
CHANGED
@@ -5,7 +5,6 @@ module Vedeu
|
|
5
5
|
# Provides the mechanism to create menus within client applications and use
|
6
6
|
# events to drive them.
|
7
7
|
#
|
8
|
-
# @api public
|
9
8
|
class Menu
|
10
9
|
|
11
10
|
include Vedeu::DSL
|
@@ -24,8 +23,7 @@ module Vedeu
|
|
24
23
|
#
|
25
24
|
# @param element [Object] An object you wish to add to the collection.
|
26
25
|
#
|
27
|
-
#
|
28
|
-
# menu 'my_menu' do
|
26
|
+
# Vedeu.menu 'my_menu' do
|
29
27
|
# item SomeClass.new
|
30
28
|
# item SomeClass.new
|
31
29
|
# end
|
@@ -41,18 +39,16 @@ module Vedeu
|
|
41
39
|
# In the 'my_playlist' example below, your `Track` model may return a
|
42
40
|
# collection of tracks to populate the menu.
|
43
41
|
#
|
44
|
-
#
|
45
|
-
# the menu items.
|
46
|
-
#
|
47
|
-
# @example
|
48
|
-
# menu 'my_menu' do
|
42
|
+
# Vedeu.menu 'my_menu' do
|
49
43
|
# items [:item_1, :item_2, :item_3]
|
50
44
|
# end
|
51
45
|
#
|
52
|
-
# menu 'my_playlist' do
|
46
|
+
# Vedeu.menu 'my_playlist' do
|
53
47
|
# items Track.all_my_favourites
|
54
48
|
# end
|
55
49
|
#
|
50
|
+
# @param collection [Array<Object>] A collection of objects which make up
|
51
|
+
# the menu items.
|
56
52
|
# @return [Array]
|
57
53
|
def items(collection = [])
|
58
54
|
model.collection = collection
|
@@ -61,14 +57,12 @@ module Vedeu
|
|
61
57
|
# The name of the menu. Used to reference the menu throughout your
|
62
58
|
# application's execution lifetime.
|
63
59
|
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
# @example
|
67
|
-
# menu do
|
60
|
+
# Vedeu.menu do
|
68
61
|
# name 'my_menu'
|
69
62
|
# # ...
|
70
63
|
# end
|
71
64
|
#
|
65
|
+
# @param value [String]
|
72
66
|
# @return [String]
|
73
67
|
def name(value)
|
74
68
|
model.name = value
|
data/lib/vedeu/dsl/stream.rb
CHANGED
data/lib/vedeu/dsl/text.rb
CHANGED
data/lib/vedeu/dsl/use.rb
CHANGED
data/lib/vedeu/dsl/view.rb
CHANGED
@@ -4,7 +4,6 @@ module Vedeu
|
|
4
4
|
|
5
5
|
# DSL for creating views.
|
6
6
|
#
|
7
|
-
# @api public
|
8
7
|
class View
|
9
8
|
|
10
9
|
class << self
|
@@ -13,25 +12,22 @@ module Vedeu
|
|
13
12
|
# or command. This provides the means for you to define your the views
|
14
13
|
# of your application without their content.
|
15
14
|
#
|
16
|
-
# @todo More documentation required.
|
17
|
-
#
|
18
|
-
# @param name [String] The name of the interface. Used to reference the
|
19
|
-
# interface throughout your application's execution lifetime.
|
20
|
-
# @param block [Proc] A set of attributes which define the features of
|
21
|
-
# the interface.
|
22
|
-
#
|
23
|
-
# @example
|
24
15
|
# Vedeu.interface 'my_interface' do
|
25
|
-
# # ...
|
16
|
+
# # ... some code
|
26
17
|
# end
|
27
18
|
#
|
28
19
|
# Vedeu.interface do
|
29
20
|
# name 'interfaces_must_have_a_name'
|
30
|
-
# # ...
|
21
|
+
# # ... some code
|
31
22
|
# end
|
32
23
|
#
|
24
|
+
# @param name [String] The name of the interface. Used to reference the
|
25
|
+
# interface throughout your application's execution lifetime.
|
26
|
+
# @param block [Proc] A set of attributes which define the features of
|
27
|
+
# the interface.
|
33
28
|
# @raise [Vedeu::InvalidSyntax] The required block was not given.
|
34
29
|
# @return [Vedeu::Interface]
|
30
|
+
# @todo More documentation required.
|
35
31
|
def interface(name = '', &block)
|
36
32
|
fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
|
37
33
|
|
@@ -40,22 +36,26 @@ module Vedeu
|
|
40
36
|
Vedeu::Interface.build(attributes, &block).store
|
41
37
|
end
|
42
38
|
|
43
|
-
# Immediate render
|
44
|
-
#
|
45
39
|
# Directly write a view buffer to the terminal. Using this method means
|
46
40
|
# that the refresh event does not need to be triggered after creating
|
47
41
|
# the views, though can be later triggered if needed.
|
48
42
|
#
|
49
|
-
# @param block [Proc] The directives you wish to send to render.
|
50
|
-
# Typically includes `view` with associated sub-directives.
|
51
|
-
#
|
52
|
-
# @example
|
53
43
|
# Vedeu.renders do
|
54
44
|
# view 'my_interface' do
|
55
|
-
# # ...
|
45
|
+
# # ... some code
|
56
46
|
# end
|
57
47
|
# end
|
58
48
|
#
|
49
|
+
# # or...
|
50
|
+
#
|
51
|
+
# Vedeu.render do
|
52
|
+
# view 'my_interface' do
|
53
|
+
# # ... some code
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# @param block [Proc] The directives you wish to send to render.
|
58
|
+
# Typically includes `view` with associated sub-directives.
|
59
59
|
# @raise [Vedeu::InvalidSyntax] The required block was not given.
|
60
60
|
# @return [Array<Interface>]
|
61
61
|
def render(&block)
|
@@ -65,20 +65,14 @@ module Vedeu
|
|
65
65
|
end
|
66
66
|
alias_method :renders, :render
|
67
67
|
|
68
|
-
# Deferred view
|
69
|
-
#
|
70
68
|
# Define a view (content) for an interface.
|
71
69
|
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
70
|
+
# The views declared within this block are stored in their respective
|
71
|
+
# interface back buffers until a refresh event occurs. When the refresh
|
72
|
+
# event is triggered, the back buffers are swapped into the front
|
73
|
+
# buffers and the content here will be rendered to
|
74
|
+
# {Vedeu::Terminal.output}.
|
77
75
|
#
|
78
|
-
# @param block [Proc] The directives you wish to send to render.
|
79
|
-
# Typically includes `view` with associated sub-directives.
|
80
|
-
#
|
81
|
-
# @example
|
82
76
|
# Vedeu.views do
|
83
77
|
# view 'my_interface' do
|
84
78
|
# # ... some attributes ...
|
@@ -86,16 +80,19 @@ module Vedeu
|
|
86
80
|
# view 'my_other_interface' do
|
87
81
|
# # ... some other attributes ...
|
88
82
|
# end
|
89
|
-
# # ...
|
83
|
+
# # ... some code
|
90
84
|
# end
|
91
85
|
#
|
86
|
+
# @param block [Proc] The directives you wish to send to render.
|
87
|
+
# Typically includes `view` with associated sub-directives.
|
92
88
|
# @raise [Vedeu::InvalidSyntax] The required block was not given.
|
93
89
|
# @return [Array<Interface>]
|
94
|
-
def
|
90
|
+
def view(&block)
|
95
91
|
fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
|
96
92
|
|
97
93
|
store(:store_deferred, &block)
|
98
94
|
end
|
95
|
+
alias_method :views, :view
|
99
96
|
|
100
97
|
private
|
101
98
|
|
data/lib/vedeu/events/event.rb
CHANGED
data/lib/vedeu/events/events.rb
CHANGED
data/lib/vedeu/events/trigger.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
require 'vedeu/null/geometry'
|
2
|
-
require 'vedeu/geometry/geometry'
|
3
|
-
|
4
1
|
module Vedeu
|
5
2
|
|
6
3
|
# Allows the storing of interface/view geometry independent of the interface
|
7
4
|
# instance.
|
8
5
|
#
|
9
|
-
# @api public
|
10
6
|
class Geometries < Vedeu::Repository
|
11
7
|
|
12
8
|
class << self
|
data/lib/vedeu/geometry/grid.rb
CHANGED
@@ -5,7 +5,6 @@ module Vedeu
|
|
5
5
|
# width is not a multiple of 12, then Grid chooses the maximum value which
|
6
6
|
# will fit.
|
7
7
|
#
|
8
|
-
# @api public
|
9
8
|
class Grid
|
10
9
|
|
11
10
|
# @see #initialize
|
@@ -28,18 +27,7 @@ module Vedeu
|
|
28
27
|
@value = value
|
29
28
|
end
|
30
29
|
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# @example
|
34
|
-
# Vedeu.geometry 'main_interface' do
|
35
|
-
# width: columns(9) # Vedeu.width # => 92 (for example)
|
36
|
-
# # 92 / 12 = 7
|
37
|
-
# # 7 * 9 = 63
|
38
|
-
# # Therefore, width is 63 characters.
|
39
|
-
#
|
40
|
-
# @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
|
41
|
-
# 12 inclusive.
|
42
|
-
# @return [Fixnum|Vedeu::OutOfRange]
|
30
|
+
# @see Vedeu::DSL::Geometry#columns
|
43
31
|
def columns
|
44
32
|
fail Vedeu::OutOfRange,
|
45
33
|
'Valid value between 1 and 12 inclusive.' if out_of_range?
|
@@ -47,18 +35,7 @@ module Vedeu
|
|
47
35
|
column * value
|
48
36
|
end
|
49
37
|
|
50
|
-
#
|
51
|
-
#
|
52
|
-
# @example
|
53
|
-
# Vedeu.geometry 'main_interface' do
|
54
|
-
# height: rows(3) # Vedeu.height # => 38 (for example)
|
55
|
-
# # 38 / 12 = 3
|
56
|
-
# # 3 * 3 = 9
|
57
|
-
# # Therefore, height is 9 characters.
|
58
|
-
#
|
59
|
-
# @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
|
60
|
-
# 12 inclusive.
|
61
|
-
# @return [Fixnum|Vedeu::OutOfRange]
|
38
|
+
# @see Vedeu::DSL::Geometry#rows
|
62
39
|
def rows
|
63
40
|
fail Vedeu::OutOfRange,
|
64
41
|
'Valid value between 1 and 12 inclusive.' if out_of_range?
|
data/lib/vedeu/input/keymap.rb
CHANGED
data/lib/vedeu/input/keymaps.rb
CHANGED
data/lib/vedeu/launcher.rb
CHANGED
data/lib/vedeu/log.rb
CHANGED
data/lib/vedeu/models/char.rb
CHANGED
data/lib/vedeu/models/group.rb
CHANGED
data/lib/vedeu/models/groups.rb
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
require 'vedeu/models/char'
|
2
|
-
require 'vedeu/models/stream'
|
3
|
-
require 'vedeu/models/line'
|
4
|
-
require 'vedeu/buffers/display_buffer'
|
5
|
-
require 'vedeu/models/toggleable'
|
6
|
-
|
7
1
|
module Vedeu
|
8
2
|
|
9
3
|
# An Interface represents a portion of the terminal defined by
|
@@ -165,19 +159,6 @@ module Vedeu
|
|
165
159
|
store_group
|
166
160
|
end
|
167
161
|
|
168
|
-
# Toggle the named interface buffer, or without a name, the buffer of the
|
169
|
-
# currently focussed interface.
|
170
|
-
#
|
171
|
-
# @example
|
172
|
-
# Vedeu.toggle_interface(name)
|
173
|
-
#
|
174
|
-
# @return [void]
|
175
|
-
def toggle
|
176
|
-
super
|
177
|
-
|
178
|
-
Vedeu.buffers.by_name(name).toggle
|
179
|
-
end
|
180
|
-
|
181
162
|
private
|
182
163
|
|
183
164
|
# The default values for a new instance of this class.
|