Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ task :references do
puts 'bundle exec rake references:puppet VERSION=<GIT TAG OR COMMIT>'
puts 'bundle exec rake references:facter VERSION=<GIT TAG OR COMMIT>'
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
Expand All @@ -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
5 changes: 3 additions & 2 deletions WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 8 additions & 0 deletions lib/puppet_references.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shall we cleanup it first? What if there are files deleted in the current version?

I'd maybe delete or rename the existing "latest" directory first and deploy after.

Another option is "rsync -a --delete".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But this may be done for the subdirectories only.
We need to ensure that files, which are directly in source/puppet/ folder do not have a file with the same name that comes from references.
I will give it a try.

end
end
Loading