yard-cucumber 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0307aff56f1f409371e475250339911845443a61
4
- data.tar.gz: 7be6505ef893717f5e939e1cf74500f4de6feac1
3
+ metadata.gz: b47e4ea0d0d5419c1ec4e655f0abd9c753ce3a9a
4
+ data.tar.gz: 520193860d1a8ad24df4cb19c860c812cd34d9cc
5
5
  SHA512:
6
- metadata.gz: 15be5b802d0f5688eae9d662fccc2aa26b09d645ddacff62af317018e68e4bac8d3d1421664b0563ba12a3ba1d4a47fec8317d3cc2544ccea6247bf3359bcdf0
7
- data.tar.gz: 99dccdb8a0542f293c58810070c5574bd6e8b924c2db00539e285f36c1d4ee02eefb4a54cc5154f605797cfda748acbf64f32e98e65783b6983c5546f45df20b
6
+ metadata.gz: a469a5f7efbea7ed3f0c042e26da076d9de5262926675809d2f91d60b1e04150e053bbfc3048b83e88b54a7c1d2e13d3e4d347321273219082659c15228ea26c
7
+ data.tar.gz: f151570da2884259715c99c4dfa7b71b90d13e304191b059ab7d54c221d8c642d2264018f26d9f9d67e6020b6f0e6a62505ca0a981aa184e35855b606b597135
@@ -0,0 +1 @@
1
+ yard-cucumber
@@ -0,0 +1 @@
1
+ 2.0.0-p353
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem 'redcarpet'
4
- gem 'gherkin', '~> 3'
4
+ gem 'gherkin', '~> 4.0'
5
5
 
6
- gemspec
6
+ gemspec
@@ -3,37 +3,40 @@ PATH
3
3
  specs:
4
4
  yard-cucumber (3.0.0)
5
5
  cucumber (~> 2)
