Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2022-05-19 12:04:31 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2022-05-19 12:26:39 +0300
commitef01561bc4856dbddcd4f6a0822862f0a8884ce3 (patch)
treeaa9b4981bf077959d2d20e65bc53e36f9452f08d /Rakefile
parent78c9b7a5f7f3883e1a39fb8f0010a1f8a08f0384 (diff)
Check if remove_date is present for the clean_redirects task
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index cdb5820a..a60b18f5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -333,15 +333,21 @@ namespace :docs do
# Exclude 'doc/development/documentation/redirects.md' because it
# contains an example of the YAML front matter.
#
- files_to_be_deleted = `grep -Ir 'remove_date:' #{content_dir} | grep -v doc/development/documentation/redirects.md | cut -d ":" -f1`.split("\n")
- puts "Found redirect files:"
+ files_to_be_deleted = `grep -Ir 'remove_date:' #{content_dir} | cut -d ":" -f1`.split("\n")
+ puts "Files containing 'remove_date':"
files_to_be_deleted.each { |file| puts "- #{file}" }
+ puts
+
#
# Iterate over the files to be deleted and print the needed
# YAML entries for the Docs site redirects.
#
files_to_be_deleted.each do |filename|
frontmatter = YAML.safe_load(File.read(filename))
+
+ # Skip if remove_date is not found in the frontmatter
+ next unless frontmatter.has_key?('remove_date')
+
remove_date = Date.parse(frontmatter['remove_date'])
old_path = filename.gsub(/\.md/, '.html').gsub(content_dir, "/#{slug}")