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 e7f6de8  API for YAML_safe_load has changed
e7f6de8 is described below

commit e7f6de84556dced92c4715d6d1df565791ddd28e
Author: Sebb <[email protected]>
AuthorDate: Fri Jan 14 00:43:15 2022 +0000

    API for YAML_safe_load has changed
---
 lib/spec/lib/committee_spec.rb          | 10 +++++-----
 lib/whimsy/asf/petri.rb                 |  2 +-
 lib/whimsy/asf/yaml.rb                  | 14 +++++++-------
 www/board/agenda/routes.rb              |  4 ++--
 www/board/agenda/spec/secretary_spec.rb |  2 +-
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lib/spec/lib/committee_spec.rb b/lib/spec/lib/committee_spec.rb
index 368c671..719f4f4 100644
--- a/lib/spec/lib/committee_spec.rb
+++ b/lib/spec/lib/committee_spec.rb
@@ -84,7 +84,7 @@ describe ASF::Committee do
       desc = 'Description of A-B-C'
       expect { res = ASF::Committee.appendtlpmetadata(input, pmc, desc) }.to 
output("").to_stderr
       expect(res).not_to eq(input)
-      tlps = YAML.safe_load(res, [Symbol])[:tlps]
+      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/?})
@@ -96,7 +96,7 @@ describe ASF::Committee do
     cinfoy = File.join(ASF::SVN['board'], 'committee-info.yaml')
     yyyymm = '2020-10'
     data = File.read cinfoy
-    yaml = YAML.safe_load(data, [Symbol])
+    yaml = YAML.safe_load(data, permitted_classes: [Symbol])
     it "should contain HTTPD, but not retired" do
       para = yaml[:tlps]['httpd']
       expect(para).not_to eql(nil)
@@ -104,13 +104,13 @@ describe ASF::Committee do
     end
     it "should add retired tag to HTTPD" do
       data = ASF::Committee.record_termination(data, 'HTTP Server', yyyymm)
-      yaml = YAML.safe_load(data, [Symbol])
+      yaml = YAML.safe_load(data, permitted_classes: [Symbol])
       para = yaml[:tlps]['httpd']
       expect(para).not_to eql(nil)
       expect(para[:retired]).to eql(yyyymm)
       expect(para[:name]).to eql('HTTP Server')
     end
-    yaml = YAML.safe_load(data, [Symbol])
+    yaml = YAML.safe_load(data, permitted_classes: [Symbol])
     name = 'XYZXYZ'
     pmc = ASF::Committee.to_canonical(name)
     it "should not contain XYZXYZ" do
@@ -119,7 +119,7 @@ describe ASF::Committee do
     end
     it "should now contain XYZXYZ" do
       data = ASF::Committee.record_termination(data, name, yyyymm)
-      yaml = YAML.safe_load(data, [Symbol])
+      yaml = YAML.safe_load(data, permitted_classes: [Symbol])
       para = yaml[:tlps][pmc]
       expect(para).not_to eql(nil)
       expect(para[:retired]).to eql(yyyymm)
diff --git a/lib/whimsy/asf/petri.rb b/lib/whimsy/asf/petri.rb
index a4718cc..dd01b21 100644
--- a/lib/whimsy/asf/petri.rb
+++ b/lib/whimsy/asf/petri.rb
@@ -35,7 +35,7 @@ module ASF
       @list = []
       response = Net::HTTP.get_response(URI(PETRI_INFO))
       response.value() # Raises error if not OK
-      yaml = YAML.safe_load(response.body, [Symbol])
+      yaml = YAML.safe_load(response.body, permitted_classes: [Symbol])
       # @mentors = yaml['mentors']
       yaml['cultures'].each do |proj|
         @list << new(proj)
diff --git a/lib/whimsy/asf/yaml.rb b/lib/whimsy/asf/yaml.rb
index 4b7a59a..6ba2376 100644
--- a/lib/whimsy/asf/yaml.rb
+++ b/lib/whimsy/asf/yaml.rb
@@ -14,9 +14,9 @@ module YamlFile
   # creating the file if necessary
   # Yields the parsed YAML to the block, and writes the return
   # data to the file
-  # The args are passed to YAML.safe_load, and default to [Symbol]
+  # The args are passed to YAML.safe_load, and default to permitted_classes: 
[Symbol]
   def self.update(yaml_file, *args)
