yard-gherkin-turnip 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.rspec +3 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.yardopts +1 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +48 -0
  9. data/History.txt +293 -0
  10. data/LICENSE.txt +22 -0
  11. data/README.md +182 -0
  12. data/Rakefile +24 -0
  13. data/example/README.md +8 -0
  14. data/example/child_feature/README.md +21 -0
  15. data/example/child_feature/child.feature +11 -0
  16. data/example/child_feature/grandchild_feature/grandchild.feature +12 -0
  17. data/example/empty.feature +2 -0
  18. data/example/placeholder.feature +34 -0
  19. data/example/scenario.feature +63 -0
  20. data/example/scenario_outline.feature +100 -0
  21. data/example/scenario_outline_multi.feature +15 -0
  22. data/example/step_definitions/customer.step.rb +16 -0
  23. data/example/step_definitions/duck.step.rb +6 -0
  24. data/example/step_definitions/placeholder.step.rb +70 -0
  25. data/example/step_definitions/text.step.rb +11 -0
  26. data/example/tags.feature +18 -0
  27. data/lib/cucumber/city_builder.rb +412 -0
  28. data/lib/docserver/default/fulldoc/html/js/cucumber.js +88 -0
  29. data/lib/docserver/default/layout/html/headers.erb +13 -0
  30. data/lib/docserver/doc_server/full_list/html/full_list.erb +39 -0
  31. data/lib/docserver/doc_server/full_list/html/setup.rb +18 -0
  32. data/lib/templates/default/feature/html/feature.erb +39 -0
  33. data/lib/templates/default/feature/html/no_steps_defined.erb +1 -0
  34. data/lib/templates/default/feature/html/outline.erb +59 -0
  35. data/lib/templates/default/feature/html/pystring.erb +3 -0
  36. data/lib/templates/default/feature/html/scenario.erb +55 -0
  37. data/lib/templates/default/feature/html/setup.rb +54 -0
  38. data/lib/templates/default/feature/html/steps.erb +39 -0
  39. data/lib/templates/default/feature/html/table.erb +20 -0
  40. data/lib/templates/default/featuredirectory/html/alpha_table.erb +30 -0
  41. data/lib/templates/default/featuredirectory/html/directory.erb +32 -0
  42. data/lib/templates/default/featuredirectory/html/setup.rb +41 -0
  43. data/lib/templates/default/featuretags/html/namespace.erb +159 -0
  44. data/lib/templates/default/featuretags/html/setup.rb +34 -0
  45. data/lib/templates/default/fulldoc/html/css/cucumber.css +226 -0
  46. data/lib/templates/default/fulldoc/html/directories.erb +27 -0
  47. data/lib/templates/default/fulldoc/html/full_list_featuredirectories.erb +11 -0
  48. data/lib/templates/default/fulldoc/html/full_list_features.erb +37 -0
  49. data/lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb +20 -0
  50. data/lib/templates/default/fulldoc/html/full_list_steps.erb +20 -0
  51. data/lib/templates/default/fulldoc/html/full_list_tags.erb +16 -0
  52. data/lib/templates/default/fulldoc/html/js/cucumber.js +331 -0
  53. data/lib/templates/default/fulldoc/html/setup.rb +208 -0
  54. data/lib/templates/default/layout/html/setup.rb +131 -0
  55. data/lib/templates/default/requirements/html/alpha_table.erb +26 -0
  56. data/lib/templates/default/requirements/html/requirements.erb +50 -0
  57. data/lib/templates/default/requirements/html/setup.rb +51 -0
  58. data/lib/templates/default/steptransformers/html/header.erb +12 -0
  59. data/lib/templates/default/steptransformers/html/index.erb +10 -0
  60. data/lib/templates/default/steptransformers/html/placeholders.erb +79 -0
  61. data/lib/templates/default/steptransformers/html/setup.rb +107 -0
  62. data/lib/templates/default/steptransformers/html/step_definitions.erb +79 -0
  63. data/lib/templates/default/steptransformers/html/undefined_steps.erb +26 -0
  64. data/lib/templates/default/tag/html/alpha_table.erb +33 -0
  65. data/lib/templates/default/tag/html/setup.rb +27 -0
  66. data/lib/templates/default/tag/html/tag.erb +35 -0
  67. data/lib/yard-gherkin-turnip.rb +42 -0
  68. data/lib/yard-gherkin-turnip/version.rb +3 -0
  69. data/lib/yard/code_objects/cucumber/base.rb +24 -0
  70. data/lib/yard/code_objects/cucumber/feature.rb +16 -0
  71. data/lib/yard/code_objects/cucumber/namespace_object.rb +55 -0
  72. data/lib/yard/code_objects/cucumber/scenario.rb +22 -0
  73. data/lib/yard/code_objects/cucumber/scenario_outline.rb +68 -0
  74. data/lib/yard/code_objects/cucumber/step.rb +46 -0
  75. data/lib/yard/code_objects/cucumber/tag.rb +31 -0
  76. data/lib/yard/code_objects/placeholder.rb +45 -0
  77. data/lib/yard/code_objects/step_definition.rb +46 -0
  78. data/lib/yard/code_objects/step_transformer.rb +32 -0
  79. data/lib/yard/handlers/cucumber/base.rb +21 -0
  80. data/lib/yard/handlers/cucumber/feature_handler.rb +96 -0
  81. data/lib/yard/handlers/placeholder_handler.rb +28 -0
  82. data/lib/yard/handlers/placeholder_match_handler.rb +17 -0
  83. data/lib/yard/handlers/step_definition_handler.rb +55 -0
  84. data/lib/yard/parser/cucumber/feature.rb +72 -0
  85. data/lib/yard/server/adapter.rb +43 -0
  86. data/lib/yard/server/commands/list_command.rb +31 -0
  87. data/lib/yard/server/router.rb +31 -0
  88. data/lib/yard/templates/helpers/base_helper.rb +26 -0
  89. data/yard-gherkin-turnip.gemspec +67 -0
  90. metadata +216 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 67de9dce9f9670a5fb850a1a4a169da5d9db6248bf701e1cb0d07176209e44e4
