From 725e1749e43beeb5fe24464a62431ea447bf7f48 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Tue, 15 Aug 2023 22:44:37 -0400
Subject: [PATCH] Cleaned up some old unused test scaffolding and updated
 contributors file

---
 CONTRIBUTORS.md                         |   5 +
 Rakefile                                |  69 +++---
 apex-aprs.gemspec                       |   5 +-
 features/apex.feature                   |   6 -
 features/step_definitions/apex_steps.rb |   1 -
 features/support/env.rb                 |  15 --
 lib/apex/encoder/aprs_kiss.rb           | 282 ++++++++++++------------
 test/tc_frame.rb                        | 125 -----------
 8 files changed, 182 insertions(+), 326 deletions(-)
 delete mode 100644 features/apex.feature
 delete mode 100644 features/step_definitions/apex_steps.rb
 delete mode 100644 features/support/env.rb
 delete mode 100644 test/tc_frame.rb

diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index f0906dc..f815e7a 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -1,4 +1,9 @@
+## Current Project Lead
+
 * Jeffrey Phillips Freeman (WI2ARD) - http://JeffreyFreeman.me
+
+## Contributors
+
 * Greg Albrecht W2GMD <oss@undef.net>
 * Martin Murray (KD8LVZ)
 * Paul McMillan - https://github.com/PaulMcMillan
diff --git a/Rakefile b/Rakefile
index c1be21c..46ecc4d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -24,44 +24,43 @@ def dump_load_path
     end
 end
 
-gem 'json', '~> 2.5'
-
-gem 'bundler', '~> 2.2'
-require 'bundler'
-
-gem 'rake', '~> 13.0'
-require 'rake/clean'
-require 'rake/testtask'
-
-
-require 'cucumber'
-require 'cucumber/rake/task'
-gem 'rdoc' # we need the installed RDoc gem, not the system one
-require 'rdoc/task'
+# gem 'json', '~> 2.5'
+#
+# gem 'bundler', '~> 2.2'
+# require 'bundler'
+#
+# gem 'rake', '~> 13.0'
+# require 'rake/clean'
+# require 'rake/testtask'
+#
+#
+# require 'cucumber'
+# require 'cucumber/rake/task'
+# gem 'rdoc' # we need the installed RDoc gem, not the system one
+# require 'rdoc/task'
 
 include Rake::DSL
 
 Bundler::GemHelper.install_tasks
 
 
-Rake::TestTask.new do |t|
-    t.pattern = 'test/tc_*.rb'
-end
-
-
-CUKE_RESULTS = 'results.html'
-CLEAN << CUKE_RESULTS
-Cucumber::Rake::Task.new(:features) do |t|
-    t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
-    t.fork = false
-end
-
-Rake::RDocTask.new do |rd|
-
-    rd.main = "README.rdoc"
-
-    rd.rdoc_files.include("README.rdoc", "lib/**/*.rb", "bin/**/*")
-end
-
-task :default => [:test, :features]
-
+# Rake::TestTask.new do |t|
+#     t.pattern = 'test/tc_*.rb'
+# end
+#
+#
+# CUKE_RESULTS = 'results.html'
+# CLEAN << CUKE_RESULTS
+# Cucumber::Rake::Task.new(:features) do |t|
+#     t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
+#     t.fork = false
+# end
+#
+# Rake::RDocTask.new do |rd|
+#
+#     rd.main = "README.rdoc"
+#
+#     rd.rdoc_files.include("README.rdoc", "lib/**/*.rb", "bin/**/*")
+# end
+#
+# task :default => [:test, :features]
diff --git a/apex-aprs.gemspec b/apex-aprs.gemspec
index 3855d64..b58acd6 100644
--- a/apex-aprs.gemspec
+++ b/apex-aprs.gemspec
@@ -29,12 +29,11 @@ Gem::Specification.new do |spec|
     spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
     spec.require_paths = ['lib']
 
-    spec.add_dependency 'abstraction', '~> 0.0.4'
+    spec.add_dependency 'abstractify', '~> 1.1'
     spec.add_dependency 'json', '~> 2.5'
-    spec.add_dependency 'kiss-tnc', '~> 1.0'
+    spec.add_dependency 'kiss-tnc', '~> 2.0'
     spec.add_development_dependency 'bundler', '~> 2.2'
     spec.add_development_dependency 'rake', '~> 13.0'
-    spec.add_development_dependency 'test-unit', '~> 3.6'
     spec.add_development_dependency 'rspec', '~> 3.12'
     spec.add_development_dependency 'simplecov', '~> 0.22'
     spec.add_development_dependency 'simplecov-console', '~> 0.9'
