apiwork 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/apiwork/reference_generator.rb +19 -3
- data/lib/apiwork/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14f70185b89b359e58791101591102755c5e523fed61fe4e4cdf7e5ad3cd1615
|
|
4
|
+
data.tar.gz: 10303ee74f360fa49fd711497dec982094cd7d3f7621d08a47c68abecf22bd3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb799505dac690b1807a31f3c6f87d5b4893d85ba79f007966a2e6bfe19c58e2e63a0bf6bed4080de6b8c7a1aee3fbd9deab76f4fbabf8c416ff9ab9e78598b6
|
|
7
|
+
data.tar.gz: 0bfe2378cfc17aab81dd0af3ccd1fff1e0bbafad476e97e9c71f0b2c7764485d2f02f44290a7c9015d2ada479ae2b37d00c76786369515361a424688cb1b390a
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'yard'
|
|
4
3
|
require 'fileutils'
|
|
5
4
|
require 'active_support/core_ext/string/inflections'
|
|
6
5
|
require 'active_support/core_ext/object/blank'
|
|
@@ -22,6 +21,8 @@ module Apiwork
|
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
def generate
|
|
24
|
+
require 'yard'
|
|
25
|
+
|
|
25
26
|
parse_source
|
|
26
27
|
modules = extract_modules
|
|
27
28
|
write_files(modules)
|
|
@@ -237,6 +238,7 @@ module Apiwork
|
|
|
237
238
|
@modules = modules
|
|
238
239
|
@modules_with_children = build_modules_with_children(modules)
|
|
239
240
|
|
|
241
|
+
write_root_index
|
|
240
242
|
modules.each.with_index(1) do |mod, order|
|
|
241
243
|
filepath = module_filepath(mod[:path])
|
|
242
244
|
FileUtils.mkdir_p(File.dirname(filepath))
|
|
@@ -247,6 +249,22 @@ module Apiwork
|
|
|
247
249
|
write_namespace_indexes
|
|
248
250
|
end
|
|
249
251
|
|
|
252
|
+
def write_root_index
|
|
253
|
+
children = find_direct_children('Apiwork')
|
|
254
|
+
parts = []
|
|
255
|
+
parts << "---\norder: 2\n---\n"
|
|
256
|
+
parts << "# Reference\n"
|
|
257
|
+
parts << "Complete API reference for Apiwork's public classes.\n"
|
|
258
|
+
|
|
259
|
+
if children.any?
|
|
260
|
+
parts << "## Modules\n"
|
|
261
|
+
render_child_links(parts, 'Apiwork', children)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
FileUtils.mkdir_p(OUTPUT_DIR)
|
|
265
|
+
File.write(File.join(OUTPUT_DIR, 'index.md'), parts.join("\n"))
|
|
266
|
+
end
|
|
267
|
+
|
|
250
268
|
def write_namespace_indexes
|
|
251
269
|
collect_all_folder_paths.each do |folder_parts|
|
|
252
270
|
folder_path = File.join(OUTPUT_DIR, *folder_parts.map { |p| dasherize(p) })
|
|
@@ -337,8 +355,6 @@ module Apiwork
|
|
|
337
355
|
|
|
338
356
|
def cleanup_old_files
|
|
339
357
|
Dir.glob(File.join(OUTPUT_DIR, '**/*')).each do |entry|
|
|
340
|
-
next if entry == File.join(OUTPUT_DIR, 'index.md')
|
|
341
|
-
|
|
342
358
|
FileUtils.rm_rf(entry)
|
|
343
359
|
end
|
|
344
360
|
end
|
data/lib/apiwork/version.rb
CHANGED