sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit e07b9b5f738dfa2aa12e5faca7853dd831f20bb0
parent f402f3a12882064c8316f32d281598f8fc048000
Author: Dan Callaghan <djc@djc.id.au>
Date:   Tue, 19 Apr 2022 20:49:25 +1000

remove vestigial support for YAML migration

This code has evidently not worked for a very long time, even on Ruby
2.0. I tried on CentOS 7 with Ruby 2.0 and Psych 2.0, the tests fail as
far back as sup 0.22.1 (2015). Just delete it.

Diffstat:
M Manifest.txt | 2 --
D bin/sup-psych-ify-config-files | 21 ---------------------
M lib/sup.rb | 3 ---
D test/test_yaml_migration.rb | 85 -------------------------------------------------------------------------------
4 files changed, 0 insertions(+), 111 deletions(-)
diff --git a/Manifest.txt b/Manifest.txt
@@ -16,7 +16,6 @@ bin/sup-add
 bin/sup-config
 bin/sup-dump
 bin/sup-import-dump
-bin/sup-psych-ify-config-files
 bin/sup-recover-sources
 bin/sup-sync
 bin/sup-sync-back-maildir
@@ -139,7 +138,6 @@ test/test_header_parsing.rb
 test/test_helper.rb
 test/test_message.rb
 test/test_messages_dir.rb
-test/test_yaml_migration.rb
 test/test_yaml_regressions.rb
 test/unit/service/test_label_service.rb
 test/unit/test_contact.rb
diff --git a/bin/sup-psych-ify-config-files b/bin/sup-psych-ify-config-files
@@ -1,21 +0,0 @@
-#!/usr/bin/env ruby
-
-$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
-
-require "sup"
-require "fileutils"
-
-if RUBY_VERSION >= "2.1"
-  puts "YAML migration is deprecated by Ruby 2.1 and newer."
-  exit
-end
-
-Redwood.start
-
-fn = Redwood::SOURCE_FN
-FileUtils.cp fn, "#{fn}.syck_bak"
-
-Redwood::SourceManager.load_sources fn
-Redwood::SourceManager.save_sources fn, true
-
-Redwood.finish
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -38,9 +38,6 @@ class Module
         hash
       end
     end
-
-    # Legacy
-    Psych.load_tags["!#{Redwood::LEGACY_YAML_DOMAIN},#{Redwood::YAML_DATE}/#{path}"] = self
   end
 end
 
diff --git a/test/test_yaml_migration.rb b/test/test_yaml_migration.rb
@@ -1,85 +0,0 @@
-require "test_helper"
-
-require "sup"
-require "psych"
-
-if RUBY_VERSION < "2.1"
-describe "Sup's YAML util" do
-  describe "Module#yaml_properties" do
-    def build_class_with_name name, &b
-      Class.new do
-        meta_cls = class << self; self; end
-        meta_cls.send(:define_method, :name) { name }
-        class_exec(&b) unless b.nil?
-      end
-    end
-
-    after do
-      Psych.load_tags = {}
-      Psych.dump_tags = {}
-    end
-
-    it "defines YAML tag for class" do
-      cls = build_class_with_name 'Cls' do
-        yaml_properties
-      end
-
-      expected_yaml_tag = "!supmua.org,2006-10-01/Cls"
-
-      Psych.load_tags[expected_yaml_tag].must_equal cls
-      Psych.dump_tags[cls].must_equal expected_yaml_tag
-
-    end
-
-    it "Loads legacy YAML format as well" do
-      cls = build_class_with_name 'Cls' do
-        yaml_properties :id
-        attr_accessor :id
-        def initialize id
-          @id = id
-        end
-      end
-
-      Psych.load_tags["!masanjin.net,2006-10-01/Cls"].must_equal cls
-
-      yaml = <<EOF
---- !masanjin.net,2006-10-01/Cls
-id: ID
-EOF
-      loaded = YAML.load(yaml)
-
-      loaded.id.must_equal 'ID'
-      loaded.must_be_kind_of cls
-    end
-
-    it "Dumps & loads w/ state re-initialized" do
-      cls = build_class_with_name 'Cls' do
-        yaml_properties :id
-        attr_accessor :id
-        attr_reader :flag
-
-        def initialize id
-          @id = id
-          @flag = true
-        end
-      end
-
-      instance = cls.new 'ID'
-
-      dumped = YAML.dump(instance)
-      loaded = YAML.load(dumped)
-
-      dumped.must_equal <<-EOF
---- !supmua.org,2006-10-01/Cls
-id: ID
-      EOF
-
-      loaded.id.must_equal 'ID'
-      assert loaded.flag
-    end
-  end
-end
-
-else
-  puts "Some YAML tests are skipped on Ruby 2.1.0 and newer."
-end