6
- gherkin (~> 3)
6
+ gherkin (~> 4.0)
7
7
  yard (~> 0.8, >= 0.8.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
12
  builder (3.2.2)
13
- cucumber (2.3.2)
13
+ cucumber (2.4.0)
14
14
  builder (>= 2.1.2)
15
- cucumber-core (~> 1.4.0)
15
+ cucumber-core (~> 1.5.0)
16
16
  cucumber-wire (~> 0.0.1)
17
17
  diff-lcs (>= 1.1.3)
18
- gherkin (~> 3.2.0)
18
+ gherkin (~> 4.0)
19
19
  multi_json (>= 1.7.5, < 2.0)
20
20
  multi_test (>= 0.1.2)
21
- cucumber-core (1.4.0)
22
- gherkin (~> 3.2.0)
21
+ cucumber-core (1.5.0)
22
+ gherkin (~> 4.0)
23
23
  cucumber-wire (0.0.1)
24
24
  diff-lcs (1.2.5)
25
- gherkin (3.2.0)
26
- multi_json (1.11.2)
25
+ gherkin (4.0.0)
26
+ multi_json (1.12.1)
27
27
  multi_test (0.1.2)
28
28
  rake (10.4.2)
29
29
  redcarpet (2.2.2)
30
- yard (0.8.7.6)
30
+ yard (0.9.5)
31
31
 
32
32
  PLATFORMS
33
33
  ruby
34
34
 
35
35
  DEPENDENCIES
36
- gherkin (~> 3)
36
+ gherkin (~> 4.0)
37
37
  rake (~> 10)
38
38
  redcarpet
39
39
  yard-cucumber!
40
+
41
+ BUNDLED WITH
42
+ 1.12.4
@@ -1,8 +1,7 @@
1
- === 3.0.0/ 2016-03-14
1
+ === 3.1.0/ 2016-12-06
2
2
 
3
- Happy PI day!
4
-
5
- * Cucumber 2 and Gherkin 3 support (idstein)
3
+ * Updates to Gherkin 4.0 and Cucumber 2.4.0
4
+ * Fixes issues with the formatting that comes from these changes
6
5
 
7
6
  === 2.3.2/ 2013-11-08
8
7
 
data/README.md CHANGED
@@ -125,6 +125,16 @@ English step definitions. Even without specifying this feature files in other
125
125
  languages are found, this provides the ability for the step definitions to match
126
126
  correctly to step definitions.
127
127
 
128
+ * Exclude features or scenarios from yardoc
129
+
130
+ You can exclude any feature or scenario from the yardoc by adding a predefined tags to them.
131
+ To define tags that will be excluded, again in yard configuration file:
132
+
133
+ ```yaml
134
+ :"yard-cucumber":
135
+ exclude_tags: [ 'exclude-yardoc', 'also-exclude-yardoc' ]
136
+ ```
137
+
128
138
  ## Details
129
139
 
130
140
  There are two things that I enjoy: a test framework written in my own Domain
@@ -185,4 +195,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
185
195
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
186
196
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
187
197
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
188
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
198
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -87,12 +87,15 @@ module Cucumber
87
87
  # This is once, as the gherking parser does not like multiple feature per
88
88
  # file.
89
89
  #
90
- def feature(feature)
90
+ def feature(document)
91
91
  #log.debug "FEATURE"
92
+ feature = document[:feature]
93
+ return unless document[:feature]
94
+ return if has_exclude_tags?(feature[:tags].map { |t| t[:name].gsub(/^@/, '') })
92
95
 
93
96
  @feature = YARD::CodeObjects::Cucumber::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|
94
97
  f.comments = feature[:comments] ? feature[:comments].map{|comment| comment[:text]}.join("\n") : ''
95
- f.description = ''#feature.description
98
+ f.description = feature[:description] || ''
96
99
  f.add_file(@file,feature[:location][:line])
97
100
  f.keyword = feature[:keyword]
98
101
  f.value = feature[:name]
@@ -100,8 +103,10 @@ module Cucumber
100
103
 
101
104
  feature[:tags].each {|feature_tag| find_or_create_tag(feature_tag[:name],f) }
102
105
  end
103
- feature[:scenarioDefinitions].each { |s|
106
+ feature[:children].each { |s|
104
107
  case s[:type]
108
+ when :Background
109
+ background(s)
105
110
  when :ScenarioOutline
106
111
  scenario_outline(s)
107
112
  when :Scenario
@@ -113,21 +118,24 @@ module Cucumber
113
118
  #
114
119
  # Called when a background has been found
115
120
  #
116
- # @see #scenario
121
+ # @see #feature
117
122
  def background(background)
118
123
  #log.debug "BACKGROUND"
119
124
 
120
125
  @background = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"background") do |b|
121
- b.comments = background.comments.map{|comment| comment.value}.join("\n")
122
- b.description = background.description
123
- b.keyword = background.keyword
124
- b.value = background.name
125
- b.add_file(@file,background.line)
126
+ b.comments = background[:comments] ? background[:comments].map{|comment| comment.value}.join("\n") : ''
127
+ b.description = background[:description] || ''
128
+ b.keyword = background[:keyword]
129
+ b.value = background[:name]
130
+ b.add_file(@file,background[:location][:line])
126
131
  end
127
132
 
128
133
  @feature.background = @background
129
134
  @background.feature = @feature
130
135
  @step_container = @background
136
+ background[:steps].each { |s|
137
+ step(s)
138
+ }
131
139
  end
132
140
 
133
141
  #
@@ -146,9 +154,11 @@ module Cucumber
146
154
  def scenario(statement)
147
155
  #log.debug "SCENARIO"
148
156
 
157
+ return if has_exclude_tags?(statement[:tags].map { |t| t[:name].gsub(/^@/, '') })
158
+
149
159
  scenario = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
150
160
  s.comments = statement[:comments] ? statement[:comments].map{|comment| comment.value}.join("\n") : ''
151
- s.description = ''#statement.description
161
+ s.description = statement[:description] || ''
152
162
  s.add_file(@file,statement[:location][:line])
153
163
  s.keyword = statement[:keyword]
154
164
  s.value = statement[:name]
@@ -174,9 +184,11 @@ module Cucumber
174
184
  def scenario_outline(statement)
175
185
  #log.debug "SCENARIO OUTLINE"
176
186
 
187
+ return if has_exclude_tags?(statement[:tags].map { |t| t[:name].gsub(/^@/, '') })
188
+
177
189
  outline = YARD::CodeObjects::Cucumber::ScenarioOutline.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
178
190
  s.comments = statement[:comments] ? statement[:comments].map{|comment| comment.value}.join("\n") : ''
179
- s.description = ''#statement.description
191
+ s.description = statement[:description] || ''
180
192
  s.add_file(@file,statement[:location][:line])
181
193
  s.keyword = statement[:keyword]
182
194
  s.value = statement[:name]
@@ -340,6 +352,12 @@ module Cucumber
340
352
  base.map {|row| row.map {|cell| cell.dup }}
341
353
  end
342
354
 
355
+ def has_exclude_tags?(tags)
356
+ if YARD::Config.options["yard-cucumber"] and YARD::Config.options["yard-cucumber"]["exclude_tags"]
357
+ return true unless (YARD::Config.options["yard-cucumber"]["exclude_tags"] & tags).empty?
358
+ end
359
+ end
360
+
343
361
  end
344
362
  end
345
363
  end
@@ -81,7 +81,6 @@
81
81
  * ul.alpha ul { padding-left: 15px; }
82
82
  * ul small { color: #666; font-size: 0.7em; }
83
83
 
84
-
85
84
  .scenario .steps {
86
85
  margin: 0px 20px 0px 30px;
87
86
  font-size: 12px;
@@ -115,7 +114,7 @@ div.undefined { padding: 6px; }
115
114
  .step .defined .match { color: #346F97; }
116
115
 
117
116
  .multiline, .text { margin-top: 10px; margin-left: 20px; }
118
- .text {
117
+ .text {
119
118
  padding: 20px;
120
119
  background-color: #F8F8FF;
121
120
  color: #444444;
@@ -187,18 +186,18 @@ div.undefined { padding: 6px; }
187
186
  border: 1px solid #DEDEDE; -moz-border-radius: 3px; -webkit-border-radius: 3px;
188
187
  }
189
188
 
190
- #command_example {
191
- margin-top: 10px;
192
- margin-left: 0px;
189
+ #command_example {
190
+ margin-top: 10px;
191
+ margin-left: 0px;
193
192
  font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace;
194
193
  color: #333;
195
- padding: 8px 10px;
194
+ padding: 8px 10px;
196
195
  background: #A8E795; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px;
197
196
  }
198
197
 
199
198
 
200
- #cukes_links {
201
- margin: 10px auto 10px auto;
199
+ #cukes_links {
200
+ margin: 10px auto 10px auto;
202
201
  border-bottom: 1px solid #E3E3E3;
203
202
  width: 762px; text-align: center;
204
203
  padding: 10px;
@@ -224,4 +223,4 @@ div.undefined { padding: 6px; }
224
223
  width: 15px;
225
224
  height: 15px;
226
225
  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAIAAAC0tAIdAAAACXBIWXMAAA86AAAPOgGXOdvCAAABWUlEQVQoFS2SvVEEMQyFJdkspFcCVAAVUREZXVAHHRAwZOQwQ3YM67X4nnwe3+3afn+S18/P9366s5yZ042R6c3c3bRKDw+WwZxf791Pt/3hMcev5QBpFtauPLoBYrYr6zcem/Xr8frUbc4c59zPPoekQeSesTm47IaD74kfTjnDbNqxC5pTzrJfQcCFBQClIh7bIdDc9S+6E8WIQXTl9somfA1S4iJVbUnJmyOhJT+51AMRkXVArMtBdUNLGcpmaReDdSIGHw4m2iyNIiMslTWqBvMuZSVZB4QhMRRp6IUjzYuPctvq3TpWumq2sIfNw/KQ3DwomfIv6aVBT+ZQMFKxhB8uLfhlzkO3Sstlwh1ja3+oEKVuqipGHhMztEGvvlZEQHwyMKPD1NDtrrpBR3jbalv90hWzo05FBr1vlKGXtvGF9fz5HG8vFRpK1a5yV0/KVuZSzO+Pf3G6tVs/+L00AAAAAElFTkSuQmCC) no-repeat center;
227
- }
226
+ }
@@ -1,53 +1,27 @@
1
- <% n = 1 %>
2
-
3
-
1
+ <% @row = @row == 'even' ? 'odd' : 'even' %>
4
2
  <% if @directory.children %>
5
3
  <ul>
6
4
  <% @directory.children.sort {|x,y| x.value.to_s <=> y.value.to_s }.each_with_index do |child,index| %>
7
- <% if child.is_a?(YARD::CodeObjects::Cucumber::Feature) %>
8
- <li class="r<%= n %>">
9
- <%= linkify child, child.value %>
10
- <!--
11
- <span class='object_link'>
12
- <a href="<%= url_for(child,"scenario_#{index}") %>"
13
- title="<%= h child.value %>">
14
- <%= h child.value %>
15
- </a>
16
- </span>
17
- -->
18
- <small><%= child.location %></small>
19
- </li>
20
- <% end %>
21
- <% if child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) %>
22
- <li class="r<%= n %>">
23
- <%= "<a class='toggle'></a>" unless child.features.empty? && child.subdirectories.empty? %>
24
- <%= linkify child, child.value.to_s.capitalize %>
25
- <small><%= child.location %></small>
26
- </li>
27
- <%= directory_node child %>
28
- <% end %>
29
- <% n = n == 2 ? 1 : 2 %>
30
- <% end %>
31
- </ul>
32
- <% end %>
5
+ <% if child.is_a?(YARD::CodeObjects::Cucumber::Feature) %>
6
+ <li class="<%= @row %>">
7
+ <div class="item" style="padding-left: <%= @padding %>px">
8
+ <%= linkify child, child.value %>
9
+ <small><%= child.location %></small>
10
+ </div>
11
+ </li>
12
+ <% @row = @row == 'even' ? 'odd' : 'even' %>
13
+ <% end %>
33
14
 
34
- <!-- YARD::CodeObjects::Cucumber::FeatureDirectory -->
35
-
36
- <!--
37
- <% if @directory.subdirectories %>
38
- <ul>
39
- <% @directory.subdirectories.each_with_index do |subdir,index| %>
40
- <li class="r<%= n %>">
41
- <span class='object_link'>
42
- <a href="<%= url_for(subdir,"scenario_#{index}") %>"
43
- title="<%= h subdir.value %>">
44
- <%= h subdir.value %>
45
- </a>
46
- </span>
47
- <small><%= subdir.location %></small>
48
- </li>
49
- <% n = n == 2 ? 1 : 2 %>
15
+ <% if child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) %>
16
+ <li class="<%= @row %>">
17
+ <div class="item" style="padding-left: <%= @padding %>px">
18
+ <%= "<a class='toggle'></a>" unless child.features.empty? && child.subdirectories.empty? %>
19
+ <%= linkify child, child.value.to_s.capitalize %>
20
+ <small><%= child.location %></small>
21
+ </div>
22
+ <%= directory_node child, @padding + 15, @row %>
23
+ </li>
24
+ <% end %>
50
25
  <% end %>