diff --git a/features/apex.feature b/features/apex.feature
deleted file mode 100644
index 8b2b7cc..0000000
--- a/features/apex.feature
+++ /dev/null
@@ -1,6 +0,0 @@
-Feature: My bootstrapped app kinda works
-  In order to get going on coding my awesome app
-  I want to have aruba and cucumber setup
-  So I don't have to do it myself
-
-  Scenario: App just runs
diff --git a/features/step_definitions/apex_steps.rb b/features/step_definitions/apex_steps.rb
deleted file mode 100644
index 5fe9e7a..0000000
--- a/features/step_definitions/apex_steps.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Put your step definitions here
diff --git a/features/support/env.rb b/features/support/env.rb
deleted file mode 100644
index 9b4b914..0000000
--- a/features/support/env.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'aruba/cucumber'
-
-ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
-LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib')
-
-Before do
-    # Using "announce" causes massive warnings on 1.9.2
-    @puts = true
-    @original_rubylib = ENV['RUBYLIB']
-    ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
-end
-
-After do
-    ENV['RUBYLIB'] = @original_rubylib
-end
diff --git a/lib/apex/encoder/aprs_kiss.rb b/lib/apex/encoder/aprs_kiss.rb
index 236b384..a224743 100644
--- a/lib/apex/encoder/aprs_kiss.rb
+++ b/lib/apex/encoder/aprs_kiss.rb
@@ -10,133 +10,133 @@ module Apex
             @lock = Mutex.new
         end
 
