vedeu 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/integrations/342_streams.rb +74 -0
  4. data/integrations/dsl_app_001.rb +58 -0
  5. data/integrations/dsl_app_002.rb +59 -0
  6. data/integrations/dsl_app_003.rb +58 -0
  7. data/integrations/dsl_app_004.rb +63 -0
  8. data/integrations/dsl_app_005.rb +62 -0
  9. data/integrations/dsl_app_006.rb +57 -0
  10. data/integrations/dsl_app_007.rb +63 -0
  11. data/integrations/dsl_app_008.rb +65 -0
  12. data/integrations/dsl_app_009.rb +70 -0
  13. data/integrations/dsl_app_010.rb +71 -0
  14. data/integrations/dsl_app_011.rb +61 -0
  15. data/integrations/dsl_app_012.rb +59 -0
  16. data/integrations/dsl_app_013.rb +60 -0
  17. data/integrations/dsl_app_014.rb +60 -0
  18. data/integrations/dsl_app_015.rb +60 -0
  19. data/integrations/dsl_app_016.rb +64 -0
  20. data/integrations/dsl_app_017.rb +56 -0
  21. data/integrations/dsl_app_018.rb +56 -0
  22. data/integrations/dsl_app_019.rb +56 -0
  23. data/integrations/dsl_app_020.rb +56 -0
  24. data/integrations/expected/342_streams.out +1 -0
  25. data/integrations/expected/dsl_app_001.out +1 -0
  26. data/integrations/expected/dsl_app_002.out +1 -0
  27. data/integrations/expected/dsl_app_003.out +1 -0
  28. data/integrations/expected/dsl_app_004.out +1 -0
  29. data/integrations/expected/dsl_app_005.out +1 -0
  30. data/integrations/expected/dsl_app_006.out +1 -0
  31. data/integrations/expected/dsl_app_007.out +1 -0
  32. data/integrations/expected/dsl_app_008.out +1 -0
  33. data/integrations/expected/dsl_app_009.out +1 -0
  34. data/integrations/expected/dsl_app_010.out +1 -0
  35. data/integrations/expected/dsl_app_011.out +1 -0
  36. data/integrations/expected/dsl_app_012.out +1 -0
  37. data/integrations/expected/dsl_app_013.out +1 -0
  38. data/integrations/expected/dsl_app_014.out +1 -0
  39. data/integrations/expected/dsl_app_015.out +1 -0
  40. data/integrations/expected/dsl_app_016.out +1 -0
  41. data/integrations/support/test_interface.rb +13 -0
  42. data/integrations/test_runner.sh +32 -0
  43. data/lib/vedeu/cells/empty.rb +14 -0
  44. data/lib/vedeu/colours/background.rb +13 -0
  45. data/lib/vedeu/colours/colour.rb +11 -4
  46. data/lib/vedeu/colours/foreground.rb +13 -0
  47. data/lib/vedeu/common.rb +42 -0
  48. data/lib/vedeu/dsl/attributes.rb +1 -1
  49. data/lib/vedeu/dsl/elements.rb +57 -23
  50. data/lib/vedeu/dsl/string/align.rb +17 -2
  51. data/lib/vedeu/geometries/position.rb +5 -0
  52. data/lib/vedeu/geometries/positionable.rb +2 -2
  53. data/lib/vedeu/presentation/style.rb +5 -0
  54. data/lib/vedeu/renderers/all.rb +1 -0
  55. data/lib/vedeu/renderers/escape.rb +96 -0
  56. data/lib/vedeu/repositories/defaults.rb +14 -6
  57. data/lib/vedeu/runtime/launcher.rb +5 -1
  58. data/lib/vedeu/version.rb +1 -1
  59. data/lib/vedeu/views/lines.rb +5 -0
  60. data/lib/vedeu/views/stream.rb +8 -1
  61. data/lib/vedeu/views/streams.rb +6 -1
  62. data/lib/vedeu/views/value.rb +2 -8
  63. data/lib/vedeu/views/view.rb +1 -1
  64. data/test/lib/vedeu/colours/colour_test.rb +0 -8
  65. data/test/lib/vedeu/common_test.rb +72 -0
  66. data/test/lib/vedeu/dsl/string/align_test.rb +1 -1
  67. metadata +43 -17
  68. data/examples/284_slow_rendering.rb +0 -108
  69. data/examples/views/expected/vedeu_line.html +0 -140
  70. data/examples/views/expected/vedeu_line.json +0 -96050
  71. data/examples/views/expected/vedeu_line.out +0 -1
  72. data/examples/views/expected/vedeu_line.txt +0 -58
  73. data/examples/views/expected/vedeu_lines.html +0 -140
  74. data/examples/views/expected/vedeu_lines.json +0 -96050
  75. data/examples/views/expected/vedeu_lines.out +0 -1
  76. data/examples/views/expected/vedeu_lines_alignment.html +0 -80
  77. data/examples/views/expected/vedeu_lines_alignment.json +0 -46370
  78. data/examples/views/expected/vedeu_lines_alignment.out +0 -1
  79. data/examples/views/line.rb +0 -128
  80. data/examples/views/lines.rb +0 -165
  81. data/examples/views/lines_alignment.rb +0 -126
  82. data/examples/views/runner.sh +0 -73
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_007.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_007.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_007.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_007.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.render do
30
+ view(:test_interface) do
31
+ line do
32
+ stream 'view->line 1->stream', { foreground: '#00ff00' }
33
+ end
34
+ line do
35
+ stream 'view->line 2->stream 1', { foreground: '#007fff' }
36
+ stream 'view->line 2->stream 2', { foreground: '#ff00ff' }
37
+ end
38
+ end
39
+ end
40
+
41
+ def self.actual
42
+ File.read('/tmp/dsl_app_007.out')
43
+ end
44
+
45
+ def self.expected
46
+ File.read(File.expand_path('../expected/dsl_app_007.out', __FILE__))
47
+ end
48
+
49
+ def self.start(argv = ARGV)
50
+ Vedeu::Launcher.execute!(argv)
51
+ end
52
+
53
+ end # DSLApp
54
+
55
+ DSLApp.start
56
+
57
+ if DSLApp.expected == DSLApp.actual
58
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
59
+ exit 0;
60
+ else
61
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
62
+ exit 1;
63
+ end
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_008.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_008.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_008.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_008.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.render do
30
+ view(:test_interface) do
31
+ lines do
32
+ line do
33
+ stream 'view->lines->line->stream', { foreground: '#5500cc' }
34
+ end
35
+ line do
36
+ stream 'view->stream 2->text 1', { foreground: '#ff00ff' }
37
+ stream 'view->stream 2->text 2', { foreground: '#ffffff' }
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ def self.actual
44
+ File.read('/tmp/dsl_app_008.out')
45
+ end
46
+
47
+ def self.expected
48
+ File.read(File.expand_path('../expected/dsl_app_008.out', __FILE__))
49
+ end
50
+
51
+ def self.start(argv = ARGV)
52
+ Vedeu::Launcher.execute!(argv)
53
+ end
54
+
55
+ end # DSLApp
56
+
57
+ DSLApp.start
58
+
59
+ if DSLApp.expected == DSLApp.actual
60
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
61
+ exit 0;
62
+ else
63
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
64
+ exit 1;
65
+ end
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_009.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_009.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_009.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_009.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.render do
30
+ view(:test_interface) do
31
+ stream do
32
+ text 'Multiple ', { foreground: '#00ff00' }
33
+ text '`text` ', { foreground: '#007fff' }
34
+ text 'keywords within', { foreground: '#00ff00' }
35
+ end
36
+ stream do
37
+ text 'a ', { foreground: '#00ff00' }
38
+ text '`stream` ', { foreground: '#007fff' }
39
+ text 'block view are', { foreground: '#00ff00' }
40
+ end
41
+ stream do
42
+ text 'treated as ', { foreground: '#00ff00' }
43
+ text 'separate streams.', { foreground: '#007fff' }
44
+ end
45
+ end
46
+ end
47
+
48
+ def self.actual
49
+ File.read('/tmp/dsl_app_009.out')
50
+ end
51
+
52
+ def self.expected
53
+ File.read(File.expand_path('../expected/dsl_app_009.out', __FILE__))
54
+ end
55
+
56
+ def self.start(argv = ARGV)
57
+ Vedeu::Launcher.execute!(argv)
58
+ end
59
+
60
+ end # DSLApp
61
+
62
+ DSLApp.start
63
+
64
+ if DSLApp.expected == DSLApp.actual
65
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
66
+ exit 0;
67
+ else
68
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
69
+ exit 1;
70
+ end
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_010.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_010.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_010.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_010.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.render do
30
+ view(:test_interface) do
31
+ line do
32
+ streams do
33
+ stream 'Multiple ', { foreground: '#00ff00' }
34
+ stream '`stream` ', { foreground: '#007fff' }
35
+ stream 'within a ', { foreground: '#00ff00' }
36
+ end
37
+ end
38
+ line do
39
+ streams do
40
+ stream '`streams` ', { foreground: '#007fff' }
41
+ stream 'within a ', { foreground: '#00ff00' }
42
+ stream '`line`', { foreground: '#007fff' }
43
+ stream '.', { foreground: '#00ff00' }
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ def self.actual
50
+ File.read('/tmp/dsl_app_010.out')
51
+ end
52
+
53
+ def self.expected
54
+ File.read(File.expand_path('../expected/dsl_app_010.out', __FILE__))
55
+ end
56
+
57
+ def self.start(argv = ARGV)
58
+ Vedeu::Launcher.execute!(argv)
59
+ end
60
+
61
+ end # DSLApp
62
+
63
+ DSLApp.start
64
+
65
+ if DSLApp.expected == DSLApp.actual
66
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
67
+ exit 0;
68
+ else
69
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
70
+ exit 1;
71
+ end
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_011.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_011.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_011.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_011.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.render do
30
+ view(:test_interface) do
31
+ background '#002200'
32
+ foreground '#aaff00'
33
+ line 'view->line (align: :left)', { align: :left }
34
+ line 'view->line (align: :centre)', { align: :centre }
35
+ line 'view->line (align: :right)', { align: :right }
36
+ end
37
+ end
38
+
39
+ def self.actual
40
+ File.read('/tmp/dsl_app_011.out')
41
+ end
42
+
43
+ def self.expected
44
+ File.read(File.expand_path('../expected/dsl_app_011.out', __FILE__))
45
+ end
46
+
47
+ def self.start(argv = ARGV)
48
+ Vedeu::Launcher.execute!(argv)
49
+ end
50
+
51
+ end # DSLApp
52
+
53
+ DSLApp.start
54
+
55
+ if DSLApp.expected == DSLApp.actual
56
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
57
+ exit 0;
58
+ else
59
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
60
+ exit 1;
61
+ end
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_012.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_012.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_012.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_012.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.render do
30
+ view(:test_interface) do
31
+ left 'view->left'
32
+ centre 'view->centre'
33
+ right 'view->right'
34
+ end
35
+ end
36
+
37
+ def self.actual
38
+ File.read('/tmp/dsl_app_012.out')
39
+ end
40
+
41
+ def self.expected
42
+ File.read(File.expand_path('../expected/dsl_app_012.out', __FILE__))
43
+ end
44
+
45
+ def self.start(argv = ARGV)
46
+ Vedeu::Launcher.execute!(argv)
47
+ end
48
+
49
+ end # DSLApp
50
+
51
+ DSLApp.start
52
+
53
+ if DSLApp.expected == DSLApp.actual
54
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
55
+ exit 0;
56
+ else
57
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
58
+ exit 1;
59
+ end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'vedeu'
7
+
8
+ class DSLApp
9
+
10
+ Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
11
+
12
+ Vedeu.configure do
13
+ debug!
14
+ log '/tmp/vedeu_views_dsl.log'
15
+ renderers [
16
+ Vedeu::Renderers::Terminal.new(
17
+ filename: '/tmp/dsl_app_013.out',
18
+ write_file: true),
19
+ # Vedeu::Renderers::JSON.new(filename: '/tmp/dsl_app_013.json'),
20
+ # Vedeu::Renderers::HTML.new(filename: '/tmp/dsl_app_013.html'),
21
+ # Vedeu::Renderers::Text.new(filename: '/tmp/dsl_app_013.txt'),
22
+ ]
23
+ run_once!
24
+ standalone!
25
+ end
26
+
27
+ load './support/test_interface.rb'
28
+
29
+ Vedeu.render do
30
+ view(:test_interface) do
31
+ lines do
32
+ left 'view->lines->left 1', { foreground: '#ff0000' }
33
+ left 'view->lines->left 2', { background: '#ff0000', foreground: '#000000' }
34
+ end
35
+ end
36
+ end
37
+
38
+ def self.actual
39
+ File.read('/tmp/dsl_app_013.out')
40
+ end
41
+
42
+ def self.expected
43
+ File.read(File.expand_path('../expected/dsl_app_013.out', __FILE__))
44
+ end
45
+
46
+ def self.start(argv = ARGV)
47
+ Vedeu::Launcher.execute!(argv)
48
+ end
49
+
50
+ end # DSLApp
51
+
52
+ DSLApp.start
53
+
54
+ if DSLApp.expected == DSLApp.actual
55
+ puts "#{__FILE__} \e[32mPassed.\e[39m"
56
+ exit 0;
57
+ else
58
+ puts "#{__FILE__} \e[31mFailed.\e[39m"
59
+ exit 1;
60
+ end