webgen 1.6.0 → 1.7.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
  SHA256:
3
- metadata.gz: c19662fd022a762e3796811586f073028780d7631922f6ade3c930d14b7b05e0
4
- data.tar.gz: 341981393076fbea3fbc4ea77bebd907c622de58243910638cc46539960786cc
3
+ metadata.gz: 0c2b90d29a4e3ddf583052496505ee5e903beac7a460c2b9fb19180540fe8e59
4
+ data.tar.gz: '06109f7ce0df6dce4095287907be396c816fcaf8f3c26767420f41af80a00965'
5
5
  SHA512:
6
- metadata.gz: 662b03ce9694fff8130e39b1f36e6efbb63c0da37c4c8cde291ee91ae48f2a35791c19e3502a8e7d49354ff2f90636fca9de993b84567e52857c27c949a30c48
7
- data.tar.gz: bf93a18ede7b162597b1224de51b757156ec818b506c05620cf4aee403a14ac48b1b529ad5e9538d9a534d2cb1923d72f07241eaca6af56628635d19700ed997
6
+ metadata.gz: e4bc1e38d4cb27cbaeeda92b0775f65a44c8c4a048b4da6c661f8b502a9fe031b5d8476e62a9811f383be1c8dd152a3b59ed31e7466d116d02acf984d39c8184
7
+ data.tar.gz: '08e4498259a4e83f7623729082637f9ef7a8f78912d07808e65a62aa498cf672149c71a368bf909a80e62d45432ac844f9ae710a754304d451133e6431da8e02'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.0
1
+ 1.7.0
@@ -47,8 +47,9 @@ module Webgen
47
47
  klass_node = create_page_node_for_class(path, dir_node, klass, output_flag_file)
48
48
  api.class_nodes[klass.full_name] = klass_node
49
49
  klass_node.node_info[:api] = api
50
- klass.each_method {|method| create_fragment_node_for_method(path, klass_node, method)}
51
- klass.each_attribute {|attr| create_fragment_node_for_method(path, klass_node, attr)}
50
+ create_fragment_nodes_for_constants(path, klass_node, klass)
51
+ create_fragment_nodes_for_attributes(path, klass_node, klass)
52
+ create_fragment_nodes_for_methods(path, klass_node, klass)
52
53
  end
53
54
 
54
55
  rdoc.store.all_files.sort.each do |file|
@@ -179,13 +180,76 @@ module Webgen
179
180
  end
180
181
  protected :create_page_node_for_class
181
182
 
183
+ # Creates fragment nodes for constants under the "Constants" fragment.
184
+ def create_fragment_nodes_for_constants(api_path, klass_node, klass)
185
+ return if klass.constants.none? {|const| const.display? }
186
+ constants_url = "#{klass_node.alcn}#Constants"
187
+ path = Webgen::Path.new(constants_url,
188
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
189
+ 'pipeline' => [], 'no_output' => true, 'title' => "Constants"})
190
+ const_node = @website.ext.path_handler.create_secondary_nodes(path).first
191
+ klass.constants.sort_by(&:name).each do |const|
192
+ create_fragment_node_for_constant(api_path, const_node, const)
193
+ end
194
+ end
195
+ protected :create_fragment_nodes_for_constants
196
+
197
+ # Create a fragment node for the given constant.
198
+ #
199
+ # A link definition entry for the method is also created.
200
+ def create_fragment_node_for_constant(api_path, parent_node, constant)
201
+ constant_url = "#{parent_node.alcn.sub(/#.*$/, '')}##{constant.name}"
202
+ path = Webgen::Path.new(constant_url,
203
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
204
+ 'parent_alcn' => parent_node.alcn,
205
+ 'pipeline' => [], 'no_output' => true, 'title' => constant.name})
206
+ @website.ext.path_handler.create_secondary_nodes(path)
207
+ add_link_definition(api_path, constant.full_name, constant_url, constant.full_name)
208
+ end
209
+ protected :create_fragment_node_for_constant
210
+
211
+ # Creates fragment nodes for attributes under the "Attributes" fragment.
212
+ def create_fragment_nodes_for_attributes(api_path, parent_node, klass)
213
+ return if klass.attributes.none? {|attr| attr.display? }
214
+ attributes_url = "#{parent_node.alcn}#Attributes"
215
+ path = Webgen::Path.new(attributes_url,
216
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
217
+ 'parent_alcn' => parent_node.alcn,
218
+ 'pipeline' => [], 'no_output' => true, 'title' => "Attributes"})
219
+ attr_node = @website.ext.path_handler.create_secondary_nodes(path).first
220
+ klass.attributes.sort_by(&:name).each do |attribute|
221
+ create_fragment_node_for_method(api_path, attr_node, attribute)
222
+ end
223
+ end
224
+ protected :create_fragment_nodes_for_attributes
225
+
226
+ # Creates fragment nodes for methods under the "Class Methods" or "Instance Methods"
227
+ # fragments.
228
+ def create_fragment_nodes_for_methods(api_path, klass_node, klass)
229
+ ["Class", "Instance"].each do |type|
230
+ method_list = klass.send("#{type.downcase}_method_list")
231
+ next if method_list.empty?
232
+ meth_url = "#{klass_node.alcn}##{type}-Methods"
233
+ path = Webgen::Path.new(meth_url,
234
+ {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
235
+ 'pipeline' => [], 'no_output' => true,
236
+ 'title' => "#{type} Methods"})
237
+ meth_node = @website.ext.path_handler.create_secondary_nodes(path).first
238
+ method_list.sort_by(&:name).each do |method|
239
+ create_fragment_node_for_method(api_path, meth_node, method)
240
+ end
241
+ end
242
+ end
243
+ protected :create_fragment_nodes_for_attributes
244
+
182
245
  # Create a fragment node for the given method.