-        private
-        def self.decode_frame(raw_frame)
-            frame_len = raw_frame.length
-
-            if frame_len > 16
-                (0...frame_len - 2).each do |raw_slice|
-                    # Is address field length correct?
-                    if raw_frame[raw_slice] & 0x01 != 0 and ((raw_slice + 1) % 7) == 0
-                        i = (raw_slice.to_f + 1.0) / 7.0
-                        # Less than 2 callsigns?
-                        if 1.0 < i and i < 11.0
-                            if raw_frame[raw_slice + 1] & 0x03 == 0x03 and [0xf0, 0xcf].include? raw_frame[raw_slice + 2]
-                                payload_as_array = raw_frame[raw_slice + 3..-1].map { |b| b.chr }
-                                payload = payload_as_array.join
-                                destination = Apex::Frame::Entity.from_raw(identity_as_string(extract_callsign(raw_frame)))
-                                source = Apex::Frame::Entity.from_raw(identity_as_string(extract_callsign(raw_frame[7..-1])))
-                                path = extract_path(i.to_i, raw_frame)
-                                return Apex::Frame::Frame.new(source, destination, path, payload)
-                            end
-                        end
-                    end
-                end
-            end
-            return nil
-        end
-
-        private
-        def self.valid_frame(raw_frame)
-            frame_len = raw_frame.length
-
-            if frame_len > 16
-                (0...frame_len - 2).each do |raw_slice|
-                    # Is address field length correct?
-                    if raw_frame[raw_slice] & 0x01 != 0 and ((raw_slice + 1) % 7) == 0
-                        i = (raw_slice.to_f + 1.0) / 7.0
-                        # Less than 2 callsigns?
-                        if 1.0 < i and i < 11.0
-                            if raw_frame[raw_slice + 1] & 0x03 == 0x03 and [0xf0, 0xcf].include? raw_frame[raw_slice + 2]
-                                return true
-                            end
-                        end
-                    end
-                end
-            end
-            return false
-        end
-
-        private
-        def self.extract_path(start, raw_frame)
-            full_path = []
-
-            (2...start).each do |i|
-                path = identity_as_string(extract_callsign(raw_frame[i * 7..-1]))
-                if path and path.length > 0
-                    if raw_frame[i * 7 + 6] & 0x80 != 0
-                        full_path << [path, '*'].join
-                    else
-                        full_path << path
-                    end
-                end
-            end
-            return Apex::Frame::Path.from_raw(full_path)
-        end
-
-        private
-        def self.extract_callsign(raw_frame)
-            callsign_as_array = raw_frame[0...6].map { |x| (x >> 1).chr }
-            callsign = callsign_as_array.join.strip
-            ssid = (raw_frame[6] >> 1) & 0x0f
-            ssid = (ssid == nil or ssid == 0 ? nil : ssid)
-            return {:callsign => callsign, :ssid => ssid}
-        end
-
-        private
-        def self.identity_as_string(identity)
-            if identity[:ssid] and identity[:ssid] > 0
-                return [identity[:callsign], identity[:ssid].to_s].join('-')
-            else
-                return identity[:callsign]
-            end
-        end
-
-        private
-        def self.encode_frame(frame)
-            enc_frame = encode_callsign(parse_identity_string(frame.destination.to_s)) + encode_callsign(parse_identity_string(frame.source.to_s))
-
-            frame.path.each do |hop|
-                enc_frame += encode_callsign(parse_identity_string(hop.to_s))
-            end
-
-            return enc_frame[0...-1] + [enc_frame[-1] | 0x01] + [Kiss::SLOT_TIME] + [0xf0] + frame.payload.chars.map { |c| c.ord }
-        end
-
-        private
-        def self.encode_callsign(callsign)
-            call_sign = callsign[:callsign]
-
-            enc_ssid = (callsign[:ssid] << 1) | 0x60
-
-            if call_sign.include? '*'
-                call_sign.gsub!(/\*/, '')
-                enc_ssid |= 0x80
-            end
-
-            while call_sign.length < 6
-                call_sign = [call_sign, ' '].join
-            end
-
-            return call_sign.chars.map { |p| p.ord << 1 } + [enc_ssid]
-        end
-
-        private
-        def self.parse_identity_string(identity_string)
-            # If we are parsing a spent token then first lets get rid of the astresick suffix.
-            if identity_string[-1] == '*'
-                identity_string = identity_string[0..-1]
-            end
-
-            if identity_string.include? '-'
-                call_sign, ssid = identity_string.split('-')
-            else
-                call_sign = identity_string
-                ssid = 0
-            end
-
-            return {:callsign => call_sign, :ssid => ssid.to_i}
-        end
+        # private
+        # def self.decode_frame(raw_frame)
+        #     frame_len = raw_frame.length
+        #
+        #     if frame_len > 16
+        #         (0...frame_len - 2).each do |raw_slice|
+        #             # Is address field length correct?
+        #             if raw_frame[raw_slice] & 0x01 != 0 and ((raw_slice + 1) % 7) == 0
+        #                 i = (raw_slice.to_f + 1.0) / 7.0
+        #                 # Less than 2 callsigns?
+        #                 if 1.0 < i and i < 11.0
+        #                     if raw_frame[raw_slice + 1] & 0x03 == 0x03 and [0xf0, 0xcf].include? raw_frame[raw_slice + 2]
+        #                         payload_as_array = raw_frame[raw_slice + 3..-1].map { |b| b.chr }
+        #                         payload = payload_as_array.join
+        #                         destination = Apex::Frame::Entity.from_raw(identity_as_string(extract_callsign(raw_frame)))
+        #                         source = Apex::Frame::Entity.from_raw(identity_as_string(extract_callsign(raw_frame[7..-1])))
+        #                         path = extract_path(i.to_i, raw_frame)
+        #                         return Apex::Frame::Frame.new(source, destination, path, payload)
+        #                     end
+        #                 end
+        #             end
+        #         end
+        #     end
+        #     return nil
+        # end
+        #
+        # private
+        # def self.valid_frame(raw_frame)
+        #     frame_len = raw_frame.length
+        #
+        #     if frame_len > 16
+        #         (0...frame_len - 2).each do |raw_slice|
+        #             # Is address field length correct?
+        #             if raw_frame[raw_slice] & 0x01 != 0 and ((raw_slice + 1) % 7) == 0
+        #                 i = (raw_slice.to_f + 1.0) / 7.0
+        #                 # Less than 2 callsigns?
+        #                 if 1.0 < i and i < 11.0
+        #                     if raw_frame[raw_slice + 1] & 0x03 == 0x03 and [0xf0, 0xcf].include? raw_frame[raw_slice + 2]
+        #                         return true
+        #                     end
+        #                 end
+        #             end
+        #         end
+        #     end
+        #     return false
+        # end
+
+        # private
+        # def self.extract_path(start, raw_frame)
+        #     full_path = []
+        #
+        #     (2...start).each do |i|
+        #         path = identity_as_string(extract_callsign(raw_frame[i * 7..-1]))
+        #         if path and path.length > 0
+        #             if raw_frame[i * 7 + 6] & 0x80 != 0
+        #                 full_path << [path, '*'].join
+        #             else
+        #                 full_path << path
+        #             end
+        #         end
+        #     end
+        #     return Apex::Frame::Path.from_raw(full_path)
+        # end
+
+        # private
+        # def self.extract_callsign(raw_frame)
+        #     callsign_as_array = raw_frame[0...6].map { |x| (x >> 1).chr }
+        #     callsign = callsign_as_array.join.strip
+        #     ssid = (raw_frame[6] >> 1) & 0x0f
+        #     ssid = (ssid == nil or ssid == 0 ? nil : ssid)
+        #     return {:callsign => callsign, :ssid => ssid}
+        # end
+
+        # private
+        # def self.identity_as_string(identity)
+        #     if identity[:ssid] and identity[:ssid] > 0
+        #         return [identity[:callsign], identity[:ssid].to_s].join('-')
+        #     else
+        #         return identity[:callsign]
+        #     end
+        # end
+
+        # private
+        # def self.encode_frame(frame)
+        #     enc_frame = encode_callsign(parse_identity_string(frame.destination.to_s)) + encode_callsign(parse_identity_string(frame.source.to_s))
+        #
+        #     frame.path.each do |hop|
+        #         enc_frame += encode_callsign(parse_identity_string(hop.to_s))
+        #     end
+        #
+        #     return enc_frame[0...-1] + [enc_frame[-1] | 0x01] + [Kiss::SLOT_TIME] + [0xf0] + frame.payload.chars.map { |c| c.ord }
+        # end
+
+        # private
+        # def self.encode_callsign(callsign)
+        #     call_sign = callsign[:callsign]
+        #
+        #     enc_ssid = (callsign[:ssid] << 1) | 0x60
+        #
+        #     if call_sign.include? '*'
+        #         call_sign.gsub!(/\*/, '')
+        #         enc_ssid |= 0x80
+        #     end
+        #
+        #     while call_sign.length < 6
+        #         call_sign = [call_sign, ' '].join
+        #     end
+        #
+        #     return call_sign.chars.map { |p| p.ord << 1 } + [enc_ssid]
+        # end
+
+        # private
+        # def self.parse_identity_string(identity_string)
+        #     # If we are parsing a spent token then first lets get rid of the astresick suffix.
+        #     if identity_string[-1] == '*'
+        #         identity_string = identity_string[0..-1]
+        #     end
+        #
+        #     if identity_string.include? '-'
+        #         call_sign, ssid = identity_string.split('-')
+        #     else
+        #         call_sign = identity_string
+        #         ssid = 0
+        #     end
+        #
+        #     return {:callsign => call_sign, :ssid => ssid.to_i}
+        # end
 
         public
         def connect(*args, **kwargs)