51
26
  </ul>
52
27
  <% end %>
53
- -->
@@ -1,11 +1,11 @@
1
- <% n = 1 %>
2
- <% n = n == 2 ? 1 : 2 %>
1
+ <% n = 'odd' %>
3
2
  <% @items.each do |directory| %>
4
- <li class="r<%= n %>">
5
- <%= "<a class='toggle'></a>" unless directory.features.empty? && directory.subdirectories.empty? %>
6
- <%= linkify directory, directory.value %>
7
- <small><%= directory.location %></small>
3
+ <li class="<%= n %>">
4
+ <div class="item" style="padding-left: 30px">
5
+ <%= "<a class='toggle'></a>" unless directory.features.empty? && directory.subdirectories.empty? %>
6
+ <%= linkify directory, directory.value %>
7
+ <small><%= directory.location %></small>
8
+ </div>
9
+ <%= directory_node directory, 45, n %>
8
10
  </li>
9
- <% n = n == 2 ? 1 : 2 %>
10
- <%= directory_node directory %>
11
11
  <% end %>
@@ -1,29 +1,37 @@
1
- <% n = 1 %>
2
- <li class="r<%= n %>">
3
- <%= all_features_link %>
1
+ <% n = 'odd' %>
2
+ <li class="<%= n %>">
3
+ <div class="item" style="padding-left: 30px">
4
+ <%= all_features_link %>
5
+ </div>
4
6
  </li>