4
+ data.tar.gz: '09332973d65527f530801f524955aad6182918913c34922116f3e958f75c3c84'
5
+ SHA512:
6
+ metadata.gz: 4850efe6c5b56cc7f207a6f05d4f6cb3f443b8016f7005da652ea21836d224f6e528b507a880f83f2832cdffc28665424622f210c3988b9e1cb08be00dbc2856
7
+ data.tar.gz: 4e5d7038c782c9282ab891638b97b8187b610e90a71270de3bb103894ba4e3f0bd6cc943ac3b4a7ff371e9c71d61dc3113de487fa01878b29a6aee67b2b48f2c
@@ -0,0 +1,6 @@
1
+ # Ignore any built gems that are laying around
2
+ *.gem
3
+
4
+ # Documents folder
5
+ doc
6
+ .yardoc
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ # /.rspec
2
+ --format d
3
+ --color
@@ -0,0 +1 @@
1
+ yard-gherkin-turnip
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -0,0 +1 @@
1
+ --plugin yard-gherkin-turnip
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'redcarpet'
4
+ gem 'gherkin', '>= 4.0', '< 6.0'
5
+
6
+ gemspec
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ yard-gherkin-turnip (1.0.0)
5
+ cucumber (>= 2.0, < 4.0)
6
+ gherkin (>= 4.0, < 6.0)
7
+ yard (~> 0.8, >= 0.8.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ backports (3.18.1)
13
+ builder (3.2.4)
14
+ cucumber (3.2.0)
15
+ builder (>= 2.1.2)
16
+ cucumber-core (~> 3.2.0)
17
+ cucumber-expressions (~> 6.0.1)
18
+ cucumber-wire (~> 0.0.1)
19
+ diff-lcs (~> 1.3)
20
+ gherkin (~> 5.1.0)
21
+ multi_json (>= 1.7.5, < 2.0)
22
+ multi_test (>= 0.1.2)
23
+ cucumber-core (3.2.1)
24
+ backports (>= 3.8.0)
25
+ cucumber-tag_expressions (~> 1.1.0)
26
+ gherkin (~> 5.0)
27
+ cucumber-expressions (6.0.1)
28
+ cucumber-tag_expressions (1.1.1)
29
+ cucumber-wire (0.0.1)
30
+ diff-lcs (1.4.2)
31
+ gherkin (5.1.0)
32
+ multi_json (1.14.1)
33
+ multi_test (0.1.2)
34
+ rake (10.5.0)
35
+ redcarpet (3.5.0)
36
+ yard (0.9.25)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ gherkin (>= 4.0, < 6.0)
43
+ rake (~> 10)
44
+ redcarpet
45
+ yard-gherkin-turnip!
46
+
47
+ BUNDLED WITH
48
+ 2.1.4
@@ -0,0 +1,293 @@
1
+ === 1.0.0 / 2020-06-28
2
+
3
+ * Forked from yard-cucumber and renamed yard-gherkin-turnip
4
+ * Support added for Turnip `step` and `placeholder` definitions
5
+
6
+ === 4.0.0 / 2018-02-25
7
+
8
+ * @wellavelino: Adjusts the indentation of several project classes
9
+ (https://github.com/burtlo/yard-cucumber/pull/89)
10
+ * @elhuang: Adding example tags and scenarios counts
11
+ (https://github.com/burtlo/yard-cucumber/pull/87)
12
+ * @weh: Update README.md
13
+ (https://github.com/burtlo/yard-cucumber/pull/84)
14
+ * @weh: Fix Gem Load Error
15
+ (https://github.com/burtlo/yard-cucumber/pull/83)
16
+ * @Stephen-Kaye: Transforms with CONSTANTS
17
+ (https://github.com/burtlo/yard-cucumber/pull/79)
18
+
19
+ === 3.1.0/ 2016-12-06
20
+
21
+ * Updates to Gherkin 4.0 and Cucumber 2.4.0
22
+ * Fixes issues with the formatting that comes from these changes
23
+
24
+ === 2.3.2/ 2013-11-08
25
+
26
+ * De-duping uses of step definitions when the line number is the same (ipwnstuff)
27
+
28
+ === 2.3.1/ 2013-07-12
29
+
30
+ * Fixes for Cucumber ~> 1.3 and gherkin ~> 2.12 by loading
31
+ a required platform file.
32
+ * Added appropriate MIT license
33
+
34
+ === 2.3.0/ 2013-07-12
35
+
36
+ * Fixes for Cucumber ~> 1.3 and gherkin ~> 2.12 by loading
37
+ a required platform file.
38
+
39
+ === 2.2.3/ 2013-02-15
40
+
41
+ * Step Definitions that are marked as 'pending' will now appear as pending
42
+ on the step definition and transforms page.
43
+
44
+ === 2.2.2/ 2012-10-07
45
+
46
+ * Steps and Definitions have links to step transformer page
47
+ * Step definitions in the search menu no longer expand constants
48
+
49
+ === 2.2.1/ 2012-09-29
50
+
51
+ * Fixes and compatibility with JRuby (Thanks @singram)
52
+
53
+ === 2.2.0/ 2012-05-29
54
+
55
+ * Fixes and changes to become compatible with YARD 0.8.1
56
+
57
+ === 2.1.7/ 2011-11-24
58
+
59
+ * Better parsing support for doc_strings (thanks @nikosd)
60
+
61
+ === 2.1.6 / 2011-11-24
62
+
63
+ * FIX for yard-server (Thanks @msolovyov, @maxigit, @nikosd)
64
+
65
+ === 2.1.5 / 2011-10-19
66
+
67
+ * FIX for multiple scenario outlines (Thanks @ardavis)
68
+
69
+ === 2.1.4 / 2011-10-10
70
+
71
+ * Support for multiple scenario outlines (Thanks @jmerrifield)
72
+
73
+ === 2.1.3 / 2011-09-24
74
+
75
+ * Support for Gherkin ~ 2.5 (Thanks @turboladen)
76
+
77
+ === 2.1.2 / 2011-09-16
78
+
79
+ * JRuby Bug Fix (Thanks @aledalgrande)
80
+
81
+ === 2.1.1 / 2011-06-17
82
+
83
+ * Gherkin 2.4.0 Compatibility (Thanks @bowsersenior)
84
+
85
+ === 2.1.0 / 2011-05-22
86
+
87
+ * YARD 0.7.0 compatibility (removed some monkey-patching)
88
+ * Add more menus (Steps and Step Definitions)
89
+ * Define step definitions in your language Internalization (Ruby 1.9.2)
90
+
91
+ === 2.0.3 / 2011-05-22
92
+
93
+ * Updated Cucumber links to the new github organization
94
+
95
+ === 2.0.2 / 2011-04-06
96
+
97
+ - No Features/Tags will still generate landing pages instead of no pages
98
+ - Changed link to current gem 'yard-cucumber'
99
+
100
+ === 2.0.1 / 2011-03-14
101
+
102
+ - YARD 0.6.5 compatibility
103
+
104
+ === 2.0.0 / 2011-02-08
105
+
106
+ * Cucumber In The YARD becomes `yard-cucumber` and with that gains the
107
+ benefits of being a YARD plugin
108
+
109
+ === 1.7.9 / 2011-02-05
110
+
111
+ - FIX links to Scenarios and Transforms in various places
112
+ - FIX Comments on Step Definitions that may blow up
113
+
114
+ === 1.7.8 / 2011-01-30
115
+
116
+ * 'All Features' lands you on the root features directory; 'Requirements'
117
+ is still accessible through the breadcrumbs.
118
+ * Feature directory pages will display all the features in all subdirectories
119
+ * Better sorting for features, tags, and step transformers.
120
+
121
+ - FIX Feature-Scenario links and Cursors
122
+
123
+ === 1.7.7 / 2011-01-06
124
+
125
+ * Feature Directories now support a README.md file that can be used to provide
126
+ information (with markdown support) about the directory of features.
127
+
128
+ === 1.7.6 / 2011-01-06
129
+
130
+ * Feature descriptions, multi-line strings, and comments will preserve spacing.
131
+
132
+ === 1.7.5 / 2010-12-14
133
+
134
+ * FIX Step Transforms were colliding with Step Definitions in Ruby 1.9.2
135
+
136
+ === 1.7.4 / 2010-12-11
137
+
138
+ * Ruby 1.9.2 Support
139
+ * Change to YARD Server support:
140
+ yard server -e /path/to/gem/lib/server.b
141
+
142
+ === 1.7.3 / 2010-12-06
143
+
144
+ * Shortcut Keys (t) for tags and (r) for features (f was taken)
145
+ * Step definitions/transforms consolidate steps for easier viewing
146
+ and when they have no steps they are colored differently
147
+ * Tag filtering supports inverse (~) of tags
148
+
149
+ * FIX Scenario Outlines without examples will not crash the parser
150
+ * FIX Features, Scenarios, and Directories should display in alphabetic order
151
+ * FIX Comments and multiline strings will display correctly
152
+ * FIX Feature comments will show
153
+
154
+ === 1.7.2 / 2010-11-30
155
+
156
+ * Step Definition and Transform page enhancements
157
+ * Step Regex links to Rubular
158
+ * FIX Steps with HTML encoded characters will display correctly
159
+
160
+ === 1.7.1 / 2010-11-28
161
+
162
+ * Feature file with layout enhancements
163
+ * Scenarios are now linked/linkable
164
+ * FIX Scenario Outline error on CentOS, Ruby 1.8.7
165
+ * FIX Requiring Cucumber before Gherkin so that correct gherkin is loaded
166
+
167
+ === 1.7.0 / 2010-11-18
168
+
169
+ * Dynamic Tag Union / Intersection
170
+
171
+ === 1.6.4 / 2010-11-16
172
+
173
+ * `yard server` can now serve up requirements with YARD 0.6.2
174
+ * 'All Tags' page now has a cucumber tag AND filtering tool (beta)
175
+ * Step Defs and Transforms will show comments
176
+
177
+ * FIX removed warnings by no longer requiring YARD
178
+
179
+ === 1.6.2 / 2010-11-07
180
+
181
+ * Undefined Steps are displayed on the Step Transformer page
182
+ * Defined and Undefined steps are better linked to the Transformer page
183
+
184
+ * FIX Requirements tags were conflicting with YARD tags and being displayed
185
+ in multiple locations
186
+ * FIX Scenario Outlines Examples failed to show their tables or text
187
+
188
+ === 1.6.1 / 2010-11-04
189
+
190
+ * FIX - Feature Directries with sub-directories aborted serialization
191
+
192
+ === 1.6.0 / 2010-11-02
193
+
194
+ * Feature directories, subdirectories, and Tags breadcrumb pages are present
195
+ * Scenario Outlines now display each example inline when the example is clicked
196
+ * 'All Features' and 'All Tags' links in the search fields
197
+
198
+ === 1.5.4 / 2010-10-28
199
+
200
+ * Optimization - Found that for a large test suite that the processing time was
201
+ approaching 2 hours (oh boy!). Reduced that time to a few minutes by optimizing
202
+ the feature handler to cache all step definitions and step transforms.
203
+
204
+ * Step Transforms will now attempt to unpack any constants found within them.
205
+ * FIX - Step Transforms were not being parsed because the regex incorrectly included
206
+ the block.
207
+ * FIX - Features and Scenarios with multiple tags were not being displayed
208
+
209
+ === 1.5.3 / 2010-10-26
210
+
211
+ * FIX - Step Definition YARD handler regex was poorly formed and raised exceptions
212
+ when it contained a forward-slash (even if escaped).
213
+ * FIX - Step highlighting was causing 'Out Of Memory' issues because
214
+ gsub could not handle nil values.
215
+ * FIX - Step highlighting failed to replace matches properly causing for corrupted
216
+ HTML span values to appear in the highlighted step definitions
217
+
218
+ === 1.5.2 / 2010-10-26
219
+
220
+ * FIX - Step Transform YARD handler regex was poorly formed and raised exceptions
221
+ when a transform contained a forward-slash (even if escaped).
222
+
223
+ === 1.5.1 / 2010-10-26
224
+
225
+ * Unified Feature/Scenario search field that resembles the Namespace-Class field
226
+ * Tag search also displays immediate features/scenarios
227
+ * Removed Scenario searching field
228
+ * Added filename and line number to a number of locations
229
+ * Minor Tag template enhancements
230
+ * FIX - Scenario Outline Reference was being replaced with the first example
231
+ * FIX - Scenario Outlines were not getting counted for tags
232
+
233
+ === 1.5 / 2010-10-25
234
+
235
+ * Steps that have found their step definitions will also attempt to find their
236
+ step transforms (However step transforms are not unpacked yet like step
237
+ definitions).
238
+ * Scenario Outlines will expand, behind the scenes, and match like traditional
239
+ scenarios.
240
+ * FIX - duplication of owners that the tag reports has been removed.
241
+ * INFO level messaging while processing features and scenarios to help assist
242
+ with feedback during the long processing.
243
+
244
+ === 1.4 / 2010-10-17
245
+
246
+ * Tagusage has been retired
247
+ * Tags are found during parsing by name or created and all uses are appended to the exising or newly created object
248
+ * Tagusage template renamed and fixed up for just a tag and all the references
249
+ * Tags are named tag_TAG (removed the @ as it was encoded during file serialization and I couldn't find an encoder helper)
250
+ * Cleaned up all references in the fulldoc, full list to references tags
251
+
252
+ * Moved Cucumber CodeObjects, Handlers, and Parsers to a Cucumber sub-directory
253
+ * Moved StepDefinition and StepTransforms form extensions.rb to individual StepObject and Handlers files
254
+
255
+ * (lsegal advice) Created Cucumber Namespace and sub namespaces for features, tags, and step transformers.
256
+ * (lsegal advice) Started to break apart the feature.erb into smaller digestable erb sections
257
+
258
+ * Feature namespace now parallels the directory structure of the feature directory (from where it is parsed)
259
+ * Feature files have simpler names; i.e. featurefile.html instead of featurefile.feature.html
260
+ * Feature page title now states Feature: The Feature ( KEYWORD: FEATURE_TITLE )
261
+ * Moved the templates to lib/templates so I could use yard/templates to override the YARD helpers
262
+
263
+ * Changed document parsing to mirror the order imposed by Cucumber, this is to stop features being loaded before step definitions.
264
+ This should hopefully address the issue where steps were not being mapped correctly to step definitions. This fixed the issue
265
+ in the small and large test suite I ran it against.
266
+
267
+
268
+ === 1.3 / 2010-10-13
269
+
270
+ * (7rans requested) Step definitions to show their source code; required a better source definition to be stored during creation of the CodeObject
271
+ * Fixes to the Feature template which had some unclosed table header elements
272
+ * Scenario Outline helper methods added to Scenarios
273
+ * Scenario Outlines, Tables, and Multiline Strings had other minor CSS changes
274
+ * Step tables and Scenario Example tables are no longer locked to 150px; instead that is the minimum width
275
+ * Tables and Multiline Strings (PyStrings) are no longer displayed in the steps frame which was causing ugliness with the striping of the rows
276
+ * (lsegal strongly recommended) Removed the pervasive use of filename in the CodeObjects
277
+ * Cleaned up the fulldoc setup to remove the redundancy
278
+ * Updated all the templates to support the lack of filename
279
+
280
+ === 1.2 / 2010-10-10
281
+
282
+ * FIX: Empty Step Definitions caused failure during serialization
283
+ * FIX: Empty Step Definitions caused failure during rendering HTML
284
+
285
+ === 1.1 / 2010-10-10
286
+
287
+ * FIX: Feature template had references to old methods for description (when it was an array)
288
+ * FIX: Empty feature files caused the documentation to fail; ignoring emptying feature files
289
+ * FIX: Tags, Step definitions, and other CodeObjects that were not present caused rendering to fail; Checking for nil
290
+
291
+ === 1.0 / 2010-10-10
292
+
293
+ * Initial Release
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Franklin Webber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
@@ -0,0 +1,182 @@
1
+ # YARD-Gherkin-Turnip: A Requirements Documentation Tool
2
+
3
+ ## Synopsis
4
+
5
+ YARD-Gherkin-Turnip (forked from YARD-Cucumber) is a YARD extension that processes
6
+ Gherkin features, scenarios, steps and tags with step definitions and placeholders written using Turnip
7
+ to provide documentation similar to what you expect to how YARD displays
8
+ classes, methods and constants.This tools bridges the gap of having feature
9
+ files found in your source code and true documentation that your team, product
10
+ owners and stakeholders can use.
11
+
12
+ ## Examples
13
+
14
+ I have created a trivial, example project to help provide a quick
15
+ visualization of the resulting documentation. I encourage you to look at it as
16
+ an example and see if it would assist your project from a multitude of
17
+ perspectives: as the project's core developer; another developer or a new
18
+ developer; quality assurance engineer; or product owner/stakeholder.
19
+
20
+ The implemented example has been deployed at [http://burtlo.github.io/yard-cucumber/](http://burtlo.github.io/yard-cucumber/).
21
+
22
+ **1. View Features and Scenarios** [example](http://burtlo.github.io/yard-cucumber/requirements.html)
23
+
24
+ **2. Search through [features, scenarios](http://burtlo.github.io/yard-cucumber/feature_list.html), and [tags](http://burtlo.github.io/yard-cucumber/tag_list.html)**
25
+
26
+ **3. Dynamic Tag Unions and Intersections** [example](http://burtlo.github.io/yard-cucumber/requirements/tags.html)
27
+
28
+ **4. View all features and scenarios by tag** [example](http://burtlo.github.io/yard-cucumber/requirements/tags/bvt.html)
29
+
30
+ **5. View Step Definitions and Transforms** [example](http://burtlo.github.io/yard-cucumber/requirements/step_transformers.html)
31
+
32
+ **6. All steps [matched](http://burtlo.github.io/yard-cucumber/requirements/step_transformers.html#definition_5-stepdefinition) to step definitions**
33
+
34
+ **7. [Steps](http://burtlo.github.io/yard-cucumber/requirements/step_transformers.html#step_transform7-steptransform) that have transforms applied to them**
35
+
36
+ **8. [Undefined steps](http://burtlo.github.io/yard-cucumber/requirements/step_transformers.html#undefined_steps) and even [Rubular](http://rubular.com/) links of your step definitions.**
37
+
38
+ **9. Feature directories with a README.md will be parsed into the description** [example](http://burtlo.github.io/yard-cucumber/requirements/example/child_feature.html)
39
+
40
+ **10. Configurable Menus - want a searchable steps menu and remove the tags menu**
41
+
42
+ **11. Step definitions in your language (Ruby 1.9.2 - Internationalization)**
43
+
44
+ ## Installation
45
+
46
+ YARD-Gherkin-Turnip requires the following gems installed:
47
+
48
+ Gherkin - http://cukes.info
49
+ YARD - http://yardoc.org
50
+ Turnip - https://github.com/jnicklas/turnip
51
+
52
+ To install `yard-gherkin-turnip` use the following command:
53
+
54
+ ```bash
55
+ $ gem install yard-gherkin-turnip
56
+ ```
57
+
58
+ (Add `sudo` if you're installing under a POSIX system as root)
59
+
60
+ ## Usage
61
+
62
+ YARD supports for automatically including gems with the prefix `yard-`
63
+ as a plugin. To enable automatic loading yard-gherkin-turnip.
64
+
65
+ ```bash
66
+ $ mkdir ~/.yard
67
+ $ yard config load_plugins true
68
+ $ yardoc 'example/**/*.rb' 'example/**/*.feature'
69
+ ```
70
+
71
+ Now you can run YARD as you [normally](https://github.com/lsegal/yard) would and
72
+ have your features, step definitions and transforms captured.
73
+
74
+ An example with the rake task:
75
+
76
+ ```ruby
77
+ require 'yard'
78
+
79
+ YARD::Rake::YardocTask.new do |t|
80
+ t.files = ['features/**/*.feature', 'features/**/*.rb']
81
+ t.options = ['--any', '--extra', '--opts'] # optional
82
+ end
83
+ ```
84
+
85
+
86
+ ## Configuration
87
+
88
+ * Adding or Removing search fields (yardoc)
89
+
90
+ Be default the yardoc output will generate a search field for features and tags.
91
+ This can be configured through the yard configuration file `~/.yard/config` to
92
+ add or remove these search fields.
93
+
94
+ ```yaml
95
+ --- !ruby/hash-with-ivars:SymbolHash
96
+ elements:
97
+ :load_plugins: true
98
+ :ignored_plugins: []
99
+ :autoload_plugins: []
100
+ :safe_mode: false
101
+ :"yard-gherkin-turnip":
102
+ menus: [ 'features', 'directories', 'tags', 'steps', 'step definitions' ]
103
+ ivars:
104
+ :@symbolize_value: false
105
+ ```
106
+
107
+ By default the configuration, yaml format, that is generate by the `yard config`
108
+ command will save a `SymbolHash`. You can still edit this file add the entry for
109
+ `:"yard-gherkin-turnipr":` and the sub-entry `menus:` which can contain all of the above
110
+ mentioned menus or simply an empty array `[]` if you want no additional menus.
111
+
112
+ * Exclude features or scenarios from yardoc
113
+
114
+ You can exclude any feature or scenario from the yardoc by adding a predefined tags to them.
115
+ To define tags that will be excluded, again in yard configuration file:
116
+
117
+ ```yaml
118
+ :"yard-gherkin-turnip":
119
+ exclude_tags: [ 'exclude-yardoc', 'also-exclude-yardoc' ]
120
+ ```
121
+
122
+ ## Details
123
+
124
+ There are two things that I enjoy: a test framework written in my own Domain
125
+ Specific Language (DSL) that is easily understood by all those on a project
126
+ and the ability for all participants to easily read, search, and view the tests.
127
+
128
+ Cucumber is an amazing tool that allowed me to define exercisable requirements.
129
+ My biggest obstacle was bringing these requirements to my team, the product
130
+ owner, and other stakeholders.
131
+
132
+ Initially I tried to expose more of the functionality by providing freshly
133
+ authored requirements through email, attachments to JIRA tickets, or linked in
134
+ wiki documents. None of these methods were very sustainable or successful.
135
+ First, I was continually pushing out the documents to those interested.
136
+ Second, the documents were displayed to the user in text without the syntax
137
+ highlighting that was exceedingly helpful for quickly understanding the requirements.
138
+
139
+ I also found it hard to share the test framework that I had put together with
140
+ another developer that joined the team. It was difficult to direct them around
141
+ the features, tags, step definitions, and transforms. It was when I started to
142
+ convey to them the conventions that I had established that I wished I had a
143
+ tool that would allow me to provide documentation like one would find generated
144
+ by a great tool like YARD.
145
+
146
+ So I set out to integrate Cucumber objects like features, backgrounds,
147
+ scenarios, tags, steps, step definitions, and transforms into a YARD template.
148
+ From my quick survey of the landscape I can see that the my needs are
149
+ different than a lot of others that use Cucumber. The entire project that
150
+ spawned this effort was solely to exercise the functionality of a different,
151
+ large project and so there is a huge dependence on having the requirements
152
+ documented. This is in contrast to other projects that are using this on a
153
+ small scale to test the functionality of small software component. Though,
154
+ ultimately, I realized that the functionality may provide a valuable tool for
155
+ many as I feel it helps more solidly bridge the reporting of the documentation
156
+ by putting a coat of paint on it.
157
+
158
+
159
+ ## LICENSE
160
+
161
+ (The MIT License)
162
+
163
+ Copyright (c) 2011 Franklin Webber
164
+
165
+ Permission is hereby granted, free of charge, to any person obtaining
166
+ a copy of this software and associated documentation files (the
167
+ 'Software'), to deal in the Software without restriction, including
168
+ without limitation the rights to use, copy, modify, merge, publish,
169
+ distribute, sublicense, and/or sell copies of the Software, and to
170
+ permit persons to whom the Software is furnished to do so, subject to
171
+ the following conditions:
172
+
173
+ The above copyright notice and this permission notice shall be
174
+ included in all copies or substantial portions of the Software.
175
+
176
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
177
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
178
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
179
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
180
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
181
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
182
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.