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
path: root/lib
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2023-10-16 23:57:21 +0300
committerAsh McKenzie <amckenzie@gitlab.com>2023-10-16 23:57:21 +0300
commitf3942a4736d0d0fad57059b51e0b9496fa071264 (patch)
treefe372e74f04ee88fcbd9f598368f360c5a408012 /lib
parent53516f4934c2cde34d95603810ac4779bef94ef3 (diff)
Load deprecation release dates from the www-gitlab-com project
Diffstat (limited to 'lib')
-rw-r--r--lib/helpers/generic.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/helpers/generic.rb b/lib/helpers/generic.rb
index 7feb7ec0..5132cdaf 100644
--- a/lib/helpers/generic.rb
+++ b/lib/helpers/generic.rb
@@ -197,5 +197,20 @@ module Nanoc::Helpers
list = breadcrumb_trail(data, path[1..])
list.map { |item| item[:name] }.join(" &rsaquo; ")
end
+
+ #
+ # Fetch information about GitLab releases.
+ #
+ def get_release_dates
+ uri = URI('https://gitlab.com/gitlab-com/www-gitlab-com/-/raw/master/data/releases.yml')
+ response = Net::HTTP.get_response(uri)
+ return "[]" unless response.is_a?(Net::HTTPSuccess)
+
+ parsed_yaml = YAML.safe_load(response.body) || []
+ JSON.generate(parsed_yaml)
+ rescue StandardError => e
+ warn("Error getting release dates - #{e}")
+ "[]"
+ end
end
end