yard-cucumber 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ === 2.0.2 / 2011-04-06
2
+
3
+ - No Features/Tags will still generate landing pages instead of no pages
4
+ - Changed link to current gem 'yard-cucumber'
5
+
1
6
  === 2.0.1 / 2011-03-14
2
7
 
3
8
  - YARD 0.6.5 compatibility
data/Rakefile CHANGED
@@ -13,5 +13,5 @@ end
13
13
 
14
14
  task :gem do
15
15
  `gem build city.gemspec`
16
- `gem install --local yard-cucumber-2.0.0.gem`
16
+ `gem install --local yard-cucumber-2.0.2.gem`
17
17
  end
@@ -2,47 +2,66 @@ include YARD::Templates::Helpers::HtmlHelper
2
2
 
3
3
  def init
4
4
  super
5
+
6
+ # Additional javascript that power the additional menus, collapsing, etc.
5
7
  asset("js/cucumber.js",file("js/cucumber.js",true))
6
8
 
9
+ #
10
+ # Generate pages for each feature, with the 'feature' template and then
11
+ # generate the page which is the full list of features
12
+ #
13
+
7
14
  @features = Registry.all(:feature)
8
15
 
9
16
  if @features
10
17
  @features.each {|feature| serialize(feature) }
11
- generate_full_list @features.sort {|x,y| x.value.to_s <=> y.value.to_s }
18
+ generate_full_list @features.sort {|x,y| x.value.to_s <=> y.value.to_s }, :feature
12
19
  end
13
20
 
21
+ #
22
+ # Generate pages for each tag, with the 'tag' template and then generate the
23
+ # page which is the full list of tags. Tags are ordered in descending order
24
+ # by the size of how many scenarios that the affect
25
+ #
26
+
14
27
  @tags = Registry.all(:tag)
15
28
 
16
29
  if @tags
17
30
  @tags.each {|tag| serialize(tag) }
18
- generate_full_list @tags.sort {|x,y| y.all_scenarios.size <=> x.all_scenarios.size }
31
+ generate_full_list @tags.sort {|x,y| y.all_scenarios.size <=> x.all_scenarios.size }, :tag
19
32
  end
20
33
 
21
- feature_directories = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) }
22
-
23
-
34
+ # Generates the requirements splash page with the 'requirements' template
24
35
  serialize(YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE)
36
+
37
+ # Generates a page for step definitions and step transforms with the 'steptransformers' template
25
38
  serialize(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE)
39
+
40
+ # Generates the tags page with the 'featuretags' template
26
41
  serialize(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE)
42
+
43
+ # Generate pages for each of the directories with features with the 'featuredirectory' template
44
+ feature_directories = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) }
27
45
  serialize_feature_directories(feature_directories)
28
46
 
29
47
  end
30
48
 
31
-
32
- def generate_full_list(objects,friendly_name=nil)
33
- if !objects.empty?
49
+ #
50
+ # Generate a full_list page of the specified objects with the specified type.
51
+ #
52
+ def generate_full_list(objects,list_type,friendly_name=nil)
34
53
  @items = objects
35
- @list_type = "#{objects.first.type.to_s}s"
36
- @list_title = "#{friendly_name || objects.first.type.to_s.capitalize} List"
54
+ @list_type = "#{list_type}s"
55
+ @list_title = "#{friendly_name || list_type.to_s.capitalize} List"
37
56
  @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
57
+ asset("#{list_type}_list.html",erb(:full_list))
42
58
  end
43
59
 
44
60
  #
45
- # Remove CUCUMBER namespace from the class list
61
+ # The existing 'Class List' search field would normally contain the Cucumber
62
+ # Namespace object that has been added. Here we call the class_list method
63
+ # that is contained in the YARD template and we remove the namespace. Returning
64
+ # it when we are done.
46
65
  #
47
66
  def class_list(root = Registry.root)
48
67
  root.instance_eval { children.delete YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE } if root == Registry.root
@@ -51,6 +70,11 @@ def class_list(root = Registry.root)
51
70
  out
52
71
  end
53
72
 
73
+ #
74
+ # Generate a page for each Feature Directory. This is called recursively to
75
+ # ensure that all feature directories contained as children are rendered to
76
+ # pages.
77
+ #
54
78
  def serialize_feature_directories(namespaces)
55
79
  namespaces.each do |namespace|
56
80
  Templates::Engine.with_serializer(namespace, options[:serializer]) do
@@ -61,10 +85,18 @@ def serialize_feature_directories(namespaces)
61
85
  end
62
86
  end
63
87
 
88
+ #
89
+ # Generate a link to the 'All Features' in the features_list.html
90
+ #
91
+ # When there are no feature directories or multiple top-level feature directories
92
+ # then we want to link to the 'Requirements' page
93
+ #
94
+ # When there are is just one feature directory then we want to link to that directory
95
+ #
64
96
  def all_features_link
65
97
  root_feature_directories = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory)}
66
98
 
67
- if root_feature_directories.length > 1
99
+ if root_feature_directories.length == 0 || root_feature_directories.length > 1
68
100
  linkify YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE, "All Features"
69
101
  else
70
102
  linkify root_feature_directories.first, "All Features"
@@ -4,7 +4,7 @@
4
4
  <a href="http://cukes.info/">Cucumber</a> |
5
5
  <a href="http://github.com/aslakhellesoy/cucumber/wiki/Gherkin">Gherkin</a> |
6
6
  <a href="http://yardoc.org/">YARD</a> |
7
- <a href="http://github.com/burtlo/Cucumber-In-The-Yard">Cucumber-In-The-YARD</a>
7
+ <a href="https://github.com/burtlo/yard-cucumber">YARD-Cucumber</a>
8
8
  </div>
9
9
 
10
10
  <div class="requirements">
@@ -4,7 +4,7 @@ require 'gherkin/formatter/tag_count_formatter'
4
4
 
5
5
 
6
6
  module CucumberInTheYARD
7
- VERSION = '2.0.1' unless defined?(CucumberInTheYARD::VERSION)
7
+ VERSION = '2.0.2'
8
8
  end
9
9
 
10
10
  require File.dirname(__FILE__) + "/yard/code_objects/cucumber/base.rb"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: yard-cucumber
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.0.1
5
+ version: 2.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Franklin Webber
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-14 00:00:00 -07:00
13
+ date: 2011-04-06 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -143,7 +143,7 @@ homepage: http://github.com/burtlo/yard-cucumber
143
143
  licenses: []
144
144
 
145
145
  post_install_message: "\n\
146
- (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n Thank you for installing yard-cucumber 2.0.1 / 2011-03-14.\n \n Changes:\n \n - YARD 0.6.5 compatibility\n \n\n\
146
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n Thank you for installing yard-cucumber 2.0.2 / 2011-04-06.\n \n Changes:\n \n - No Features/Tags will still generate landing pages instead of no pages\n - Changed link to current gem 'yard-cucumber'\n \n\n\
147
147
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n"
148
148
  rdoc_options:
149
149
  - --charset=UTF-8