cucumber-in-the-yard 1.6.4 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.7.0 / 2010-11-18
2
+
3
+ * Dynamic Tag Union / Intersection
4
+
1
5
  === 1.6.4 / 2010-11-16
2
6
 
3
7
  * `yard server` can now serve up requirements with YARD 0.6.2
data/README.md CHANGED
@@ -24,6 +24,8 @@ The implemented example has been deployed at [http://recursivegames.com/cukes/](
24
24
 
25
25
  **2. Search through features, scenarios, and tags** [example](http://recursivegames.com/cukes/feature_list.html) & [example](http://recursivegames.com/cukes/tag_list.html)
26
26
 
27
+ **3. Dynamic Tag Unions and Intersections** [example](http://recursivegames.com/cukes/requirements/tags.html)
28
+
27
29
  **4. View features and scenarios by tag** [example](http://recursivegames.com/cukes/requirements/tags/bvt.html)
28
30
 
29
31
  **5. Steps link to their step definitions** [example](http://recursivegames.com/cukes/requirements/example/scenario.html)
@@ -110,37 +112,33 @@ Roadmap
110
112
 
111
113
  **Future Feature Ideas**
112
114
 
113
- **1. Feature/Scenario Tag unions and intersections**
114
-
115
- Create an AJAX interface that would allow the user to specify tags to union, intersect, or exclude to
116
- produce a list of features and scenarios that would execute. The output could also provide an example
117
- command line parameter list to produce the feature/scenario execution results.
115
+ **1. Table Step Transforms**
118
116
 
119
- Visualization of this execution with some graphing library for some extra points.
117
+ The table step transform matching would be nice to show which tables are affected by table transforms
120
118
 
121
- **2. Performance enhancements**
119
+ **2. Before, After, and Around Hooks**
122
120
 
123
- The current rate of documentation is not dreadfully slow anymore but more performance enhancements could
124
- always be performed to produce the documentation faster.
121
+ Document the additional before, after, and around hooks that Cucumber uses. Specifically display the before, after, and around
122
+ hooks that are tied to tags (unions and intersections) on the tag pages.
125
123
 
126
- **3. Requirements Only Docuementation**
124
+ **3. Layout refinements of the step definition / step tranform page**
127
125
 
128
- 'fulldoc' is the default documentation generated but I have this thought that a requirements-only document
129
- may be useful. Essentially the first draft would be the current documentation minus the class and method
130
- links/searches and replacing the index.html.
126
+ More work could be done to make this page more searchable, sortable, and usable.
131
127
 
132
- **4. Before, After, and Around Hooks**
128
+ **4. Visualization of /Scenario Tag unions and intersections**
133
129
 
134
- Document the additional before, after, and around hooks that Cucumber uses. Specifically display the before, after, and around
135
- hooks that are tied to tags (unions and intersections) on the tag pages.
130
+ Continue to expand the tag union/intersection tool. Visualization of this execution with some graphing library for some extra points.
136
131
 
137
- **5. Layout refinements of the step definition / step tranform page**
132
+ **5. Requirements Only Docuementation**
138
133
 
139
- More work could be done to make this page more searchable, sortable, and usable.
134
+ 'fulldoc' is the default documentation generated but I have this thought that a requirements-only document
135
+ may be useful. Essentially the first draft would be the current documentation minus the class and method
136
+ links/searches and replacing the index.html.
140
137
 
141
- **6. Table Step Transforms**
138
+ **6. Performance enhancements**
142
139
 
143
- The table step transform matching would be nice to show which tables are affected by table transforms
140
+ The current rate of documentation is not dreadfully slow anymore but more performance enhancements could
141
+ always be performed to produce the documentation faster.
144
142
 
145
143
 
146
144
 
data/lib/city.rb CHANGED
@@ -4,7 +4,7 @@ require 'gherkin/parser/parser'
4
4
  require 'gherkin/formatter/tag_count_formatter'
5
5
 
6
6
  module CucumberInTheYARD
7
- VERSION = '1.6.4' unless defined?(CucumberInTheYARD::VERSION)
7
+ VERSION = '1.7.0' unless defined?(CucumberInTheYARD::VERSION)
8
8
  end
9
9
 
10
10
 
@@ -4,28 +4,55 @@
4
4
  var tag_list = [ <%= tags.collect{|t| "'#{t.value}'" }.join(',') %> ];
5
5
 
6
6
  $(function() {
7
- $("#tag_search").keyup(function(event) {
8
- var tags = determine_tags_used_in_formula($("#tag_search")[0].value);
9
- display_example_command_line(tags);
10
- display_qualifying_features_and_scenarios(tags);
7
+ $("#tag_search").keyup(function(evt) {
8
+ updateTagFiltering($("#tag_search")[0].value);
9
+ });
10
+
11
+ $(".tag").click(function(evt) {
12
+ if (typeof evt !== "undefined") {
13
+
14
+ if (evt.ctrlKey === true) {
15
+ window.location = $(this).attr("href");
16
+ } else if (evt.altKey === true ) {
17
+ $("#tag_search")[0].value += ($("#tag_search")[0].value != "" ? "," : "") + this.innerHTML;
18
+ updateTagFiltering($("#tag_search")[0].value);
19
+ } else {
20
+ $("#tag_search")[0].value += ($("#tag_search")[0].value != "" ? " " : "") + this.innerHTML;
21
+ updateTagFiltering($("#tag_search")[0].value);
22
+ }
23
+ }
11
24
  });
12
25
  });
13
26
  </script>
14
27
 
15
28
  <div class="title">
16
- <span class="name">Requirements Tags</span>
29
+ <span class="name">Tags</span>
17
30
  </div>
18
31
 
19
- <div class="tags"><span class="name">Tags:</span>
20
- <%= tags.collect {|tag| linkify(tag,tag.value) }.join(",\n") %>
32
+ <div id="tag_filtering" >
33
+ <span>Tag Filtering <a href="https://github.com/aslakhellesoy/cucumber/wiki/Tags" target="_blank">?</a></span>
34
+
35
+ <div style="clear: both"></div>
36
+
37
+ <div style="float: left; margin-top: 10px; font-size: 10px; font-style: italic;">
38
+ Left-click tags to 'AND'; ALT left-click tags to 'OR'
39
+ </div>
40
+
41
+ <div style="float: right;">
42
+ <a href="" onclick=" updateTagFiltering(""); return true;">clear</a>
43
+ </div>
44
+
45
+ <div style="clear: both"></div>
46
+
47
+ <input id="tag_search" type="text" />
48
+ <span>Example command line execution:</span>
49
+ <div id="command_example">cucumber</div>
21
50
  </div>
22
51
 
23
- <div>
24
- <input id="tag_search" type="text" />
52
+ <div class="tags" style="margin-top: 20px;"><span class="name">Tags:</span>
53
+ <%= tags.collect {|tag| tagify(tag) }.join(",\n") %>
25
54
  </div>
26
55
 
27
- <div id="command_example">cucumber</div>
28
-
29
56
  <div id="features">
30
57
  <div class="title">
31
58
  <span class="name">Features</span>
@@ -33,8 +60,11 @@
33
60
  <% n = 1 %>
34
61
  <% features.each do |feature| %>
35
62
  <li class="feature r<%= n %> <%= feature.tags.collect{|t| t.value }.join(" ") %>">
36
- <%= linkify feature, feature.value %>
37
- <small>(<%= h(feature.location) %>)</small>
63
+ <%= linkify feature, feature.value %>
64
+ <% itags = feature.tags.collect{|t| tagify(t) }.join(", ") %>
65
+ <% if itags && itags != "" %>
66
+ - <small><%= itags %></small>
67
+ <% end %>
38
68
  </li>
39
69
  <% n = n == 2 ? 1 : 2 %>
40
70
  <% end %>
@@ -47,8 +77,11 @@
47
77
  <% n = 1 %>
48
78
  <% scenarios.each_with_index do |scenario,index| %>
49
79
  <li class="scenario r<%= n %> <%= scenario.tags.collect{|t| t.value }.join(" ") %>">
50
- <%= linkify scenario.feature, scenario.value %>
51
- <small>(<%= h(scenario.feature.location) %>)</small>
80
+ <%= linkify scenario.feature, scenario.value %>
81
+ <% itags = scenario.tags.collect{|t| tagify(t) }.join(", ") %>
82
+ <% if itags && itags != "" %>
83
+ - <small><%= itags %></small>
84
+ <% end %>
52
85
  </li>
53
86
  <% n = n == 2 ? 1 : 2 %>
54
87
  <% end %>
@@ -27,3 +27,7 @@ end
27
27
  def scenarios
28
28
  @scenarios ||= Registry.all(:scenario).reject {|s| s.outline? || s.background? }.sort {|x,y| x.value <=> y.value }
29
29
  end
30
+
31
+ def tagify(tag)
32
+ %{<span class="tag" href="#{url_for tag}">#{tag.value}</span>}
33
+ end
@@ -91,7 +91,6 @@
91
91
  border: 1px solid #DEDEDE;
92
92
  }
93
93
 
94
-
95
94
  .outline {
96
95
  margin-top: 20px;
97
96
  margin-left: 40px;
@@ -115,6 +114,9 @@
115
114
  padding: 4px 10px 4px 10px;
116
115
  }
117
116
 
117
+ /* tag page */
118
+ #tags #features, #tags #scenarios { margin-right: 20px;}
119
+ #tags * .tag { font-family: monospace; font-size: 14px; cursor: pointer; }
118
120
 
119
121
  /* Overrides for scenarios in the tag view */
120
122
  .tag .feature { margin-left: 20px; }
@@ -139,15 +141,17 @@
139
141
  }
140
142
  #tags * li { padding: 5px; padding-left: 12px; margin: 0 0 0 10px; font-size: 1.1em; list-style: none; }
141
143
 
142
- .tag_search { margin-left: 40px; }
143
- #tag_search { margin-left: 40px; width: 500px; height: 20px; }
144
- #command_example {
145
- margin: 10px 0px 0px 40px;
144
+ #tag_search { margin: 10px 0px 10px 0px; width: 100%; min-width: 200px; height: 20px; }
145
+ #tag_filtering {
146
+ margin: 10px 20px 0px 40px;
147
+ font-weight: bold;
146
148
  padding: 20px;
147
149
  background-color: #F8F8FF;
148
150
  color: #444444;
149
151
  border: 1px solid #DEDEDE;
150
152
  }
153
+ #command_example { margin-top: 10px; margin-left: 10px; font-weight: normal; }
154
+
151
155
 
152
156
 
153
157
  #cukes_links { margin: 10px auto 10px auto;
@@ -33,29 +33,48 @@ function toggleScenarioExample(id,example) {
33
33
 
34
34
  }
35
35
 
36
- function determine_tags_used_in_formula(tag_string) {
37
- //$("#tag_debug")[0].innerHTML = "";
38
-
39
- tag_string = tag_string.replace(/^(\s+)|(\s+)$/,'').replace(/\s{2,}/,' ');
40
36
 
41
- var tags = tag_string.match(/@\w+/g);
37
+ function updateTagFiltering(tagString) {
38
+ var formulaTags = determineTagsUsedInFormula(tagString);
39
+ displayExampleCommandLine(formulaTags);
40
+ displayQualifyingFeaturesAndScenarios(formulaTags);
41
+ hideEmptySections();
42
+ fixSectionRowAlternations();
43
+ }
44
+
45
+ function determineTagsUsedInFormula(tagString) {
46
+
47
+ tagString = tagString.replace(/^(\s+)|(\s+)$/,'').replace(/\s{2,}/,' ');
48
+
49
+ var tagGroup = tagString.match(/@\w+(,@\w+)*/g);
42
50
 
43
- var return_tags = [];
51
+ var returnTags = [];
44
52
 
45
- if (tags != null) {
46
- tags.forEach(function(tag, index, array) {
47
- //$("#tag_debug")[0].innerHTML += tag + " ";
48
- if (tag_list.indexOf(tag) != -1) {
49
- return_tags.push(tag);
50
- }
53
+ if (tagGroup) {
54
+ tagGroup.forEach(function(tag, index, array) {
55
+ //console.log("Tag Group: " + tag);
56
+ var validTags = removeInvalidTags(tag)
57
+ if (validTags != "") { returnTags.push(validTags); }
51
58
  });
52
59
  }
53
60
 
54
- return return_tags;
61
+ return returnTags;
55
62
  }
56
63
 
64
+ function removeInvalidTags(tagGroup) {
65
+ tagGroup.split(",").forEach(function(tag, index, array) {
66
+ //console.log("Validating Tag: " + tag)
67
+ if (tag_list.indexOf(tag) === -1) {
68
+ //console.log("Removing Tag: " + tag);
69
+ tagGroup = tagGroup.replace(new RegExp(',?' + tag + ',?'),"")
70
+ }
71
+ });
72
+
73
+ return tagGroup;
74
+ }
57
75
 
58
- function display_example_command_line(tags) {
76
+
77
+ function displayExampleCommandLine(tags) {
59
78
  $("#command_example")[0].innerHTML = "cucumber ";
60
79
 
61
80
  if (tags.length > 0) {
@@ -63,24 +82,74 @@ function display_example_command_line(tags) {
63
82
  }
64
83
  }
65
84
 
66
- function display_qualifying_features_and_scenarios(tags) {
67
- //$("#tag_debug")[0].innerHTML = "";
85
+ function hideEmptySections() {
86
+
87
+ ["feature","scenario"].forEach(function(section,index,sections) {
88
+
89
+ if ( $("." + section + ":visible").length == 0 ) {
90
+ $("#" + section + "s")[0].style.display = "none";
91
+ } else {
92
+ $("#" + section + "s")[0].style.display = "block";
93
+ }
94
+
95
+ });
96
+ }
68
97
 
69
- if (tags.length > 0) {
98
+ function fixSectionRowAlternations() {
99
+
100
+ ["feature","scenario"].forEach(function(section,index,sections) {
101
+
102
+ $("." + section + ":visible")
103
+ $("." + section + ":visible").each(function(index) {
104
+ $(this).removeClass("r1 r2").addClass("r" + ((index % 2) + 1));
105
+ });
70
106
 
107
+ });
108
+ }
109
+
110
+ function displayQualifyingFeaturesAndScenarios(tags) {
111
+
112
+ if (tags.length > 0) {
113
+
71
114
  $(".feature,.scenario").each(function(feature){
72
115
  this.style.display = "none";
73
116
  });
74
117
 
75
- $(".feature.\\" + tags.join(".\\") + ",.scenario.\\" + tags.join(".\\")).each(function(feature) {
76
- //$("#tag_debug")[0].innerHTML += feature + " " + this;
77
- this.style.display = "block";
118
+ var tagSelectors = generateCssSelectorFromTags(tags);
119
+
120
+ tagSelectors.forEach(function(selector,selectorIndex,selectorArray) {
121
+ $(".feature." + selector.replace(/@/g,"\\@").replace(/\s/,".") + ",.scenario." + selector.replace(/@/g,"\\@").replace(/\s/,".")).each(function(matchItem) {
122
+ this.style.display = "block";
123
+ });
78
124
  });
79
-
125
+
80
126
  } else {
81
127
  $(".feature,.scenario").each(function(feature){
82
128
  this.style.display = "block";
83
129
  });
84
130
  }
85
131
 
132
+ }
133
+
134
+ function generateCssSelectorFromTags(tagGroups) {
135
+
136
+ var tagSelectors = [ "" ];
137
+
138
+ tagGroups.forEach(function(tagGroup,index,array) {
139
+ var newTagSelectors = [];
140
+
141
+ tagSelectors.forEach(function(selector,selectorIndex,selectorArray) {
142
+ tagGroup.split(",").forEach(function(tag,tagIndex,tagArray) {
143
+ //console.log("selector: " + (selector + " " + tag).trim());
144
+ newTagSelectors.push((selector + " " + tag).trim());
145
+ });
146
+
147
+ });
148
+
149
+ tagSelectors = newTagSelectors;
150
+
151
+ });
152
+
153
+
154
+ return tagSelectors;
86
155
  }
@@ -20,9 +20,10 @@ def init
20
20
 
21
21
  feature_directories = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) }
22
22
 
23
+
23
24
  serialize(YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE)
24
25
  serialize(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE)
25
- serialize(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE)
26
+ serialize(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE)
26
27
  serialize_feature_directories(feature_directories)
27
28
 
28
29
  end
@@ -3,7 +3,11 @@ module YARD::Templates::Helpers
3
3
  module BaseHelper
4
4
 
5
5
  def format_object_title(object)
6
- if object.is_a?(YARD::CodeObjects::Cucumber::NamespaceObject)
6
+ if object.is_a?(YARD::CodeObjects::Cucumber::FeatureTags)
7
+ "Tags"
8
+ elsif object.is_a?(YARD::CodeObjects::Cucumber::StepTransformersObject)
9
+ "Step Definitions and Transforms"
10
+ elsif object.is_a?(YARD::CodeObjects::Cucumber::NamespaceObject)
7
11
  "#{format_object_type(object)}#{object.value ? ": #{object.value}" : ''}"
8
12
  else
9
13
  case object
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-in-the-yard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 6
9
- - 4
10
- version: 1.6.4
8
+ - 7
9
+ - 0
10
+ version: 1.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Franklin Webber
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-16 00:00:00 -08:00
18
+ date: 2010-11-18 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -164,15 +164,11 @@ post_install_message: |+
164
164
 
165
165
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
166
166
 
167
- Thank you for installing Cucumber-In-The-YARD 1.6.4 / 2010-11-16.
167
+ Thank you for installing Cucumber-In-The-YARD 1.7.0 / 2010-11-18.
168
168
 
169
169
  Changes:
170
170
 
171
- * `yard server` can now serve up requirements with YARD 0.6.2
172
- * 'All Tags' page now has a cucumber tag AND filtering tool (beta)
173
- * Step Defs and Transforms will show comments
174
-
175
- * FIX removed warnings by no longer requiring YARD
171
+ * Dynamic Tag Union / Intersection
176
172
 
177
173
 
178
174
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)