yard-cucumber 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +3 -0
- data/History.txt +190 -0
- data/README.md +145 -0
- data/Rakefile +17 -0
- data/city.gemspec +66 -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/scenario.feature +63 -0
- data/example/scenario_outline.feature +80 -0
- data/example/step_definitions/example.step.rb +109 -0
- data/example/step_definitions/first.step.rb +21 -0
- data/example/step_definitions/support/env.rb +7 -0
- data/example/step_definitions/support/env_support.rb +12 -0
- data/example/step_definitions/support/support.rb +6 -0
- data/example/tags.feature +18 -0
- data/example/transform.feature +13 -0
- data/lib/cucumber/city_builder.rb +209 -0
- data/lib/docserver/default/fulldoc/html/js/cucumber.js +85 -0
- data/lib/docserver/default/layout/html/headers.erb +13 -0
- data/lib/docserver/doc_server/full_list/html/full_list.erb +37 -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 +42 -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 +55 -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 +26 -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 +131 -0
- data/lib/templates/default/featuretags/html/setup.rb +34 -0
- data/lib/templates/default/fulldoc/html/css/common.css +214 -0
- data/lib/templates/default/fulldoc/html/full_list.erb +36 -0
- data/lib/templates/default/fulldoc/html/full_list_features.erb +28 -0
- data/lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb +11 -0
- data/lib/templates/default/fulldoc/html/full_list_steps.erb +13 -0
- data/lib/templates/default/fulldoc/html/full_list_tags.erb +12 -0
- data/lib/templates/default/fulldoc/html/index.erb +24 -0
- data/lib/templates/default/fulldoc/html/js/cucumber.js +314 -0
- data/lib/templates/default/fulldoc/html/setup.rb +72 -0
- data/lib/templates/default/layout/html/headers.erb +14 -0
- data/lib/templates/default/layout/html/search.erb +7 -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/setup.rb +94 -0
- data/lib/templates/default/steptransformers/html/transformers.erb +74 -0
- data/lib/templates/default/steptransformers/html/undefinedsteps.erb +26 -0
- data/lib/templates/default/tag/html/alpha_table.erb +32 -0
- data/lib/templates/default/tag/html/setup.rb +27 -0
- data/lib/templates/default/tag/html/tag.erb +35 -0
- data/lib/yard/code_objects/cucumber/base.rb +32 -0
- data/lib/yard/code_objects/cucumber/feature.rb +18 -0
- data/lib/yard/code_objects/cucumber/namespace_object.rb +45 -0
- data/lib/yard/code_objects/cucumber/scenario.rb +26 -0
- data/lib/yard/code_objects/cucumber/scenario_outline.rb +66 -0
- data/lib/yard/code_objects/cucumber/step.rb +35 -0
- data/lib/yard/code_objects/cucumber/tag.rb +27 -0
- data/lib/yard/code_objects/step_definition.rb +7 -0
- data/lib/yard/code_objects/step_transform.rb +7 -0
- data/lib/yard/code_objects/step_transformer.rb +51 -0
- data/lib/yard/handlers/cucumber/base.rb +22 -0
- data/lib/yard/handlers/cucumber/feature_handler.rb +93 -0
- data/lib/yard/handlers/legacy/step_definition_handler.rb +46 -0
- data/lib/yard/handlers/legacy/step_transform_handler.rb +24 -0
- data/lib/yard/handlers/step_definition_handler.rb +22 -0
- data/lib/yard/handlers/step_transform_handler.rb +23 -0
- data/lib/yard/parser/cucumber/feature.rb +46 -0
- data/lib/yard/parser/source_parser.rb +54 -0
- data/lib/yard/rake/city_task.rb +12 -0
- data/lib/yard/server/adapter.rb +29 -0
- data/lib/yard/server/commands/list_command.rb +25 -0
- data/lib/yard/server/router.rb +31 -0
- data/lib/yard/templates/helpers/base_helper.rb +26 -0
- data/lib/yard-cucumber.rb +53 -0
- metadata +173 -0
@@ -0,0 +1,314 @@
|
|
1
|
+
function cucumberSearchFrameLinks() {
|
2
|
+
$('#features_list_link').click(function() {
|
3
|
+
toggleSearchFrame(this, relpath + 'feature_list.html');
|
4
|
+
});
|
5
|
+
$('#tags_list_link').click(function() {
|
6
|
+
toggleSearchFrame(this, relpath + 'tag_list.html');
|
7
|
+
});
|
8
|
+
}
|
9
|
+
|
10
|
+
function cucumberKeyboardShortcuts() {
|
11
|
+
if (window.top.frames.main) return;
|
12
|
+
$(document).keypress(function(evt) {
|
13
|
+
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
|
14
|
+
if (typeof evt.orignalTarget !== "undefined" &&
|
15
|
+
(evt.originalTarget.nodeName == "INPUT" ||
|
16
|
+
evt.originalTarget.nodeName == "TEXTAREA")) return;
|
17
|
+
switch (evt.charCode) {
|
18
|
+
case 82: case 114: $('#features_list_link').click(); break; // 'r'
|
19
|
+
case 84: case 116: $('#tags_list_link').click(); break; // 't'
|
20
|
+
}
|
21
|
+
});
|
22
|
+
}
|
23
|
+
|
24
|
+
$(cucumberSearchFrameLinks);
|
25
|
+
$(cucumberKeyboardShortcuts);
|
26
|
+
|
27
|
+
|
28
|
+
$(function() {
|
29
|
+
|
30
|
+
//
|
31
|
+
// Feature Page - Scenarios
|
32
|
+
//
|
33
|
+
$('.scenario div.title').click(function(eventObject) {
|
34
|
+
if (typeof eventObject.currentTarget !== "undefined") {
|
35
|
+
toggleScenario( $($(eventObject.currentTarget).parent()) );
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
//
|
40
|
+
// Developer View
|
41
|
+
// Click + Developer View = toggle the expansion of all tags, location, and comments
|
42
|
+
//
|
43
|
+
$('#view').click(function(eventObject) {
|
44
|
+
|
45
|
+
if (typeof eventObject.currentTarget !== "undefined") {
|
46
|
+
var view = eventObject.currentTarget;
|
47
|
+
|
48
|
+
if (view.innerHTML === '[More Detail]') {
|
49
|
+
$('.developer').show(500);
|
50
|
+
view.innerHTML = '[Less Detail]';
|
51
|
+
} else {
|
52
|
+
$('.developer').hide(500);
|
53
|
+
// Already hidden elements with .developer sub-elements were not getting message
|
54
|
+
$('.developer').each(function() {
|
55
|
+
$(this).css('display','none');
|
56
|
+
});
|
57
|
+
view.innerHTML = '[More Detail]';
|
58
|
+
}
|
59
|
+
}
|
60
|
+
});
|
61
|
+
|
62
|
+
//
|
63
|
+
// Expand/Collapse All
|
64
|
+
//
|
65
|
+
$('#expand').click(function(eventObject) {
|
66
|
+
|
67
|
+
if (typeof eventObject.currentTarget !== "undefined") {
|
68
|
+
if (eventObject.currentTarget.innerHTML === '[Expand All]') {
|
69
|
+
eventObject.currentTarget.innerHTML = '[Collapse All]';
|
70
|
+
$('div.scenario > div.details:hidden').each(function() {
|
71
|
+
toggleScenario( $($(this).parent()) );
|
72
|
+
});
|
73
|
+
} else {
|
74
|
+
eventObject.currentTarget.innerHTML = '[Expand All]';
|
75
|
+
$('div.scenario > div.details:visible').each(function() {
|
76
|
+
toggleScenario( $($(this).parent()) );
|
77
|
+
});
|
78
|
+
}
|
79
|
+
}
|
80
|
+
});
|
81
|
+
|
82
|
+
//
|
83
|
+
// Expand/Collapse All
|
84
|
+
//
|
85
|
+
$('#stepdefinition,#steptransform').click(function(eventObject) {
|
86
|
+
|
87
|
+
if (typeof eventObject.currentTarget !== "undefined") {
|
88
|
+
if (eventObject.currentTarget.innerHTML === '[Expand All]') {
|
89
|
+
eventObject.currentTarget.innerHTML = '[Collapse All]';
|
90
|
+
$('div.' + eventObject.currentTarget.id + ' > div.details:hidden').each(function() {
|
91
|
+
$(this).show(200);
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
eventObject.currentTarget.innerHTML = '[Expand All]';
|
95
|
+
$('div.' + eventObject.currentTarget.id + ' > div.details:visible').each(function() {
|
96
|
+
$(this).hide(200);
|
97
|
+
});
|
98
|
+
}
|
99
|
+
}
|
100
|
+
});
|
101
|
+
|
102
|
+
|
103
|
+
//
|
104
|
+
// Scenario Outlines - Toggle Examples
|
105
|
+
//
|
106
|
+
$('.outline table tr').click(function(eventObject) {
|
107
|
+
|
108
|
+
if (typeof eventObject.currentTarget !== "undefined") {
|
109
|
+
var exampleRow = $(eventObject.currentTarget);
|
110
|
+
|
111
|
+
if (eventObject.currentTarget.className.match(/example\d+/) == null) {
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
|
115
|
+
var exampleClass = eventObject.currentTarget.className.match(/example\d+/)[0];
|
116
|
+
var example = exampleRow.closest('div.details').find('.' + exampleClass);
|
117
|
+
|
118
|
+
var currentExample = null;
|
119
|
+
|
120
|
+
$('.outline table tr').each(function() {
|
121
|
+
$(this).removeClass('selected');
|
122
|
+
});
|
123
|
+
|
124
|
+
if ( example[0].style.display == 'none' ) {
|
125
|
+
currentExample = example[0];
|
126
|
+
exampleRow.addClass('selected');
|
127
|
+
} else {
|
128
|
+
currentExample = exampleRow.closest('div.details').find('.steps')[0];
|
129
|
+
}
|
130
|
+
|
131
|
+
// hide everything
|
132
|
+
exampleRow.closest('div.details').find('.steps').each(function() {
|
133
|
+
$(this).hide();
|
134
|
+
});
|
135
|
+
|
136
|
+
// show the selected
|
137
|
+
$(currentExample).show();
|
138
|
+
}
|
139
|
+
});
|
140
|
+
|
141
|
+
|
142
|
+
});
|
143
|
+
|
144
|
+
|
145
|
+
function toggleScenario(scenario) {
|
146
|
+
|
147
|
+
var state = scenario.find(".attributes input[name='collapsed']")[0];
|
148
|
+
|
149
|
+
if (state.value === 'true') {
|
150
|
+
scenario.find("div.details").each(function() {
|
151
|
+
$(this).show(500);
|
152
|
+
});
|
153
|
+
state.value = "false";
|
154
|
+
scenario.find('a.toggle').each(function() {
|
155
|
+
this.innerHTML = ' - ';
|
156
|
+
});
|
157
|
+
|
158
|
+
} else {
|
159
|
+
scenario.find("div.details").each(function() {
|
160
|
+
$(this).hide(500);
|
161
|
+
});
|
162
|
+
state.value = "true";
|
163
|
+
scenario.find('a.toggle').each(function() {
|
164
|
+
this.innerHTML = ' + ';
|
165
|
+
});
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
function updateTagFiltering(tagString) {
|
171
|
+
var formulaTags = determineTagsUsedInFormula(tagString);
|
172
|
+
displayExampleCommandLine(formulaTags);
|
173
|
+
displayQualifyingFeaturesAndScenarios(formulaTags);
|
174
|
+
fixSectionRowAlternations();
|
175
|
+
}
|
176
|
+
|
177
|
+
function clearTagFiltering() {
|
178
|
+
updateTagFiltering("");
|
179
|
+
}
|
180
|
+
|
181
|
+
function determineTagsUsedInFormula(tagString) {
|
182
|
+
|
183
|
+
tagString = tagString.replace(/^(\s+)|(\s+)$/,'').replace(/\s{2,}/,' ');
|
184
|
+
|
185
|
+
var tagGroup = tagString.match(/(?:~)?@\w+(,(?:~)?@\w+)*/g);
|
186
|
+
|
187
|
+
var returnTags = [];
|
188
|
+
|
189
|
+
if (tagGroup) {
|
190
|
+
tagGroup.forEach(function(tag, index, array) {
|
191
|
+
console.log("Tag Group: " + tag);
|
192
|
+
var validTags = removeInvalidTags(tag)
|
193
|
+
if (validTags != "") {
|
194
|
+
returnTags.push(validTags);
|
195
|
+
}
|
196
|
+
});
|
197
|
+
}
|
198
|
+
|
199
|
+
return returnTags;
|
200
|
+
}
|
201
|
+
|
202
|
+
function removeInvalidTags(tagGroup) {
|
203
|
+
tagGroup.split(",").forEach(function(tag, index, array) {
|
204
|
+
|
205
|
+
baseTag = tag.match(/^~(.+)/) ? tag.match(/^~(.+)/)[1] : tag;
|
206
|
+
|
207
|
+
//console.log("Validating Tag: " + tag)
|
208
|
+
if (tag_list.indexOf(baseTag) === -1) {
|
209
|
+
//console.log("Removing Tag: " + tag);
|
210
|
+
tagGroup = tagGroup.replace(new RegExp(',?' + tag + ',?'),"")
|
211
|
+
}
|
212
|
+
});
|
213
|
+
|
214
|
+
return tagGroup;
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
function displayExampleCommandLine(tags) {
|
219
|
+
$("#command_example")[0].innerHTML = "cucumber ";
|
220
|
+
|
221
|
+
if (tags.length > 0) {
|
222
|
+
$("#command_example")[0].innerHTML += "--tags " + tags.join(" --tags ");
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
function fixSectionRowAlternations() {
|
227
|
+
$(".feature:visible,.scenario:visible").each(function(index){
|
228
|
+
$(this).removeClass("odd even").addClass( ((index + 1) % 2 == 0 ? "even" : "odd") );
|
229
|
+
});
|
230
|
+
}
|
231
|
+
|
232
|
+
function displayQualifyingFeaturesAndScenarios(tags) {
|
233
|
+
|
234
|
+
if (tags.length > 0) {
|
235
|
+
|
236
|
+
$(".feature,.scenario").each(function(feature){
|
237
|
+
$(this).hide();
|
238
|
+
});
|
239
|
+
|
240
|
+
var tagSelectors = generateCssSelectorFromTags(tags);
|
241
|
+
|
242
|
+
tagSelectors.forEach(function(selector,selectorIndex,selectorArray) {
|
243
|
+
var tags = selector;
|
244
|
+
|
245
|
+
$(".feature." + tags).each(function(index) {
|
246
|
+
$(this).show();
|
247
|
+
});
|
248
|
+
$(".scenario." + tags).each(function(index) {
|
249
|
+
$(this).show();
|
250
|
+
$(this).parent().prev().show();
|
251
|
+
});
|
252
|
+
|
253
|
+
});
|
254
|
+
|
255
|
+
if ( $(".feature:visible,.scenario:visible").length == 0 ) {
|
256
|
+
$("#features div.undefined").show();
|
257
|
+
} else {
|
258
|
+
$("#features div.undefined").hide();
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
} else {
|
263
|
+
$(".feature:hidden,.scenario:hidden").each(function(feature){
|
264
|
+
$(this).show();
|
265
|
+
});
|
266
|
+
}
|
267
|
+
|
268
|
+
}
|
269
|
+
|
270
|
+
function generateCssSelectorFromTags(tagGroups) {
|
271
|
+
|
272
|
+
var tagSelectors = [ "" ];
|
273
|
+
|
274
|
+
tagGroups.forEach(function(tagGroup,index,array) {
|
275
|
+
var newTagSelectors = [];
|
276
|
+
|
277
|
+
tagSelectors.forEach(function(selector,selectorIndex,selectorArray) {
|
278
|
+
tagGroup.split(",").forEach(function(tag,tagIndex,tagArray) {
|
279
|
+
|
280
|
+
if ( tag.match(/^~@.+$/) ) {
|
281
|
+
tag = tag.match(/^~(@.+)$/)[1]
|
282
|
+
//console.log("selector: " + (selector + " :not(" + tag + ")").trim());
|
283
|
+
newTagSelectors.push((selector + ":not(." + tag.replace(/@/g,"\\@") +")").trim());
|
284
|
+
} else {
|
285
|
+
//console.log("selector: " + (selector + " " + tag).trim());
|
286
|
+
newTagSelectors.push((selector + "." + tag.replace(/@/g,"\\@")).trim());
|
287
|
+
}
|
288
|
+
});
|
289
|
+
|
290
|
+
});
|
291
|
+
|
292
|
+
tagSelectors = newTagSelectors;
|
293
|
+
|
294
|
+
});
|
295
|
+
|
296
|
+
|
297
|
+
return tagSelectors;
|
298
|
+
}
|
299
|
+
|
300
|
+
|
301
|
+
function createStepDefinitionLinks() {
|
302
|
+
// $('.step_instances_list').
|
303
|
+
// before("<span class='showSteps'>[<a href='#' class='toggleSteps'>View steps</a>]</span>");
|
304
|
+
$('.toggleSteps').toggle(function() {
|
305
|
+
$(this).parent().next().slideUp(100);
|
306
|
+
$(this).text("View " + $(this).attr('alt'));
|
307
|
+
},
|
308
|
+
function() {
|
309
|
+
$(this).parent().next().slideDown(100);
|
310
|
+
$(this).text("Hide " + $(this).attr('alt'));
|
311
|
+
});
|
312
|
+
}
|
313
|
+
|
314
|
+
$(createStepDefinitionLinks);
|
@@ -0,0 +1,72 @@
|
|
1
|
+
include YARD::Templates::Helpers::HtmlHelper
|
2
|
+
|
3
|
+
def init
|
4
|
+
super
|
5
|
+
asset("js/cucumber.js",file("js/cucumber.js",true))
|
6
|
+
|
7
|
+
@features = Registry.all(:feature)
|
8
|
+
|
9
|
+
if @features
|
10
|
+
@features.each {|feature| serialize(feature) }
|
11
|
+
generate_full_list @features.sort {|x,y| x.value.to_s <=> y.value.to_s }
|
12
|
+
end
|
13
|
+
|
14
|
+
@tags = Registry.all(:tag)
|
15
|
+
|
16
|
+
if @tags
|
17
|
+
@tags.each {|tag| serialize(tag) }
|
18
|
+
generate_full_list @tags.sort {|x,y| y.all_scenarios.size <=> x.all_scenarios.size }
|
19
|
+
end
|
20
|
+
|
21
|
+
feature_directories = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) }
|
22
|
+
|
23
|
+
|
24
|
+
serialize(YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE)
|
25
|
+
serialize(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE)
|
26
|
+
serialize(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE)
|
27
|
+
serialize_feature_directories(feature_directories)
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def generate_full_list(objects,friendly_name=nil)
|
33
|
+
if !objects.empty?
|
34
|
+
@items = objects
|
35
|
+
@list_type = "#{objects.first.type.to_s}s"
|
36
|
+
@list_title = "#{friendly_name || objects.first.type.to_s.capitalize} List"
|
37
|
+
@list_class = "class"
|
38
|
+
asset("#{objects.first.type}_list.html",erb(:full_list))
|
39
|
+
else
|
40
|
+
log.warn "Full List: Failed to create a list because the objects array is empty."
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# Remove CUCUMBER namespace from the class list
|
46
|
+
#
|
47
|
+
def class_list(root = Registry.root)
|
48
|
+
root.instance_eval { children.delete YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE } if root == Registry.root
|
49
|
+
out = super(root)
|
50
|
+
root.instance_eval { children << YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE } if root == Registry.root
|
51
|
+
out
|
52
|
+
end
|
53
|
+
|
54
|
+
def serialize_feature_directories(namespaces)
|
55
|
+
namespaces.each do |namespace|
|
56
|
+
Templates::Engine.with_serializer(namespace, options[:serializer]) do
|
57
|
+
options[:object] = namespace
|
58
|
+
T('layout').run(options)
|
59
|
+
end
|
60
|
+
serialize_feature_directories(namespace.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory)})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def all_features_link
|
65
|
+
root_feature_directories = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory)}
|
66
|
+
|
67
|
+
if root_feature_directories.length > 1
|
68
|
+
linkify YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE, "All Features"
|
69
|
+
else
|
70
|
+
linkify root_feature_directories.first, "All Features"
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<meta name="Content-Type" content="text/html; charset=<%= charset %>" />
|
2
|
+
<title><%= @page_title %></title>
|
3
|
+
<link rel="stylesheet" href="<%= url_for("css/style.css") %>" type="text/css" media="screen" charset="utf-8" />
|
4
|
+
<link rel="stylesheet" href="<%= url_for("css/common.css") %>" type="text/css" media="screen" charset="utf-8" />
|
5
|
+
<% if @extra_css %>
|
6
|
+
<link rel="stylesheet" href="<%= url_for @extra_css %>" type="text/css" media="screen" charset="utf-8" />
|
7
|
+
<% end %>
|
8
|
+
<script type="text/javascript" charset="utf-8">
|
9
|
+
relpath = '<%= url_for('') %>';
|
10
|
+
if (relpath != '') relpath += '/';
|
11
|
+
</script>
|
12
|
+
<script type="text/javascript" charset="utf-8" src="<%= url_for("js/jquery.js") %>"></script>
|
13
|
+
<script type="text/javascript" charset="utf-8" src="<%= url_for("js/app.js") %>"></script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="<%= url_for("js/cucumber.js") %>"></script>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div id="search">
|
2
|
+
<a id="features_list_link" href="#">Features</a>
|
3
|
+
<a id="tags_list_link" href="#">Tags</a>
|
4
|
+
<a id="class_list_link" href="#">Class List</a>
|
5
|
+
<a id="method_list_link" href="#">Method List</a>
|
6
|
+
<a id ="file_list_link" href="#">File List</a>
|
7
|
+
</div>
|
@@ -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/aslakhellesoy/cucumber/wiki/Gherkin">Gherkin</a> |
|
6
|
+
<a href="http://yardoc.org/">YARD</a> |
|
7
|
+
<a href="http://github.com/burtlo/Cucumber-In-The-Yard">Cucumber-In-The-YARD</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 & Transforms</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
|
+
<%= transformers.length %>
|
42
|
+
<a href="<%= url_for step_transformers, "step_transforms" %>">Transforms</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,o| 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 transformers
|
33
|
+
@transformers ||= YARD::Registry.all(:steptransform)
|
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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="title">
|
2
|
+
<% if @item_type %>
|
3
|
+
<a class="control" id="<%= @item_type.gsub(/\s/,'') %>">[Collapse All]</a>
|
4
|
+
<div style="clear: right;"></div>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% if @item_anchor_name %>
|
8
|
+
<a name="<%= @item_anchor_name %>">
|
9
|
+
<% end %>
|
10
|
+
<div class="name"><%= @item_title %></div>
|
11
|
+
</div>
|
12
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="requirements">
|
2
|
+
<div class="title">Step Definitions & Transforms</div>
|
3
|
+
|
4
|
+
<div class="summary">
|
5
|
+
<div><%= step_definitions.length %><a href="#step_definitions">Step Definitions</a></div>
|
6
|
+
<div><%= step_transforms.length %><a href="#step_transforms">Step Transforms</a></div>
|
7
|
+
<div><%= undefined_steps.length %><a href="#undefined_steps">Undefined Steps</a></div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
</div>
|
@@ -0,0 +1,94 @@
|
|
1
|
+
def init
|
2
|
+
super
|
3
|
+
sections.push :index, :stepdefinitions, :steptransforms, :undefinedsteps
|
4
|
+
end
|
5
|
+
|
6
|
+
def step_definitions
|
7
|
+
@step_definitions ||= begin
|
8
|
+
YARD::Registry.all(:stepdefinition).sort_by {|definition| definition.steps.length * -1 }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def step_transforms
|
13
|
+
@step_transforms ||= begin
|
14
|
+
YARD::Registry.all(:steptransform).sort_by {|definition| definition.steps.length * -1 }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def undefined_steps
|
19
|
+
@undefined_steps ||= begin
|
20
|
+
unique_steps(Registry.all(:step).reject {|s| s.definition || s.scenario.outline? }).sort_by{|steps| steps.last.length * -1 }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def stepdefinitions
|
25
|
+
@item_title = "Step Definitions"
|
26
|
+
@item_anchor_name = "step_definitions"
|
27
|
+
@item_type = "step definition"
|
28
|
+
@items = step_definitions
|
29
|
+
erb(:header) + erb(:transformers)
|
30
|
+
end
|
31
|
+
|
32
|
+
def steptransforms
|
33
|
+
@item_title = "Step Transforms"
|
34
|
+
@item_anchor_name = "step_transforms"
|
35
|
+
@item_type = "step transform"
|
36
|
+
@items = step_transforms
|
37
|
+
erb(:header) + erb(:transformers)
|
38
|
+
end
|
39
|
+
|
40
|
+
def undefinedsteps
|
41
|
+
@item_title = "Undefined Steps"
|
42
|
+
@item_anchor_name = "undefined_steps"
|
43
|
+
@item_type = nil
|
44
|
+
@items = undefined_steps
|
45
|
+
erb(:header) + erb(:undefinedsteps)
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def unique_steps(steps)
|
50
|
+
uniq_steps = {}
|
51
|
+
steps.each {|s| (uniq_steps[s.value.to_s] ||= []) << s }
|
52
|
+
uniq_steps
|
53
|
+
end
|
54
|
+
|
55
|
+
def display_comments_for(item)
|
56
|
+
begin
|
57
|
+
T('docstring').run(options.dup.merge({:object => item}))
|
58
|
+
rescue
|
59
|
+
log.warn %{An error occurred while attempting to render the comments for: #{item.location} }
|
60
|
+
return ""
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
def link_constants(definition)
|
66
|
+
value = definition.literal_value.dup
|
67
|
+
|
68
|
+
definition.constants_from_value(value).each do |name|
|
69
|
+
constant = YARD::Registry.all(:constant).find{|c| c.name == name.to_sym }
|
70
|
+
value.gsub!(/\b#{name}\b/,"<a href='#{url_for(constant)}'>#{name}</a>") if constant
|
71
|
+
end
|
72
|
+
|
73
|
+
value
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
def link_transformed_step(step)
|
78
|
+
value = step.value.dup
|
79
|
+
|
80
|
+
if step.definition
|
81
|
+
matches = step.value.match(step.definition.regex)
|
82
|
+
|
83
|
+
if matches
|
84
|
+
matches[1..-1].reverse.each_with_index do |match,index|
|
85
|
+
next if match == nil
|
86
|
+
transform = step.transforms.find {|transform| transform.regex.match(match) }
|
87
|
+
|
88
|
+
value[matches.begin((matches.size - 1) - index)..(matches.end((matches.size - 1) - index) - 1)] = transform ? "<a href='#{url_for(transform)}'>#{h(match)}</a>" : "<span class='match'>#{match}</span>"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
value
|
94
|
+
end
|