-    args << [Symbol] if args.empty?
+    args << permitted_classes: [Symbol] if args.empty?
     File.open(yaml_file, File::RDWR|File::CREAT, 0o644) do |file|
       file.flock(File::LOCK_EX)
       yaml = YAML.safe_load(file.read, *args) || {}
@@ -27,7 +27,7 @@ module YamlFile
   end
 
   # replace a section of YAML text whilst preserving surrounding data 
including comments.
-  # The args are passed to YAML.safe_load, and default to [Symbol]
+  # The args are passed to YAML.safe_load, and default to permitted_classes: 
[Symbol]
   # The caller must provide a block, which is passed two JSON parameters:
   # - the section related to the key
   # - the entire file (this is for validation purposes)
@@ -36,7 +36,7 @@ module YamlFile
   def self.replace_section(content, key, *args)
     raise ArgumentError, 'block is required' unless block_given?
 
-    args << [Symbol] if args.empty?
+    args << permitted_classes: [Symbol] if args.empty?
     yaml = YAML.safe_load(content, *args)
 
     section = yaml[key]
@@ -68,7 +68,7 @@ module YamlFile
   # opens the file for exclusive access
   # Yields the parsed YAML to the block, and writes the updated
   # data to the file
-  # The args are passed to YAML.safe_load, and default to [Symbol]
+  # The args are passed to YAML.safe_load, and default to permitted_classes: 
[Symbol]
   # [originally designed for updating committee-info.yaml]
   def self.update_section(yaml_file, key, *args, &block)
     raise ArgumentError, 'block is required' unless block_given?
@@ -92,9 +92,9 @@ module YamlFile
   # Opens the file read-only, with a shared lock, and parses the YAML
   # This is yielded to the block (if provided), whilst holding the lock
   # Otherwise the YAML is returned to the caller, and the lock is released
-  # The args are passed to YAML.safe_load, and default to [Symbol]
+  # The args are passed to YAML.safe_load, and default to permitted_classes: 
[Symbol]
   def self.read(yaml_file, *args)
-    args << [Symbol] if args.empty?
+    args << permitted_classes: [Symbol] if args.empty?
     File.open(yaml_file, File::RDONLY) do |file|
       file.flock(File::LOCK_SH)
       yaml = YAML.safe_load(file.read, *args)
diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index d967467..2e524e2 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -273,7 +273,7 @@ get %r{/(\d\d\d\d-\d\d-\d\d)/(.*)} do |date, path|
 
   minutes = AGENDA_WORK + '/' +
     agenda.sub('agenda', 'minutes').sub('.txt', '.yml')
-  @page[:minutes] = YAML.safe_load(File.read(minutes), [Symbol]) if 
File.exist? minutes
+  @page[:minutes] = YAML.safe_load(File.read(minutes), permitted_classes: 
[Symbol]) if File.exist? minutes
 
   @cssmtime = File.mtime('public/stylesheets/app.css').to_i
   @manmtime = File.mtime("#{settings.views}/manifest.json.erb").to_i
@@ -477,7 +477,7 @@ end
 get %r{/json/chat/(\d\d\d\d_\d\d_\d\d)} do |date|
   log = "#{AGENDA_WORK}/board_agenda_#{date}-chat.yml"
   if File.exist? log
-    _json YAML.safe_load(File.read(log), [Symbol])
+    _json YAML.safe_load(File.read(log), permitted_classes: [Symbol])
   else
     _json []
   end
diff --git a/www/board/agenda/spec/secretary_spec.rb 
b/www/board/agenda/spec/secretary_spec.rb
index adc9c40..a14dbf3 100644
--- a/www/board/agenda/spec/secretary_spec.rb
+++ b/www/board/agenda/spec/secretary_spec.rb
@@ -113,7 +113,7 @@ feature 'report' do
     file = "#{AGENDA_WORK}/board_minutes_#{meeting.gsub('-', '_')}.yml"
     minutes = IO.read(file)
     timestamp = Time.now.gmtime.to_f * 1000
-    IO.write file, YAML.dump(YAML.safe_load(minutes, [Symbol]).
+    IO.write file, YAML.dump(YAML.safe_load(minutes, permitted_classes: 
[Symbol]).
       merge('complete' => timestamp, 'Adjournment' => '11:45'))
     yield
   ensure

Reply via email to