debian-mirror-gitlab/lib/tasks/gitlab/docs/compile_deprecations.rake

69 lines
2.5 KiB
Ruby
Raw Normal View History

2021-11-11 11:23:49 +05:30
# frozen_string_literal: true
namespace :gitlab do
namespace :docs do
2022-04-04 11:22:00 +05:30
COLOR_CODE_RESET = "\e[0m"
COLOR_CODE_RED = "\e[31m"
COLOR_CODE_GREEN = "\e[32m"
2021-11-11 11:23:49 +05:30
desc "Generate deprecation list from individual files"
task :compile_deprecations do
2022-03-02 08:16:31 +05:30
require_relative '../../../../tooling/docs/deprecation_handling'
path = Rails.root.join("doc/update/deprecations.md")
File.write(path, Docs::DeprecationHandling.new('deprecation').render)
2022-04-04 11:22:00 +05:30
puts "#{COLOR_CODE_GREEN}INFO: Deprecations compiled to #{path}.#{COLOR_CODE_RESET}"
2021-11-11 11:23:49 +05:30
end
2022-04-04 11:22:00 +05:30
desc "Check that the deprecation documentation is up to date"
2021-11-11 11:23:49 +05:30
task :check_deprecations do
2022-03-02 08:16:31 +05:30
require_relative '../../../../tooling/docs/deprecation_handling'
path = Rails.root.join("doc/update/deprecations.md")
2021-11-11 11:23:49 +05:30
2022-03-02 08:16:31 +05:30
contents = Docs::DeprecationHandling.new('deprecation').render
doc = File.read(path)
2021-11-11 11:23:49 +05:30
if doc == contents
2022-04-04 11:22:00 +05:30
puts "#{COLOR_CODE_GREEN}INFO: Deprecations documentation is up to date.#{COLOR_CODE_RESET}"
2021-11-11 11:23:49 +05:30
else
2022-04-04 11:22:00 +05:30
warn <<~EOS
#{COLOR_CODE_RED}ERROR: Deprecations documentation is outdated!#{COLOR_CODE_RESET}
To update the deprecations documentation, either:
- Run `bin/rake gitlab:docs:compile_deprecations` and commit the changes to this branch.
- Have a technical writer resolve the issue.
EOS
2021-11-11 11:23:49 +05:30
abort
end
end
2022-03-02 08:16:31 +05:30
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)
2022-04-04 11:22:00 +05:30
puts "#{COLOR_CODE_GREEN}INFO: Removals compiled to #{path}.#{COLOR_CODE_RESET}"
2022-03-02 08:16:31 +05:30
end
2022-04-04 11:22:00 +05:30
desc "Check that the removal documentation is up to date"
2022-03-02 08:16:31 +05:30
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
2022-04-04 11:22:00 +05:30
puts "#{COLOR_CODE_GREEN}INFO: Removals documentation is up to date.#{COLOR_CODE_RESET}"
2022-03-02 08:16:31 +05:30
else
2022-04-04 11:22:00 +05:30
warn <<~EOS
#{COLOR_CODE_RED}ERROR: Removals documentation is outdated!#{COLOR_CODE_RESET}
To update the removals documentation, either:
- Run `bin/rake gitlab:docs:compile_removals` and commit the changes to this branch.
- Have a technical writer resolve the issue.
EOS
2022-03-02 08:16:31 +05:30
abort
end
end
2021-11-11 11:23:49 +05:30
end
end