Skip to content

A doc generator implementation for aliased plugin.#68

Merged
mashhurs merged 9 commits intoelastic:mainfrom
mashhurs:aliased-plugin-doc-generator
Apr 25, 2022
Merged

A doc generator implementation for aliased plugin.#68
mashhurs merged 9 commits intoelastic:mainfrom
mashhurs:aliased-plugin-doc-generator

Conversation

@mashhurs
Copy link
Contributor

@mashhurs mashhurs commented Mar 20, 2022

A doc generator for alias plugins.

Description

This change automates manual job to create a doc for aliased plugins such as beats. We don't see the potential use cases to generate versioned docs for alias plugins, so lgic will be integrated into reference doc generator.

Usage

Install the bundle
bundle install --path=vendor/bundle
Run generator
bundle exec ruby plugindocs.rb --output-path ../logstash-docs ../logstash/plugins_version_docs.json
Note that, I have locally pulled logstash repo and run plugins_version_docs.json generator gradle job before running this command.

Test

  • Update beats.asciidoc, run following command and see if it generates elastic_agent.asciidoc file.
    bundle exec ruby plugindocs.rb --output-path ../logstash-docs ../logstash/plugins_version_docs.json
  • In case I have also run the versioned_plugins.rb script to make sure this change does not block existing jobs.
    bundle exec ruby versioned_plugins.rb --repair --skip-existing --dry-run --output-path=../
    (don't forget setting your GITHUB_TOKEN in env if running multiple times)

@mashhurs mashhurs self-assigned this Mar 20, 2022
@mashhurs mashhurs linked an issue Mar 20, 2022 that may be closed by this pull request
@mashhurs
Copy link
Contributor Author

I will update this PR once dependant PR is merged: dependant PR

@mashhurs mashhurs requested a review from yaauie April 16, 2022 06:40
Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mashhurs fantastic work.

I've left a couple nitpicks, a suggestion to pull some of the reindexing up into the new Alias utility, and some thoughts about simplifying the intermediate alias definition index format so that we didn't have to deal with so many complexities of nesting.

@mashhurs mashhurs requested a review from yaauie April 20, 2022 01:13
Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly getting close. Everything I have left is pretty minor:

My comments fit into 5 categories:

  • alias plugin equivalence
  • copy/paste artifacts from wrapped plugin implementation remain in alias plugin
  • failing early by using Hash#fetch for required values
  • ruby-ism: avoiding explicit return (except in guard clauses)
  • ruby-ism: module methods

@mashhurs mashhurs requested a review from yaauie April 22, 2022 00:53
Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@mashhurs mashhurs merged commit 1bc020d into elastic:main Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evaluate automating docs generation for aliased plugins

2 participants