@@ -150,24 +150,24 @@ module Apex
 
         public
         def read(*args, **kwargs)
-            @lock.synchronize do
-                frame = @data_stream.read(*args, **kwargs)
-                if frame and frame.length > 0
-                    return AprsKiss.decode_frame(frame)
-                else
-                    return nil
-                end
-            end
+            # @lock.synchronize do
+            #     frame = @data_stream.read(*args, **kwargs)
+            #     if frame and frame.length > 0
+            #         return AprsKiss.decode_frame(frame)
+            #     else
+            #         return nil
+            #     end
+            # end
         end
 
         public
         def write(frame, *args, **kwargs)
-            @lock.synchronize do
-                encoded_frame = AprsKiss.encode_frame(frame)
-                if AprsKiss.valid_frame(encoded_frame)
-                  @data_stream.write(encoded_frame, *args, **kwargs)
-                end
-            end
+            # @lock.synchronize do
+            #     encoded_frame = AprsKiss.encode_frame(frame)
+            #     if AprsKiss.valid_frame(encoded_frame)
+            #       @data_stream.write(encoded_frame, *args, **kwargs)
+            #     end
+            # end
         end
     end
 end
diff --git a/test/tc_frame.rb b/test/tc_frame.rb
deleted file mode 100644
index 15256a8..0000000
--- a/test/tc_frame.rb
+++ /dev/null
@@ -1,125 +0,0 @@
-# require 'test/unit'
-# require_relative '../lib/apex/frame'
-#
-# module Apex
-#   BASE_FRAME = Apex::Frame.new(
-#       'WI2ARD-1',
-#       'OMG',
-#       ['WIDE2-2' 'WIDE1-1'],
-#       'payload goes here'
-#   )
-#
-#   SAME_BASE_FRAME = Apex::Frame.new(
-#       'WI2ARD-1',
-#       'OMG',
-#       ['WIDE2-2' 'WIDE1-1'],
-#       'payload goes here'
-#   )
-#
-#   DIFF_PATH_FRAME = Apex::Frame.new(
-#       'WI2ARD-1',
-#       'OMG',
-#       ['WIDE2-1' 'WIDE1-1'],
-#       'payload goes here'
-#   )
-#
-#   DIFF_SOURCE_FRAME = Apex::Frame.new(
-#       'WI2ARD-2',
-#       'OMG',
-#       ['WIDE2-2' 'WIDE1-1'],
-#       'payload goes here'
-#   )
-#
-#   DIFF_DEST_FRAME = Apex::Frame.new(
-#       'WI2ARD-1',
-#       'LOL',
-#       ['WIDE2-2' 'WIDE1-1'],
-#       'payload goes here'
-#   )
-#
-#   DIFF_PAYLOAD_FRAME = Apex::Frame.new(
-#       'WI2ARD-1',
-#       'OMG',
-#       ['WIDE2-2' 'WIDE1-1'],
-#       'totally different payload here'
-#   )
-#
-#   class TestFrame < Test::Unit::TestCase
-#     def test_self_frame
-#       assert BASE_FRAME.eql? BASE_FRAME
-#       assert BASE_FRAME.hash.eql? BASE_FRAME.hash
-#     end
-#
-#     def test_same_frame
-#       assert BASE_FRAME.eql? SAME_BASE_FRAME
-#       assert BASE_FRAME.hash.eql? SAME_BASE_FRAME.hash
-#     end
-#
-#     def test_same_frame_path_agnostic
-#       agnostic_frame = BASE_FRAME.path_agnostic_identity
-#       agnostic_other_frame = SAME_BASE_FRAME.path_agnostic_identity
-#       assert agnostic_frame.eql? agnostic_other_frame
-#       assert agnostic_frame.hash.eql? agnostic_other_frame.hash
-#     end
-#
-#     def test_diff_path_frame
-#       assert (not BASE_FRAME.eql? DIFF_PATH_FRAME)
-#       assert (not BASE_FRAME.hash.eql? DIFF_PATH_FRAME.hash)
-#     end
-#
-#     def test_diff_path_frame_path_agnostic
-#       agnostic_frame = BASE_FRAME.path_agnostic_identity
-#       agnostic_other_frame = DIFF_PATH_FRAME.path_agnostic_identity
-#       assert agnostic_frame.eql? agnostic_other_frame
-#       assert agnostic_frame.hash.eql? agnostic_other_frame.hash
-#     end
-#
-#     def test_diff_source_frame
-#       assert (not BASE_FRAME.eql? DIFF_SOURCE_FRAME)
-#       assert (not BASE_FRAME.hash.eql? DIFF_SOURCE_FRAME.hash)
-#     end
-#
-#     def test_diff_source_frame_path_agnostic
-#       agnostic_frame = BASE_FRAME.path_agnostic_identity
-#       agnostic_other_frame = DIFF_SOURCE_FRAME.path_agnostic_identity
-#       assert (not agnostic_frame.eql? agnostic_other_frame)
-#       assert (not agnostic_frame.hash.eql? agnostic_other_frame.hash)
-#     end
-#
-#     def test_diff_dest_frame
-#       assert (not BASE_FRAME.eql? DIFF_DEST_FRAME)
-#       assert (not BASE_FRAME.hash.eql? DIFF_DEST_FRAME.hash)
-#     end
-#
-#     def test_diff_dest_frame_path_agnostic
-#       agnostic_frame = BASE_FRAME.path_agnostic_identity
-#       agnostic_other_frame = DIFF_DEST_FRAME.path_agnostic_identity
-#       assert (not agnostic_frame.eql? agnostic_other_frame)
-#       assert (not agnostic_frame.hash.eql? agnostic_other_frame.hash)
-#     end
-#
-#     def test_diff_payload_frame
-#       assert (not BASE_FRAME.eql? DIFF_PAYLOAD_FRAME)
-#       assert (not BASE_FRAME.hash.eql? DIFF_PAYLOAD_FRAME.hash)
-#     end
-#
-#     def test_diff_payload_frame_path_agnostic
-#       agnostic_frame = BASE_FRAME.path_agnostic_identity
-#       agnostic_other_frame = DIFF_PAYLOAD_FRAME.path_agnostic_identity
-#       assert (not agnostic_frame.eql? agnostic_other_frame)
-#       assert (not agnostic_frame.hash.eql? agnostic_other_frame.hash)
-#     end
-#
-#     def test_bad_type
-#       assert_raise ArgumentError do
-#         BASE_FRAME.eql? BASE_FRAME.path_agnostic_identity
-#       end
-#     end
-#
-#     def test_bad_type_agnostic
-#       assert_raise ArgumentError do
-#         BASE_FRAME.path_agnostic_identity.eql? BASE_FRAME
-#       end
-#     end
-#   end
-# end
-- 
GitLab