5
- <% n = n == 2 ? 1 : 2 %>
7
+ <% n = n == 'odd' ? 'even' : 'odd' %>
6
8
  <% @items.each do |feature| %>
7
- <li class="r<%= n %>">
8
- <%= "<a class='toggle'></a>" unless feature.scenarios.empty? %>
9
- <%= linkify feature, feature.value %>
10
- <small><%= feature.location %></small>
11
- </li>
12
- <% n = n == 2 ? 1 : 2 %>
13
- <% if feature.scenarios %>
14
- <ul>
15
- <% feature.scenarios.each_with_index do |scenario,index| %>
16
- <li class="r<%= n %>">
17
- <span class='object_link'>
18
- <a href="<%= url_for(scenario.feature,"scenario_#{index}") %>"
19
- title="<%= h scenario.value %>">
20
- <%= h scenario.value %>
21
- </a>
22
- </span>
23
- <small><%= scenario.location %></small>
24
- </li>
25
- <% n = n == 2 ? 1 : 2 %>
9
+ <li class="<%= n %>">
10
+ <div class="item" style="padding-left: 30px">
11
+ <%= "<a class='toggle'></a>" unless feature.scenarios.empty? %>
12
+ <%= linkify feature, feature.value %>
13
+ <small><%= feature.location %></small>
14
+ </div>
15
+
16
+ <% n = n == 'odd' ? 'even' : 'odd' %>
17
+ <% if feature.scenarios %>
18
+ <ul>
19
+ <% feature.scenarios.each_with_index do |scenario,index| %>
20
+ <li class="<%= n %>">
21
+ <div class="item" style="padding-left: 45px">
22
+ <span class='object_link'>
23
+ <a href="<%= url_for(scenario.feature,"scenario_#{index}") %>"
24
+ title="<%= h scenario.value %>">
25
+ <%= h scenario.value %>
26
+ </a>
27
+ </span>
28
+ <small><%= scenario.location %></small>
29
+ </div>
30
+ </li>
31
+ <% n = n == 'odd' ? 'even' : 'odd' %>
32
+ <% end %>
33
+ </ul>
26
34
  <% end %>
