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

commit e179f34bc48404ec3e87d9f8a3c1f01b1536921a
Author: Sebb <[email protected]>
AuthorDate: Mon Aug 1 17:03:33 2022 +0100

    Track TLP establishment date
---
 lib/spec/lib/committee_spec.rb               | 10 +++++++---
 lib/whimsy/asf/committee.rb                  |  3 ++-
 www/board/agenda/views/actions/todos.json.rb |  2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/spec/lib/committee_spec.rb b/lib/spec/lib/committee_spec.rb
index 9909cd90..1a5b4f4f 100644
--- a/lib/spec/lib/committee_spec.rb
+++ b/lib/spec/lib/committee_spec.rb
@@ -69,6 +69,9 @@ describe ASF::Committee do
     end
   end
 
+  date_established = Date.parse('1970-01-01')
+  established_value = '1970-01' # as per yaml
+
   describe "ASF::Committee.appendtlpmetadata" do
     board = ASF::SVN.find('board')
     file = File.join(board, 'committee-info.yaml')
@@ -78,7 +81,7 @@ describe ASF::Committee do
       # Wunderbar.logger = nil; is needed to ensure logging output works as 
expected
       expect {
         Wunderbar.logger = nil
-        res = ASF::Committee.appendtlpmetadata(input, 'httpd', 'description')
+        res = ASF::Committee.appendtlpmetadata(input, 'httpd', 'description', 
date_established)
       }.to output("_WARN Entry for 'httpd' already exists under 
:tlps\n").to_stderr
       expect(res).to eql(input)
     end
@@ -88,7 +91,7 @@ describe ASF::Committee do
       # Wunderbar.logger = nil; is needed to ensure logging output works as 
expected
       expect {
         Wunderbar.logger = nil
-        res = ASF::Committee.appendtlpmetadata(input, 'comdev', 'description')
+        res = ASF::Committee.appendtlpmetadata(input, 'comdev', 'description', 
date_established)
       }.to output("_WARN Entry for 'comdev' already exists under 
:cttees\n").to_stderr
       expect(res).to eql(input)
     end
@@ -97,13 +100,14 @@ describe ASF::Committee do
     it "should succeed for '#{pmc}'" do
       res = nil
       desc = 'Description of A-B-C'
-      expect { res = ASF::Committee.appendtlpmetadata(input, pmc, desc) }.to 
output("").to_stderr
+      expect { res = ASF::Committee.appendtlpmetadata(input, pmc, desc, 
date_established) }.to output("").to_stderr
       expect(res).not_to eq(input)
       tlps = YAML.safe_load(res, permitted_classes: [Symbol])[:tlps]
       abc = tlps[pmc]
       expect(abc.class).to eq(Hash)
       expect(abc[:site]).to match(%r{https?://#{pmc}\.apache\.org/?})
       expect(abc[:description]).to eq(desc)
+      expect(abc[:established]).to eq(established_value)
     end
   end
 
diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index 7e1db50b..378c09f8 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -665,7 +665,7 @@ module ASF
 
     # append the description for a new tlp committee.
     # this is intended to be called from todos.json.rb in the block for 
ASF::SVN.update
-    def self.appendtlpmetadata(input, committee, description)
+    def self.appendtlpmetadata(input, committee, description, date_established)
       YamlFile.replace_section(input, :tlps) do |section, yaml|
         output = section # default no change
         if yaml[:cttees][committee]
@@ -676,6 +676,7 @@ module ASF
           section[committee] = {
             site: "http://#{committee}.apache.org";,
             description: description,
+            established: date_established.strftime('%Y-%m'),
           }
           output = section.sort.to_h
         end
diff --git a/www/board/agenda/views/actions/todos.json.rb 
b/www/board/agenda/views/actions/todos.json.rb
index 4b8319bb..123e4c41 100644
--- a/www/board/agenda/views/actions/todos.json.rb
+++ b/www/board/agenda/views/actions/todos.json.rb
@@ -135,7 +135,7 @@ if @establish and env.password
       # update ci.yaml
       cinfoy = File.join(ASF::SVN['board'], 'committee-info.yaml')
       ASF::SVN.update cinfoy, title, env, _ do |_tmpdir, contents|
-        ASF::Committee.appendtlpmetadata(contents, pmc.downcase, charter)
+        ASF::Committee.appendtlpmetadata(contents, pmc.downcase, charter, 
date_established)
       end
     end
   end

Reply via email to