Skip to content

Show source and used version in auto generated content#131

Closed
tuxmea wants to merge 1 commit into
masterfrom
add_information_on_autogenerate
Closed

Show source and used version in auto generated content#131
tuxmea wants to merge 1 commit into
masterfrom
add_information_on_autogenerate

Conversation

@tuxmea
Copy link
Copy Markdown
Contributor

@tuxmea tuxmea commented Apr 30, 2026

Short description

Example: Show

> **NOTE:** This page was generated from the OpenVox source code based on version 8.26.2 on 2026-04-30 17:27:15 +0200
> **NOTE:** This page was generated from the Openact source code based on version 5.6.0 on 2026-04-30 17:27:15 +0200

instead of

> **NOTE:** This page was generated from the OpenVox source code based on 2026-04-30 17:27:15 +0200

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document and added a Signed-off-by annotation to each of my commits
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

Signed-off-by: Martin Alfke <ma@betadots.de>
@tuxmea tuxmea requested a review from a team as a code owner April 30, 2026 15:32
@miharp
Copy link
Copy Markdown
Contributor

miharp commented Apr 30, 2026

This is mostly Claude's idea but it seems sound: since commit is already threaded through Reference#make_headerUtil.make_header as a parameter, util.rb can just use that argument directly instead of the global:

def self.make_header(data, repo, commit)
  generated_at = "...based on version #{commit}..."  # use the param, not $version_commit
end

Then in puppet_references.rb, version_commit can stay a plain local variable, and each reference class reads it via a module accessor (PuppetReferences.version_commit) instead of $version_commit. That clears all 15 rubocop offenses without any disables.

I've tested this locally and it produces the expected output. If it's helpful, I've put a working version on a branch: add_information_on_autogenerate...miharp:openvox-docs:fix/pr131-global-var-refactor

@jay7x
Copy link
Copy Markdown
Contributor

jay7x commented May 1, 2026

@miharp I like that solution more than using global variables in Ruby :)

@tuxmea
Copy link
Copy Markdown
Contributor Author

tuxmea commented May 1, 2026

This is better than my idea. Please make a PR from your branch.
I am going to close this one.

@tuxmea tuxmea closed this May 1, 2026
tuxmea added a commit that referenced this pull request May 3, 2026
Update to not use global variables
Based on @miharp idea: #131 (comment)

Co-authored-by: Claude <noreply@anthropic.com>

Signed-off-by: Martin Alfke <ma@betadots.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants