Commit 469b659

mokha <mo@mokhan.ca>
2019-04-30 19:49:31
drop support for unsupported rubies
1 parent 9de1a62
lib/xml/kit/crypto/oaep_cipher.rb
@@ -4,7 +4,7 @@ module Xml
   module Kit
     module Crypto
       class OaepCipher
-        ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-oaep-mgf1p".freeze
+        ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-oaep-mgf1p"
         ALGORITHMS = {
           ALGORITHM => true
         }.freeze
lib/xml/kit/crypto/rsa_cipher.rb
@@ -4,7 +4,7 @@ module Xml
   module Kit
     module Crypto
       class RsaCipher
-        ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5".freeze
+        ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5"
         attr_reader :algorithm, :key
 
         def initialize(algorithm, key)
lib/xml/kit/crypto/symmetric_cipher.rb
@@ -4,7 +4,7 @@ module Xml
   module Kit
     module Crypto
       class SymmetricCipher
-        DEFAULT_ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc".freeze
+        DEFAULT_ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc"
         ALGORITHMS = {
           "#{::Xml::Kit::Namespaces::XMLENC}tripledes-cbc" => 'DES-EDE3-CBC',
           "#{::Xml::Kit::Namespaces::XMLENC}aes128-cbc" => 'AES-128-CBC',
lib/xml/kit/key_info/key_value.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Xml
   module Kit
     class KeyInfo
lib/xml/kit/key_info/retrieval_method.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Xml
   module Kit
     class KeyInfo
lib/xml/kit/key_info/rsa_key_value.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Xml
   module Kit
     class KeyInfo
lib/xml/kit/namespaces.rb
@@ -3,18 +3,18 @@
 module Xml
   module Kit
     module Namespaces
-      CANONICALIZATION = 'http://www.w3.org/2001/10/xml-exc-c14n#'.freeze
-      ENVELOPED_SIG = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'.freeze
-      RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'.freeze
-      RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'.freeze
-      RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'.freeze
-      RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'.freeze
-      SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1'.freeze
-      SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'.freeze
-      SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384'.freeze
-      SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'.freeze
-      XMLDSIG = 'http://www.w3.org/2000/09/xmldsig#'.freeze
-      XMLENC = 'http://www.w3.org/2001/04/xmlenc#'.freeze
+      CANONICALIZATION = 'http://www.w3.org/2001/10/xml-exc-c14n#'
+      ENVELOPED_SIG = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
+      RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
+      RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
+      RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'
+      RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'
+      SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1'
+      SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'
+      SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384'
+      SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'
+      XMLDSIG = 'http://www.w3.org/2000/09/xmldsig#'
+      XMLENC = 'http://www.w3.org/2001/04/xmlenc#'
     end
   end
 end
lib/xml/kit/self_signed_certificate.rb
@@ -3,7 +3,7 @@
 module Xml
   module Kit
     class SelfSignedCertificate
-      SUBJECT = '/C=CA/ST=AB/L=Calgary/O=XmlKit/OU=XmlKit/CN=XmlKit'.freeze
+      SUBJECT = '/C=CA/ST=AB/L=Calgary/O=XmlKit/OU=XmlKit/CN=XmlKit'
 
       def create(algorithm: 'AES-256-CBC',
                  passphrase: nil,
lib/xml/kit/version.rb
@@ -2,6 +2,6 @@
 
 module Xml
   module Kit
-    VERSION = '0.3.1'.freeze
+    VERSION = '0.3.1'
   end
 end
spec/xml/kit/crypto/symmetric_cipher_spec.rb
@@ -37,8 +37,8 @@ RSpec.describe ::Xml::Kit::Crypto::SymmetricCipher do
               "openssl enc -#{openssl_algorithm} -p -e -A -nosalt",
               "-in #{original_file}",
               "-out #{encrypted_file}",
-              "-K #{key.unpack('H*')[0].upcase}",
-              "-iv #{iv.unpack('H*')[0].upcase}"
+              "-K #{key.unpack1('H*').upcase}",
+              "-iv #{iv.unpack1('H*').upcase}"
             ].join(' '))
           end
 
@@ -55,8 +55,8 @@ RSpec.describe ::Xml::Kit::Crypto::SymmetricCipher do
               "openssl enc -#{openssl_algorithm} -p -e -A -nosalt",
               "-in #{original_file}",
               "-out #{encrypted_file}",
-              "-K #{key.unpack('H*')[0].upcase}",
-              "-iv #{iv.unpack('H*')[0].upcase}"
+              "-K #{key.unpack1('H*').upcase}",
+              "-iv #{iv.unpack1('H*').upcase}"
             ].join(' '))
           end
 
@@ -80,8 +80,8 @@ RSpec.describe ::Xml::Kit::Crypto::SymmetricCipher do
             "openssl enc -#{openssl_algorithm} -p -d -nosalt",
             "-in #{encrypted_file}",
             "-out #{decrypted_file}",
-            "-K #{key.unpack('H*')[0].upcase}",
-            "-iv #{iv.unpack('H*')[0].upcase}"
+            "-K #{key.unpack1('H*').upcase}",
+            "-iv #{iv.unpack1('H*').upcase}"
           ].join(' '))
         end
 
.rubocop.yml
@@ -9,7 +9,7 @@ AllCops:
     - 'spec/fixtures/**/*'
     - 'tmp/**/*'
     - 'vendor/**/*'
-  TargetRubyVersion: 2.2
+  TargetRubyVersion: 2.4
 
 Layout/ClassStructure:
   Enabled: true
.travis.yml
@@ -1,11 +1,9 @@
 sudo: false
 language: ruby
 rvm:
-  - 2.2.10
-  - 2.3.8
   - 2.4.6
   - 2.5.5
-  - 2.6.2
+  - 2.6.3
 script:
   - bin/cibuild
   - bin/lint
CHANGELOG.md
@@ -1,4 +1,5 @@
 Version 0.3.1
+
 # Changelog
 All notable changes to this project will be documented in this file.
 
@@ -7,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 ### Changed
-- nil
+- drop support for ruby 2.2
+- drop support for ruby 2.3
 
 ## [0.3.1] - 2019-04-01
 ### Changed
Gemfile.lock
@@ -53,7 +53,7 @@ GEM
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.8.0)
     rspec-support (3.8.0)
-    rubocop (0.68.0)
+    rubocop (0.68.1)
       jaro_winkler (~> 1.5.1)
       parallel (~> 1.10)
       parser (>= 2.5, != 2.5.1.1)
xml-kit.gemspec
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
   spec.description   = 'A simple toolkit for working with XML.'
   spec.homepage      = 'https://github.com/saml-kit/xml-kit'
   spec.license       = 'MIT'
-  spec.required_ruby_version = '>= 2.2.0'
+  spec.required_ruby_version = '~> 2.4'
 
   spec.files = `git ls-files -z`.split("\x0").reject do |f|
     f.match(%r{^(test|spec|features)/})