From 522fdcf17245b38f7256a5960e476829744f8250 Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Fri, 4 Jun 2021 12:15:40 -0700 Subject: [PATCH] Use gem-tool for CI, Appraise Ruby 2.7.1 and Rails 6.1, remove support for DSS1 --- .circleci/config.yml | 24 ++++++-------- .ruby-version | 2 +- Appraisals | 14 +++++--- Gemfile | 4 +-- Rakefile | 2 +- gemfiles/ruby_2.5.3_rails521.gemfile | 15 --------- gemfiles/ruby_2.6.3_rails521.gemfile | 15 --------- gemfiles/ruby_2.6.3_rails60.gemfile | 15 +++++++++ gemfiles/ruby_2.6.3_rails61.gemfile | 15 +++++++++ gemfiles/ruby_2.7.1_rails60.gemfile | 15 +++++++++ gemfiles/ruby_2.7.1_rails61.gemfile | 15 +++++++++ lib/ezcrypto.rb | 2 +- lib/ezsig.rb | 10 ++++-- test/dsig_test.rb | 48 ++++++++++++++++------------ test/ezcrypto_test.rb | 7 ++-- 15 files changed, 122 insertions(+), 81 deletions(-) delete mode 100644 gemfiles/ruby_2.5.3_rails521.gemfile delete mode 100644 gemfiles/ruby_2.6.3_rails521.gemfile create mode 100644 gemfiles/ruby_2.6.3_rails60.gemfile create mode 100644 gemfiles/ruby_2.6.3_rails61.gemfile create mode 100644 gemfiles/ruby_2.7.1_rails60.gemfile create mode 100644 gemfiles/ruby_2.7.1_rails61.gemfile diff --git a/.circleci/config.yml b/.circleci/config.yml index b5f45b4..979f6f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,16 @@ version: 2.1 -commands: - bundle_install_and_test: - steps: - - checkout - - run: sudo gem update --system - - run: bundle install - - run: bundle exec appraisal install - - run: bundle exec appraisal rake test -jobs: - test-ruby-263: - docker: - - image: circleci/ruby:2.6.3 - steps: - - bundle_install_and_test +orbs: + gem-tool: appfolio/gem-tool@volatile workflows: rc: jobs: - - test-ruby-263: + - gem-tool/checkout_bundle_install_appraisal_rake_test: + name: test-ruby-271 context: appfolio_test_context + executor_tag: gem-tool/ruby_base_271 + - gem-tool/checkout_bundle_install_appraisal_rake_test: + name: test-ruby-263 + context: appfolio_test_context + executor_tag: gem-tool/ruby_base_263 diff --git a/.ruby-version b/.ruby-version index 4560fb9..bff6ce5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.6.3 +ruby-2.7.1 diff --git a/Appraisals b/Appraisals index baf2a07..64f3820 100644 --- a/Appraisals +++ b/Appraisals @@ -1,12 +1,16 @@ # frozen_string_literal: true case RUBY_VERSION -when '2.6.3' then - appraise "ruby-#{RUBY_VERSION}_rails522" do - gem 'rails', '~> 5.2.2' +when '2.6.3', '2.7.1' then + appraise "ruby-#{RUBY_VERSION}_rails60" do + source 'https://rubygems.org' do + gem 'rails', '~> 6.0.0' + end end - appraise "ruby-#{RUBY_VERSION}_rails6" do - gem 'rails', '~> 6.0.0' + appraise "ruby-#{RUBY_VERSION}_rails61" do + source 'https://rubygems.org' do + gem 'rails', '~> 6.1.0' + end end else raise "Unsupported Ruby version #{RUBY_VERSION}" diff --git a/Gemfile b/Gemfile index f098987..ef03201 100644 --- a/Gemfile +++ b/Gemfile @@ -7,8 +7,8 @@ source 'https://rubygems.org' do end source 'https://rubygems.pkg.github.com/appfolio' do - gem 'af_gems', '>= 9', '< 10', group: :development - gem 'af_testing', '>= 14', '< 15' + gem 'af_gems', '>= 9.2', '< 10', group: :development + gem 'af_testing', '>= 14.4', '< 15' end gemspec diff --git a/Rakefile b/Rakefile index 5ca730a..a592ff1 100644 --- a/Rakefile +++ b/Rakefile @@ -20,7 +20,7 @@ Rake::TestTask.new(:test) do |test| end namespace :test do - AfGems::RubyAppraisalTask.new(:all, ['ruby-2.6.3']) + AfGems::RubyAppraisalTask.new(:all, ['ruby-2.6.3', 'ruby-2.7.1']) end task default: :test diff --git a/gemfiles/ruby_2.5.3_rails521.gemfile b/gemfiles/ruby_2.5.3_rails521.gemfile deleted file mode 100644 index f271bc1..0000000 --- a/gemfiles/ruby_2.5.3_rails521.gemfile +++ /dev/null @@ -1,15 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "5.2.1" - -group :development, :test do - gem "minitest", "~> 5.8" -end - -source "https://gemini.atl.appfolio.net" do - gem "af_gems", "~> 7.1" -end - -gemspec path: "../" diff --git a/gemfiles/ruby_2.6.3_rails521.gemfile b/gemfiles/ruby_2.6.3_rails521.gemfile deleted file mode 100644 index f271bc1..0000000 --- a/gemfiles/ruby_2.6.3_rails521.gemfile +++ /dev/null @@ -1,15 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "5.2.1" - -group :development, :test do - gem "minitest", "~> 5.8" -end - -source "https://gemini.atl.appfolio.net" do - gem "af_gems", "~> 7.1" -end - -gemspec path: "../" diff --git a/gemfiles/ruby_2.6.3_rails60.gemfile b/gemfiles/ruby_2.6.3_rails60.gemfile new file mode 100644 index 0000000..d15388c --- /dev/null +++ b/gemfiles/ruby_2.6.3_rails60.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" do + gem "minitest", ">= 5.8", "< 6" + gem "minitest-reporters", ">= 1.4", "< 2" + gem "simplecov", ">= 0.18", "< 1", group: :test, require: false + gem "rails", "~> 6.0.0" +end + +source "https://rubygems.pkg.github.com/appfolio" do + gem "af_gems", ">= 9.2", "< 10", group: :development + gem "af_testing", ">= 14.4", "< 15" +end + +gemspec path: "../" diff --git a/gemfiles/ruby_2.6.3_rails61.gemfile b/gemfiles/ruby_2.6.3_rails61.gemfile new file mode 100644 index 0000000..885b114 --- /dev/null +++ b/gemfiles/ruby_2.6.3_rails61.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" do + gem "minitest", ">= 5.8", "< 6" + gem "minitest-reporters", ">= 1.4", "< 2" + gem "simplecov", ">= 0.18", "< 1", group: :test, require: false + gem "rails", "~> 6.1.0" +end + +source "https://rubygems.pkg.github.com/appfolio" do + gem "af_gems", ">= 9.2", "< 10", group: :development + gem "af_testing", ">= 14.4", "< 15" +end + +gemspec path: "../" diff --git a/gemfiles/ruby_2.7.1_rails60.gemfile b/gemfiles/ruby_2.7.1_rails60.gemfile new file mode 100644 index 0000000..d15388c --- /dev/null +++ b/gemfiles/ruby_2.7.1_rails60.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" do + gem "minitest", ">= 5.8", "< 6" + gem "minitest-reporters", ">= 1.4", "< 2" + gem "simplecov", ">= 0.18", "< 1", group: :test, require: false + gem "rails", "~> 6.0.0" +end + +source "https://rubygems.pkg.github.com/appfolio" do + gem "af_gems", ">= 9.2", "< 10", group: :development + gem "af_testing", ">= 14.4", "< 15" +end + +gemspec path: "../" diff --git a/gemfiles/ruby_2.7.1_rails61.gemfile b/gemfiles/ruby_2.7.1_rails61.gemfile new file mode 100644 index 0000000..885b114 --- /dev/null +++ b/gemfiles/ruby_2.7.1_rails61.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" do + gem "minitest", ">= 5.8", "< 6" + gem "minitest-reporters", ">= 1.4", "< 2" + gem "simplecov", ">= 0.18", "< 1", group: :test, require: false + gem "rails", "~> 6.1.0" +end + +source "https://rubygems.pkg.github.com/appfolio" do + gem "af_gems", ">= 9.2", "< 10", group: :development + gem "af_testing", ">= 14.4", "< 15" +end + +gemspec path: "../" diff --git a/lib/ezcrypto.rb b/lib/ezcrypto.rb index e044bc7..9250c3c 100644 --- a/lib/ezcrypto.rb +++ b/lib/ezcrypto.rb @@ -122,7 +122,7 @@ def self.decrypt_with_password(password,salt,data,options = {}) =end def self.calculate_key_size(algorithm) if !algorithm.nil? - algorithm=~/^([[:alnum:]]+)(-(\d+))?/ + algorithm.to_s =~ /^([[:alnum:]]+)(-(\d+))?/ if $3 size=($3.to_i)/8 else diff --git a/lib/ezsig.rb b/lib/ezsig.rb index 7eb6f45..d8566a5 100644 --- a/lib/ezsig.rb +++ b/lib/ezsig.rb @@ -99,7 +99,9 @@ def sign(data) if rsa? @priv.sign(OpenSSL::Digest::SHA1.new,data) elsif dsa? - @priv.sign(OpenSSL::Digest::DSS1.new,data) + # DSS1 was dropped from OpenSSL in version 1.1 + # @priv.sign(OpenSSL::Digest::DSS1.new,data) + raise StandardError, 'DSA is not supported' end end @@ -186,7 +188,7 @@ def self.load_all_from_file(filename) pem="-----BEGIN#{pem}\n" cert=decode(pem) if cert.is_a? EzCrypto::Verifier - certs<