vedeu 0.4.60 → 0.4.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu.rb +2 -0
- data/lib/vedeu/all.rb +8 -4
- data/lib/vedeu/{output → borders}/border.rb +0 -0
- data/lib/vedeu/{output → borders}/borders.rb +0 -0
- data/lib/vedeu/{output → borders}/render_border.rb +24 -18
- data/lib/vedeu/cursor/move.rb +5 -16
- data/lib/vedeu/cursor/reposition.rb +3 -17
- data/lib/vedeu/dsl/view.rb +1 -1
- data/lib/vedeu/geometry/coordinate.rb +21 -11
- data/lib/vedeu/geometry/geometry.rb +1 -1
- data/lib/vedeu/geometry/position.rb +2 -2
- data/lib/vedeu/output/compressor.rb +3 -7
- data/lib/vedeu/output/style.rb +1 -1
- data/lib/vedeu/plugins.rb +12 -13
- data/lib/vedeu/plugins/plugin.rb +4 -2
- data/lib/vedeu/repositories/collection.rb +9 -0
- data/lib/vedeu/templating/all.rb +9 -0
- data/lib/vedeu/templating/decoder.rb +62 -0
- data/lib/vedeu/templating/directive.rb +0 -1
- data/lib/vedeu/templating/encoder.rb +62 -0
- data/lib/vedeu/templating/helpers.rb +10 -22
- data/lib/vedeu/templating/post_processor.rb +81 -0
- data/lib/vedeu/templating/template.rb +1 -7
- data/lib/vedeu/terminal_mode.rb +2 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/{output → borders}/border_test.rb +0 -0
- data/test/lib/vedeu/{output → borders}/borders_test.rb +0 -0
- data/test/lib/vedeu/{output → borders}/render_border_test.rb +0 -0
- data/test/lib/vedeu/geometry/coordinate_test.rb +20 -17
- data/test/lib/vedeu/geometry/position_test.rb +1 -1
- data/test/lib/vedeu/models/char_test.rb +17 -18
- data/test/lib/vedeu/output/compressor_test.rb +5 -5
- data/test/lib/vedeu/output/{renderers/all_test.rb → renderers_test.rb} +0 -0
- data/test/lib/vedeu/output/viewport_test.rb +63 -63
- data/test/lib/vedeu/plugins_test.rb +12 -6
- data/test/lib/vedeu/repositories/collection_test.rb +14 -0
- data/test/lib/vedeu/templating/decoder_test.rb +37 -0
- data/test/lib/vedeu/templating/encoder_test.rb +38 -0
- data/test/lib/vedeu/templating/helpers_test.rb +11 -0
- data/test/lib/vedeu/templating/{preprocessor_test.rb → post_processor_test.rb} +14 -18
- data/test/lib/vedeu/templating/template_test.rb +3 -2
- data/test/support/templates/{inline.erb → plain.erb} +0 -0
- metadata +25 -18
- data/lib/vedeu/templating/preprocessor.rb +0 -81
@@ -33,9 +33,10 @@ module Vedeu
|
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when the path exists' do
|
36
|
-
let(:path) { 'test/support/templates/
|
36
|
+
let(:path) { 'test/support/templates/plain.erb' }
|
37
|
+
let(:expected) { "This is a test.\n" }
|
37
38
|
|
38
|
-
it { subject.must_equal(
|
39
|
+
it { subject.must_equal(expected) }
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
File without changes
|
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.4.
|
4
|
+
version: 0.4.61
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -275,6 +275,9 @@ files:
|
|
275
275
|
- lib/vedeu/bindings/system.rb
|
276
276
|
- lib/vedeu/bindings/visibility.rb
|
277
277
|
- lib/vedeu/bootstrap.rb
|
278
|
+
- lib/vedeu/borders/border.rb
|
279
|
+
- lib/vedeu/borders/borders.rb
|
280
|
+
- lib/vedeu/borders/render_border.rb
|
278
281
|
- lib/vedeu/buffers/buffer.rb
|
279
282
|
- lib/vedeu/buffers/buffers.rb
|
280
283
|
- lib/vedeu/buffers/display_buffer.rb
|
@@ -398,8 +401,6 @@ files:
|
|
398
401
|
- lib/vedeu/null/geometry.rb
|
399
402
|
- lib/vedeu/null/interface.rb
|
400
403
|
- lib/vedeu/null/menu.rb
|
401
|
-
- lib/vedeu/output/border.rb
|
402
|
-
- lib/vedeu/output/borders.rb
|
403
404
|
- lib/vedeu/output/clear/named_group.rb
|
404
405
|
- lib/vedeu/output/clear/named_interface.rb
|
405
406
|
- lib/vedeu/output/compressor.rb
|
@@ -409,7 +410,6 @@ files:
|
|
409
410
|
- lib/vedeu/output/presentation.rb
|
410
411
|
- lib/vedeu/output/refresh.rb
|
411
412
|
- lib/vedeu/output/refresh_group.rb
|
412
|
-
- lib/vedeu/output/render_border.rb
|
413
413
|
- lib/vedeu/output/renderers.rb
|
414
414
|
- lib/vedeu/output/renderers/escape_sequence.rb
|
415
415
|
- lib/vedeu/output/renderers/file.rb
|
@@ -434,9 +434,12 @@ files:
|
|
434
434
|
- lib/vedeu/repositories/registerable.rb
|
435
435
|
- lib/vedeu/repositories/repository.rb
|
436
436
|
- lib/vedeu/repositories/store.rb
|
437
|
+
- lib/vedeu/templating/all.rb
|
438
|
+
- lib/vedeu/templating/decoder.rb
|
437
439
|
- lib/vedeu/templating/directive.rb
|
440
|
+
- lib/vedeu/templating/encoder.rb
|
438
441
|
- lib/vedeu/templating/helpers.rb
|
439
|
-
- lib/vedeu/templating/
|
442
|
+
- lib/vedeu/templating/post_processor.rb
|
440
443
|
- lib/vedeu/templating/template.rb
|
441
444
|
- lib/vedeu/terminal.rb
|
442
445
|
- lib/vedeu/terminal_mode.rb
|
@@ -457,6 +460,9 @@ files:
|
|
457
460
|
- test/lib/vedeu/bindings/system_test.rb
|
458
461
|
- test/lib/vedeu/bindings/visibility_test.rb
|
459
462
|
- test/lib/vedeu/bootstrap_test.rb
|
463
|
+
- test/lib/vedeu/borders/border_test.rb
|
464
|
+
- test/lib/vedeu/borders/borders_test.rb
|
465
|
+
- test/lib/vedeu/borders/render_border_test.rb
|
460
466
|
- test/lib/vedeu/buffers/buffer_test.rb
|
461
467
|
- test/lib/vedeu/buffers/buffers_test.rb
|
462
468
|
- test/lib/vedeu/buffers/display_buffer_test.rb
|
@@ -547,8 +553,6 @@ files:
|
|
547
553
|
- test/lib/vedeu/null/geometry_test.rb
|
548
554
|
- test/lib/vedeu/null/interface_test.rb
|
549
555
|
- test/lib/vedeu/null/menu_test.rb
|
550
|
-
- test/lib/vedeu/output/border_test.rb
|
551
|
-
- test/lib/vedeu/output/borders_test.rb
|
552
556
|
- test/lib/vedeu/output/clear/named_group_test.rb
|
553
557
|
- test/lib/vedeu/output/clear/named_interface_test.rb
|
554
558
|
- test/lib/vedeu/output/compressor_test.rb
|
@@ -558,8 +562,6 @@ files:
|
|
558
562
|
- test/lib/vedeu/output/presentation_test.rb
|
559
563
|
- test/lib/vedeu/output/refresh_group_test.rb
|
560
564
|
- test/lib/vedeu/output/refresh_test.rb
|
561
|
-
- test/lib/vedeu/output/render_border_test.rb
|
562
|
-
- test/lib/vedeu/output/renderers/all_test.rb
|
563
565
|
- test/lib/vedeu/output/renderers/escape_sequence_test.rb
|
564
566
|
- test/lib/vedeu/output/renderers/file_test.rb
|
565
567
|
- test/lib/vedeu/output/renderers/html_test.rb
|
@@ -568,6 +570,7 @@ files:
|
|
568
570
|
- test/lib/vedeu/output/renderers/renderer_options_test.rb
|
569
571
|
- test/lib/vedeu/output/renderers/terminal_test.rb
|
570
572
|
- test/lib/vedeu/output/renderers/text_test.rb
|
573
|
+
- test/lib/vedeu/output/renderers_test.rb
|
571
574
|
- test/lib/vedeu/output/style_test.rb
|
572
575
|
- test/lib/vedeu/output/text_test.rb
|
573
576
|
- test/lib/vedeu/output/viewport_test.rb
|
@@ -582,9 +585,11 @@ files:
|
|
582
585
|
- test/lib/vedeu/repositories/registerable_test.rb
|
583
586
|
- test/lib/vedeu/repositories/repository_test.rb
|
584
587
|
- test/lib/vedeu/repositories/store_test.rb
|
588
|
+
- test/lib/vedeu/templating/decoder_test.rb
|
585
589
|
- test/lib/vedeu/templating/directive_test.rb
|
590
|
+
- test/lib/vedeu/templating/encoder_test.rb
|
586
591
|
- test/lib/vedeu/templating/helpers_test.rb
|
587
|
-
- test/lib/vedeu/templating/
|
592
|
+
- test/lib/vedeu/templating/post_processor_test.rb
|
588
593
|
- test/lib/vedeu/templating/template_test.rb
|
589
594
|
- test/lib/vedeu/terminal_mode_test.rb
|
590
595
|
- test/lib/vedeu/terminal_test.rb
|
@@ -594,7 +599,7 @@ files:
|
|
594
599
|
- test/support/all_seeds.sh
|
595
600
|
- test/support/helpers/model_test_class.rb
|
596
601
|
- test/support/stats.sh
|
597
|
-
- test/support/templates/
|
602
|
+
- test/support/templates/plain.erb
|
598
603
|
- test/support/templates/simple_stuff.erb
|
599
604
|
- test/test_helper.rb
|
600
605
|
- vedeu.gemspec
|
@@ -637,6 +642,9 @@ test_files:
|
|
637
642
|
- test/lib/vedeu/bindings/system_test.rb
|
638
643
|
- test/lib/vedeu/bindings/visibility_test.rb
|
639
644
|
- test/lib/vedeu/bootstrap_test.rb
|
645
|
+
- test/lib/vedeu/borders/border_test.rb
|
646
|
+
- test/lib/vedeu/borders/borders_test.rb
|
647
|
+
- test/lib/vedeu/borders/render_border_test.rb
|
640
648
|
- test/lib/vedeu/buffers/buffer_test.rb
|
641
649
|
- test/lib/vedeu/buffers/buffers_test.rb
|
642
650
|
- test/lib/vedeu/buffers/display_buffer_test.rb
|
@@ -727,8 +735,6 @@ test_files:
|
|
727
735
|
- test/lib/vedeu/null/geometry_test.rb
|
728
736
|
- test/lib/vedeu/null/interface_test.rb
|
729
737
|
- test/lib/vedeu/null/menu_test.rb
|
730
|
-
- test/lib/vedeu/output/border_test.rb
|
731
|
-
- test/lib/vedeu/output/borders_test.rb
|
732
738
|
- test/lib/vedeu/output/clear/named_group_test.rb
|
733
739
|
- test/lib/vedeu/output/clear/named_interface_test.rb
|
734
740
|
- test/lib/vedeu/output/compressor_test.rb
|
@@ -738,8 +744,6 @@ test_files:
|
|
738
744
|
- test/lib/vedeu/output/presentation_test.rb
|
739
745
|
- test/lib/vedeu/output/refresh_group_test.rb
|
740
746
|
- test/lib/vedeu/output/refresh_test.rb
|
741
|
-
- test/lib/vedeu/output/render_border_test.rb
|
742
|
-
- test/lib/vedeu/output/renderers/all_test.rb
|
743
747
|
- test/lib/vedeu/output/renderers/escape_sequence_test.rb
|
744
748
|
- test/lib/vedeu/output/renderers/file_test.rb
|
745
749
|
- test/lib/vedeu/output/renderers/html_test.rb
|
@@ -748,6 +752,7 @@ test_files:
|
|
748
752
|
- test/lib/vedeu/output/renderers/renderer_options_test.rb
|
749
753
|
- test/lib/vedeu/output/renderers/terminal_test.rb
|
750
754
|
- test/lib/vedeu/output/renderers/text_test.rb
|
755
|
+
- test/lib/vedeu/output/renderers_test.rb
|
751
756
|
- test/lib/vedeu/output/style_test.rb
|
752
757
|
- test/lib/vedeu/output/text_test.rb
|
753
758
|
- test/lib/vedeu/output/viewport_test.rb
|
@@ -762,9 +767,11 @@ test_files:
|
|
762
767
|
- test/lib/vedeu/repositories/registerable_test.rb
|
763
768
|
- test/lib/vedeu/repositories/repository_test.rb
|
764
769
|
- test/lib/vedeu/repositories/store_test.rb
|
770
|
+
- test/lib/vedeu/templating/decoder_test.rb
|
765
771
|
- test/lib/vedeu/templating/directive_test.rb
|
772
|
+
- test/lib/vedeu/templating/encoder_test.rb
|
766
773
|
- test/lib/vedeu/templating/helpers_test.rb
|
767
|
-
- test/lib/vedeu/templating/
|
774
|
+
- test/lib/vedeu/templating/post_processor_test.rb
|
768
775
|
- test/lib/vedeu/templating/template_test.rb
|
769
776
|
- test/lib/vedeu/terminal_mode_test.rb
|
770
777
|
- test/lib/vedeu/terminal_test.rb
|
@@ -774,7 +781,7 @@ test_files:
|
|
774
781
|
- test/support/all_seeds.sh
|
775
782
|
- test/support/helpers/model_test_class.rb
|
776
783
|
- test/support/stats.sh
|
777
|
-
- test/support/templates/
|
784
|
+
- test/support/templates/plain.erb
|
778
785
|
- test/support/templates/simple_stuff.erb
|
779
786
|
- test/test_helper.rb
|
780
787
|
has_rdoc:
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
# Provides means to use templates with Vedeu.
|
4
|
-
module Templating
|
5
|
-
|
6
|
-
# preprocess
|
7
|
-
# takes a line at a time
|
8
|
-
# splits line into component parts e.g. text1, ruby, text1
|
9
|
-
# takes text1, adds to JSON stream
|
10
|
-
# processes ruby, adding to a new JSON stream
|
11
|
-
# takes text2, adds to a JSON stream
|
12
|
-
#
|
13
|
-
# process
|
14
|
-
# converts JSON streams into line/stream objects with correct attributes
|
15
|
-
#
|
16
|
-
# Pre-processes a template, to convert all lines and lines with directives
|
17
|
-
# into Vedeu::Streams.
|
18
|
-
#
|
19
|
-
class Preprocessor
|
20
|
-
|
21
|
-
# @param lines [Array<String>]
|
22
|
-
# @return [Array<Vedeu::Stream>]
|
23
|
-
def self.process(lines)
|
24
|
-
new(lines).process
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns a new instance of Vedeu::Templating::Preprocessor.
|
28
|
-
#
|
29
|
-
# @param lines [Array<String>]
|
30
|
-
# @return [Vedeu::Templating::Preprocessor]
|
31
|
-
def initialize(lines)
|
32
|
-
@lines = lines
|
33
|
-
end
|
34
|
-
|
35
|
-
# @return [Array<Vedeu::Stream>]
|
36
|
-
def process
|
37
|
-
lines.each_with_object([]) do |line, acc|
|
38
|
-
if line =~ markers?
|
39
|
-
code = line.gsub(markers, '').chomp
|
40
|
-
|
41
|
-
acc << Directive.process(code)
|
42
|
-
|
43
|
-
else
|
44
|
-
acc << Vedeu::Stream.new(value: line.chomp)
|
45
|
-
|
46
|
-
end
|
47
|
-
acc
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
protected
|
52
|
-
|
53
|
-
# @!attribute [r] lines
|
54
|
-
# @return [Array<String>]
|
55
|
-
attr_reader :lines
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
# Return a pattern to remove directive markers and spaces.
|
60
|
-
#
|
61
|
-
# @example
|
62
|
-
# line containing {{ or }}
|
63
|
-
#
|
64
|
-
# @return [Regexp]
|
65
|
-
def markers
|
66
|
-
/({{\s*|\s*}})/
|
67
|
-
end
|
68
|
-
|
69
|
-
# @example
|
70
|
-
# line contains {{ or }}
|
71
|
-
#
|
72
|
-
# @return [Regexp]
|
73
|
-
def markers?
|
74
|
-
/^\s*({{)(.*?)(}})$/
|
75
|
-
end
|
76
|
-
|
77
|
-
end # Preprocessor
|
78
|
-
|
79
|
-
end # Templating
|
80
|
-
|
81
|
-
end # Vedeu
|