vedeu 0.4.18 → 0.4.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Rakefile +1 -0
- data/bin/vedeu_drb_server +0 -1
- data/bin/vedeu_test +0 -1
- data/config/rubocop_enabled.yml +1 -1
- data/examples/borders_app.rb +0 -1
- data/examples/colours_app.rb +0 -1
- data/examples/cursor_app.rb +0 -1
- data/examples/drb_app.rb +0 -1
- data/examples/geometry_app.rb +0 -1
- data/examples/hello_world.rb +0 -1
- data/examples/lines_app.rb +0 -1
- data/examples/material_colours_app.rb +0 -1
- data/examples/typed_commands/typed_commands_app.rb +0 -1
- data/examples/view_templates_app/view_templates_app.rb +0 -1
- data/lib/vedeu/api.rb +2 -1
- data/lib/vedeu/application.rb +3 -2
- data/lib/vedeu/bindings.rb +3 -5
- data/lib/vedeu/buffers/buffer.rb +8 -11
- data/lib/vedeu/buffers/display_buffer.rb +0 -2
- data/lib/vedeu/configuration/api.rb +1 -4
- data/lib/vedeu/configuration/cli.rb +153 -74
- data/lib/vedeu/configuration/configuration.rb +1 -2
- data/lib/vedeu/cursor/cursor.rb +0 -4
- data/lib/vedeu/cursor/move.rb +3 -6
- data/lib/vedeu/cursor/refresh_cursor.rb +12 -2
- data/lib/vedeu/distributed/client.rb +3 -2
- data/lib/vedeu/distributed/server.rb +4 -3
- data/lib/vedeu/distributed/subprocess.rb +3 -4
- data/lib/vedeu/distributed/test_application.rb +0 -1
- data/lib/vedeu/distributed/uri.rb +0 -1
- data/lib/vedeu/dsl/components/border.rb +3 -4
- data/lib/vedeu/dsl/components/geometry.rb +1 -5
- data/lib/vedeu/dsl/components/keymap.rb +1 -3
- data/lib/vedeu/dsl/components/menu.rb +1 -2
- data/lib/vedeu/dsl/composition.rb +3 -4
- data/lib/vedeu/dsl/group.rb +1 -4
- data/lib/vedeu/dsl/interface.rb +3 -10
- data/lib/vedeu/dsl/line.rb +3 -4
- data/lib/vedeu/dsl/shared/text.rb +0 -3
- data/lib/vedeu/dsl/stream.rb +3 -4
- data/lib/vedeu/dsl/view.rb +0 -3
- data/lib/vedeu/events/event.rb +3 -3
- data/lib/vedeu/events/trigger.rb +3 -2
- data/lib/vedeu/geometry/area.rb +0 -1
- data/lib/vedeu/geometry/canvas.rb +0 -1
- data/lib/vedeu/geometry/coordinate.rb +6 -7
- data/lib/vedeu/geometry/dimension.rb +3 -2
- data/lib/vedeu/geometry/geometry.rb +0 -6
- data/lib/vedeu/geometry/grid.rb +3 -2
- data/lib/vedeu/geometry/index_position.rb +0 -1
- data/lib/vedeu/geometry/position.rb +0 -1
- data/lib/vedeu/geometry/position_index.rb +0 -1
- data/lib/vedeu/geometry/position_validator.rb +6 -68
- data/lib/vedeu/input/all.rb +0 -2
- data/lib/vedeu/input/input.rb +3 -2
- data/lib/vedeu/input/key.rb +0 -1
- data/lib/vedeu/input/keymap.rb +4 -7
- data/lib/vedeu/input/mapper.rb +3 -2
- data/lib/vedeu/launcher.rb +3 -2
- data/lib/vedeu/main_loop.rb +1 -1
- data/lib/vedeu/models/cell.rb +0 -1
- data/lib/vedeu/models/char.rb +0 -1
- data/lib/vedeu/models/composition.rb +1 -7
- data/lib/vedeu/models/group.rb +0 -3
- data/lib/vedeu/models/interface.rb +0 -3
- data/lib/vedeu/models/line.rb +0 -4
- data/lib/vedeu/models/menu.rb +5 -8
- data/lib/vedeu/models/stream.rb +0 -4
- data/lib/vedeu/null/all.rb +11 -0
- data/lib/vedeu/null/border.rb +3 -1
- data/lib/vedeu/null/buffer.rb +0 -1
- data/lib/vedeu/null/generic.rb +4 -1
- data/lib/vedeu/null/geometry.rb +0 -1
- data/lib/vedeu/null/interface.rb +36 -7
- data/lib/vedeu/output/background.rb +0 -1
- data/lib/vedeu/output/border.rb +1 -6
- data/lib/vedeu/output/clear.rb +3 -2
- data/lib/vedeu/output/colour.rb +6 -18
- data/lib/vedeu/output/compressor.rb +5 -2
- data/lib/vedeu/output/esc.rb +4 -1
- data/lib/vedeu/output/foreground.rb +0 -5
- data/lib/vedeu/output/html_char.rb +3 -2
- data/lib/vedeu/output/output.rb +1 -5
- data/lib/vedeu/output/refresh.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +0 -1
- data/lib/vedeu/output/renderers/escape_sequence.rb +3 -2
- data/lib/vedeu/output/renderers/file.rb +85 -80
- data/lib/vedeu/output/renderers/html.rb +77 -72
- data/lib/vedeu/output/renderers/json.rb +45 -42
- data/lib/vedeu/output/renderers/null.rb +11 -8
- data/lib/vedeu/output/renderers/terminal.rb +41 -36
- data/lib/vedeu/output/renderers/text.rb +41 -36
- data/lib/vedeu/output/style.rb +0 -3
- data/lib/vedeu/output/text.rb +3 -2
- data/lib/vedeu/output/viewport.rb +3 -2
- data/lib/vedeu/output/virtual_terminal.rb +0 -1
- data/lib/vedeu/output/wordwrap.rb +3 -2
- data/lib/vedeu/repositories/all.rb +7 -6
- data/lib/vedeu/repositories/collection.rb +0 -1
- data/lib/vedeu/repositories/collections/chars.rb +0 -1
- data/lib/vedeu/repositories/collections/events.rb +0 -1
- data/lib/vedeu/repositories/collections/interfaces.rb +0 -1
- data/lib/vedeu/repositories/collections/keys.rb +0 -1
- data/lib/vedeu/repositories/collections/lines.rb +0 -1
- data/lib/vedeu/repositories/collections/streams.rb +0 -1
- data/lib/vedeu/repositories/model.rb +0 -1
- data/lib/vedeu/repositories/registerable.rb +29 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +0 -1
- data/lib/vedeu/repositories/repositories/borders.rb +2 -13
- data/lib/vedeu/repositories/repositories/buffers.rb +2 -13
- data/lib/vedeu/repositories/repositories/colours.rb +0 -1
- data/lib/vedeu/repositories/repositories/cursors.rb +1 -2
- data/lib/vedeu/repositories/repositories/events_repository.rb +0 -1
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +0 -1
- data/lib/vedeu/repositories/repositories/geometries.rb +2 -13
- data/lib/vedeu/repositories/repositories/groups.rb +1 -2
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +2 -14
- data/lib/vedeu/repositories/repositories/keymaps.rb +1 -2
- data/lib/vedeu/repositories/repositories/menus.rb +1 -2
- data/lib/vedeu/repositories/repository.rb +14 -5
- data/lib/vedeu/storage/all.rb +0 -1
- data/lib/vedeu/storage/associative_store.rb +0 -1
- data/lib/vedeu/storage/conveyor_store.rb +0 -1
- data/lib/vedeu/storage/fifo_store.rb +0 -1
- data/lib/vedeu/support/log.rb +0 -3
- data/lib/vedeu/support/options.rb +3 -2
- data/lib/vedeu/support/template.rb +3 -4
- data/lib/vedeu/support/terminal.rb +0 -2
- data/lib/vedeu/support/trace.rb +6 -7
- data/lib/vedeu/support/visibility.rb +1 -2
- data/lib/vedeu.rb +3 -5
- data/test/lib/vedeu/buffers/buffer_test.rb +48 -13
- data/test/lib/vedeu/configuration/cli_test.rb +5 -4
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +37 -15
- data/test/lib/vedeu/distributed/subprocess_test.rb +1 -0
- data/test/lib/vedeu/dsl/shared/use_test.rb +1 -6
- data/test/lib/vedeu/main_loop_test.rb +11 -0
- data/test/lib/vedeu/null/interface_test.rb +27 -0
- data/test/lib/vedeu/output/output_test.rb +17 -10
- data/test/lib/vedeu/output/presentation_test.rb +35 -7
- data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +50 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +34 -30
- data/test/lib/vedeu/output/renderers/html_test.rb +61 -57
- data/test/lib/vedeu/output/renderers/json_test.rb +40 -36
- data/test/lib/vedeu/output/renderers/null_test.rb +12 -8
- data/test/lib/vedeu/output/renderers/terminal_test.rb +17 -13
- data/test/lib/vedeu/output/renderers/text_test.rb +17 -13
- data/test/lib/vedeu/repositories/model_test.rb +1 -1
- data/test/lib/vedeu/repositories/registerable_test.rb +28 -0
- data/test/lib/vedeu/storage/associative_store_test.rb +7 -0
- data/test/lib/vedeu/storage/conveyor_store_test.rb +7 -0
- data/test/lib/vedeu/storage/fifo_store_test.rb +7 -0
- data/test/support/helpers/model_test_class.rb +6 -2
- data/test/test_helper.rb +2 -0
- data/vedeu.gemspec +3 -2
- metadata +23 -6
- data/test/lib/vedeu/output/renderers/escape_sequence_renderer_test.rb +0 -46
@@ -5,7 +5,6 @@ module Vedeu
|
|
5
5
|
# When a buffer has more lines than the defined height, or more columns than
|
6
6
|
# the defined width of the interface, the Viewport class provides 'scrolling'
|
7
7
|
# via the cursor's position.
|
8
|
-
#
|
9
8
|
class Viewport
|
10
9
|
|
11
10
|
extend Forwardable
|
@@ -72,12 +71,14 @@ module Vedeu
|
|
72
71
|
render.map(&:to_s).join("\n")
|
73
72
|
end
|
74
73
|
|
75
|
-
|
74
|
+
protected
|
76
75
|
|
77
76
|
# @!attribute [r] interface
|
78
77
|
# @return [Vedeu::Interface]
|
79
78
|
attr_reader :interface
|
80
79
|
|
80
|
+
private
|
81
|
+
|
81
82
|
# Returns the visible content for the interface.
|
82
83
|
#
|
83
84
|
# @note If there are no lines of content, we return an empty array. If there
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Wrap or prune text.
|
4
|
-
#
|
5
4
|
class Wordwrap
|
6
5
|
|
7
6
|
# @see {Vedeu::Wordwrap#initialize}
|
@@ -78,7 +77,7 @@ module Vedeu
|
|
78
77
|
end
|
79
78
|
end
|
80
79
|
|
81
|
-
|
80
|
+
protected
|
82
81
|
|
83
82
|
# @!attribute [r] text
|
84
83
|
# @return [String]
|
@@ -88,6 +87,8 @@ module Vedeu
|
|
88
87
|
# @return [Hash]
|
89
88
|
attr_reader :options
|
90
89
|
|
90
|
+
private
|
91
|
+
|
91
92
|
# @param text_as_lines [Array<String>]
|
92
93
|
# @return [Vedeu::Lines]
|
93
94
|
def to_line_objects(text_as_lines)
|
@@ -1,9 +1,3 @@
|
|
1
|
-
require_relative 'collection'
|
2
|
-
require_relative 'collections/all'
|
3
|
-
require_relative 'model'
|
4
|
-
require_relative 'repositories/all'
|
5
|
-
require_relative 'repository'
|
6
|
-
|
7
1
|
module Vedeu
|
8
2
|
|
9
3
|
# Provides all registered repositories.
|
@@ -39,3 +33,10 @@ module Vedeu
|
|
39
33
|
end
|
40
34
|
|
41
35
|
end # Vedeu
|
36
|
+
|
37
|
+
require_relative 'registerable'
|
38
|
+
require_relative 'collection'
|
39
|
+
require_relative 'collections/all'
|
40
|
+
require_relative 'model'
|
41
|
+
require_relative 'repositories/all'
|
42
|
+
require_relative 'repository'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Repositories contain registerables, this module provides convenience methods
|
4
|
+
# for them.
|
5
|
+
module Registerable
|
6
|
+
|
7
|
+
# These class methods are mixed into the repository.
|
8
|
+
module ClassMethods
|
9
|
+
|
10
|
+
# @param klass [Class]
|
11
|
+
# @return [Symbol]
|
12
|
+
def null(klass)
|
13
|
+
define_method(:null_model) { klass }
|
14
|
+
end
|
15
|
+
|
16
|
+
end # ClassMethods
|
17
|
+
|
18
|
+
# When this module is included in a class, provide ClassMethods as class
|
19
|
+
# methods for the class.
|
20
|
+
#
|
21
|
+
# @param klass [Class]
|
22
|
+
# @return [void]
|
23
|
+
def self.included(klass)
|
24
|
+
klass.send :extend, ClassMethods
|
25
|
+
end
|
26
|
+
|
27
|
+
end # Registerable
|
28
|
+
|
29
|
+
end # Vedeu
|
@@ -2,7 +2,6 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Allows the storing of interface/view borders independent of the interface
|
4
4
|
# instance.
|
5
|
-
#
|
6
5
|
class Borders < Repository
|
7
6
|
|
8
7
|
class << self
|
@@ -17,22 +16,12 @@ module Vedeu
|
|
17
16
|
#
|
18
17
|
# @return [Vedeu::Borders]
|
19
18
|
def reset!
|
20
|
-
@borders = Vedeu::Borders.
|
19
|
+
@borders = Vedeu::Borders.register(Vedeu::Border)
|
21
20
|
end
|
22
21
|
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
|
-
# @return [Vedeu::Border|Vedeu::Null::Border]
|
27
|
-
def by_name(name)
|
28
|
-
if registered?(name)
|
29
|
-
find(name)
|
30
|
-
|
31
|
-
else
|
32
|
-
Vedeu::Null::Border.new(name)
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
24
|
+
null Vedeu::Null::Border
|
36
25
|
|
37
26
|
end # Borders
|
38
27
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Allows the storing of view buffers.
|
4
|
-
#
|
5
4
|
class Buffers < Repository
|
6
5
|
|
7
6
|
class << self
|
@@ -16,22 +15,12 @@ module Vedeu
|
|
16
15
|
#
|
17
16
|
# @return [Vedeu::Buffers]
|
18
17
|
def reset!
|
19
|
-
@buffers = Vedeu::Buffers.
|
18
|
+
@buffers = Vedeu::Buffers.register(Vedeu::Buffer)
|
20
19
|
end
|
21
20
|
|
22
21
|
end
|
23
22
|
|
24
|
-
|
25
|
-
# @return [Vedeu::Buffer|Vedeu::Null::Buffer]
|
26
|
-
def by_name(name)
|
27
|
-
if registered?(name)
|
28
|
-
find(name)
|
29
|
-
|
30
|
-
else
|
31
|
-
Vedeu::Null::Buffer.new(name)
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
23
|
+
null Vedeu::Null::Buffer
|
35
24
|
|
36
25
|
end # Buffers
|
37
26
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Allows the storing of each interface's cursor.
|
4
|
-
#
|
5
4
|
class Cursors < Repository
|
6
5
|
|
7
6
|
class << self
|
@@ -21,7 +20,7 @@ module Vedeu
|
|
21
20
|
#
|
22
21
|
# @return [Vedeu::Cursors]
|
23
22
|
def reset!
|
24
|
-
@cursors = Vedeu::Cursors.
|
23
|
+
@cursors = Vedeu::Cursors.register(Vedeu::Cursor)
|
25
24
|
end
|
26
25
|
|
27
26
|
end
|
@@ -2,7 +2,6 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Allows the storing of interface/view geometry independent of the interface
|
4
4
|
# instance.
|
5
|
-
#
|
6
5
|
class Geometries < Repository
|
7
6
|
|
8
7
|
class << self
|
@@ -17,22 +16,12 @@ module Vedeu
|
|
17
16
|
#
|
18
17
|
# @return [Vedeu::Geometries]
|
19
18
|
def reset!
|
20
|
-
@geometries = Vedeu::Geometries.
|
19
|
+
@geometries = Vedeu::Geometries.register(Vedeu::Geometry)
|
21
20
|
end
|
22
21
|
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
|
-
# @return [Vedeu::Geometry|Vedeu::Null::Geometry]
|
27
|
-
def by_name(name)
|
28
|
-
if registered?(name)
|
29
|
-
find(name)
|
30
|
-
|
31
|
-
else
|
32
|
-
Vedeu::Null::Geometry.new(name)
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
24
|
+
null Vedeu::Null::Geometry
|
36
25
|
|
37
26
|
end # Geometries
|
38
27
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Allows the storing of view groups.
|
4
|
-
#
|
5
4
|
class Groups < Repository
|
6
5
|
|
7
6
|
class << self
|
@@ -16,7 +15,7 @@ module Vedeu
|
|
16
15
|
#
|
17
16
|
# @return [Vedeu::Groups]
|
18
17
|
def reset!
|
19
|
-
@groups = Vedeu::Groups.
|
18
|
+
@groups = Vedeu::Groups.register(Vedeu::Group)
|
20
19
|
end
|
21
20
|
|
22
21
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Allows the storing of interfaces and views.
|
4
|
-
#
|
5
4
|
class InterfacesRepository < Repository
|
6
5
|
|
7
6
|
class << self
|
@@ -16,23 +15,12 @@ module Vedeu
|
|
16
15
|
#
|
17
16
|
# @return [Vedeu::InterfacesRepository]
|
18
17
|
def reset!
|
19
|
-
@interfaces = Vedeu::InterfacesRepository.
|
20
|
-
register_repository(Vedeu::Interface)
|
18
|
+
@interfaces = Vedeu::InterfacesRepository.register(Vedeu::Interface)
|
21
19
|
end
|
22
20
|
|
23
21
|
end
|
24
22
|
|
25
|
-
|
26
|
-
# @return [Vedeu::Interface|Vedeu::Null::Interface]
|
27
|
-
def by_name(name)
|
28
|
-
if registered?(name)
|
29
|
-
find(name)
|
30
|
-
|
31
|
-
else
|
32
|
-
Vedeu::Null::Interface.new(name: name)
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
23
|
+
null Vedeu::Null::Interface
|
36
24
|
|
37
25
|
end # InterfacesRepository
|
38
26
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Allows the storing of keymaps.
|
4
|
-
#
|
5
4
|
class Keymaps < Repository
|
6
5
|
|
7
6
|
class << self
|
@@ -16,7 +15,7 @@ module Vedeu
|
|
16
15
|
#
|
17
16
|
# @return [Vedeu::Keymaps]
|
18
17
|
def reset!
|
19
|
-
@keymaps = Vedeu::Keymaps.
|
18
|
+
@keymaps = Vedeu::Keymaps.register(Vedeu::Keymap)
|
20
19
|
end
|
21
20
|
|
22
21
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Allows the storing of menus by name.
|
4
|
-
#
|
5
4
|
class Menus < Repository
|
6
5
|
|
7
6
|
class << self
|
@@ -16,7 +15,7 @@ module Vedeu
|
|
16
15
|
#
|
17
16
|
# @return [Vedeu::Menus]
|
18
17
|
def reset!
|
19
|
-
@menus = Vedeu::Menus.
|
18
|
+
@menus = Vedeu::Menus.register(Vedeu::Menu)
|
20
19
|
end
|
21
20
|
|
22
21
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'vedeu/models/all'
|
2
|
-
require 'vedeu/storage/store'
|
3
1
|
require 'vedeu/support/common'
|
4
2
|
|
5
3
|
module Vedeu
|
@@ -10,10 +8,10 @@ module Vedeu
|
|
10
8
|
# { 'models' => [Model, Model, Model] }
|
11
9
|
#
|
12
10
|
# { 'models' => [Model] }
|
13
|
-
#
|
14
11
|
class Repository
|
15
12
|
|
16
13
|
include Vedeu::Common
|
14
|
+
include Vedeu::Registerable
|
17
15
|
include Vedeu::Store
|
18
16
|
|
19
17
|
# @!attribute [r] model
|
@@ -27,7 +25,7 @@ module Vedeu
|
|
27
25
|
# @param model [Class]
|
28
26
|
# @param storage [Class|Hash]
|
29
27
|
# @return [Vedeu::Repository]
|
30
|
-
def self.
|
28
|
+
def self.register(model = nil, storage = {})
|
31
29
|
new(model, storage).tap do |klass|
|
32
30
|
Vedeu::Repositories.register(klass.repository)
|
33
31
|
end
|
@@ -50,6 +48,18 @@ module Vedeu
|
|
50
48
|
self.class # .name
|
51
49
|
end
|
52
50
|
|
51
|
+
# @param name [String] The name of the stored model.
|
52
|
+
# @return [void]
|
53
|
+
def by_name(name)
|
54
|
+
if registered?(name)
|
55
|
+
find(name)
|
56
|
+
|
57
|
+
else
|
58
|
+
null_model.new(name)
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
53
63
|
# Return the model for the interface currently in focus.
|
54
64
|
#
|
55
65
|
# @return [String|NilClass]
|
@@ -90,7 +100,6 @@ module Vedeu
|
|
90
100
|
model.new(name).store
|
91
101
|
end
|
92
102
|
end
|
93
|
-
alias_method :by_name, :find_or_create
|
94
103
|
|
95
104
|
# @return [String]
|
96
105
|
def inspect
|
data/lib/vedeu/storage/all.rb
CHANGED
data/lib/vedeu/support/log.rb
CHANGED
@@ -3,7 +3,6 @@ module Vedeu
|
|
3
3
|
# Converts an options Hash into a class containing methods for each of the
|
4
4
|
# keys, which when called returns the value associated. When the value is
|
5
5
|
# either true or false, an additional predicate method is created.
|
6
|
-
#
|
7
6
|
class Options
|
8
7
|
|
9
8
|
# @!attribute [r] _defined
|
@@ -36,12 +35,14 @@ module Vedeu
|
|
36
35
|
self
|
37
36
|
end
|
38
37
|
|
39
|
-
|
38
|
+
protected
|
40
39
|
|
41
40
|
# @!attribute [r] _options
|
42
41
|
# @return [Hash]
|
43
42
|
attr_reader :_options
|
44
43
|
|
44
|
+
private
|
45
|
+
|
45
46
|
# @param alias_name [String|Symbol]
|
46
47
|
# @param method_name [String|Symbol]
|
47
48
|
# @return [void]
|
@@ -1,9 +1,6 @@
|
|
1
|
-
require 'erb'
|
2
|
-
|
3
1
|
module Vedeu
|
4
2
|
|
5
3
|
# Generic class to loading a template and parsing it via ERb.
|
6
|
-
#
|
7
4
|
class Template
|
8
5
|
|
9
6
|
# @param object [Class]
|
@@ -27,12 +24,14 @@ module Vedeu
|
|
27
24
|
ERB.new(load, nil, '-').result(binding)
|
28
25
|
end
|
29
26
|
|
30
|
-
|
27
|
+
protected
|
31
28
|
|
32
29
|
# @!attribute [r] object
|
33
30
|
# @return [Class]
|
34
31
|
attr_reader :object
|
35
32
|
|
33
|
+
private
|
34
|
+
|
36
35
|
# @return [String]
|
37
36
|
def load
|
38
37
|
File.read(path)
|
data/lib/vedeu/support/trace.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
require 'vedeu/configuration/configuration'
|
2
|
-
require 'vedeu/output/esc'
|
3
|
-
require 'vedeu/support/log'
|
4
|
-
|
5
1
|
module Vedeu
|
6
2
|
|
7
3
|
# :nocov:
|
@@ -9,7 +5,6 @@ module Vedeu
|
|
9
5
|
# occurs inside Vedeu. This is very useful (to me!) for debugging. Running
|
10
6
|
# this will make your application less responsive, and the tests
|
11
7
|
# excruciatingly slow to run.
|
12
|
-
#
|
13
8
|
class Trace
|
14
9
|
|
15
10
|
# @todo
|
@@ -48,11 +43,15 @@ module Vedeu
|
|
48
43
|
# - (id) the method name being traced,
|
49
44
|
# - (vars) any local variables belonging to the method.
|
50
45
|
#
|
46
|
+
# @note
|
47
|
+
# Arguments to set_trace_func proc:
|
48
|
+
# |event, file, line, id, binding, name|
|
49
|
+
#
|
51
50
|
# @todo Deprecate, and use TracePoint instead.
|
52
51
|
#
|
53
52
|
# @return [NilClass|String]
|
54
53
|
def trace
|
55
|
-
set_trace_func proc { |event,
|
54
|
+
set_trace_func proc { |event, _, _, id, binding, name|
|
56
55
|
if event == watched && id != :log && classes.include?(name.to_s)
|
57
56
|
vars = variables(binding)
|
58
57
|
|
@@ -163,7 +162,7 @@ module Vedeu
|
|
163
162
|
#
|
164
163
|
# @return [Set]
|
165
164
|
def vedeu_exceptions
|
166
|
-
Vedeu::
|
165
|
+
Vedeu::EXCEPTIONS.to_set
|
167
166
|
end
|
168
167
|
|
169
168
|
# Returns a set of classes to ignore during tracing.
|
data/lib/vedeu.rb
CHANGED
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift($LIB_DIR) unless $LOAD_PATH.include?($LIB_DIR)
|
|
3
3
|
|
4
4
|
require 'date'
|
5
5
|
require 'drb'
|
6
|
+
require 'erb'
|
6
7
|
require 'forwardable'
|
7
8
|
require 'io/console'
|
8
9
|
require 'json'
|
@@ -16,7 +17,6 @@ require 'time'
|
|
16
17
|
require 'vedeu/support/log'
|
17
18
|
|
18
19
|
# Vedeu is a GUI framework for terminal/console applications written in Ruby.
|
19
|
-
#
|
20
20
|
module Vedeu
|
21
21
|
|
22
22
|
extend Forwardable
|
@@ -67,7 +67,7 @@ module Vedeu
|
|
67
67
|
#
|
68
68
|
# VedeuInterrupt: Raised when Vedeu wishes to exit.
|
69
69
|
#
|
70
|
-
|
70
|
+
EXCEPTIONS = %w(
|
71
71
|
ModelNotFound
|
72
72
|
InvalidSyntax
|
73
73
|
MissingRequired
|
@@ -76,9 +76,7 @@ module Vedeu
|
|
76
76
|
OutOfRange
|
77
77
|
VedeuInterrupt
|
78
78
|
)
|
79
|
-
|
80
|
-
|
81
|
-
private
|
79
|
+
EXCEPTIONS.each { |e| const_set(e, Class.new(StandardError)) }
|
82
80
|
|
83
81
|
end # Vedeu
|
84
82
|
|