From 27a92ad63b124240f6f9667ef5420cdfd8e560f6 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 7 Apr 2026 23:20:58 +0200 Subject: [PATCH] feat(build): automate references deployment fixes: #41 Signed-off-by: Martin Alfke --- Rakefile | 18 ++++++++++++++++++ WORKFLOW.md | 5 +++-- lib/puppet_references.rb | 8 ++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index ec4cbdfd0..3409c908c 100644 --- a/Rakefile +++ b/Rakefile @@ -384,6 +384,9 @@ task :references do puts 'bundle exec rake references:puppet VERSION=' puts 'bundle exec rake references:facter VERSION=' puts 'bundle exec rake references:version_tables' + puts 'bundle exec rake references:update_puppet_docs' + puts 'bundle exec rake references:update_facter_docs' + puts 'bundle exec rake references:update_docs' end namespace :references do @@ -405,4 +408,19 @@ namespace :references do task :check_version do abort 'No VERSION given to build references for' unless ENV['VERSION'] end + + task :update_puppet_docs do + require 'puppet_references' + PuppetReferences.update_docs('puppet') + end + + task :update_facter_docs do + require 'puppet_references' + PuppetReferences.update_docs('facter') + end + + task :update_docs do + Rake::Task['references:update_facter_docs'].invoke + Rake::Task['references:update_puppet_docs'].invoke + end end diff --git a/WORKFLOW.md b/WORKFLOW.md index f38d6cd74..1cfca559e 100644 --- a/WORKFLOW.md +++ b/WORKFLOW.md @@ -55,9 +55,10 @@ This clones puppet and facter into the `vendor` directory and generates the `ref ## Moving stuff in place -Copy the output from `references_output/facter` to `source/facter/latest` +For Puppet run `bundle exec rake references:update_puppet_docs` +For Facter run `bundle exec rake references:update_facter_docs` -Copy the output from `references_output/puppet` to `source/puppet/latest` +or do both in one: `bundle exec rake references:update_docs` Run `bundle exec rake generate` to generate the new content. diff --git a/lib/puppet_references.rb b/lib/puppet_references.rb index 6edb557bc..8f724d5bf 100644 --- a/lib/puppet_references.rb +++ b/lib/puppet_references.rb @@ -78,4 +78,12 @@ def self.build_from_list_of_classes(reference_classes, real_commit) puts "NOTE: You'll have to move the generated files into place yourself. The 'latest' location for each is:" puts locations end + + def self.update_docs(component) + raise Exception "Missing latest directory in source/#{component}" unless File.exist?("source/#{component}/latest") + raise Exception "No reference output found in references_output/#{component}" unless File.exist?("references_output/#{component}") + + require 'fileutils' + FileUtils.cp_r("references_output/#{component}/.", "source/#{component}/latest") + end end