27
- </ul>
35
+
36
+ </li>
28
37
  <% end %>
29
- <% end %>
@@ -1,16 +1,20 @@
1
1
  <li>
2
- <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE, "All Step Definitions" %>
2
+ <div class="item" style="padding-left: 30px">
3
+ <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE, "All Step Definitions" %>
4
+ </div>
3
5
  </li>
4
- <% n = 1 %>
6
+ <% n = 'odd' %>
5
7
  <% @items.each do |stepdef| %>
6
- <li class="r<%= n %>">
7
- <span class='object_link'>
8
- <span class="pre"><%= stepdef.keyword %></span>
9
- <a href="<%= url_for stepdef %>" title="<%= h stepdef.value %>">
10
- <span class="name"><%= h stepdef.literal_value %></span>
11
- </a>&nbsp;&nbsp;
12
- </span>
13
- <small><%= h(stepdef.location) %></small>
8
+ <li class="<%= n %>">
9
+ <div class="item" style="padding-left: 30px">
10
+ <span class='object_link'>
11
+ <span class="pre"><%= stepdef.keyword %></span>
12
+ <a href="<%= url_for stepdef %>" title="<%= h stepdef.value %>">
13
+ <span class="name"><%= h stepdef.literal_value %></span>
14
+ </a>&nbsp;&nbsp;
15
+ </span>
16
+ <small><%= h(stepdef.location) %></small>
17
+ </div>
14
18
  </li>
15
- <% n = n == 2 ? 1 : 2 %>
16
- <% end %>
19
+ <% n = n == 'even' ? 'odd' : 'even' %>
20
+ <% end %>
@@ -1,17 +1,20 @@
1
- <li>
2
- <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE, "All Defined Steps" %>
1
+ <li class='odd'>
2
+ <div class="item" style="padding-left: 30px">
3
+ <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE, "All Defined Steps" %>
4
+ </div>
3
5
  </li>
4
- <% n = 1 %>
5
-
6
+ <% n = 'even' %>
6
7
  <% @items.each do |step| %>
7
- <li class="r<%= n %>">
8
- <span class='object_link'>
9
- <a href="<%= url_for step.scenario.feature %>" title="<%= h step.value %>">
10
- <span class="pre"><%= step.keyword %></span>
11
- <span class="name"><%= h(step.value) %></span>
12
- </a>
13
- </span>
14
- <span class="">(<%= h(step.file) %>)<span>
8
+ <li class="<%= n %>">
9
+ <div class="item" style="padding-left: 30px">
10
+ <span class='object_link'>
11
+ <a href="<%= url_for step.scenario.feature %>" title="<%= h step.value %>">
12
+ <span class="pre"><%= step.keyword %></span>
13
+ <span class="name"><%= h(step.value) %></span>
14
+ </a>
15
+ </span>
16
+ <span class="">(<%= h(step.file) %>)<span>
17
+ </div>
15
18
  </li>