183
246
  #
184
247
  # A link definition entry for the method is also created.
185
- def create_fragment_node_for_method(api_path, klass_node, method)
186
- method_url = "#{klass_node.alcn}##{method.aref}"
248
+ def create_fragment_node_for_method(api_path, parent_node, method)
249
+ method_url = "#{parent_node.alcn.sub(/#.*$/, '')}##{method.aref}"
187
250
  path = Webgen::Path.new(method_url,
188
251
  {'handler' => 'copy', 'modified_at' => api_path['modified_at'],
252
+ 'parent_alcn' => parent_node.alcn,
189
253
  'pipeline' => [], 'no_output' => true, 'title' => method.name})
190
254
  @website.ext.path_handler.create_secondary_nodes(path)
191
255
  add_link_definition(api_path, method.full_name, method_url, method.full_name)
@@ -3,6 +3,6 @@
3
3
  module Webgen
4
4
 
5
5
  # The version of webgen.
6
- VERSION = '1.6.0'
6
+ VERSION = '1.7.0'
7
7
 
8
8
  end
@@ -5,6 +5,18 @@ require 'webgen/path_handler/api'
5
5
 
6
6
  class TestPathHandlerApi < Minitest::Test
7
7
 
8
+ # Some Constant
9
+ TEST_CONST = 42
10
+
11
+ # Other Constant
12
+ OTHER_CONST = 43
13
+
14
+ def self.test_meth; end
15
+ def self.other_meth; end
16
+
17
+ attr_reader :test_attr
18
+ attr_reader :other_attr
19
+
8
20
  class SampleTestSubclass
9
21
  end
10
22
 
@@ -44,9 +56,31 @@ class TestPathHandlerApi < Minitest::Test
44
56
  assert(@website.tree["#{test_alcn}#method-i-setup"])
45
57
  assert_equal(["#{test_alcn}#method-i-setup", 'TestPathHandlerApi#setup'],
46
58
  @website.ext.link_definitions['my_api:TestPathHandlerApi#setup'])
59
+ assert(@website.tree["#{test_alcn}#method-c-test_meth"])
60
+ assert_equal(["#{test_alcn}#method-c-test_meth", 'TestPathHandlerApi::test_meth'],
61
+ @website.ext.link_definitions['my_api:TestPathHandlerApi::test_meth'])
62
+ assert(@website.tree["#{test_alcn}#attribute-i-test_attr"])
63
+ assert_equal(["#{test_alcn}#attribute-i-test_attr", 'TestPathHandlerApi#test_attr'],
64
+ @website.ext.link_definitions['my_api:TestPathHandlerApi#test_attr'])
65
+ assert(@website.tree["#{test_alcn}#TEST_CONST"])
66
+ assert_equal(["#{test_alcn}#TEST_CONST", 'TestPathHandlerApi::TEST_CONST'],
67
+ @website.ext.link_definitions['my_api:TestPathHandlerApi::TEST_CONST'])
47
68
  assert(@website.tree['/my_dir/API_rdoc.en.html'])
48
69
  assert(@website.tree['/my_dir/TestPathHandlerApi/SampleTestSubclass.en.html'])
49
70
 
71
+ collector = lambda do |node|
72
+ node.children.empty? ? node.lcn : [node.lcn, node.children.map(&collector)]
73
+ end
74
+ result = @website.tree[test_alcn].children.map(&collector)
75
+
76
+ assert_equal([["#Constants", ["#OTHER_CONST", "#TEST_CONST"]],
77
+ ["#Attributes", ["#attribute-i-other_attr", "#attribute-i-test_attr"]],
78
+ ["#Class-Methods", ["#method-c-other_meth", "#method-c-test_meth"]],
79
+ ["#Instance-Methods", ["#method-i-assert_common_tests_for_create_nodes",
80
+ "#method-i-setup", "#method-i-setup_for_create_nodes", "#method-i-teardown",
81
+ "#method-i-test_create_nodes", "#method-i-test_create_nodes_hierarchical",
82
+ "#method-i-test_rdoc_options", "#method-i-test_rdoc_store"]]], result)
83
+
50
84
  cache_dir = @website.tmpdir(File.join('path_handler.api', 'my_api'))
51
85
  assert(File.directory?(cache_dir))
52
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdparse