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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dffa2da3925e765760fc1b380f2f5fdb48ed0d055a4d6bfe87055b81577183ef
4
- data.tar.gz: 85995c7465a4875da8ebc72ef04606b198667b8344c9f4717da3465fe5d06f19
3
+ metadata.gz: 14f70185b89b359e58791101591102755c5e523fed61fe4e4cdf7e5ad3cd1615
4
+ data.tar.gz: 10303ee74f360fa49fd711497dec982094cd7d3f7621d08a47c68abecf22bd3f
5
5
  SHA512:
6
- metadata.gz: 7d71c49e6cb7d238d5adb40c0a7b829536bdfa4cee09cd4993542906cec0aa6f861115a1e4dafcb7f4523a91be06aeffa02e1643d7b71a483b7b0cb5a9b6775b
7
- data.tar.gz: e61222b9596f21de4a8af7cf1279db74a5db1c426fbd5f10affc083ce30d4c6f0da205105cec0355c2704830aad8574804dbb635f75582b5463b3391be455d9f
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Apiwork
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - skiftle