16
- <% n = n == 2 ? 1 : 2 %>
17
- <% end %>
19
+ <% n = n == 'even' ? 'odd' : 'even' %>
20
+ <% end %>
@@ -1,12 +1,16 @@
1
1
  <li>
2
- <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE, "All Tags" %>
2
+ <div class="item" style="padding-left: 30px;">
3
+ <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE, "All Tags" %>
4
+ </div
3
5
  </li>
4
- <% n = 1 %>
5
6
 
7
+ <% n = 'odd' %>
6
8
  <% @items.each do |tag| %>
7
- <li class="r<%= n %>">
8
- <%= linkify tag, tag.value %>
9
- <small><%= tag.all_scenarios.size %></small>
9
+ <li class="<%= n %>">
10
+ <div class="item" style="padding-left: 30px;">
11
+ <%= linkify tag, tag.value %>
12
+ <small style="display: inline;"><%= tag.all_scenarios.size %></small>
13
+ </div>
10
14
  </li>
11
- <% n = n == 2 ? 1 : 2 %>
12
- <% end %>
15
+ <% n = n == 'odd' ? 'even' : 'odd' %>
16
+ <% end %>
@@ -111,7 +111,7 @@ end
111
111
  # See the layout template method that loads the menus
112
112
  def generate_featuredirectories_list
113
113
  directories_ordered_by_name = root_feature_directories.sort {|x,y| x.value.to_s <=> y.value.to_s }
114
- generate_full_list directories_ordered_by_name, :featuredirectories,
114
+ generate_full_list directories_ordered_by_name, :featuredirectories,
115
115
  :list_title => "Features by Directory",
116
116
  :list_filename => "featuredirectories_list.html"
117
117
  end
@@ -143,7 +143,7 @@ end
143
143
  # This method removes the namespace from the root node, generates the class list,
144
144
  # and then adds it back into the root node.
145
145
  #
146
- def class_list(root = Registry.root)
146
+ def class_list(root = Registry.root, tree = TreeContext.new)
147
147
  return super unless root == Registry.root
148
148
 
149
149
  cucumber_namespace = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE
@@ -169,7 +169,18 @@ def all_features_link
169
169
  end
170
170
  end
171
171
 
172
- def directory_node(directory)
172
+ #
173
+ # This method is used to generate a feature directory. This template may call
174
+ # this method as well to generate any child feature directories as well.
175
+ #
176
+ # @param directory [FeatureDirectory] this is the FeatureDirectory to display
177
+ # @param padding [Fixnum] this is the pixel value to ident as we want to keep
178
+ # pushing in the padding to show the parent relationship
179
+ # @param row [String] 'odd' or 'even' to correctly color the row
180
+ #
181
+ def directory_node(directory,padding,row)
173
182
  @directory = directory
183
+ @padding = padding
184
+ @row = row
174
185
  erb(:directories)
175
186
  end
@@ -4,49 +4,57 @@ end
4
4
 
5
5
  #
6
6
  # Append yard-cucumber stylesheet to yard core stylesheets
7
- #
7
+ #
8
8
  def stylesheets
9
9
  super + %w(css/cucumber.css)
10
10
  end
11
11
 
12
12
  #
13
13
  # Append yard-cucumber javascript to yard core javascripts
14
- #
14
+ #
15
15
  def javascripts
16
16
  super + %w(js/cucumber.js)
17
17
  end
18
18
 
19
19
  #
20
20
  # Append yard-cucumber specific menus 'features' and 'tags'
21
- #
21
+ #
22
22
  # 'features' and 'tags' are enabled by default.
23
- #
23
+ #
24
24
  # 'step definitions' and 'steps' may be enabled by setting up a value in
25
25
  # yard configuration file '~/.yard/config'
26
- #
26
+ #
27
27
  # @example `~/.yard.config`
28
- #
28
+ #
29
29
  # yard-cucumber:
30
30
  # menus: [ 'features', 'directories', 'tags', 'step definitions', 'steps' ]
31
- #
31
+ #
32
32
  def menu_lists
33
-
34
- menus = [ "features", "tags" ]
33
+ current_menu_lists.map {|menu_name| yard_cucumber_menus[menu_name] }.compact + super
34
+ end
35
35
 
36
- # load the yard-cucumber menus defined in the configuration file
37
- if YARD::Config.options["yard-cucumber"] and YARD::Config.options["yard-cucumber"]["menus"]
38
- menus = YARD::Config.options["yard-cucumber"]["menus"]
39
- end
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-cucumber"] and YARD::Config.options["yard-cucumber"]["menus"]
45
+ menus = YARD::Config.options["yard-cucumber"]["menus"]
46
+ end
40
47
 
