macros4cuke 0.5.07 → 0.5.08
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/Rakefile +0 -2
- data/features/support/use_macros4cuke.rb +11 -0
- data/lib/macros4cuke/application.rb +0 -3
- data/lib/macros4cuke/cli/cmd-line.rb +0 -7
- data/lib/macros4cuke/coll-walker-factory.rb +0 -7
- data/lib/macros4cuke/constants.rb +1 -1
- data/lib/macros4cuke/exceptions.rb +0 -3
- data/lib/macros4cuke/formatter/all-notifications.rb +20 -24
- data/lib/macros4cuke/formatter/to-gherkin.rb +0 -6
- data/lib/macros4cuke/formatter/to-null.rb +70 -79
- data/lib/macros4cuke/formatter/to-trace.rb +64 -70
- data/lib/macros4cuke/formatting-service.rb +0 -3
- data/lib/macros4cuke/macro-collection.rb +0 -3
- data/lib/macros4cuke/macro-step-support.rb +0 -3
- data/lib/macros4cuke/macro-step.rb +1 -4
- data/lib/macros4cuke/templating/comment.rb +37 -43
- data/lib/macros4cuke/templating/engine.rb +4 -14
- data/lib/macros4cuke/templating/eo-line.rb +10 -19
- data/lib/macros4cuke/templating/placeholder.rb +0 -8
- data/lib/macros4cuke/templating/section.rb +0 -11
- data/lib/macros4cuke/templating/static-text.rb +28 -33
- data/lib/macros4cuke/templating/unary-element.rb +0 -4
- data/spec/macros4cuke/application_spec.rb +0 -5
- data/spec/macros4cuke/cli/cmd-line_spec.rb +213 -223
- data/spec/macros4cuke/coll-walker-factory_spec.rb +0 -6
- data/spec/macros4cuke/formatter/to-gherkin_spec.rb +0 -9
- data/spec/macros4cuke/formatter/to-null_spec.rb +0 -6
- data/spec/macros4cuke/formatter/to-trace_spec.rb +0 -6
- data/spec/macros4cuke/formatting-service_spec.rb +0 -5
- data/spec/macros4cuke/macro-collection_spec.rb +1 -8
- data/spec/macros4cuke/macro-step-support_spec.rb +0 -9
- data/spec/macros4cuke/macro-step_spec.rb +0 -7
- data/spec/macros4cuke/templating/comment_spec.rb +0 -7
- data/spec/macros4cuke/templating/engine_spec.rb +0 -10
- data/spec/macros4cuke/templating/eo-line_spec.rb +1 -8
- data/spec/macros4cuke/templating/placeholder_spec.rb +0 -9
- data/spec/macros4cuke/templating/section_spec.rb +0 -13
- data/spec/macros4cuke/templating/static_text_spec.rb +0 -6
- data/spec/macros4cuke/use-sample-collection.rb +0 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDNiMDM5MjcwMjA4MzdlYmY3NTYxYzA2ZDIyMTliZDRmYzI4NzViMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzRlNTUxZWJhOGQxMWY5MjI4OWE4ZDc1YzMzODI0ODlmZjAyZjAyYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTgwNzk3ZjMxYmRmODI2MGE1ZWNkZjQ1ZGE1NDVkOWUxZDc1M2E0ZTMyMmM1
|
10
|
+
MmJkODNkY2FiYjc0YTc5MDEyNDI4MzA2ZjFhMjhmZDUzOTI1NzQwM2JhMzIy
|
11
|
+
OGYyNzY1ZjFkYzVmM2YzZDJhYjAwYjM4YTA1MDlhM2I5ODM1ZWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTA0OTU5MmZkNGVjY2I3MThkZDUxYTNkYzlhYWY0MmQ0YTE3ZmIzZTUxMzYw
|
14
|
+
NDBkOTlhMDZiMWI2YmZhNDYzNzQxMmM5MDNjMzlhMmMxYjM1ZWNlNWMyM2Jj
|
15
|
+
MjQ1NDg0MjUyNzNhNzYzZDg1MDg0NmY2YjQzYWZjMDEzOThhOWM=
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 0.5.08 / 2015-02-xx
|
2
|
+
* [CHANGE] Code layout reformat to please Rubocop 0.28.0 (Removal of 'Extra empty line detected at...' offenses)
|
3
|
+
* [TEST] Regression tests with Cucumber 1.3.18: all pass
|
4
|
+
|
1
5
|
### 0.5.06 / 2014-06-30
|
2
6
|
* [CHANGE] Multiple minor changes to please Rubocop 0.26.1
|
3
7
|
* [CHANGE] File `demo03.feature`: Added an example with scenario outline
|
data/README.md
CHANGED
@@ -558,4 +558,4 @@ Macros with Cucumber is a hot topic, so it is good to know what other people say
|
|
558
558
|
|
559
559
|
Copyright
|
560
560
|
---------
|
561
|
-
Copyright (c) 2014, Dimitri Geshef. Macros4Cuke is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt) for details.
|
561
|
+
Copyright (c) 2014-2015, Dimitri Geshef. Macros4Cuke is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt) for details.
|
data/Rakefile
CHANGED
@@ -2,12 +2,10 @@ require 'rubygems'
|
|
2
2
|
require_relative './lib/macros4cuke/constants'
|
3
3
|
|
4
4
|
namespace :gem do
|
5
|
-
|
6
5
|
desc 'Push the gem to rubygems.org'
|
7
6
|
task :push do
|
8
7
|
system("gem push macros4cuke-#{Macros4Cuke::Version}.gem")
|
9
8
|
end
|
10
|
-
|
11
9
|
end # namespace
|
12
10
|
|
13
11
|
# Testing-specific tasks
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# File: use_macros4cuke.rb
|
2
|
+
# Purpose: Add the support for macros in a Cucumber project.
|
3
|
+
# This file is meant to be put next to the 'env.rb' file
|
4
|
+
# of your Cucumber project.
|
5
|
+
|
6
|
+
|
7
|
+
# Load modules, classes and step definitions from the macros4cuke gem
|
8
|
+
require 'macros4cuke/cucumber'
|
9
|
+
|
10
|
+
|
11
|
+
# End of file
|
@@ -5,7 +5,6 @@ require 'erb'
|
|
5
5
|
require_relative 'cli/cmd-line'
|
6
6
|
|
7
7
|
module Macros4Cuke # Module used as a namespace
|
8
|
-
|
9
8
|
# Runner for the Macros4Cuke application.
|
10
9
|
class Application
|
11
10
|
attr_reader(:options)
|
@@ -69,9 +68,7 @@ class Application
|
|
69
68
|
exit
|
70
69
|
end
|
71
70
|
end
|
72
|
-
|
73
71
|
end # class
|
74
|
-
|
75
72
|
end # module
|
76
73
|
|
77
74
|
# End of file
|
@@ -8,11 +8,8 @@ require 'cucumber/platform'
|
|
8
8
|
require_relative '../constants'
|
9
9
|
|
10
10
|
module Macros4Cuke # Module used as a namespace
|
11
|
-
|
12
11
|
# Module dedicated to the command-line interface
|
13
12
|
module CLI
|
14
|
-
|
15
|
-
|
16
13
|
# Manages the application command-line interface (CLI).
|
17
14
|
# It is merely a thin wrapper around the OptionParser library.
|
18
15
|
# Responsibilities:
|
@@ -70,7 +67,6 @@ EOS
|
|
70
67
|
puts msg
|
71
68
|
options[:version] = true
|
72
69
|
end
|
73
|
-
|
74
70
|
end
|
75
71
|
end
|
76
72
|
|
@@ -132,11 +128,8 @@ EOS
|
|
132
128
|
puts ShortHelpMsg
|
133
129
|
exit
|
134
130
|
end
|
135
|
-
|
136
131
|
end # class
|
137
|
-
|
138
132
|
end # module
|
139
|
-
|
140
133
|
end # module
|
141
134
|
|
142
135
|
# End of file
|
@@ -5,8 +5,6 @@ require_relative 'macro-collection'
|
|
5
5
|
|
6
6
|
|
7
7
|
module Macros4Cuke # Module used as a namespace
|
8
|
-
|
9
|
-
|
10
8
|
# A Coll(ection)WalkerFactory object is a factory that creates
|
11
9
|
# an enumerator that itself walks in the passed macro collection object.
|
12
10
|
# The walker performs a depth-first visit and yields visit events.
|
@@ -110,12 +108,7 @@ class CollWalkerFactory
|
|
110
108
|
|
111
109
|
return [:on_section, nesting_level, current_node.name]
|
112
110
|
end
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
111
|
end # class
|
118
|
-
|
119
112
|
end # module
|
120
113
|
|
121
114
|
# End of file
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# File: exceptions.rb
|
2
2
|
|
3
3
|
module Macros4Cuke # Module used as a namespace
|
4
|
-
|
5
4
|
# @abstract
|
6
5
|
# Base class for any exception explicitly raised in the Macros4Cuke methods.
|
7
6
|
class Macros4CukeError < StandardError
|
@@ -143,8 +142,6 @@ end # class
|
|
143
142
|
# that it can't handle properly.
|
144
143
|
class InternalError < Macros4CukeError
|
145
144
|
end # class
|
146
|
-
|
147
|
-
|
148
145
|
end # module
|
149
146
|
|
150
147
|
# End of file
|
@@ -1,30 +1,26 @@
|
|
1
1
|
# File: all_notifications.rb
|
2
2
|
|
3
3
|
module Macros4Cuke # Module used as a namespace
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
]
|
25
|
-
|
26
|
-
end # module
|
27
|
-
|
4
|
+
# Namespace for all formatters of MacroCollection and MacroStep objects
|
5
|
+
module Formatter
|
6
|
+
# The list of all formatting notifications
|
7
|
+
AllNotifications = [
|
8
|
+
:on_collection,
|
9
|
+
:on_collection_end,
|
10
|
+
:on_step,
|
11
|
+
:on_step_end,
|
12
|
+
:on_phrase,
|
13
|
+
:on_renderer,
|
14
|
+
:on_renderer_end,
|
15
|
+
:on_source,
|
16
|
+
:on_static_text,
|
17
|
+
:on_eol,
|
18
|
+
:on_comment,
|
19
|
+
:on_placeholder,
|
20
|
+
:on_section,
|
21
|
+
:on_section_end
|
22
|
+
]
|
23
|
+
end # module
|
28
24
|
end # module
|
29
25
|
|
30
26
|
# End of file
|
@@ -3,10 +3,8 @@
|
|
3
3
|
require_relative '../constants'
|
4
4
|
|
5
5
|
module Macros4Cuke # Module used as a namespace
|
6
|
-
|
7
6
|
# Namespace for all formatters of MacroCollection and MacroStep objects
|
8
7
|
module Formatter
|
9
|
-
|
10
8
|
# A macro-step formatter that outputs to the given IO the macro-steps from a
|
11
9
|
# macro collection into a Gherkin feature file.
|
12
10
|
class ToGherkin
|
@@ -71,12 +69,8 @@ class ToGherkin
|
|
71
69
|
def indentation(aLevel)
|
72
70
|
return ' ' * (aLevel)
|
73
71
|
end
|
74
|
-
|
75
|
-
|
76
72
|
end # class
|
77
|
-
|
78
73
|
end # module
|
79
|
-
|
80
74
|
end # module
|
81
75
|
|
82
76
|
# End of file
|
@@ -3,85 +3,76 @@
|
|
3
3
|
require_relative 'all-notifications'
|
4
4
|
|
5
5
|
module Macros4Cuke # Module used as a namespace
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
def on_section_end(_)
|
77
|
-
; # Do Nothing
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
end # class
|
82
|
-
|
83
|
-
end # module
|
84
|
-
|
6
|
+
# Namespace for all formatters of MacroCollection and MacroStep objects
|
7
|
+
module Formatter
|
8
|
+
# A macro-step formatter that doesn't produce any output.
|
9
|
+
# It fully implements the expected interface of formatters but
|
10
|
+
# its methods are NOOP (i.e. they do nothing).
|
11
|
+
# This formatter can be useful when one wants to discard
|
12
|
+
# any formatted output.
|
13
|
+
class ToNull
|
14
|
+
# Tell which notifications the formatter subscribes to.
|
15
|
+
def implements()
|
16
|
+
return Formatter::AllNotifications
|
17
|
+
end
|
18
|
+
|
19
|
+
def on_collection(_, _)
|
20
|
+
; # Do nothing
|
21
|
+
end
|
22
|
+
|
23
|
+
def on_collection_end(_)
|
24
|
+
; # Do nothing
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_step(_, _)
|
28
|
+
; # Do nothing
|
29
|
+
end
|
30
|
+
|
31
|
+
def on_step_end(_)
|
32
|
+
; # Do nothing
|
33
|
+
end
|
34
|
+
|
35
|
+
def on_phrase(_, _, _)
|
36
|
+
; # Do nothing
|
37
|
+
end
|
38
|
+
|
39
|
+
def on_renderer(_, _)
|
40
|
+
; # Do nothing
|
41
|
+
end
|
42
|
+
|
43
|
+
def on_renderer_end(_)
|
44
|
+
; # Do nothing
|
45
|
+
end
|
46
|
+
|
47
|
+
def on_source(_, _)
|
48
|
+
; # Do nothing
|
49
|
+
end
|
50
|
+
|
51
|
+
def on_static_text(_, _)
|
52
|
+
; # Do nothing
|
53
|
+
end
|
54
|
+
|
55
|
+
def on_comment(_, _)
|
56
|
+
; # Do nothing
|
57
|
+
end
|
58
|
+
|
59
|
+
def on_eol(_)
|
60
|
+
; # Do nothing
|
61
|
+
end
|
62
|
+
|
63
|
+
def on_placeholder(_, _)
|
64
|
+
; # Do nothing
|
65
|
+
end
|
66
|
+
|
67
|
+
def on_section(_, _)
|
68
|
+
; # Do Nothing
|
69
|
+
end
|
70
|
+
|
71
|
+
def on_section_end(_)
|
72
|
+
; # Do Nothing
|
73
|
+
end
|
74
|
+
end # class
|
75
|
+
end # module
|
85
76
|
end # module
|
86
77
|
|
87
78
|
# End of file
|
@@ -3,100 +3,94 @@
|
|
3
3
|
require_relative 'all-notifications'
|
4
4
|
|
5
5
|
module Macros4Cuke # Module used as a namespace
|
6
|
-
|
7
6
|
# Namespace for all formatters of MacroCollection and MacroStep objects
|
8
7
|
module Formatter
|
8
|
+
# A macro-step formatter that outputs in the given IO the formatting events.
|
9
|
+
# Can be useful in tracing the visit sequence inside
|
10
|
+
# a given macro-step collection.
|
11
|
+
class ToTrace
|
12
|
+
# The IO where the formatter's output will be written to.
|
13
|
+
attr_reader(:io)
|
9
14
|
|
10
|
-
# A macro-step formatter that outputs in the given IO the formatting events.
|
11
|
-
# Can be useful in tracing the visit sequence inside
|
12
|
-
# a given macro-step collection.
|
13
|
-
class ToTrace
|
14
|
-
# The IO where the formatter's output will be written to.
|
15
|
-
attr_reader(:io)
|
16
|
-
|
17
|
-
|
18
|
-
def initialize(anIO)
|
19
|
-
@io = anIO
|
20
|
-
end
|
21
15
|
|
22
|
-
|
16
|
+
def initialize(anIO)
|
17
|
+
@io = anIO
|
18
|
+
end
|
23
19
|
|
24
|
-
|
25
|
-
def implements()
|
26
|
-
return Formatter::AllNotifications
|
27
|
-
end
|
20
|
+
public
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
# Tell which notifications the formatter subscribes to.
|
23
|
+
def implements()
|
24
|
+
return Formatter::AllNotifications
|
25
|
+
end
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
def on_collection(aLevel, _)
|
28
|
+
trace_event(aLevel, __method__)
|
29
|
+
end
|
36
30
|
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
def on_collection_end(aLevel)
|
32
|
+
trace_event(aLevel, __method__)
|
33
|
+
end
|
40
34
|
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
def on_step(aLevel, _)
|
36
|
+
trace_event(aLevel, __method__)
|
37
|
+
end
|
44
38
|
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
def on_step_end(aLevel)
|
40
|
+
trace_event(aLevel, __method__)
|
41
|
+
end
|
48
42
|
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
def on_phrase(aLevel, _, _)
|
44
|
+
trace_event(aLevel, __method__)
|
45
|
+
end
|
52
46
|
|
53
|
-
|
54
|
-
|
55
|
-
|
47
|
+
def on_renderer(aLevel, _)
|
48
|
+
trace_event(aLevel, __method__)
|
49
|
+
end
|
56
50
|
|
57
|
-
|
58
|
-
|
59
|
-
|
51
|
+
def on_renderer_end(aLevel)
|
52
|
+
trace_event(aLevel, __method__)
|
53
|
+
end
|
60
54
|
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
def on_source(aLevel, _)
|
56
|
+
trace_event(aLevel, __method__)
|
57
|
+
end
|
64
58
|
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
def on_static_text(aLevel, _)
|
60
|
+
trace_event(aLevel, __method__)
|
61
|
+
end
|
68
62
|
|
69
|
-
|
70
|
-
|
71
|
-
|
63
|
+
def on_comment(aLevel, _)
|
64
|
+
trace_event(aLevel, __method__)
|
65
|
+
end
|
72
66
|
|
73
|
-
|
74
|
-
|
75
|
-
|
67
|
+
def on_eol(aLevel)
|
68
|
+
trace_event(aLevel, __method__)
|
69
|
+
end
|
76
70
|
|
77
|
-
|
78
|
-
|
79
|
-
|
71
|
+
def on_placeholder(aLevel, _)
|
72
|
+
trace_event(aLevel, __method__)
|
73
|
+
end
|
80
74
|
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
def on_section(aLevel, _)
|
76
|
+
trace_event(aLevel, __method__)
|
77
|
+
end
|
84
78
|
|
85
|
-
|
79
|
+
def on_section_end(aLevel)
|
80
|
+
trace_event(aLevel, __method__)
|
81
|
+
end
|
86
82
|
|
87
|
-
|
88
|
-
return ' ' * aLevel
|
89
|
-
end
|
83
|
+
private
|
90
84
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end # class
|
85
|
+
def indentation(aLevel)
|
86
|
+
return ' ' * aLevel
|
87
|
+
end
|
97
88
|
|
89
|
+
def trace_event(aLevel, anEvent)
|
90
|
+
io.puts "#{indentation(aLevel)}#{anEvent}"
|
91
|
+
end
|
92
|
+
end # class
|
98
93
|
end # module
|
99
|
-
|
100
94
|
end # module
|
101
95
|
|
102
96
|
# End of file
|