yard-gherkin-turnip 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.yardopts +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +48 -0
- data/History.txt +293 -0
- data/LICENSE.txt +22 -0
- data/README.md +182 -0
- data/Rakefile +24 -0
- data/example/README.md +8 -0
- data/example/child_feature/README.md +21 -0
- data/example/child_feature/child.feature +11 -0
- data/example/child_feature/grandchild_feature/grandchild.feature +12 -0
- data/example/empty.feature +2 -0
- data/example/placeholder.feature +34 -0
- data/example/scenario.feature +63 -0
- data/example/scenario_outline.feature +100 -0
- data/example/scenario_outline_multi.feature +15 -0
- data/example/step_definitions/customer.step.rb +16 -0
- data/example/step_definitions/duck.step.rb +6 -0
- data/example/step_definitions/placeholder.step.rb +70 -0
- data/example/step_definitions/text.step.rb +11 -0
- data/example/tags.feature +18 -0
- data/lib/cucumber/city_builder.rb +412 -0
- data/lib/docserver/default/fulldoc/html/js/cucumber.js +88 -0
- data/lib/docserver/default/layout/html/headers.erb +13 -0
- data/lib/docserver/doc_server/full_list/html/full_list.erb +39 -0
- data/lib/docserver/doc_server/full_list/html/setup.rb +18 -0
- data/lib/templates/default/feature/html/feature.erb +39 -0
- data/lib/templates/default/feature/html/no_steps_defined.erb +1 -0
- data/lib/templates/default/feature/html/outline.erb +59 -0
- data/lib/templates/default/feature/html/pystring.erb +3 -0
- data/lib/templates/default/feature/html/scenario.erb +55 -0
- data/lib/templates/default/feature/html/setup.rb +54 -0
- data/lib/templates/default/feature/html/steps.erb +39 -0
- data/lib/templates/default/feature/html/table.erb +20 -0
- data/lib/templates/default/featuredirectory/html/alpha_table.erb +30 -0
- data/lib/templates/default/featuredirectory/html/directory.erb +32 -0
- data/lib/templates/default/featuredirectory/html/setup.rb +41 -0
- data/lib/templates/default/featuretags/html/namespace.erb +159 -0
- data/lib/templates/default/featuretags/html/setup.rb +34 -0
- data/lib/templates/default/fulldoc/html/css/cucumber.css +226 -0
- data/lib/templates/default/fulldoc/html/directories.erb +27 -0
- data/lib/templates/default/fulldoc/html/full_list_featuredirectories.erb +11 -0
- data/lib/templates/default/fulldoc/html/full_list_features.erb +37 -0
- data/lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb +20 -0
- data/lib/templates/default/fulldoc/html/full_list_steps.erb +20 -0
- data/lib/templates/default/fulldoc/html/full_list_tags.erb +16 -0
- data/lib/templates/default/fulldoc/html/js/cucumber.js +331 -0
- data/lib/templates/default/fulldoc/html/setup.rb +208 -0
- data/lib/templates/default/layout/html/setup.rb +131 -0
- data/lib/templates/default/requirements/html/alpha_table.erb +26 -0
- data/lib/templates/default/requirements/html/requirements.erb +50 -0
- data/lib/templates/default/requirements/html/setup.rb +51 -0
- data/lib/templates/default/steptransformers/html/header.erb +12 -0
- data/lib/templates/default/steptransformers/html/index.erb +10 -0
- data/lib/templates/default/steptransformers/html/placeholders.erb +79 -0
- data/lib/templates/default/steptransformers/html/setup.rb +107 -0
- data/lib/templates/default/steptransformers/html/step_definitions.erb +79 -0
- data/lib/templates/default/steptransformers/html/undefined_steps.erb +26 -0
- data/lib/templates/default/tag/html/alpha_table.erb +33 -0
- data/lib/templates/default/tag/html/setup.rb +27 -0
- data/lib/templates/default/tag/html/tag.erb +35 -0
- data/lib/yard-gherkin-turnip.rb +42 -0
- data/lib/yard-gherkin-turnip/version.rb +3 -0
- data/lib/yard/code_objects/cucumber/base.rb +24 -0
- data/lib/yard/code_objects/cucumber/feature.rb +16 -0
- data/lib/yard/code_objects/cucumber/namespace_object.rb +55 -0
- data/lib/yard/code_objects/cucumber/scenario.rb +22 -0
- data/lib/yard/code_objects/cucumber/scenario_outline.rb +68 -0
- data/lib/yard/code_objects/cucumber/step.rb +46 -0
- data/lib/yard/code_objects/cucumber/tag.rb +31 -0
- data/lib/yard/code_objects/placeholder.rb +45 -0
- data/lib/yard/code_objects/step_definition.rb +46 -0
- data/lib/yard/code_objects/step_transformer.rb +32 -0
- data/lib/yard/handlers/cucumber/base.rb +21 -0
- data/lib/yard/handlers/cucumber/feature_handler.rb +96 -0
- data/lib/yard/handlers/placeholder_handler.rb +28 -0
- data/lib/yard/handlers/placeholder_match_handler.rb +17 -0
- data/lib/yard/handlers/step_definition_handler.rb +55 -0
- data/lib/yard/parser/cucumber/feature.rb +72 -0
- data/lib/yard/server/adapter.rb +43 -0
- data/lib/yard/server/commands/list_command.rb +31 -0
- data/lib/yard/server/router.rb +31 -0
- data/lib/yard/templates/helpers/base_helper.rb +26 -0
- data/yard-gherkin-turnip.gemspec +67 -0
- metadata +216 -0
@@ -0,0 +1,208 @@
|
|
1
|
+
include YARD::Templates::Helpers::HtmlHelper
|
2
|
+
|
3
|
+
def init
|
4
|
+
super
|
5
|
+
|
6
|
+
# Additional javascript that power the additional menus, collapsing, etc.
|
7
|
+
asset "js/cucumber.js", file("js/cucumber.js",true)
|
8
|
+
|
9
|
+
serialize_object_type :feature
|
10
|
+
|
11
|
+
serialize_object_type :tag
|
12
|
+
|
13
|
+
# Generates the requirements splash page with the 'requirements' template
|
14
|
+
serialize(YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE)
|
15
|
+
|
16
|
+
# Generates a page for step definitions and step placeholders with the 'steptransformers' template
|
17
|
+
serialize(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE)
|
18
|
+
|
19
|
+
# Generates the tags page with the 'featuretags' template
|
20
|
+
serialize(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE)
|
21
|
+
|
22
|
+
serialize_feature_directories
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# The top-level feature directories. This is affected by the directories that YARD is told to parse.
|
27
|
+
# All other features in sub-directories are contained under each of these top-level directories.
|
28
|
+
#
|
29
|
+
# @example Generating one feature directory
|
30
|
+
#
|
31
|
+
# `yardoc 'example/**/*'`
|
32
|
+
#
|
33
|
+
# @example Generating two feature directories
|
34
|
+
#
|
35
|
+
# `yardoc 'example/**/*' 'example2/**/*'`
|
36
|
+
#
|
37
|
+
# @return the feature directories at the root of the Cucumber Namespace.
|
38
|
+
#
|
39
|
+
def root_feature_directories
|
40
|
+
@root_feature_directories ||= YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory)}
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Generate pages for the objects if there are objects of this type contained
|
45
|
+
# within the Registry.
|
46
|
+
#
|
47
|
+
def serialize_object_type(type)
|
48
|
+
objects = Registry.all(type.to_sym)
|
49
|
+
Array(objects).each {|object| serialize(object) }
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Generates pages for the feature directories found. Starting with all root-level feature
|
54
|
+
# directories and then recursively finding all child feature directories.
|
55
|
+
#
|
56
|
+
def serialize_feature_directories
|
57
|
+
serialize_feature_directories_recursively(root_feature_directories)
|
58
|
+
root_feature_directories.each {|directory| serialize(directory) }
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Generate a page for each Feature Directory. This is called recursively to
|
63
|
+
# ensure that all feature directories contained as children are rendered to
|
64
|
+
# pages.
|
65
|
+
#
|
66
|
+
def serialize_feature_directories_recursively(namespaces)
|
67
|
+
namespaces.each do |namespace|
|
68
|
+
Templates::Engine.with_serializer(namespace, options[:serializer]) do
|
69
|
+
options[:object] = namespace
|
70
|
+
T('layout').run(options)
|
71
|
+
end
|
72
|
+
serialize_feature_directories_recursively(namespace.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory)})
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Generate feature list
|
77
|
+
# @note this method is called automatically by YARD based on the menus defined in the layout
|
78
|
+
def generate_feature_list
|
79
|
+
features = Registry.all(:feature)
|
80
|
+
features_ordered_by_name = features.sort {|x,y| x.value.to_s <=> y.value.to_s }
|
81
|
+
generate_full_list features_ordered_by_name, :features
|
82
|
+
end
|
83
|
+
|
84
|
+
# Count scenarios for features
|
85
|
+
def record_feature_scenarios(features)
|
86
|
+
count_with_examples = 0
|
87
|
+
features.each do |f|
|
88
|
+
count_with_examples += f.total_scenarios
|
89
|
+
end
|
90
|
+
return count_with_examples
|
91
|
+
end
|
92
|
+
|
93
|
+
# Count scenarios for tags
|
94
|
+
def record_tagged_scenarios(tags)
|
95
|
+
scenario_count = 0
|
96
|
+
count_with_examples = 0
|
97
|
+
tags.each do |t|
|
98
|
+
scenario_count += t.all_scenarios.size
|
99
|
+
count_with_examples += t.total_scenarios
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Generate tag list
|
104
|
+
# @note this method is called automatically by YARD based on the menus defined in the layout
|
105
|
+
def generate_tag_list
|
106
|
+
tags = Registry.all(:tag)
|
107
|
+
tags_ordered_by_use = Array(tags).sort {|x,y| y.total_scenarios <=> x.total_scenarios }
|
108
|
+
|
109
|
+
record_tagged_scenarios(tags)
|
110
|
+
|
111
|
+
generate_full_list tags_ordered_by_use, :tags
|
112
|
+
end
|
113
|
+
|
114
|
+
# Generate a step definition list
|
115
|
+
# @note this menu is not automatically added until yard configuration has this menu added
|
116
|
+
# See the layout template method that loads the menus
|
117
|
+
def generate_stepdefinition_list
|
118
|
+
generate_full_list YARD::Registry.all(:stepdefinition), :stepdefinitions,
|
119
|
+
:list_title => "Step Definitions List"
|
120
|
+
end
|
121
|
+
|
122
|
+
# Generate a step list
|
123
|
+
# @note this menu is not automatically added until yard configuration has this menu added
|
124
|
+
# See the layout template method that loads the menus
|
125
|
+
def generate_step_list
|
126
|
+
generate_full_list YARD::Registry.all(:step), :steps
|
127
|
+
end
|
128
|
+
|
129
|
+
# Generate feature list
|
130
|
+
# @note this menu is not automatically added until yard configuration has this menu added
|
131
|
+
# See the layout template method that loads the menus
|
132
|
+
def generate_featuredirectories_list
|
133
|
+
directories_ordered_by_name = root_feature_directories.sort {|x,y| x.value.to_s <=> y.value.to_s }
|
134
|
+
generate_full_list directories_ordered_by_name, :featuredirectories,
|
135
|
+
:list_title => "Features by Directory",
|
136
|
+
:list_filename => "featuredirectories_list.html"
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
# Helpler method to generate a full_list page of the specified objects with the
|
141
|
+
# specified type.
|
142
|
+
def generate_full_list(objects,type,options = {})
|
143
|
+
defaults = { :list_title => "#{type.to_s.capitalize} List",
|
144
|
+
:css_class => "class",
|
145
|
+
:list_filename => "#{type.to_s.gsub(/s$/,'')}_list.html" }
|
146
|
+
|
147
|
+
options = defaults.merge(options)
|
148
|
+
|
149
|
+
@items = objects
|
150
|
+
@list_type = type
|
151
|
+
@list_title = options[:list_title]
|
152
|
+
@list_class = options[:css_class]
|
153
|
+
asset options[:list_filename], erb(:full_list)
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# @note This method overrides YARD's default template class_list method.
|
158
|
+
#
|
159
|
+
# The existing YARD 'Class List' search field contains all the YARD namespace objects.
|
160
|
+
# We, however, do not want the Cucumber Namespace YARD Object (which holds the features,
|
161
|
+
# tags, etc.) as it is a meta-object.
|
162
|
+
#
|
163
|
+
# This method removes the namespace from the root node, generates the class list,
|
164
|
+
# and then adds it back into the root node.
|
165
|
+
#
|
166
|
+
def class_list(root = Registry.root, tree = TreeContext.new)
|
167
|
+
return super unless root == Registry.root
|
168
|
+
|
169
|
+
cucumber_namespace = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE
|
170
|
+
root.instance_eval { children.delete cucumber_namespace }
|
171
|
+
out = super(root)
|
172
|
+
root.instance_eval { children.push cucumber_namespace }
|
173
|
+
out
|
174
|
+
end
|
175
|
+
|
176
|
+
#
|
177
|
+
# Generate a link to the 'All Features' in the features_list.html
|
178
|
+
#
|
179
|
+
# When there are no feature directories or multiple top-level feature directories
|
180
|
+
# then we want to link to the 'Requirements' page
|
181
|
+
#
|
182
|
+
# When there are is just one feature directory then we want to link to that directory
|
183
|
+
#
|
184
|
+
def all_features_link
|
185
|
+
features = Registry.all(:feature)
|
186
|
+
count_with_examples = record_feature_scenarios(features)
|
187
|
+
if root_feature_directories.length == 0 || root_feature_directories.length > 1
|
188
|
+
linkify YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE, "All Features (#{count_with_examples})"
|
189
|
+
else
|
190
|
+
linkify root_feature_directories.first, "All Features (#{count_with_examples})"
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
#
|
195
|
+
# This method is used to generate a feature directory. This template may call
|
196
|
+
# this method as well to generate any child feature directories as well.
|
197
|
+
#
|
198
|
+
# @param directory [FeatureDirectory] this is the FeatureDirectory to display
|
199
|
+
# @param padding [Fixnum] this is the pixel value to ident as we want to keep
|
200
|
+
# pushing in the padding to show the parent relationship
|
201
|
+
# @param row [String] 'odd' or 'even' to correctly color the row
|
202
|
+
#
|
203
|
+
def directory_node(directory,padding,row)
|
204
|
+
@directory = directory
|
205
|
+
@padding = padding
|
206
|
+
@row = row
|
207
|
+
erb(:directories)
|
208
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
def init
|
2
|
+
super
|
3
|
+
end
|
4
|
+
|
5
|
+
#
|
6
|
+
# Append yard-gherkin-turnip stylesheet to yard core stylesheets
|
7
|
+
#
|
8
|
+
def stylesheets
|
9
|
+
super + %w(css/cucumber.css)
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Append yard-gherkin-turnip javascript to yard core javascripts
|
14
|
+
#
|
15
|
+
def javascripts
|
16
|
+
super + %w(js/cucumber.js)
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Append yard-gherkin-turnip specific menus 'features' and 'tags'
|
21
|
+
#
|
22
|
+
# 'features' and 'tags' are enabled by default.
|
23
|
+
#
|
24
|
+
# 'step definitions' and 'steps' may be enabled by setting up a value in
|
25
|
+
# yard configuration file '~/.yard/config'
|
26
|
+
#
|
27
|
+
# @example `~/.yard/config`
|
28
|
+
#
|
29
|
+
# yard-gherkin-turnip:
|
30
|
+
# menus: [ 'features', 'directories', 'tags', 'step definitions', 'steps' ]
|
31
|
+
#
|
32
|
+
def menu_lists
|
33
|
+
current_menu_lists.map {|menu_name| yard_turnip_menus[menu_name] }.compact + super
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# By default we want to display the 'features' and 'tags' menu but we will allow
|
38
|
+
# the YARD configuration to override that functionality.
|
39
|
+
#
|
40
|
+
def current_menu_lists
|
41
|
+
@current_menu_lists ||= begin
|
42
|
+
menus = [ "features", "tags" ]
|
43
|
+
|
44
|
+
if YARD::Config.options["yard-gherkin-turnip"] and YARD::Config.options["yard-gherkin-turnip"]["menus"]
|
45
|
+
menus = YARD::Config.options["yard-gherkin-turnip"]["menus"]
|
46
|
+
end
|
47
|
+
|
48
|
+
menus
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# When a menu is specified in the yard configuration file, this hash contains
|
54
|
+
# the details about the menu necessary for it to be displayed.
|
55
|
+
#
|
56
|
+
# @see #menu_lists
|
57
|
+
#
|
58
|
+
def yard_turnip_menus
|
59
|
+
{ "features" => { :type => 'feature', :title => 'Features', :search_title => 'Features' },
|
60
|
+
"directories" => { :type => 'featuredirectories', :title => 'Features by Directory', :search_title => 'Features by Directory' },
|
61
|
+
"tags" => { :type => 'tag', :title => 'Tags', :search_title => 'Tags' },
|
62
|
+
"step definitions" => { :type => 'stepdefinition', :title => 'Step Definitions', :search_title => 'Step Defs' },
|
63
|
+
"steps" => { :type => 'step', :title => 'Steps', :search_title => 'Steps' } }
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# @note This method overrides YARD's default layout template's layout method.
|
68
|
+
#
|
69
|
+
# The existing YARD layout method generates the url for the nav menu on the left
|
70
|
+
# side. For YARD-Gherkin-Turnip objects this will default to the class_list.html.
|
71
|
+
# which is not what we want for features, tags, etc.
|
72
|
+
#
|
73
|
+
# So we override this method and put in some additional logic to figure out the
|
74
|
+
# correct list to appear in the search. This can be particularly tricky because
|
75
|
+
#
|
76
|
+
# This method removes the namespace from the root node, generates the class list,
|
77
|
+
# and then adds it back into the root node.
|
78
|
+
#
|
79
|
+
def layout
|
80
|
+
@nav_url = url_for_list(!@file || options.index ? 'class' : 'file')
|
81
|
+
|
82
|
+
|
83
|
+
if is_yard_cucumber_object?(object)
|
84
|
+
@nav_url = rewrite_nav_url(@nav_url)
|
85
|
+
end
|
86
|
+
|
87
|
+
if !object || object.is_a?(String)
|
88
|
+
@path = nil
|
89
|
+
elsif @file
|
90
|
+
@path = @file.path
|
91
|
+
elsif !object.is_a?(YARD::CodeObjects::NamespaceObject)
|
92
|
+
@path = object.parent.path
|
93
|
+
else
|
94
|
+
@path = object.path
|
95
|
+
end
|
96
|
+
|
97
|
+
erb(:layout)
|
98
|
+
end
|
99
|
+
|
100
|
+
#
|
101
|
+
# Determine if the object happens to be a CodeObject defined in this gem.
|
102
|
+
#
|
103
|
+
# @note quite a few of the classes/modules defined here are not object that we
|
104
|
+
# would never want to display but it's alright if we match on them.
|
105
|
+
#
|
106
|
+
# @return [Boolean] true if the object's class name is one of the CodeObjects
|
107
|
+
#
|
108
|
+
def is_yard_cucumber_object?(object)
|
109
|
+
YARD::CodeObjects::Cucumber.constants.any? {|constant| object.class.name == "YARD::CodeObjects::Cucumber::#{constant}" }
|
110
|
+
end
|
111
|
+
|
112
|
+
#
|
113
|
+
# The re-write rules will only change the nav link to a new menu if it is a
|
114
|
+
# a Cucumber CodeObject that we care about and that we have also generated a
|
115
|
+
# menu for that item.
|
116
|
+
#
|
117
|
+
def rewrite_nav_url(nav_url)
|
118
|
+
if object.is_a?(YARD::CodeObjects::Cucumber::Feature) && current_menu_lists.include?('features')
|
119
|
+
nav_url.gsub('class_list.html','feature_list.html')
|
120
|
+
elsif object.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) && current_menu_lists.include?('directories')
|
121
|
+
nav_url.gsub('class_list.html','featuredirectories_list.html')
|
122
|
+
elsif object.is_a?(YARD::CodeObjects::Cucumber::Tag) && current_menu_lists.include?('tags')
|
123
|
+
nav_url.gsub('class_list.html','tag_list.html')
|
124
|
+
elsif object.is_a?(YARD::CodeObjects::Cucumber::Step) && current_menu_lists.include?('steps')
|
125
|
+
nav_url.gsub('class_list.html','step_list.html')
|
126
|
+
elsif object.is_a?(YARD::CodeObjects::Cucumber::StepTransformer) && current_menu_lists.include?('step definitions')
|
127
|
+
nav_url.gsub('class_list.html','stepdefinition_list.html')
|
128
|
+
else
|
129
|
+
nav_url
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<% if @elements && !@elements.empty? %>
|
2
|
+
<% i = (@elements.length % 2 == 0 ? 1 : 0) %>
|
3
|
+
<table style="margin-left: 10px; width: 100%;">
|
4
|
+
<tr>
|
5
|
+
<td valign='top' width="50%">
|
6
|
+
<% @elements.each do |letter, objects| %>
|
7
|
+
<% if (i += 1) > (@elements.length / 2 + 1) %>
|
8
|
+
</td><td valign='top' width="50%">
|
9
|
+
<% i = 0 %>
|
10
|
+
<% end %>
|
11
|
+
<ul id="alpha_<%= letter %>" class="alpha">
|
12
|
+
<li class="letter"><%= letter %></li>
|
13
|
+
<ul>
|
14
|
+
<% objects.each do |obj| %>
|
15
|
+
<li>
|
16
|
+
<%= linkify obj, obj.value %>
|
17
|
+
<small>(<%= obj.file %>)</small>
|
18
|
+
</li>
|
19
|
+
<% end %>
|
20
|
+
</ul>
|
21
|
+
</ul>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
</table>
|
26
|
+
<% end %>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<% if @namespace %>
|
2
|
+
<div id="cukes_logo"> </div>
|
3
|
+
<div id="cukes_links">
|
4
|
+
<a href="http://cukes.info/">Cucumber</a> |
|
5
|
+
<a href="http://github.com/cucumber/cucumber/wiki/Gherkin">Gherkin</a> |
|
6
|
+
<a href="http://yardoc.org/">YARD</a> |
|
7
|
+
<a href="https://github.com/angelatodd/yard-gherkin-turnip">YARD-Gherkin-Turnip</a>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="requirements">
|
11
|
+
|
12
|
+
<% if features && !features.empty? %>
|
13
|
+
<%= alpha_table(features) %>
|
14
|
+
<% else %>
|
15
|
+
<!-- No Features Defined -->
|
16
|
+
<div class="none">No Features Defined</div>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<div id="directory" style="margin-left: 40px;">
|
20
|
+
<div class="title"><span class="name">Tags</span></div>
|
21
|
+
</div>
|
22
|
+
<div class="tags">
|
23
|
+
<%= tags.collect {|tag| linkify(tag,tag.value) }.join(",\n") %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<% if feature_subdirectories && !feature_subdirectories.empty? %>
|
27
|
+
<div id="directory" style="margin-left: 40px;">
|
28
|
+
<div class="title"><span class="name">Subdirectories</span></div>
|
29
|
+
</div>
|
30
|
+
<%= alpha_table(feature_subdirectories) %>
|
31
|
+
<% else %>
|
32
|
+
<!-- No Feature Directories -->
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<div id="directory" style="margin-left: 40px;">
|
36
|
+
<div class="title"><span class="name">Step Definitions & Placeholders</span></div>
|
37
|
+
</div>
|
38
|
+
<div class="steptransformers">
|
39
|
+
<%= step_definitions.length %>
|
40
|
+
<a href="<%= url_for step_transformers, "step_definitions" %>">Step Definitions</a>
|
41
|
+
<%= placeholders.length %>
|
42
|
+
<a href="<%= url_for step_transformers, "placeholders" %>">Placeholders</a>
|
43
|
+
and <%= undefined_steps.length %>
|
44
|
+
<a href="<%= url_for step_transformers, "undefined_steps" %>">Undefined Steps</a>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
</div>
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
def init
|
2
|
+
super
|
3
|
+
sections.push :requirements
|
4
|
+
@namespace = object
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
def features
|
9
|
+
@features ||= Registry.all(:feature)
|
10
|
+
end
|
11
|
+
|
12
|
+
def tags
|
13
|
+
@tags ||= Registry.all(:tag).sort_by {|l| l.value.to_s }
|
14
|
+
end
|
15
|
+
|
16
|
+
def feature_directories
|
17
|
+
@feature_directories ||= YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory)}
|
18
|
+
end
|
19
|
+
|
20
|
+
def feature_subdirectories
|
21
|
+
@feature_subdirectories ||= Registry.all(:featuredirectory) - feature_directories
|
22
|
+
end
|
23
|
+
|
24
|
+
def step_transformers
|
25
|
+
YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE
|
26
|
+
end
|
27
|
+
|
28
|
+
def step_definitions
|
29
|
+
@step_definitions ||= YARD::Registry.all(:stepdefinition)
|
30
|
+
end
|
31
|
+
|
32
|
+
def placeholders
|
33
|
+
@placeholders ||= YARD::Registry.all(:placeholder)
|
34
|
+
end
|
35
|
+
|
36
|
+
def undefined_steps
|
37
|
+
@undefined_steps ||= Registry.all(:step).reject {|s| s.definition || s.scenario.outline? }
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def alpha_table(objects)
|
42
|
+
@elements = Hash.new
|
43
|
+
|
44
|
+
objects = run_verifier(objects)
|
45
|
+
objects.each {|o| (@elements[o.value.to_s[0,1].upcase] ||= []) << o }
|
46
|
+
@elements.values.each {|v| v.sort! {|a,b| b.value.to_s <=> a.value.to_s } }
|
47
|
+
@elements = @elements.sort_by {|l,o| l.to_s }
|
48
|
+
|
49
|
+
@elements.each {|letter,objects| objects.sort! {|a,b| b.value.to_s <=> a.value.to_s }}
|
50
|
+
erb(:alpha_table)
|
51
|
+
end
|