diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-06 06:09:17 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-06 06:09:17 +0000 |
commit | 578fc865330cb9ce65746ea5c03e993348e62c96 (patch) | |
tree | 3c8175f1d2192633a17a4a85b0824b07d055c990 /tooling | |
parent | 23d951df2d16aea96dbd78fd8afe2e22a4794115 (diff) | |
download | gitlab-ce-578fc865330cb9ce65746ea5c03e993348e62c96.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling')
-rw-r--r-- | tooling/deprecations/docs.rb | 37 | ||||
-rw-r--r-- | tooling/deprecations/docs/renderer.rb | 20 |
2 files changed, 37 insertions, 20 deletions
diff --git a/tooling/deprecations/docs.rb b/tooling/deprecations/docs.rb new file mode 100644 index 00000000000..adc3e0edb10 --- /dev/null +++ b/tooling/deprecations/docs.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true +require 'erb' + +module Deprecations + module Docs + module_function + + def path + Rails.root.join("doc/update/deprecations.md") + end + + def render + deprecations_yaml_glob = Rails.root.join("data/deprecations/**/*.yml") + + source_files = Rake::FileList.new(deprecations_yaml_glob) do |fl| + fl.exclude(/example\.yml$/) + end + + deprecations = source_files.flat_map do |file| + YAML.load_file(file) + end + + deprecations = VersionSorter.rsort(deprecations) { |d| d["removal_milestone"] } + + milestones = deprecations.map { |d| d["removal_milestone"] }.uniq + + template = Rails.root.join("data/deprecations/templates/_deprecation_template.md.erb") + + load_template(template) + .result_with_hash(deprecations: deprecations, milestones: milestones) + end + + def load_template(filename) + ERB.new(File.read(filename), trim_mode: '-') + end + end +end diff --git a/tooling/deprecations/docs/renderer.rb b/tooling/deprecations/docs/renderer.rb deleted file mode 100644 index 832c4ce99d1..00000000000 --- a/tooling/deprecations/docs/renderer.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true -require 'erb' - -module Deprecations - module Docs - module Renderer - module_function - - def render(**variables) - template = File.expand_path("data/deprecations/templates/_deprecation_template.md.erb", "#{__dir__}/../../..") - - load_template(template).result_with_hash(variables) - end - - def load_template(filename) - ERB.new(File.read(filename), trim_mode: '-') - end - end - end -end |