debian-mirror-gitlab/lib/tasks/gitlab/docs/compile_deprecations.rake
2022-03-02 08:16:31 +05:30

52 lines
1.9 KiB
Ruby

# frozen_string_literal: true
namespace :gitlab do
namespace :docs do
desc "Generate deprecation list from individual files"
task :compile_deprecations do
require_relative '../../../../tooling/docs/deprecation_handling'
path = Rails.root.join("doc/update/deprecations.md")
File.write(path, Docs::DeprecationHandling.new('deprecation').render)
puts "Deprecations compiled to #{path}"
end
desc "Check that the deprecation doc is up to date"
task :check_deprecations do
require_relative '../../../../tooling/docs/deprecation_handling'
path = Rails.root.join("doc/update/deprecations.md")
contents = Docs::DeprecationHandling.new('deprecation').render
doc = File.read(path)
if doc == contents
puts "Deprecations doc is up to date."
else
format_output('Deprecations doc is outdated! You (or your technical writer) can update it by running `bin/rake gitlab:docs:compile_deprecations`.')
abort
end
end
desc "Generate removal list from individual files"
task :compile_removals do
require_relative '../../../../tooling/docs/deprecation_handling'
path = Rails.root.join("doc/update/removals.md")
File.write(path, Docs::DeprecationHandling.new('removal').render)
puts "Removals compiled to #{path}"
end
desc "Check that the removal doc is up to date"
task :check_removals do
require_relative '../../../../tooling/docs/deprecation_handling'
path = Rails.root.join("doc/update/removals.md")
contents = Docs::DeprecationHandling.new('removal').render
doc = File.read(path)
if doc == contents
puts "Removals doc is up to date."
else
format_output('Removals doc is outdated! You (or your technical writer) can update it by running `bin/rake gitlab:docs:compile_removals`.')
abort
end
end
end
end