vedeu 0.8.30 → 0.8.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +16 -48
- data/docs/configuration/base_path.md +4 -0
- data/docs/configuration/colour.md +4 -0
- data/docs/configuration/colour_mode.md +4 -0
- data/docs/configuration/compression.md +4 -0
- data/docs/configuration/cooked.md +4 -0
- data/docs/configuration/debug.md +4 -0
- data/docs/configuration/drb.md +4 -0
- data/integrations/dsl_app_040.rb +51 -0
- data/integrations/dsl_app_041.rb +51 -0
- data/integrations/dsl_app_042.rb +51 -0
- data/integrations/expected/dsl_app_040.out +1 -0
- data/integrations/expected/dsl_app_041.out +1 -0
- data/integrations/expected/dsl_app_042.out +1 -0
- data/integrations/test_runner.sh +3 -0
- data/lib/vedeu/boolean.rb +9 -3
- data/lib/vedeu/buffers/all.rb +1 -0
- data/lib/vedeu/buffers/clear.rb +64 -0
- data/lib/vedeu/common.rb +2 -2
- data/lib/vedeu/cursors/reposition.rb +4 -4
- data/lib/vedeu/interfaces/clear.rb +4 -6
- data/lib/vedeu/interfaces/clear_content.rb +11 -9
- data/lib/vedeu/output/compressors/character.rb +10 -6
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/buffers/clear_test.rb +87 -0
- data/test/lib/vedeu/buffers/empty_test.rb +0 -2
- data/test/lib/vedeu/interfaces/clear_test.rb +1 -1
- metadata +11 -3
- data/config/rubocop_enabled.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54d020b1ed4da7b4cf81758fa09f9dfc06112407
|
4
|
+
data.tar.gz: a09b4f6ac797e2948d01816492dd384fc61c88c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd78a43accb8571c469797daeb2f3fd753c11540612a7001e5a67d65066d6b9b55edd97ad943b67e04e4557c39a0d9e3a6d0ffc5b7c1bb7f7f9fc9c0d53d3082
|
7
|
+
data.tar.gz: 048c82e69c2fd6ae30a142da63ad24109d5a0ad444ef4aa9dc94e389786e62255928117f34eb2a25e5337f8d3bbc131b8edd472da1496e1cdde7215e19288578
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- config/rubocop_enabled.yml
|
3
|
-
|
4
1
|
AllCops:
|
5
2
|
Include:
|
6
3
|
- '**/*.gemspec'
|
@@ -29,9 +26,22 @@ AllCops:
|
|
29
26
|
StyleGuideCopsOnly: false
|
30
27
|
TargetRubyVersion: 2.3
|
31
28
|
|
29
|
+
Lint/Eval:
|
30
|
+
Description: 'The use of eval represents a serious security risk.'
|
31
|
+
Enabled: false
|
32
|
+
|
32
33
|
Lint/UnusedMethodArgument:
|
33
34
|
Enabled: false
|
34
35
|
|
36
|
+
Style/AsciiComments:
|
37
|
+
Description: 'Use only ascii symbols in comments.'
|
38
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/Documentation:
|
42
|
+
Description: 'Document classes and non-namespace modules.'
|
43
|
+
Enabled: false
|
44
|
+
|
35
45
|
Style/EmptyLinesAroundBlockBody:
|
36
46
|
EnforcedStyle: no_empty_lines
|
37
47
|
|
@@ -41,61 +51,18 @@ Style/EmptyLinesAroundClassBody:
|
|
41
51
|
Style/EmptyLinesAroundModuleBody:
|
42
52
|
EnforcedStyle: empty_lines
|
43
53
|
|
44
|
-
Style/ExtraSpacing:
|
45
|
-
Enabled: false
|
46
|
-
|
47
|
-
# Style/GlobalVars:
|
48
|
-
# AllowedVariables: [$LIB_DIR]
|
49
|
-
|
50
|
-
# Style/GuardClause:
|
51
|
-
# MinBodyLength: 1
|
52
|
-
|
53
|
-
# Style/IfUnlessModifier:
|
54
|
-
# MaxLineLength: 80
|
55
|
-
|
56
|
-
# Style/IndentationWidth:
|
57
|
-
# Width: 2
|
58
|
-
|
59
|
-
# Style/IndentHash:
|
60
|
-
# EnforcedStyle: special_inside_parentheses
|
61
|
-
# SupportedStyles:
|
62
|
-
# - special_inside_parentheses
|
63
|
-
# - consistent
|
64
|
-
|
65
54
|
Style/MultilineBlockChain:
|
66
55
|
Enabled: false
|
67
56
|
|
68
|
-
Style/MultilineOperationIndentation:
|
69
|
-
Enabled: false
|
70
|
-
|
71
57
|
Style/ModuleFunction:
|
72
58
|
Enabled: false
|
73
59
|
|
74
|
-
# Style/Next:
|
75
|
-
# EnforcedStyle: skip_modifier_ifs
|
76
|
-
# MinBodyLength: 3
|
77
|
-
# SupportedStyles:
|
78
|
-
# - skip_modifier_ifs
|
79
|
-
# - always
|
80
|
-
|
81
60
|
Style/RescueModifier:
|
82
61
|
Enabled: false
|
83
62
|
|
84
63
|
Style/SpaceAroundOperators:
|
85
64
|
Enabled: false
|
86
65
|
|
87
|
-
# Style/SpaceAroundEqualsInParameterDefault:
|
88
|
-
# EnforcedStyle: space
|
89
|
-
|
90
|
-
# Style/SpaceBeforeBlockBraces:
|
91
|
-
# EnforcedStyle: space
|
92
|
-
|
93
|
-
# Style/SpaceInsideBlockBraces:
|
94
|
-
# EnforcedStyle: space
|
95
|
-
|
96
|
-
# Style/SpaceInsideHashLiteralBraces:
|
97
|
-
# EnforcedStyle: space
|
98
|
-
|
99
66
|
Style/TrailingBlankLines:
|
100
67
|
EnforcedStyle: final_newline
|
101
68
|
|
@@ -105,8 +72,9 @@ Style/TrailingCommaInLiteral:
|
|
105
72
|
Metrics/AbcSize:
|
106
73
|
Max: 25
|
107
74
|
|
108
|
-
|
109
|
-
|
75
|
+
Metrics/ClassLength:
|
76
|
+
Description: 'Avoid classes longer than 100 lines of code.'
|
77
|
+
Enabled: false
|
110
78
|
|
111
79
|
Metrics/CyclomaticComplexity:
|
112
80
|
Max: 12
|
@@ -5,7 +5,11 @@ templates and other resources). By default the base path is
|
|
5
5
|
just the current working directory but this will not work for many
|
6
6
|
applications.
|
7
7
|
|
8
|
+
# Set:
|
8
9
|
Vedeu.configure do
|
9
10
|
base_path '/path/to/application'
|
10
11
|
# ...
|
11
12
|
end
|
13
|
+
|
14
|
+
# Get:
|
15
|
+
Vedeu.config.base_path
|
@@ -1,10 +1,14 @@
|
|
1
1
|
Sets the colour mode of the terminal.
|
2
2
|
|
3
|
+
# Set:
|
3
4
|
Vedeu.configure do
|
4
5
|
colour_mode 256
|
5
6
|
# ...
|
6
7
|
end
|
7
8
|
|
9
|
+
# Get:
|
10
|
+
Vedeu.config.colour_mode
|
11
|
+
|
8
12
|
Note
|
9
13
|
- iTerm 2 on Mac OSX will handle the true colour setting
|
10
14
|
(16777216), whereas Terminator on Linux will not display
|
@@ -6,6 +6,7 @@ Sets boolean to enable/disable compression. Vedeu's default setting is
|
|
6
6
|
for compression to be enabled. Setting `compression` to false will
|
7
7
|
disable compression.
|
8
8
|
|
9
|
+
# Set:
|
9
10
|
Vedeu.configure do
|
10
11
|
compression! # enabled (default)
|
11
12
|
# ...
|
@@ -16,6 +17,9 @@ disable compression.
|
|
16
17
|
# ...
|
17
18
|
end
|
18
19
|
|
20
|
+
# Get:
|
21
|
+
Vedeu.config.compression
|
22
|
+
|
19
23
|
Note:
|
20
24
|
|
21
25
|
- Be aware that running an application without compression will affect
|
data/docs/configuration/debug.md
CHANGED
@@ -9,6 +9,7 @@ Enabling debugging will:
|
|
9
9
|
- Produce a full a backtrace to STDOUT and the log file upon
|
10
10
|
unrecoverable error or unhandled exception.
|
11
11
|
|
12
|
+
# Set:
|
12
13
|
Vedeu.configure do
|
13
14
|
debug!
|
14
15
|
# ...
|
@@ -18,3 +19,6 @@ Enabling debugging will:
|
|
18
19
|
debug false
|
19
20
|
# ...
|
20
21
|
end
|
22
|
+
|
23
|
+
# Get:
|
24
|
+
Vedeu.config.debug?
|
data/docs/configuration/drb.md
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'vedeu'
|
7
|
+
|
8
|
+
TESTCASE = 'dsl_app_040'
|
9
|
+
|
10
|
+
class DSLApp
|
11
|
+
|
12
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
13
|
+
|
14
|
+
Vedeu.configure do
|
15
|
+
colour background: '#ff0000', foreground: '#00ff00'
|
16
|
+
debug!
|
17
|
+
height 10
|
18
|
+
log Dir.tmpdir + '/vedeu_views_dsl.log'
|
19
|
+
renderers [
|
20
|
+
Vedeu::Renderers::Terminal.new(
|
21
|
+
filename: Dir.tmpdir + "/#{TESTCASE}.out",
|
22
|
+
write_file: true),
|
23
|
+
# Vedeu::Renderers::JSON.new(filename: Dir.tmpdir + "/#{TESTCASE}.json"),
|
24
|
+
# Vedeu::Renderers::HTML.new(filename: Dir.tmpdir + "/#{TESTCASE}.html"),
|
25
|
+
# Vedeu::Renderers::Text.new(filename: Dir.tmpdir + "/#{TESTCASE}.txt"),
|
26
|
+
]
|
27
|
+
run_once!
|
28
|
+
standalone!
|
29
|
+
end
|
30
|
+
|
31
|
+
load File.dirname(__FILE__) + '/support/test_interface.rb'
|
32
|
+
|
33
|
+
Vedeu.render do
|
34
|
+
view(:test_interface) do
|
35
|
+
line 'Background is #ff0000'
|
36
|
+
line 'Foreground is #00ff00'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.start(argv = ARGV)
|
41
|
+
Vedeu::Launcher.execute!(argv)
|
42
|
+
end
|
43
|
+
|
44
|
+
end # DSLApp
|
45
|
+
|
46
|
+
Vedeu.timer('Test') do
|
47
|
+
DSLApp.start
|
48
|
+
end
|
49
|
+
|
50
|
+
load File.dirname(__FILE__) + '/test_runner.rb'
|
51
|
+
TestRunner.result(TESTCASE, __FILE__)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'vedeu'
|
7
|
+
|
8
|
+
TESTCASE = 'dsl_app_041'
|
9
|
+
|
10
|
+
class DSLApp
|
11
|
+
|
12
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
13
|
+
|
14
|
+
Vedeu.configure do
|
15
|
+
background '#003300'
|
16
|
+
debug!
|
17
|
+
height 10
|
18
|
+
log Dir.tmpdir + '/vedeu_views_dsl.log'
|
19
|
+
renderers [
|
20
|
+
Vedeu::Renderers::Terminal.new(
|
21
|
+
filename: Dir.tmpdir + "/#{TESTCASE}.out",
|
22
|
+
write_file: true),
|
23
|
+
# Vedeu::Renderers::JSON.new(filename: Dir.tmpdir + "/#{TESTCASE}.json"),
|
24
|
+
# Vedeu::Renderers::HTML.new(filename: Dir.tmpdir + "/#{TESTCASE}.html"),
|
25
|
+
# Vedeu::Renderers::Text.new(filename: Dir.tmpdir + "/#{TESTCASE}.txt"),
|
26
|
+
]
|
27
|
+
run_once!
|
28
|
+
standalone!
|
29
|
+
end
|
30
|
+
|
31
|
+
load File.dirname(__FILE__) + '/support/test_interface.rb'
|
32
|
+
|
33
|
+
Vedeu.render do
|
34
|
+
view(:test_interface) do
|
35
|
+
line 'Background is #003300'
|
36
|
+
line 'Foreground is default'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.start(argv = ARGV)
|
41
|
+
Vedeu::Launcher.execute!(argv)
|
42
|
+
end
|
43
|
+
|
44
|
+
end # DSLApp
|
45
|
+
|
46
|
+
Vedeu.timer('Test') do
|
47
|
+
DSLApp.start
|
48
|
+
end
|
49
|
+
|
50
|
+
load File.dirname(__FILE__) + '/test_runner.rb'
|
51
|
+
TestRunner.result(TESTCASE, __FILE__)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'vedeu'
|
7
|
+
|
8
|
+
TESTCASE = 'dsl_app_042'
|
9
|
+
|
10
|
+
class DSLApp
|
11
|
+
|
12
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
13
|
+
|
14
|
+
Vedeu.configure do
|
15
|
+
foreground '#ff0000'
|
16
|
+
debug!
|
17
|
+
height 10
|
18
|
+
log Dir.tmpdir + '/vedeu_views_dsl.log'
|
19
|
+
renderers [
|
20
|
+
Vedeu::Renderers::Terminal.new(
|
21
|
+
filename: Dir.tmpdir + "/#{TESTCASE}.out",
|
22
|
+
write_file: true),
|
23
|
+
# Vedeu::Renderers::JSON.new(filename: Dir.tmpdir + "/#{TESTCASE}.json"),
|
24
|
+
# Vedeu::Renderers::HTML.new(filename: Dir.tmpdir + "/#{TESTCASE}.html"),
|
25
|
+
# Vedeu::Renderers::Text.new(filename: Dir.tmpdir + "/#{TESTCASE}.txt"),
|
26
|
+
]
|
27
|
+
run_once!
|
28
|
+
standalone!
|
29
|
+
end
|
30
|
+
|
31
|
+
load File.dirname(__FILE__) + '/support/test_interface.rb'
|
32
|
+
|
33
|
+
Vedeu.render do
|
34
|
+
view(:test_interface) do
|
35
|
+
line 'Background is default'
|
36
|
+
line 'Foreground is #ff0000'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.start(argv = ARGV)
|
41
|
+
Vedeu::Launcher.execute!(argv)
|
42
|
+
end
|
43
|
+
|
44
|
+
end # DSLApp
|
45
|
+
|
46
|
+
Vedeu.timer('Test') do
|
47
|
+
DSLApp.start
|
48
|
+
end
|
49
|
+
|
50
|
+
load File.dirname(__FILE__) + '/test_runner.rb'
|
51
|
+
TestRunner.result(TESTCASE, __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
[0m[2;2H[38;5;46m[48;5;196m(0l(B[2;3H(0q(B[2;4H [2;5HT[2;6He[2;7Hs[2;8Ht[2;9H [2;10H(0q(B[2;11H(0q(B[2;12H(0q(B[2;13H(0q(B[2;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[2;13H(0q(B[2;14H(0q(B[2;15H(0q(B[2;16H(0q(B[2;17H(0q(B[2;18H(0q(B[2;19H(0q(B[2;20H(0q(B[2;21H(0q(B[2;22H(0q(B[2;23H(0q(B[2;24H(0q(B[2;25H(0q(B[2;26H(0q(B[2;27H(0q(B[2;28H(0q(B[2;29H(0q(B[2;30H(0q(B[2;31H(0q(B[2;32H(0k(B[0m[3;2H[38;5;196m[49m(0x(B[3;3HB[3;4Ha[3;5Hc[3;6Hk[3;7Hg[3;8Hr[3;9Ho[3;10Hu[3;11Hn[3;12Hd[3;13H [3;14Hi[3;15Hs[3;16H [3;17Hd[3;18He[3;19Hf[3;20Ha[3;21Hu[3;22Hl[3;23Ht[3;32H(0x(B[0m[4;2H[38;5;196m[49m(0x(B[4;3HF[4;4Ho[4;5Hr[4;6He[4;7Hg[4;8Hr[4;9Ho[4;10Hu[4;11Hn[4;12Hd[4;13H [4;14Hi[4;15Hs[4;16H [4;17H#[4;18Hf[4;19Hf[4;20H0[4;21H0[4;22H0[4;23H0[4;32H(0x(B[0m[5;2H[38;5;196m[49m(0x(B[5;32H(0x(B[0m[6;2H[38;5;196m[49m(0m(B[6;3H(0q(B[6;4H(0q(B[6;5H(0q(B[6;6H(0q(B[6;7H(0q(B[6;8H(0q(B[6;9H(0q(B[6;10H(0q(B[6;11H(0q(B[6;12H(0q(B[6;13H(0q(B[6;14H(0q(B[6;15H(0q(B[6;16H(0q(B[6;17H(0q(B[6;18H(0q(B[6;19H(0q(B[6;20H(0q(B[6;21H(0q(B[6;22H(0q(B[6;23H(0q(B[6;24H(0q(B[6;25H(0q(B[6;26H(0q(B[6;27H(0q(B[6;28H(0q(B[6;29H(0q(B[6;30H(0q(B[6;31H(0q(B[6;32H(0j(B[0m
|
data/integrations/test_runner.sh
CHANGED
data/lib/vedeu/boolean.rb
CHANGED
@@ -24,17 +24,23 @@ module Vedeu
|
|
24
24
|
value ? true : false
|
25
25
|
end
|
26
26
|
|
27
|
+
# Returns a boolean indicating whether the value should be
|
28
|
+
# considered false.
|
29
|
+
#
|
27
30
|
# @return [Boolean]
|
28
31
|
def false?
|
29
32
|
value.nil? || value == false
|
30
33
|
end
|
34
|
+
alias falsy? false?
|
31
35
|
|
36
|
+
# Returns a boolean indicating whether the value should be
|
37
|
+
# considered true.
|
38
|
+
#
|
32
39
|
# @return [Boolean]
|
33
40
|
def true?
|
34
|
-
|
35
|
-
|
36
|
-
true
|
41
|
+
!false?
|
37
42
|
end
|
43
|
+
alias truthy? true?
|
38
44
|
|
39
45
|
private
|
40
46
|
|
data/lib/vedeu/buffers/all.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Buffers
|
6
|
+
|
7
|
+
# Provides a grid of Vedeu::Cells::Clear objects at the given
|
8
|
+
# height and width.
|
9
|
+
#
|
10
|
+
# @api private
|
11
|
+
#
|
12
|
+
class Clear
|
13
|
+
|
14
|
+
include Vedeu::Repositories::Defaults
|
15
|
+
|
16
|
+
# @!attribute [r] name
|
17
|
+
# @return [NilClass|String|Symbol]
|
18
|
+
attr_reader :name
|
19
|
+
|
20
|
+
# @return [Array<Array<Vedeu::Cells::Clear>>]
|
21
|
+
def buffer
|
22
|
+
@buffer ||= clear
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Fixnum]
|
26
|
+
def height
|
27
|
+
@height + 1
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Fixnum]
|
31
|
+
def width
|
32
|
+
@width + 1
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
# @macro interface_by_name
|
38
|
+
def interface
|
39
|
+
@_interface ||= Vedeu.interfaces.by_name(name)
|
40
|
+
end
|
41
|
+
|
42
|
+
# @macro defaults_method
|
43
|
+
def defaults
|
44
|
+
{
|
45
|
+
height: Vedeu.height,
|
46
|
+
name: nil,
|
47
|
+
width: Vedeu.width,
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Array<Array<Vedeu::Cells::Clear>>]
|
52
|
+
def clear
|
53
|
+
Array.new(height) do
|
54
|
+
Array.new(width) do
|
55
|
+
Vedeu::Cells::Clear.new(colour: interface.colour, name: name)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end # Clear
|
61
|
+
|
62
|
+
end # Buffers
|
63
|
+
|
64
|
+
end # Vedeu
|
data/lib/vedeu/common.rb
CHANGED
@@ -69,7 +69,7 @@ module Vedeu
|
|
69
69
|
# @param value [void]
|
70
70
|
# @return [Boolean]
|
71
71
|
def falsy?(value)
|
72
|
-
|
72
|
+
Vedeu::Boolean.new(value).false?
|
73
73
|
end
|
74
74
|
|
75
75
|
# Returns a boolean indicating whether the value is a Hash.
|
@@ -188,7 +188,7 @@ module Vedeu
|
|
188
188
|
# @param value [void]
|
189
189
|
# @return [Boolean]
|
190
190
|
def truthy?(value)
|
191
|
-
|
191
|
+
Vedeu::Boolean.new(value).true?
|
192
192
|
end
|
193
193
|
|
194
194
|
# Returns a boolean indicating the model is a
|
@@ -98,10 +98,10 @@ module Vedeu
|
|
98
98
|
|
99
99
|
# @return [Boolean]
|
100
100
|
def inside_geometry?
|
101
|
-
x >= geometry.x
|
102
|
-
|
103
|
-
|
104
|
-
|
101
|
+
x >= geometry.x &&
|
102
|
+
x <= geometry.xn &&
|
103
|
+
y >= geometry.y &&
|
104
|
+
y <= geometry.yn
|
105
105
|
end
|
106
106
|
|
107
107
|
# @return [Symbol]
|
@@ -71,14 +71,12 @@ module Vedeu
|
|
71
71
|
# defined, then starting write space characters over the area
|
72
72
|
# which the interface occupies.
|
73
73
|
#
|
74
|
-
# @return [Array<Array<Vedeu::Cells::
|
74
|
+
# @return [Array<Array<Vedeu::Cells::Clear>>]
|
75
75
|
def output
|
76
76
|
Vedeu.timer("Clearing interface: '#{name}'") do
|
77
|
-
@_clear ||=
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
77
|
+
@_clear ||= Vedeu::Buffers::Clear.new(height: height,
|
78
|
+
name: name,
|
79
|
+
width: width).buffer
|
82
80
|
end
|
83
81
|
end
|
84
82
|
|
@@ -73,13 +73,17 @@ module Vedeu
|
|
73
73
|
@_interface ||= Vedeu.interfaces.by_name(name)
|
74
74
|
end
|
75
75
|
|
76
|
+
# @param iy [Fixnum]
|
77
|
+
# @return [String]
|
78
|
+
def optimised_line(iy)
|
79
|
+
Vedeu::Geometries::Position.new(by + iy, bx).to_s + colour.to_s + chars
|
80
|
+
end
|
81
|
+
|
76
82
|
# @return [String]
|
77
83
|
def optimised_output
|
78
84
|
Vedeu.timer("Optimised clearing content: '#{name}'") do
|
79
85
|
Array.new(bordered_height) do |iy|
|
80
|
-
|
81
|
-
colour.to_s +
|
82
|
-
chars
|
86
|
+
optimised_line(iy)
|
83
87
|
end.join + Vedeu::Geometries::Position.new(by, bx)
|
84
88
|
end
|
85
89
|
end
|
@@ -89,14 +93,12 @@ module Vedeu
|
|
89
93
|
# defined, then starting write space characters over the area
|
90
94
|
# which the interface occupies.
|
91
95
|
#
|
92
|
-
# @return [Array<Array<Vedeu::Cells::
|
96
|
+
# @return [Array<Array<Vedeu::Cells::Clear>>]
|
93
97
|
def output
|
94
98
|
Vedeu.timer("Clearing content: '#{name}'") do
|
95
|
-
@_clear ||=
|
96
|
-
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
99
|
+
@_clear ||= Vedeu::Buffers::Clear.new(height: bordered_height,
|
100
|
+
name: name,
|
101
|
+
width: bordered_width).buffer
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
@@ -35,12 +35,7 @@ module Vedeu
|
|
35
35
|
@same = ''
|
36
36
|
@compress ||= Vedeu.timer(message) do
|
37
37
|
content.map do |cell|
|
38
|
-
character =
|
39
|
-
position_for(cell),
|
40
|
-
colour_for(cell),
|
41
|
-
style_for(cell),
|
42
|
-
value_for(cell),
|
43
|
-
].join
|
38
|
+
character = character_for(cell)
|
44
39
|
|
45
40
|
character == @same ? next : @same = character
|
46
41
|
end.join.tap do |out|
|
@@ -58,6 +53,15 @@ module Vedeu
|
|
58
53
|
|
59
54
|
private
|
60
55
|
|
56
|
+
# @param char [Vedeu::Cells::Char]
|
57
|
+
# @return [String]
|
58
|
+
def character_for(char)
|
59
|
+
position_for(char) +
|
60
|
+
colour_for(char) +
|
61
|
+
style_for(char) +
|
62
|
+
value_for(char)
|
63
|
+
end
|
64
|
+
|
61
65
|
# Compress by not repeatedly sending the same colours for each
|
62
66
|
# character which has the same colours as the last character
|
63
67
|
# output.
|
data/lib/vedeu/version.rb
CHANGED
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
module Vedeu
|
6
|
+
|
7
|
+
module Buffers
|
8
|
+
|
9
|
+
describe Clear do
|
10
|
+
|
11
|
+
let(:described) { Vedeu::Buffers::Clear }
|
12
|
+
let(:instance) { described.new(attributes) }
|
13
|
+
let(:attributes) {
|
14
|
+
{
|
15
|
+
height: height,
|
16
|
+
name: _name,
|
17
|
+
width: width,
|
18
|
+
}
|
19
|
+
}
|
20
|
+
let(:height) { 4 }
|
21
|
+
let(:_name) { :vedeu_buffers_empty }
|
22
|
+
let(:width) { 9 }
|
23
|
+
|
24
|
+
let(:term_height) { 8 }
|
25
|
+
let(:term_width) { 15 }
|
26
|
+
|
27
|
+
before do
|
28
|
+
Vedeu.stubs(:height).returns(term_height)
|
29
|
+
Vedeu.stubs(:width).returns(term_width)
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#initialize' do
|
33
|
+
it { instance.must_be_instance_of(described) }
|
34
|
+
|
35
|
+
context 'when the height is given' do
|
36
|
+
it { instance.instance_variable_get('@height').must_equal(height) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the height not is given' do
|
40
|
+
let(:height) {}
|
41
|
+
|
42
|
+
it do
|
43
|
+
instance.instance_variable_get('@height').must_equal(term_height)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it { instance.instance_variable_get('@name').must_equal(_name) }
|
48
|
+
|
49
|
+
context 'when the width is given' do
|
50
|
+
it { instance.instance_variable_get('@width').must_equal(width) }
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when the width not is given' do
|
54
|
+
let(:width) {}
|
55
|
+
|
56
|
+
it { instance.instance_variable_get('@width').must_equal(term_width) }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#buffer' do
|
61
|
+
subject { instance.buffer }
|
62
|
+
|
63
|
+
it { subject.must_be_instance_of(Array) }
|
64
|
+
it { subject.first.must_be_instance_of(Array) }
|
65
|
+
it { subject.first.first.must_be_instance_of(Vedeu::Cells::Clear) }
|
66
|
+
|
67
|
+
it { subject.size.must_equal(height + 1) }
|
68
|
+
it { subject.first.size.must_equal(width + 1) }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#height' do
|
72
|
+
it { instance.must_respond_to(:height) }
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#name' do
|
76
|
+
it { instance.must_respond_to(:name) }
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#width' do
|
80
|
+
it { instance.must_respond_to(:width) }
|
81
|
+
end
|
82
|
+
|
83
|
+
end # Clear
|
84
|
+
|
85
|
+
end # Buffers
|
86
|
+
|
87
|
+
end # Vedeu
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vedeu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -235,7 +235,6 @@ files:
|
|
235
235
|
- bin/vedeu_drb_client
|
236
236
|
- bin/vedeu_drb_server
|
237
237
|
- bin/vedeu_test
|
238
|
-
- config/rubocop_enabled.yml
|
239
238
|
- docs/api.md
|
240
239
|
- docs/applications/existing_application.md
|
241
240
|
- docs/applications/first_application.md
|
@@ -568,6 +567,9 @@ files:
|
|
568
567
|
- integrations/dsl_app_022.rb
|
569
568
|
- integrations/dsl_app_030.rb
|
570
569
|
- integrations/dsl_app_031.rb
|
570
|
+
- integrations/dsl_app_040.rb
|
571
|
+
- integrations/dsl_app_041.rb
|
572
|
+
- integrations/dsl_app_042.rb
|
571
573
|
- integrations/dsl_app_border_001.rb
|
572
574
|
- integrations/dsl_app_border_002.rb
|
573
575
|
- integrations/dsl_app_border_003.rb
|
@@ -607,6 +609,9 @@ files:
|
|
607
609
|
- integrations/expected/dsl_app_022.out
|
608
610
|
- integrations/expected/dsl_app_030.out
|
609
611
|
- integrations/expected/dsl_app_031.out
|
612
|
+
- integrations/expected/dsl_app_040.out
|
613
|
+
- integrations/expected/dsl_app_041.out
|
614
|
+
- integrations/expected/dsl_app_042.out
|
610
615
|
- integrations/expected/dsl_app_border_001.out
|
611
616
|
- integrations/expected/dsl_app_border_002.out
|
612
617
|
- integrations/expected/dsl_app_border_003.out
|
@@ -648,6 +653,7 @@ files:
|
|
648
653
|
- lib/vedeu/borders/title.rb
|
649
654
|
- lib/vedeu/buffers/all.rb
|
650
655
|
- lib/vedeu/buffers/buffer.rb
|
656
|
+
- lib/vedeu/buffers/clear.rb
|
651
657
|
- lib/vedeu/buffers/empty.rb
|
652
658
|
- lib/vedeu/buffers/null.rb
|
653
659
|
- lib/vedeu/buffers/refresh.rb
|
@@ -917,6 +923,7 @@ files:
|
|
917
923
|
- test/lib/vedeu/borders/title_test.rb
|
918
924
|
- test/lib/vedeu/buffers/all_test.rb
|
919
925
|
- test/lib/vedeu/buffers/buffer_test.rb
|
926
|
+
- test/lib/vedeu/buffers/clear_test.rb
|
920
927
|
- test/lib/vedeu/buffers/empty_test.rb
|
921
928
|
- test/lib/vedeu/buffers/null_test.rb
|
922
929
|
- test/lib/vedeu/buffers/refresh_content_test.rb
|
@@ -1184,6 +1191,7 @@ test_files:
|
|
1184
1191
|
- test/lib/vedeu/borders/title_test.rb
|
1185
1192
|
- test/lib/vedeu/buffers/all_test.rb
|
1186
1193
|
- test/lib/vedeu/buffers/buffer_test.rb
|
1194
|
+
- test/lib/vedeu/buffers/clear_test.rb
|
1187
1195
|
- test/lib/vedeu/buffers/empty_test.rb
|
1188
1196
|
- test/lib/vedeu/buffers/null_test.rb
|
1189
1197
|
- test/lib/vedeu/buffers/refresh_content_test.rb
|
data/config/rubocop_enabled.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
Lint/Eval:
|
2
|
-
Description: 'The use of eval represents a serious security risk.'
|
3
|
-
Enabled: false
|
4
|
-
|
5
|
-
Metrics/ClassLength:
|
6
|
-
Description: 'Avoid classes longer than 100 lines of code.'
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
Style/AsciiComments:
|
10
|
-
Description: 'Use only ascii symbols in comments.'
|
11
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Style/Documentation:
|
15
|
-
Description: 'Document classes and non-namespace modules.'
|
16
|
-
Enabled: false
|