This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new c2bfc4e4 Check that fields are class Date before using strftime
c2bfc4e4 is described below
commit c2bfc4e49502be0fa600737e5ae63654c382a2b3
Author: Sebb <[email protected]>
AuthorDate: Thu Mar 21 23:38:56 2024 +0000
Check that fields are class Date before using strftime
---
lib/whimsy/asf/podling.rb | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/whimsy/asf/podling.rb b/lib/whimsy/asf/podling.rb
index 5ed4fba6..d2fa0cf3 100644
--- a/lib/whimsy/asf/podling.rb
+++ b/lib/whimsy/asf/podling.rb
@@ -334,10 +334,10 @@ module ASF
if File.exist?(resource_yml)
rawYaml = Psych.load_file(resource_yml, permitted_classes: [Date,
Symbol])
hash = { }
- hash[:sga] = rawYaml[:sga].strftime('%Y-%m-%d') if rawYaml[:sga]
- hash[:asfCopyright] = rawYaml[:asfCopyright].strftime('%Y-%m-%d') if
rawYaml[:asfCopyright]
- hash[:distributionRights] =
rawYaml[:distributionRights].strftime('%Y-%m-%d') if
rawYaml[:distributionRights]
- hash[:ipClearance] = rawYaml[:ipClearance].strftime('%Y-%m-%d') if
rawYaml[:ipClearance]
+ hash[:sga] = rawYaml[:sga].strftime('%Y-%m-%d') if
rawYaml[:sga]&.class == Date
+ hash[:asfCopyright] = rawYaml[:asfCopyright].strftime('%Y-%m-%d') if
rawYaml[:asfCopyright]&.class == Date
+ hash[:distributionRights] =
rawYaml[:distributionRights].strftime('%Y-%m-%d') if
rawYaml[:distributionRights]&.class == Date
+ hash[:ipClearance] = rawYaml[:ipClearance].strftime('%Y-%m-%d') if
rawYaml[:ipClearance]&.class == Date
hash[:sourceControl] = rawYaml[:sourceControl]
hash[:wiki] = rawYaml[:wiki]
hash[:jira] = rawYaml[:jira]
@@ -346,7 +346,7 @@ module ASF
hash[:news] = []
rawYaml[:news]&.each do |ni|
newsItem = {}
- newsItem[:date] = ni[:date].strftime('%Y-%m-%d')
+ newsItem[:date] = ni[:date].strftime('%Y-%m-%d') if ni[:date]&.class
== Date
newsItem[:note] = ni[:note]
hash[:news].push(newsItem)
end