41
- menus.map {|menu_name| yard_cucumber_menus[menu_name] }.compact + super
48
+ menus
49
+ end
42
50
  end
43
51
 
44
52
  #
45
53
  # When a menu is specified in the yard configuration file, this hash contains
46
54
  # the details about the menu necessary for it to be displayed.
47
- #
55
+ #
48
56
  # @see #menu_lists
49
- #
57
+ #
50
58
  def yard_cucumber_menus
51
59
  { "features" => { :type => 'feature', :title => 'Features', :search_title => 'Features' },
52
60
  "directories" => { :type => 'featuredirectories', :title => 'Features by Directory', :search_title => 'Features by Directory' },
@@ -54,3 +62,70 @@ def yard_cucumber_menus
54
62
  "step definitions" => { :type => 'stepdefinition', :title => 'Step Definitions', :search_title => 'Step Defs' },
55
63
  "steps" => { :type => 'step', :title => 'Steps', :search_title => 'Steps' } }
56
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-Cucumber 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::StepTransformersObject) && 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
@@ -1,3 +1,3 @@
1
1
  module CucumberInTheYARD
2
- VERSION = '3.0.0'
3
- end
2
+ VERSION = '3.1.0'
3
+ end
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
56
56
 
57
57
  s.add_development_dependency 'rake', '~> 10'
58
58
 
59
- s.add_dependency 'gherkin', '~> 3'
59
+ s.add_dependency 'gherkin', '~> 4.0'
60
60
  s.add_dependency 'cucumber', '~> 2'
61
61
  s.add_dependency 'yard', '~> 0.8', '>= 0.8.1'
62
62
 
metadata CHANGED
@@ -1,75 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franklin Webber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '10'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gherkin
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '3'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '3'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cucumber
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.8'
62
- - - ">="
62
+ - - '>='
63
63
  - !ruby/object:Gem::Version
64
64
  version: 0.8.1
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - "~>"
69
+ - - ~>
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0.8'
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: 0.8.1
75
75
  description: "\n YARD-Cucumber is a YARD extension that processes Cucumber Features,
@@ -84,8 +84,10 @@ extra_rdoc_files:
84
84
  - README.md
85
85
  - History.txt
86
86
  files:
87
- - ".gitignore"
88
- - ".rspec"
87
+ - .gitignore
88
+ - .rspec
89
+ - .ruby-gemset
90
+ - .ruby-version
89
91
  - Gemfile
90
92
  - Gemfile.lock
91
93
  - History.txt
@@ -178,28 +180,28 @@ licenses:
178
180
  - MIT
179
181
  metadata: {}
180
182
  post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
181
- (::) (::) (::)\n\n Thank you for installing yard-cucumber 3.0.0 / 2016-03-14.\n\n
182
- \ Changes:\n \n Happy PI day!\n \n * Cucumber 2 and Gherkin 3 support (idstein)\n
183
- \ \n\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n"
183
+ (::) (::) (::)\n\n Thank you for installing yard-cucumber 3.1.0 / 2016-12-06.\n\n
184
+ \ Changes:\n \n * Updates to Gherkin 4.0 and Cucumber 2.4.0\n * Fixes issues
185
+ with the formatting that comes from these changes\n \n\n(::) (::) (::) (::) (::)
186
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n"
184
187
  rdoc_options:
185
- - "--charset=UTF-8"
188
+ - --charset=UTF-8
186
189
  require_paths:
187
190
  - lib
188
191
  required_ruby_version: !ruby/object:Gem::Requirement
189
192
  requirements:
190
- - - ">="
193
+ - - '>='
191
194
  - !ruby/object:Gem::Version
192
195
  version: '0'
193
196
  required_rubygems_version: !ruby/object:Gem::Requirement
194
197
  requirements:
195
- - - ">="
198
+ - - '>='
196
199
  - !ruby/object:Gem::Version
197
200
  version: '0'
198
201
  requirements: []
199
202
  rubyforge_project:
200
- rubygems_version: 2.5.0
203
+ rubygems_version: 2.0.14
201
204
  signing_key:
202
205
  specification_version: 4
203
206
  summary: Cucumber Features in YARD
204
207
  test_files: []
205
- has_rdoc: