macros4cuke 0.4.03 → 0.4.04
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.
- checksums.yaml +8 -8
- data/.rubocop.yml +5 -1
- data/CHANGELOG.md +7 -0
- data/lib/macros4cuke/coll-walker-factory.rb +29 -29
- data/lib/macros4cuke/constants.rb +1 -1
- data/lib/macros4cuke/templating/engine.rb +35 -35
- data/lib/macros4cuke/templating/section.rb +6 -6
- data/lib/macros4cuke/templating/unary-element.rb +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
YzAzMDg4OGYyNGY4ZGVkMzM4NjVhMzdiYjllM2M5NGExNjE0MTdmOA==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YTJiNWExZTY0OTM2NTgxNzAxY2NjYzQzM2JkYjQ5ZWM2MDVjZDMwZA==
|
|
7
7
|
!binary "U0hBNTEy":
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
ZDc3ZGVmZmQ3MzcyNTUwZmY0YWZmMjM3M2QzNzY5MDdhNmJjNTllZTM0MDk5
|
|
10
|
+
MTI3NDA2NGJkMTg4YTE3ZGEyMTQ3NzZjZjdmY2JiM2M3ZGYwOGM2NzM4YmY5
|
|
11
|
+
ZWVlMjYxZGY3NTNiOTI1MzI0YThkNjYxN2MyNmNlNmQ0ZmJiMjc=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MTA4ZGVjMDlhNmYxNWM0MDJlZWFmYzc2Zjk5NjZhZjQxOWM0N2MzMWQxNGVj
|
|
14
|
+
MWUwY2ZiMmVlZjhmYWY5N2U0ZWQwMWNiYjdkZjdmMzNhM2JjM2VhZWM1NDk2
|
|
15
|
+
MWEzMzFiZjgxZTllM2Q1ZmMwMzI3NGE5ZWZjOTQ1ZDZmNTI3MDA=
|
data/.rubocop.yml
CHANGED
|
@@ -13,7 +13,8 @@ AsciiComments:
|
|
|
13
13
|
Enabled: false
|
|
14
14
|
|
|
15
15
|
CaseIndentation:
|
|
16
|
-
|
|
16
|
+
IndentWhenRelativeTo: end
|
|
17
|
+
IndentOneStep: true
|
|
17
18
|
|
|
18
19
|
ClassLength:
|
|
19
20
|
Max: 200
|
|
@@ -43,6 +44,9 @@ Encoding:
|
|
|
43
44
|
IndentationWidth :
|
|
44
45
|
Enabled: false
|
|
45
46
|
|
|
47
|
+
MethodDefinition:
|
|
48
|
+
EnforcedStyle: parentheses
|
|
49
|
+
|
|
46
50
|
# Avoid methods longer than 50 lines of code
|
|
47
51
|
MethodLength:
|
|
48
52
|
Max: 50
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
### 0.4.04 / 2013-12-28
|
|
2
|
+
* [CHANGE] File `.rubocop.yml`: Updated for Rubocop 0.16. Cop CaseIndentation is now enabled and uses parameters
|
|
3
|
+
* [CHANGE] File `engine.rb`: Updated indentation in case statement to comply to latest Rubocop config file.
|
|
4
|
+
* [CHANGE] File `section.rb`: Updated indentation in case statement to comply to latest Rubocop config file.
|
|
5
|
+
* [CHANGE] File `coll-walker-factory.rb`: Updated indentation in case statement to comply to latest Rubocop config file.
|
|
6
|
+
|
|
7
|
+
|
|
1
8
|
### 0.4.03 / 2013-12-11
|
|
2
9
|
* [CHANGE] File `engine.rb`: Monolithic file splitted into more class-specific files.
|
|
3
10
|
* [CHANGE] File `constants.rb`: Removal of legacy app in comment.
|
|
@@ -24,44 +24,44 @@ class CollWalkerFactory
|
|
|
24
24
|
|result_receiver| # 'result_receiver' is a Yielder
|
|
25
25
|
loop do
|
|
26
26
|
case current_node
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
when MacroCollection
|
|
28
|
+
result_receiver << [:on_collection, level, current_node]
|
|
29
|
+
level += 1
|
|
30
|
+
backlog << StringNode.new(:on_collection_end, nil)
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
when MacroStep
|
|
33
|
+
result_receiver << emit_on_step(current_node, level, backlog)
|
|
34
|
+
level += 1
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
when StringNode
|
|
37
|
+
level -= 1 if current_node.event.to_s =~ /_end$/
|
|
38
|
+
event = [current_node.event, level, current_node.text]
|
|
39
|
+
event << current_node.extra unless current_node.extra.nil?
|
|
40
|
+
result_receiver << event
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
when Templating::Engine
|
|
43
|
+
result_receiver << emit_on_renderer(current_node, level, backlog)
|
|
44
|
+
level += 1
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
when Templating::StaticText
|
|
47
|
+
result_receiver << [:on_static_text, level, current_node.source]
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
when Templating::Comment
|
|
50
|
+
result_receiver << [:on_comment, level, current_node.source]
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
when Templating::EOLine
|
|
53
|
+
result_receiver << [:on_eol, level, nil]
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
when Templating::Placeholder
|
|
56
|
+
result_receiver << [:on_placeholder, level, current_node.name]
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
when Templating::Section
|
|
59
|
+
result_receiver << emit_on_section(current_node, level, backlog)
|
|
60
|
+
level += 1
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
else
|
|
63
|
+
err_msg = "Don't know how to format a #{current_node.class}."
|
|
64
|
+
fail(InternalError, err_msg)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
current_node = backlog.shift
|
|
@@ -161,14 +161,14 @@ class Engine
|
|
|
161
161
|
@variables ||= begin
|
|
162
162
|
vars = @representation.each_with_object([]) do |element, subResult|
|
|
163
163
|
case element
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
when Placeholder
|
|
165
|
+
subResult << element.name
|
|
166
|
+
|
|
167
|
+
when Section
|
|
168
|
+
subResult.concat(element.variables)
|
|
169
|
+
|
|
170
|
+
else
|
|
171
|
+
# Do nothing
|
|
172
172
|
end
|
|
173
173
|
end
|
|
174
174
|
|
|
@@ -221,8 +221,8 @@ class Engine
|
|
|
221
221
|
|
|
222
222
|
no_escaped.each_char do |ch|
|
|
223
223
|
case ch
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
when '<' then unbalance += 1
|
|
225
|
+
when '>' then unbalance -= 1
|
|
226
226
|
end
|
|
227
227
|
|
|
228
228
|
fail(StandardError, "Nested opening chevron '<'.") if unbalance > 1
|
|
@@ -265,18 +265,18 @@ class Engine
|
|
|
265
265
|
section_item = nil
|
|
266
266
|
line_to_squeeze = line_rep.all? do |item|
|
|
267
267
|
case item
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
when StaticText
|
|
269
|
+
item.source =~ /\s+/
|
|
270
|
+
|
|
271
|
+
when Section, SectionEndMarker
|
|
272
|
+
if section_item.nil?
|
|
273
|
+
section_item = item
|
|
274
|
+
true
|
|
275
|
+
else
|
|
276
|
+
false
|
|
277
|
+
end
|
|
275
278
|
else
|
|
276
279
|
false
|
|
277
|
-
end
|
|
278
|
-
else
|
|
279
|
-
false
|
|
280
280
|
end
|
|
281
281
|
end
|
|
282
282
|
if line_to_squeeze && !section_item.nil?
|
|
@@ -309,9 +309,9 @@ class Engine
|
|
|
309
309
|
(kind, text) = aCouple
|
|
310
310
|
|
|
311
311
|
result = case kind
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
when :static then StaticText.new(text)
|
|
313
|
+
when :comment then Comment.new(text)
|
|
314
|
+
when :dynamic then parse_tag(text)
|
|
315
315
|
end
|
|
316
316
|
|
|
317
317
|
return result
|
|
@@ -350,19 +350,19 @@ class Engine
|
|
|
350
350
|
|
|
351
351
|
compiled = flat_sequence.each_with_object([]) do |element, subResult|
|
|
352
352
|
case element
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
else
|
|
361
|
-
if open_sections.empty?
|
|
362
|
-
subResult << element
|
|
353
|
+
when Section
|
|
354
|
+
open_sections << element
|
|
355
|
+
|
|
356
|
+
when SectionEndMarker
|
|
357
|
+
validate_section_end(element, open_sections)
|
|
358
|
+
subResult << open_sections.pop
|
|
359
|
+
|
|
363
360
|
else
|
|
364
|
-
open_sections.
|
|
365
|
-
|
|
361
|
+
if open_sections.empty?
|
|
362
|
+
subResult << element
|
|
363
|
+
else
|
|
364
|
+
open_sections.last.add_child(element)
|
|
365
|
+
end
|
|
366
366
|
end
|
|
367
367
|
end
|
|
368
368
|
|
|
@@ -37,12 +37,12 @@ class Section < UnaryElement
|
|
|
37
37
|
def variables()
|
|
38
38
|
all_vars = children.each_with_object([]) do |a_child, subResult|
|
|
39
39
|
case a_child
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
when Placeholder
|
|
41
|
+
subResult << a_child.name
|
|
42
|
+
when Section
|
|
43
|
+
subResult.concat(a_child.variables)
|
|
44
|
+
else
|
|
45
|
+
# Do nothing
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: macros4cuke
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.04
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dimitri Geshef
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-12-
|
|
11
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cucumber
|