walrus 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/walrus +29 -14
- data/ext/extconf.rb +16 -0
- data/ext/{jindex/jindex.c → jindex.c} +27 -14
- data/lib/walrus/additions/string.rb +11 -5
- data/lib/walrus/compile_error.rb +11 -5
- data/lib/walrus/compiler.rb +12 -6
- data/lib/walrus/contrib/spec/walruscloth_spec.rb +11 -5
- data/lib/walrus/contrib/walruscloth.rb +11 -5
- data/lib/walrus/diff.rb +11 -5
- data/lib/walrus/document.rb +11 -5
- data/lib/walrus/grammar/additions/proc.rb +11 -5
- data/lib/walrus/grammar/additions/regexp.rb +11 -5
- data/lib/walrus/grammar/additions/string.rb +11 -5
- data/lib/walrus/grammar/additions/symbol.rb +12 -5
- data/lib/walrus/grammar/and_predicate.rb +11 -5
- data/lib/walrus/grammar/array_result.rb +11 -5
- data/lib/walrus/grammar/continuation_wrapper_exception.rb +11 -5
- data/lib/walrus/grammar/left_recursion_exception.rb +11 -5
- data/lib/walrus/grammar/location_tracking.rb +19 -9
- data/lib/walrus/grammar/match_data_wrapper.rb +11 -5
- data/lib/walrus/grammar/memoizing.rb +11 -5
- data/lib/walrus/grammar/memoizing_cache.rb +18 -9
- data/lib/walrus/grammar/node.rb +11 -5
- data/lib/walrus/grammar/not_predicate.rb +11 -5
- data/lib/walrus/grammar/parse_error.rb +11 -5
- data/lib/walrus/grammar/parser_state.rb +11 -5
- data/lib/walrus/grammar/parslet.rb +11 -5
- data/lib/walrus/grammar/parslet_choice.rb +15 -7
- data/lib/walrus/grammar/parslet_combination.rb +11 -5
- data/lib/walrus/grammar/parslet_combining.rb +11 -5
- data/lib/walrus/grammar/parslet_merge.rb +11 -5
- data/lib/walrus/grammar/parslet_omission.rb +11 -5
- data/lib/walrus/grammar/parslet_repetition.rb +17 -8
- data/lib/walrus/grammar/parslet_repetition_default.rb +11 -5
- data/lib/walrus/grammar/parslet_sequence.rb +20 -8
- data/lib/walrus/grammar/predicate.rb +11 -5
- data/lib/walrus/grammar/proc_parslet.rb +11 -5
- data/lib/walrus/grammar/regexp_parslet.rb +11 -5
- data/lib/walrus/grammar/skipped_substring_exception.rb +11 -5
- data/lib/walrus/grammar/string_enumerator.rb +14 -6
- data/lib/walrus/grammar/string_parslet.rb +11 -5
- data/lib/walrus/grammar/string_result.rb +11 -5
- data/lib/walrus/grammar/symbol_parslet.rb +11 -5
- data/lib/walrus/grammar.rb +11 -5
- data/lib/walrus/no_parameter_marker.rb +11 -5
- data/lib/walrus/parser.rb +12 -6
- data/lib/walrus/runner.rb +60 -67
- data/lib/walrus/template.rb +15 -7
- data/lib/walrus/version.rb +3 -0
- data/lib/walrus/walrus_grammar/assignment_expression.rb +11 -5
- data/lib/walrus/walrus_grammar/block_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/comment.rb +11 -5
- data/lib/walrus/walrus_grammar/def_directive.rb +16 -8
- data/lib/walrus/walrus_grammar/echo_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/escape_sequence.rb +11 -5
- data/lib/walrus/walrus_grammar/import_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/include_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/instance_variable.rb +11 -5
- data/lib/walrus/walrus_grammar/literal.rb +11 -5
- data/lib/walrus/walrus_grammar/message_expression.rb +11 -5
- data/lib/walrus/walrus_grammar/multiline_comment.rb +11 -5
- data/lib/walrus/walrus_grammar/placeholder.rb +11 -5
- data/lib/walrus/walrus_grammar/raw_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/raw_text.rb +11 -5
- data/lib/walrus/walrus_grammar/ruby_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/ruby_expression.rb +11 -5
- data/lib/walrus/walrus_grammar/set_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/silent_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/slurp_directive.rb +11 -5
- data/lib/walrus/walrus_grammar/super_directive.rb +11 -5
- data/lib/walrus.rb +30 -16
- metadata +91 -211
- data/ext/jindex/extconf.rb +0 -11
- data/ext/mkdtemp/extconf.rb +0 -11
- data/ext/mkdtemp/mkdtemp.c +0 -41
- data/lib/walrus/additions/module.rb +0 -36
- data/lib/walrus/additions/test/unit/error_collector.rb +0 -62
- data/spec/acceptance/acceptance_spec.rb +0 -97
- data/spec/acceptance/block/basic_block.expected +0 -1
- data/spec/acceptance/block/basic_block.tmpl +0 -3
- data/spec/acceptance/block/nested_blocks.expected +0 -5
- data/spec/acceptance/block/nested_blocks.tmpl +0 -11
- data/spec/acceptance/comments/comments_and_text.expected +0 -3
- data/spec/acceptance/comments/comments_and_text.tmpl +0 -6
- data/spec/acceptance/comments/single_comment.expected +0 -0
- data/spec/acceptance/comments/single_comment.tmpl +0 -1
- data/spec/acceptance/def/alternative_def_calling_conventions.expected +0 -3
- data/spec/acceptance/def/alternative_def_calling_conventions.tmpl +0 -18
- data/spec/acceptance/def/basic_def_block_no_output.expected +0 -0
- data/spec/acceptance/def/basic_def_block_no_output.tmpl +0 -17
- data/spec/acceptance/def/defs_can_be_called_multiple_times.expected +0 -3
- data/spec/acceptance/def/defs_can_be_called_multiple_times.tmpl +0 -6
- data/spec/acceptance/def/defs_can_be_dynamic.expected +0 -4
- data/spec/acceptance/def/defs_can_be_dynamic.tmpl +0 -12
- data/spec/acceptance/echo/echo_directive_with_numeric_literal.expected +0 -1
- data/spec/acceptance/echo/echo_directive_with_numeric_literal.tmpl +0 -1
- data/spec/acceptance/echo/echo_expression_list.expected +0 -1
- data/spec/acceptance/echo/echo_expression_list.tmpl +0 -1
- data/spec/acceptance/echo/echo_short_notation.expected +0 -1
- data/spec/acceptance/echo/echo_short_notation.tmpl +0 -1
- data/spec/acceptance/echo/echo_simple_expression.expected +0 -1
- data/spec/acceptance/echo/echo_simple_expression.tmpl +0 -1
- data/spec/acceptance/echo/echo_single_quoted_string_literal.expected +0 -1
- data/spec/acceptance/echo/echo_single_quoted_string_literal.tmpl +0 -1
- data/spec/acceptance/echo/multiple_echo_statements.expected +0 -1
- data/spec/acceptance/echo/multiple_echo_statements.tmpl +0 -2
- data/spec/acceptance/includes/basic_included_file.txt +0 -1
- data/spec/acceptance/includes/basic_includer.complex +0 -3
- data/spec/acceptance/includes/basic_includer.expected +0 -3
- data/spec/acceptance/includes/basic_includer.rb +0 -38
- data/spec/acceptance/includes/complicated_included_file.txt +0 -3
- data/spec/acceptance/includes/complicated_includer.complex +0 -3
- data/spec/acceptance/includes/complicated_includer.expected +0 -3
- data/spec/acceptance/includes/complicated_includer.rb +0 -41
- data/spec/acceptance/includes/nested_include_1.txt +0 -3
- data/spec/acceptance/includes/nested_include_2.txt +0 -1
- data/spec/acceptance/includes/nested_includer.complex +0 -3
- data/spec/acceptance/includes/nested_includer.expected +0 -4
- data/spec/acceptance/includes/nested_includer.rb +0 -41
- data/spec/acceptance/inheritance/basic_child.complex +0 -10
- data/spec/acceptance/inheritance/basic_child.expected +0 -9
- data/spec/acceptance/inheritance/basic_child.rb +0 -54
- data/spec/acceptance/inheritance/basic_parent.complex +0 -5
- data/spec/acceptance/inheritance/basic_parent.expected +0 -3
- data/spec/acceptance/inheritance/basic_parent.rb +0 -41
- data/spec/acceptance/inheritance/importing_child.complex +0 -8
- data/spec/acceptance/inheritance/importing_child.expected +0 -7
- data/spec/acceptance/inheritance/importing_child.rb +0 -46
- data/spec/acceptance/inheritance/subdirectory/importing_child_in_subdirectory.complex +0 -8
- data/spec/acceptance/inheritance/subdirectory/importing_child_in_subdirectory.expected +0 -7
- data/spec/acceptance/inheritance/subdirectory/importing_child_in_subdirectory.rb +0 -44
- data/spec/acceptance/multiline_comments/multiline_comment_with_directives_inside.expected +0 -0
- data/spec/acceptance/multiline_comments/multiline_comment_with_directives_inside.tmpl +0 -15
- data/spec/acceptance/multiline_comments/simple_multiline_comment.expected +0 -2
- data/spec/acceptance/multiline_comments/simple_multiline_comment.tmpl +0 -4
- data/spec/acceptance/raw/complicated_raw_example.expected +0 -57
- data/spec/acceptance/raw/complicated_raw_example.tmpl +0 -79
- data/spec/acceptance/raw-text/UTF_8.expected +0 -12
- data/spec/acceptance/raw-text/UTF_8.tmpl +0 -12
- data/spec/acceptance/raw-text/empty_file.expected +0 -0
- data/spec/acceptance/raw-text/empty_file.tmpl +0 -0
- data/spec/acceptance/raw-text/multi_line.expected +0 -4
- data/spec/acceptance/raw-text/multi_line.tmpl +0 -4
- data/spec/acceptance/raw-text/single_line.expected +0 -1
- data/spec/acceptance/raw-text/single_line.tmpl +0 -1
- data/spec/acceptance/raw-text/single_line_whitespace.expected +0 -1
- data/spec/acceptance/raw-text/single_line_whitespace.tmpl +0 -1
- data/spec/acceptance/ruby/ruby_directive_is_just_like_silent.expected +0 -1
- data/spec/acceptance/ruby/ruby_directive_is_just_like_silent.tmpl +0 -4
- data/spec/acceptance/ruby/ruby_directive_using_here_doc.expected +0 -1
- data/spec/acceptance/ruby/ruby_directive_using_here_doc.tmpl +0 -4
- data/spec/acceptance/ruby/ruby_directive_using_here_doc_alt_syntax.expected +0 -1
- data/spec/acceptance/ruby/ruby_directive_using_here_doc_alt_syntax.tmpl +0 -4
- data/spec/acceptance/ruby/ruby_directive_with_accumulate.expected +0 -1
- data/spec/acceptance/ruby/ruby_directive_with_accumulate.tmpl +0 -4
- data/spec/acceptance/ruby/ruby_directive_with_accumulate_and_block.expected +0 -1
- data/spec/acceptance/ruby/ruby_directive_with_accumulate_and_block.tmpl +0 -6
- data/spec/acceptance/set/unused_set.expected +0 -0
- data/spec/acceptance/set/unused_set.tmpl +0 -1
- data/spec/acceptance/set/used_set.expected +0 -1
- data/spec/acceptance/set/used_set.tmpl +0 -2
- data/spec/acceptance/silent/silent_and_echo_combined.expected +0 -1
- data/spec/acceptance/silent/silent_and_echo_combined.tmpl +0 -2
- data/spec/acceptance/silent/silent_short_notation.expected +0 -1
- data/spec/acceptance/silent/silent_short_notation.tmpl +0 -1
- data/spec/acceptance/silent/simple_silent_directive.expected +0 -0
- data/spec/acceptance/silent/simple_silent_directive.tmpl +0 -1
- data/spec/acceptance/slurp/basic_slurp_demo.expected +0 -1
- data/spec/acceptance/slurp/basic_slurp_demo.tmpl +0 -4
- data/spec/acceptance/super/super_with_no_effect.expected +0 -4
- data/spec/acceptance/super/super_with_no_effect.tmpl +0 -5
- data/spec/additions/module_spec.rb +0 -126
- data/spec/additions/string_spec.rb +0 -99
- data/spec/compiler_spec.rb +0 -55
- data/spec/grammar/additions/proc_spec.rb +0 -25
- data/spec/grammar/additions/regexp_spec.rb +0 -37
- data/spec/grammar/additions/string_spec.rb +0 -106
- data/spec/grammar/and_predicate_spec.rb +0 -29
- data/spec/grammar/continuation_wrapper_exception_spec.rb +0 -23
- data/spec/grammar/match_data_wrapper_spec.rb +0 -41
- data/spec/grammar/memoizing_cache_spec.rb +0 -112
- data/spec/grammar/node_spec.rb +0 -126
- data/spec/grammar/not_predicate_spec.rb +0 -29
- data/spec/grammar/parser_state_spec.rb +0 -172
- data/spec/grammar/parslet_choice_spec.rb +0 -49
- data/spec/grammar/parslet_combining_spec.rb +0 -287
- data/spec/grammar/parslet_merge_spec.rb +0 -33
- data/spec/grammar/parslet_omission_spec.rb +0 -58
- data/spec/grammar/parslet_repetition_spec.rb +0 -77
- data/spec/grammar/parslet_sequence_spec.rb +0 -49
- data/spec/grammar/parslet_spec.rb +0 -23
- data/spec/grammar/predicate_spec.rb +0 -53
- data/spec/grammar/proc_parslet_spec.rb +0 -52
- data/spec/grammar/regexp_parslet_spec.rb +0 -347
- data/spec/grammar/string_enumerator_spec.rb +0 -94
- data/spec/grammar/string_parslet_spec.rb +0 -143
- data/spec/grammar/symbol_parslet_spec.rb +0 -30
- data/spec/grammar_spec.rb +0 -545
- data/spec/parser_spec.rb +0 -1418
- data/spec/spec_helper.rb +0 -34
- data/spec/walrus_grammar/comment_spec.rb +0 -39
- data/spec/walrus_grammar/echo_directive_spec.rb +0 -63
- data/spec/walrus_grammar/escape_sequence_spec.rb +0 -85
- data/spec/walrus_grammar/literal_spec.rb +0 -41
- data/spec/walrus_grammar/message_expression_spec.rb +0 -37
- data/spec/walrus_grammar/multiline_comment_spec.rb +0 -58
- data/spec/walrus_grammar/placeholder_spec.rb +0 -48
- data/spec/walrus_grammar/raw_directive_spec.rb +0 -81
- data/spec/walrus_grammar/raw_text_spec.rb +0 -65
- data/spec/walrus_grammar/silent_directive_spec.rb +0 -34
metadata
CHANGED
|
@@ -1,53 +1,78 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
|
-
rubygems_version: 0.9.2
|
|
3
|
-
specification_version: 1
|
|
4
2
|
name: walrus
|
|
5
3
|
version: !ruby/object:Gem::Version
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- ext
|
|
12
|
-
email: win@wincent.com
|
|
13
|
-
homepage: http://walrus.wincent.com/
|
|
14
|
-
rubyforge_project:
|
|
15
|
-
description: Walrus is an object-oriented templating system inspired by and similar to the Cheetah Python-powered template engine. It includes a Parser Expression Grammar (PEG) parser generator capable of generating an integrated lexer, "packrat" parser, and Abstract Syntax Tree (AST) builder.
|
|
16
|
-
autorequire: walrus
|
|
17
|
-
default_executable:
|
|
18
|
-
bindir: bin
|
|
19
|
-
has_rdoc: true
|
|
20
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
21
|
-
requirements:
|
|
22
|
-
- - ">"
|
|
23
|
-
- !ruby/object:Gem::Version
|
|
24
|
-
version: 0.0.0
|
|
25
|
-
version:
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 0
|
|
7
|
+
- 2
|
|
8
|
+
version: "0.2"
|
|
26
9
|
platform: ruby
|
|
27
|
-
signing_key:
|
|
28
|
-
cert_chain:
|
|
29
|
-
post_install_message:
|
|
30
10
|
authors:
|
|
31
11
|
- Wincent Colaiuta
|
|
12
|
+
autorequire:
|
|
13
|
+
bindir: bin
|
|
14
|
+
cert_chain: []
|
|
15
|
+
|
|
16
|
+
date: 2010-08-14 00:00:00 +02:00
|
|
17
|
+
default_executable:
|
|
18
|
+
dependencies:
|
|
19
|
+
- !ruby/object:Gem::Dependency
|
|
20
|
+
name: wopen3
|
|
21
|
+
prerelease: false
|
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
segments:
|
|
27
|
+
- 0
|
|
28
|
+
- 1
|
|
29
|
+
version: "0.1"
|
|
30
|
+
type: :runtime
|
|
31
|
+
version_requirements: *id001
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: mkdtemp
|
|
34
|
+
prerelease: false
|
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
segments:
|
|
40
|
+
- 1
|
|
41
|
+
- 0
|
|
42
|
+
version: "1.0"
|
|
43
|
+
type: :development
|
|
44
|
+
version_requirements: *id002
|
|
45
|
+
- !ruby/object:Gem::Dependency
|
|
46
|
+
name: rspec
|
|
47
|
+
prerelease: false
|
|
48
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - "="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
segments:
|
|
53
|
+
- 1
|
|
54
|
+
- 3
|
|
55
|
+
- 0
|
|
56
|
+
version: 1.3.0
|
|
57
|
+
type: :development
|
|
58
|
+
version_requirements: *id003
|
|
59
|
+
description: " Walrus is an object-oriented templating system inspired by and similar\n to the Cheetah Python-powered template engine. It includes a Parser\n Expression Grammar (PEG) parser generator capable of generating an\n integrated lexer, \"packrat\" parser, and Abstract Syntax Tree (AST)\n builder.\n"
|
|
60
|
+
email: win@wincent.com
|
|
61
|
+
executables:
|
|
62
|
+
- walrus
|
|
63
|
+
extensions:
|
|
64
|
+
- ext/extconf.rb
|
|
65
|
+
extra_rdoc_files: []
|
|
66
|
+
|
|
32
67
|
files:
|
|
33
68
|
- bin/walrus
|
|
34
|
-
- lib/walrus
|
|
35
|
-
- lib/walrus/additions
|
|
36
|
-
- lib/walrus/additions/module.rb
|
|
37
69
|
- lib/walrus/additions/string.rb
|
|
38
|
-
- lib/walrus/additions/test
|
|
39
|
-
- lib/walrus/additions/test/unit
|
|
40
|
-
- lib/walrus/additions/test/unit/error_collector.rb
|
|
41
70
|
- lib/walrus/compile_error.rb
|
|
42
71
|
- lib/walrus/compiler.rb
|
|
43
|
-
- lib/walrus/contrib
|
|
44
|
-
- lib/walrus/contrib/spec
|
|
45
72
|
- lib/walrus/contrib/spec/walruscloth_spec.rb
|
|
46
73
|
- lib/walrus/contrib/walruscloth.rb
|
|
47
74
|
- lib/walrus/diff.rb
|
|
48
75
|
- lib/walrus/document.rb
|
|
49
|
-
- lib/walrus/grammar
|
|
50
|
-
- lib/walrus/grammar/additions
|
|
51
76
|
- lib/walrus/grammar/additions/proc.rb
|
|
52
77
|
- lib/walrus/grammar/additions/regexp.rb
|
|
53
78
|
- lib/walrus/grammar/additions/string.rb
|
|
@@ -86,7 +111,7 @@ files:
|
|
|
86
111
|
- lib/walrus/parser.rb
|
|
87
112
|
- lib/walrus/runner.rb
|
|
88
113
|
- lib/walrus/template.rb
|
|
89
|
-
- lib/walrus/
|
|
114
|
+
- lib/walrus/version.rb
|
|
90
115
|
- lib/walrus/walrus_grammar/assignment_expression.rb
|
|
91
116
|
- lib/walrus/walrus_grammar/block_directive.rb
|
|
92
117
|
- lib/walrus/walrus_grammar/comment.rb
|
|
@@ -109,183 +134,38 @@ files:
|
|
|
109
134
|
- lib/walrus/walrus_grammar/slurp_directive.rb
|
|
110
135
|
- lib/walrus/walrus_grammar/super_directive.rb
|
|
111
136
|
- lib/walrus.rb
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- spec/acceptance/block/nested_blocks.expected
|
|
118
|
-
- spec/acceptance/block/nested_blocks.tmpl
|
|
119
|
-
- spec/acceptance/comments
|
|
120
|
-
- spec/acceptance/comments/comments_and_text.expected
|
|
121
|
-
- spec/acceptance/comments/comments_and_text.tmpl
|
|
122
|
-
- spec/acceptance/comments/single_comment.expected
|
|
123
|
-
- spec/acceptance/comments/single_comment.tmpl
|
|
124
|
-
- spec/acceptance/def
|
|
125
|
-
- spec/acceptance/def/alternative_def_calling_conventions.expected
|
|
126
|
-
- spec/acceptance/def/alternative_def_calling_conventions.tmpl
|
|
127
|
-
- spec/acceptance/def/basic_def_block_no_output.expected
|
|
128
|
-
- spec/acceptance/def/basic_def_block_no_output.tmpl
|
|
129
|
-
- spec/acceptance/def/defs_can_be_called_multiple_times.expected
|
|
130
|
-
- spec/acceptance/def/defs_can_be_called_multiple_times.tmpl
|
|
131
|
-
- spec/acceptance/def/defs_can_be_dynamic.expected
|
|
132
|
-
- spec/acceptance/def/defs_can_be_dynamic.tmpl
|
|
133
|
-
- spec/acceptance/echo
|
|
134
|
-
- spec/acceptance/echo/echo_directive_with_numeric_literal.expected
|
|
135
|
-
- spec/acceptance/echo/echo_directive_with_numeric_literal.tmpl
|
|
136
|
-
- spec/acceptance/echo/echo_expression_list.expected
|
|
137
|
-
- spec/acceptance/echo/echo_expression_list.tmpl
|
|
138
|
-
- spec/acceptance/echo/echo_short_notation.expected
|
|
139
|
-
- spec/acceptance/echo/echo_short_notation.tmpl
|
|
140
|
-
- spec/acceptance/echo/echo_simple_expression.expected
|
|
141
|
-
- spec/acceptance/echo/echo_simple_expression.tmpl
|
|
142
|
-
- spec/acceptance/echo/echo_single_quoted_string_literal.expected
|
|
143
|
-
- spec/acceptance/echo/echo_single_quoted_string_literal.tmpl
|
|
144
|
-
- spec/acceptance/echo/multiple_echo_statements.expected
|
|
145
|
-
- spec/acceptance/echo/multiple_echo_statements.tmpl
|
|
146
|
-
- spec/acceptance/includes
|
|
147
|
-
- spec/acceptance/includes/basic_included_file.txt
|
|
148
|
-
- spec/acceptance/includes/basic_includer.complex
|
|
149
|
-
- spec/acceptance/includes/basic_includer.expected
|
|
150
|
-
- spec/acceptance/includes/basic_includer.rb
|
|
151
|
-
- spec/acceptance/includes/complicated_included_file.txt
|
|
152
|
-
- spec/acceptance/includes/complicated_includer.complex
|
|
153
|
-
- spec/acceptance/includes/complicated_includer.expected
|
|
154
|
-
- spec/acceptance/includes/complicated_includer.rb
|
|
155
|
-
- spec/acceptance/includes/nested_include_1.txt
|
|
156
|
-
- spec/acceptance/includes/nested_include_2.txt
|
|
157
|
-
- spec/acceptance/includes/nested_includer.complex
|
|
158
|
-
- spec/acceptance/includes/nested_includer.expected
|
|
159
|
-
- spec/acceptance/includes/nested_includer.rb
|
|
160
|
-
- spec/acceptance/inheritance
|
|
161
|
-
- spec/acceptance/inheritance/basic_child.complex
|
|
162
|
-
- spec/acceptance/inheritance/basic_child.expected
|
|
163
|
-
- spec/acceptance/inheritance/basic_child.rb
|
|
164
|
-
- spec/acceptance/inheritance/basic_parent.complex
|
|
165
|
-
- spec/acceptance/inheritance/basic_parent.expected
|
|
166
|
-
- spec/acceptance/inheritance/basic_parent.rb
|
|
167
|
-
- spec/acceptance/inheritance/importing_child.complex
|
|
168
|
-
- spec/acceptance/inheritance/importing_child.expected
|
|
169
|
-
- spec/acceptance/inheritance/importing_child.rb
|
|
170
|
-
- spec/acceptance/inheritance/subdirectory
|
|
171
|
-
- spec/acceptance/inheritance/subdirectory/importing_child_in_subdirectory.complex
|
|
172
|
-
- spec/acceptance/inheritance/subdirectory/importing_child_in_subdirectory.expected
|
|
173
|
-
- spec/acceptance/inheritance/subdirectory/importing_child_in_subdirectory.rb
|
|
174
|
-
- spec/acceptance/multiline_comments
|
|
175
|
-
- spec/acceptance/multiline_comments/multiline_comment_with_directives_inside.expected
|
|
176
|
-
- spec/acceptance/multiline_comments/multiline_comment_with_directives_inside.tmpl
|
|
177
|
-
- spec/acceptance/multiline_comments/simple_multiline_comment.expected
|
|
178
|
-
- spec/acceptance/multiline_comments/simple_multiline_comment.tmpl
|
|
179
|
-
- spec/acceptance/raw
|
|
180
|
-
- spec/acceptance/raw/complicated_raw_example.expected
|
|
181
|
-
- spec/acceptance/raw/complicated_raw_example.tmpl
|
|
182
|
-
- spec/acceptance/raw-text
|
|
183
|
-
- spec/acceptance/raw-text/empty_file.expected
|
|
184
|
-
- spec/acceptance/raw-text/empty_file.tmpl
|
|
185
|
-
- spec/acceptance/raw-text/multi_line.expected
|
|
186
|
-
- spec/acceptance/raw-text/multi_line.tmpl
|
|
187
|
-
- spec/acceptance/raw-text/single_line.expected
|
|
188
|
-
- spec/acceptance/raw-text/single_line.tmpl
|
|
189
|
-
- spec/acceptance/raw-text/single_line_whitespace.expected
|
|
190
|
-
- spec/acceptance/raw-text/single_line_whitespace.tmpl
|
|
191
|
-
- spec/acceptance/raw-text/UTF_8.expected
|
|
192
|
-
- spec/acceptance/raw-text/UTF_8.tmpl
|
|
193
|
-
- spec/acceptance/ruby
|
|
194
|
-
- spec/acceptance/ruby/ruby_directive_is_just_like_silent.expected
|
|
195
|
-
- spec/acceptance/ruby/ruby_directive_is_just_like_silent.tmpl
|
|
196
|
-
- spec/acceptance/ruby/ruby_directive_using_here_doc.expected
|
|
197
|
-
- spec/acceptance/ruby/ruby_directive_using_here_doc.tmpl
|
|
198
|
-
- spec/acceptance/ruby/ruby_directive_using_here_doc_alt_syntax.expected
|
|
199
|
-
- spec/acceptance/ruby/ruby_directive_using_here_doc_alt_syntax.tmpl
|
|
200
|
-
- spec/acceptance/ruby/ruby_directive_with_accumulate.expected
|
|
201
|
-
- spec/acceptance/ruby/ruby_directive_with_accumulate.tmpl
|
|
202
|
-
- spec/acceptance/ruby/ruby_directive_with_accumulate_and_block.expected
|
|
203
|
-
- spec/acceptance/ruby/ruby_directive_with_accumulate_and_block.tmpl
|
|
204
|
-
- spec/acceptance/set
|
|
205
|
-
- spec/acceptance/set/unused_set.expected
|
|
206
|
-
- spec/acceptance/set/unused_set.tmpl
|
|
207
|
-
- spec/acceptance/set/used_set.expected
|
|
208
|
-
- spec/acceptance/set/used_set.tmpl
|
|
209
|
-
- spec/acceptance/silent
|
|
210
|
-
- spec/acceptance/silent/silent_and_echo_combined.expected
|
|
211
|
-
- spec/acceptance/silent/silent_and_echo_combined.tmpl
|
|
212
|
-
- spec/acceptance/silent/silent_short_notation.expected
|
|
213
|
-
- spec/acceptance/silent/silent_short_notation.tmpl
|
|
214
|
-
- spec/acceptance/silent/simple_silent_directive.expected
|
|
215
|
-
- spec/acceptance/silent/simple_silent_directive.tmpl
|
|
216
|
-
- spec/acceptance/slurp
|
|
217
|
-
- spec/acceptance/slurp/basic_slurp_demo.expected
|
|
218
|
-
- spec/acceptance/slurp/basic_slurp_demo.tmpl
|
|
219
|
-
- spec/acceptance/super
|
|
220
|
-
- spec/acceptance/super/super_with_no_effect.expected
|
|
221
|
-
- spec/acceptance/super/super_with_no_effect.tmpl
|
|
222
|
-
- spec/additions
|
|
223
|
-
- spec/additions/module_spec.rb
|
|
224
|
-
- spec/additions/string_spec.rb
|
|
225
|
-
- spec/compiler_spec.rb
|
|
226
|
-
- spec/grammar
|
|
227
|
-
- spec/grammar/additions
|
|
228
|
-
- spec/grammar/additions/proc_spec.rb
|
|
229
|
-
- spec/grammar/additions/regexp_spec.rb
|
|
230
|
-
- spec/grammar/additions/string_spec.rb
|
|
231
|
-
- spec/grammar/and_predicate_spec.rb
|
|
232
|
-
- spec/grammar/continuation_wrapper_exception_spec.rb
|
|
233
|
-
- spec/grammar/match_data_wrapper_spec.rb
|
|
234
|
-
- spec/grammar/memoizing_cache_spec.rb
|
|
235
|
-
- spec/grammar/node_spec.rb
|
|
236
|
-
- spec/grammar/not_predicate_spec.rb
|
|
237
|
-
- spec/grammar/parser_state_spec.rb
|
|
238
|
-
- spec/grammar/parslet_choice_spec.rb
|
|
239
|
-
- spec/grammar/parslet_combining_spec.rb
|
|
240
|
-
- spec/grammar/parslet_merge_spec.rb
|
|
241
|
-
- spec/grammar/parslet_omission_spec.rb
|
|
242
|
-
- spec/grammar/parslet_repetition_spec.rb
|
|
243
|
-
- spec/grammar/parslet_sequence_spec.rb
|
|
244
|
-
- spec/grammar/parslet_spec.rb
|
|
245
|
-
- spec/grammar/predicate_spec.rb
|
|
246
|
-
- spec/grammar/proc_parslet_spec.rb
|
|
247
|
-
- spec/grammar/regexp_parslet_spec.rb
|
|
248
|
-
- spec/grammar/string_enumerator_spec.rb
|
|
249
|
-
- spec/grammar/string_parslet_spec.rb
|
|
250
|
-
- spec/grammar/symbol_parslet_spec.rb
|
|
251
|
-
- spec/grammar_spec.rb
|
|
252
|
-
- spec/parser_spec.rb
|
|
253
|
-
- spec/spec_helper.rb
|
|
254
|
-
- spec/walrus_grammar
|
|
255
|
-
- spec/walrus_grammar/comment_spec.rb
|
|
256
|
-
- spec/walrus_grammar/echo_directive_spec.rb
|
|
257
|
-
- spec/walrus_grammar/escape_sequence_spec.rb
|
|
258
|
-
- spec/walrus_grammar/literal_spec.rb
|
|
259
|
-
- spec/walrus_grammar/message_expression_spec.rb
|
|
260
|
-
- spec/walrus_grammar/multiline_comment_spec.rb
|
|
261
|
-
- spec/walrus_grammar/placeholder_spec.rb
|
|
262
|
-
- spec/walrus_grammar/raw_directive_spec.rb
|
|
263
|
-
- spec/walrus_grammar/raw_text_spec.rb
|
|
264
|
-
- spec/walrus_grammar/silent_directive_spec.rb
|
|
265
|
-
- ext/jindex/extconf.rb
|
|
266
|
-
- ext/mkdtemp/extconf.rb
|
|
267
|
-
- ext/jindex/jindex.c
|
|
268
|
-
- ext/mkdtemp/mkdtemp.c
|
|
269
|
-
test_files: []
|
|
137
|
+
- ext/jindex.c
|
|
138
|
+
- ext/extconf.rb
|
|
139
|
+
has_rdoc: true
|
|
140
|
+
homepage: https://wincent.com/products/walrus
|
|
141
|
+
licenses: []
|
|
270
142
|
|
|
143
|
+
post_install_message:
|
|
271
144
|
rdoc_options: []
|
|
272
145
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
-
|
|
279
|
-
-
|
|
146
|
+
require_paths:
|
|
147
|
+
- lib
|
|
148
|
+
- ext
|
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
|
+
requirements:
|
|
151
|
+
- - ">="
|
|
152
|
+
- !ruby/object:Gem::Version
|
|
153
|
+
segments:
|
|
154
|
+
- 0
|
|
155
|
+
version: "0"
|
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
|
+
requirements:
|
|
158
|
+
- - ">="
|
|
159
|
+
- !ruby/object:Gem::Version
|
|
160
|
+
segments:
|
|
161
|
+
- 0
|
|
162
|
+
version: "0"
|
|
280
163
|
requirements: []
|
|
281
164
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
- !ruby/object:Gem::Version
|
|
290
|
-
version: "0.1"
|
|
291
|
-
version:
|
|
165
|
+
rubyforge_project: walrus
|
|
166
|
+
rubygems_version: 1.3.6
|
|
167
|
+
signing_key:
|
|
168
|
+
specification_version: 3
|
|
169
|
+
summary: Object-oriented templating system
|
|
170
|
+
test_files: []
|
|
171
|
+
|
data/ext/jindex/extconf.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
|
2
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
3
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
4
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
5
|
-
# in the accompanying file, "LICENSE.txt", for more details.
|
|
6
|
-
#
|
|
7
|
-
# $Id$
|
|
8
|
-
|
|
9
|
-
require 'mkmf'
|
|
10
|
-
create_makefile('jindex')
|
|
11
|
-
|
data/ext/mkdtemp/extconf.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
|
2
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
3
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
4
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
5
|
-
# in the accompanying file, "LICENSE.txt", for more details.
|
|
6
|
-
#
|
|
7
|
-
# $Id$
|
|
8
|
-
|
|
9
|
-
require 'mkmf'
|
|
10
|
-
create_makefile('mkdtemp')
|
|
11
|
-
|
data/ext/mkdtemp/mkdtemp.c
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2007 Wincent Colaiuta
|
|
3
|
-
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
4
|
-
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
5
|
-
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
6
|
-
in the accompanying file, "LICENSE.txt", for more details.
|
|
7
|
-
|
|
8
|
-
$Id$
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#include <ruby.h>
|
|
12
|
-
#include <errno.h>
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
|
|
16
|
-
call-seq:
|
|
17
|
-
Dir.mkdtemp([string]) -> String or nil
|
|
18
|
-
|
|
19
|
-
This method securely creates temporary directories. It is a wrapper for the mkdtemp() function in the standard C library. It takes an optional String parameter as a template describing the desired form of the directory name; if no template is supplied then "/tmp/temp.XXXXXX" is used as a default.
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
static VALUE walrus_dir_mkdtemp_m(int argc, VALUE *argv, VALUE self)
|
|
23
|
-
{
|
|
24
|
-
VALUE template;
|
|
25
|
-
if (rb_scan_args(argc, argv, "01", &template) == 0) /* check for 0 mandatory arguments, 1 optional argument */
|
|
26
|
-
template = Qnil; /* default to nil if no argument passed */
|
|
27
|
-
if (NIL_P(template))
|
|
28
|
-
template = rb_str_new2("/tmp/temp.XXXXXX"); /* fallback to this template if passed nil */
|
|
29
|
-
SafeStringValue(template); /* raises if template is tainted and SAFE level > 0 */
|
|
30
|
-
VALUE safe = StringValue(template); /* duck typing support */
|
|
31
|
-
char *path = mkdtemp(RSTRING(safe)->ptr);
|
|
32
|
-
if (path == NULL)
|
|
33
|
-
rb_raise(rb_eSystemCallError, "mkdtemp failed (error: %d)", errno);
|
|
34
|
-
return rb_str_new2(path);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void Init_mkdtemp()
|
|
38
|
-
{
|
|
39
|
-
rb_define_module_function(rb_cDir, "mkdtemp", walrus_dir_mkdtemp_m, -1);
|
|
40
|
-
}
|
|
41
|
-
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
|
2
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
3
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
4
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
5
|
-
# in the accompanying file, "LICENSE.txt", for more details.
|
|
6
|
-
#
|
|
7
|
-
# $Id$
|
|
8
|
-
|
|
9
|
-
require 'walrus'
|
|
10
|
-
|
|
11
|
-
class Module
|
|
12
|
-
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
def attr_accessor_bycopy(*symbols)
|
|
16
|
-
symbols.each { |symbol| attr_bycopy(symbol, true) }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def attr_bycopy(symbol, writeable = false)
|
|
20
|
-
attr_reader symbol
|
|
21
|
-
attr_writer_bycopy(symbol) if writeable
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def attr_writer_bycopy(*symbols)
|
|
25
|
-
symbols.each do |symbol|
|
|
26
|
-
self.module_eval %Q{
|
|
27
|
-
def #{symbol.id2name}=(value)
|
|
28
|
-
@#{symbol.id2name} = value.clone
|
|
29
|
-
rescue TypeError
|
|
30
|
-
@#{symbol.id2name} = value
|
|
31
|
-
end
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
end # class Module
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
|
2
|
-
# $Id$
|
|
3
|
-
|
|
4
|
-
require 'walrus'
|
|
5
|
-
|
|
6
|
-
module Test
|
|
7
|
-
module Unit
|
|
8
|
-
|
|
9
|
-
# See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/138320
|
|
10
|
-
# Usage:
|
|
11
|
-
#
|
|
12
|
-
# require 'test/unit'
|
|
13
|
-
# require 'walrus/additions/test/unit/error_collector'
|
|
14
|
-
#
|
|
15
|
-
# class TestClass < Test::Unit::TestCase
|
|
16
|
-
#
|
|
17
|
-
# include Test::Unit::ErrorCollector
|
|
18
|
-
#
|
|
19
|
-
# def test_method
|
|
20
|
-
# collecting_errors do
|
|
21
|
-
# assert false
|
|
22
|
-
# assert false
|
|
23
|
-
# end
|
|
24
|
-
# end
|
|
25
|
-
#
|
|
26
|
-
# end
|
|
27
|
-
#
|
|
28
|
-
module ErrorCollector
|
|
29
|
-
|
|
30
|
-
def collecting_errors
|
|
31
|
-
# save state prior to yielding to block
|
|
32
|
-
is_collecting = @is_collecting
|
|
33
|
-
@is_collecting = true
|
|
34
|
-
yield
|
|
35
|
-
ensure
|
|
36
|
-
# restore state on leaving block
|
|
37
|
-
@is_collecting = is_collecting
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def raise(*)
|
|
41
|
-
super
|
|
42
|
-
rescue Test::Unit::AssertionFailedError
|
|
43
|
-
handle_error(:add_failure, $!)
|
|
44
|
-
rescue StandardError, ScriptError
|
|
45
|
-
handle_error(:add_error, $!)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def handle_error(method, error)
|
|
49
|
-
backtrace = error.backtrace
|
|
50
|
-
backtrace.shift # raise shouldn't appear in the backtrace
|
|
51
|
-
if @is_collecting
|
|
52
|
-
backtrace.slice!(5, 2) # remove collecting_errors and corresponding block
|
|
53
|
-
send(method, error.message, backtrace)
|
|
54
|
-
else
|
|
55
|
-
Kernel.raise(error, error.message, backtrace)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
|
2
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
3
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
4
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
5
|
-
# in the accompanying file, "LICENSE.txt", for more details.
|
|
6
|
-
#
|
|
7
|
-
# $Id: /mirrors/Walrus/trunk/walrus/spec/acceptance/acceptance_spec.rb 6739 2007-04-11T17:09:13.916915Z wincent $
|
|
8
|
-
|
|
9
|
-
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
|
|
10
|
-
require 'walrus/parser' # ensure that WalrusGrammar is defined before continuing
|
|
11
|
-
require 'mkdtemp'
|
|
12
|
-
|
|
13
|
-
module Walrus
|
|
14
|
-
|
|
15
|
-
class WalrusGrammar
|
|
16
|
-
|
|
17
|
-
# This spec performs high-level acceptance testing by running Walrus on the sample templates in the subdirectories of the "spec/acceptance/" directory and comparing them with the expected output.
|
|
18
|
-
describe 'processing test files with Walrus' do
|
|
19
|
-
|
|
20
|
-
# construct an array of absolute paths indicating the location of all testable templates.
|
|
21
|
-
template_paths = Dir[File.join(File.dirname(__FILE__), '**/*.tmpl')].collect { |template| Pathname.new(template).realpath }
|
|
22
|
-
|
|
23
|
-
# make temporary output dirs for storing compiled templates
|
|
24
|
-
manually_compiled_templates = Pathname.new(Dir.mkdtemp('/tmp/walrus.acceptance.XXXXXX'))
|
|
25
|
-
walrus_compiled_templates = Pathname.new(Dir.mkdtemp('/tmp/walrus.acceptance.XXXXXX'))
|
|
26
|
-
parser = Parser.new
|
|
27
|
-
search_additions = "#{ENV['RUBYLIB']}:#{Walrus::SpecHelper::LIBDIR}:#{Walrus::SpecHelper::EXTDIR}"
|
|
28
|
-
|
|
29
|
-
template_paths.each do |path|
|
|
30
|
-
|
|
31
|
-
template = Template.new(path)
|
|
32
|
-
compiled = nil
|
|
33
|
-
it 'template should compile (source file: #{path})' do
|
|
34
|
-
compiled = template.compile
|
|
35
|
-
end
|
|
36
|
-
next if compiled.nil? # compiled will be nil if the compilation spec failed
|
|
37
|
-
|
|
38
|
-
expected_output = IO.read(path.to_s.sub(/\.tmpl\z/i, ".expected"))
|
|
39
|
-
|
|
40
|
-
it "actual output should match expected output evaluating dynamically (source file: #{path})" do
|
|
41
|
-
actual_output = template.fill
|
|
42
|
-
actual_output.should == expected_output
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it "actual output should match expected output running compiled file in subshell (source file: #{path})" do
|
|
46
|
-
target_path = manually_compiled_templates.join(path.basename(path.extname).to_s + '.rb')
|
|
47
|
-
File.open(target_path, 'w+') { |file| file.puts compiled }
|
|
48
|
-
actual_output = `ruby -I#{Walrus::SpecHelper::LIBDIR} -I#{Walrus::SpecHelper::EXTDIR} #{target_path}`
|
|
49
|
-
actual_output.should == expected_output
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "actual output should match expected output using 'walrus' commandline tool (source file: #{path})" do
|
|
53
|
-
`env RUBYLIB='#{search_additions}' #{Walrus::SpecHelper::TOOL} fill --output-dir '#{walrus_compiled_templates}' '#{path}'`
|
|
54
|
-
dir, base = path.split
|
|
55
|
-
dir = dir.to_s.sub(/\A\//, '') if dir.absolute? # and always will be absolute
|
|
56
|
-
base = base.basename(base.extname).to_s + '.html'
|
|
57
|
-
actual_output = IO.read(walrus_compiled_templates + dir + base)
|
|
58
|
-
actual_output.should == expected_output
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# These templates have a different extension to keep them separate from the other acceptance tests.
|
|
66
|
-
describe 'processing multiple-interdependent files with Walrus' do
|
|
67
|
-
|
|
68
|
-
template_paths = Dir[File.join(File.dirname(__FILE__), '**/*.complex')].collect { |template| Pathname.new(template).realpath }
|
|
69
|
-
output_dir = Pathname.new(Dir.mkdtemp('/tmp/walrus.acceptance.XXXXXX'))
|
|
70
|
-
parser = Parser.new
|
|
71
|
-
|
|
72
|
-
search_additions = "#{ENV['RUBYLIB']}:#{Walrus::SpecHelper::LIBDIR}:#{Walrus::SpecHelper::EXTDIR}"
|
|
73
|
-
|
|
74
|
-
template_paths.each do |path|
|
|
75
|
-
it 'should be able to compile all the templates' do
|
|
76
|
-
`env RUBYLIB='#{search_additions}' #{Walrus::SpecHelper::TOOL} compile --input-extension complex --output-dir '#{output_dir}' '#{path}'`
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
template_paths.each do |path|
|
|
81
|
-
it 'should be able to fill all the templates' do
|
|
82
|
-
`env RUBYLIB='#{search_additions}' #{Walrus::SpecHelper::TOOL} fill --input-extension complex --output-dir '#{output_dir}' '#{path}'`
|
|
83
|
-
dir, base = path.split
|
|
84
|
-
dir = dir.to_s.sub(/\A\//, '') if dir.absolute? # and always will be absolute
|
|
85
|
-
base = base.basename(base.extname).to_s + '.html'
|
|
86
|
-
actual_output = IO.read(output_dir + dir + base)
|
|
87
|
-
expected_output = IO.read(path.to_s.sub(/\.complex\z/i, ".expected"))
|
|
88
|
-
actual_output.should == expected_output
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
end # module Walrus
|
|
97
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This will be output by default.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
This file contains comments ## like this one!
|
|
2
|
-
which should not appear in the template output...
|
|
3
|
-
## This line should be completely missing from the output
|
|
4
|
-
## and this one two, because the comments are the first
|
|
5
|
-
## (and only) thing on the lines
|
|
6
|
-
In the final output, this should be the third line...
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
## This template contains only a comment; the output file should be empty.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
## This example shows some alternative ways of causing #def content to appear in the output
|
|
2
|
-
## (by default #def content is not automatically injected into the output)
|
|
3
|
-
#def block1
|
|
4
|
-
This is block 1. It will be injected using the \#silent directive.
|
|
5
|
-
#end
|
|
6
|
-
#def block2
|
|
7
|
-
This is block 2. It will be injected using the \#ruby directive.
|
|
8
|
-
#end
|
|
9
|
-
#def block3
|
|
10
|
-
This is block 3. It will be referenced using a placeholder.
|
|
11
|
-
#end
|
|
12
|
-
## no need to call "accumulate" here because the block already does that.
|
|
13
|
-
#silent block1
|
|
14
|
-
#ruby
|
|
15
|
-
# no need to call "accumulate" here because the block already does that.
|
|
16
|
-
block2
|
|
17
|
-
#end
|
|
18
|
-
$block3
|
|
File without changes
|