From ef74ee876422d7d8195fcf67aab154d8c1305187 Mon Sep 17 00:00:00 2001 From: Kevin Olbrich <22176+olbrich@users.noreply.github.com> Date: Fri, 27 Dec 2024 13:24:52 -0500 Subject: [PATCH] Update dependencies 2024-12-27 and add Ruby 3.4 support to test matrix (#370) --- .github/workflows/tests.yml | 2 +- Gemfile | 4 ++ Gemfile.lock | 74 +++++++++++++++++++++--------------- lib/ruby_units/definition.rb | 8 ++-- lib/ruby_units/unit.rb | 2 +- ruby-units.gemspec | 36 +++++++++--------- spec/ruby_units/unit_spec.rb | 2 +- 7 files changed, 72 insertions(+), 56 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b04f40e..236c1e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['3.1', '3.2', '3.3', 'jruby-9.4'] + ruby: ['3.1', '3.2', '3.3', '3.4', 'jruby-9.4'] env: BUNDLE_WITHOUT: optional steps: diff --git a/Gemfile b/Gemfile index 08a3cd4..04e63f5 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ source "https://rubygems.org" # The CI process will not install them. group :optional do gem "debug", ">= 1.0.0", platform: :mri + gem "gem-ctags" gem "guard-rspec" gem "pry" gem "redcarpet", platform: :mri # redcarpet doesn't support jruby @@ -21,6 +22,9 @@ group :optional do gem "webrick" end +gem "bigdecimal" +gem "rake" +gem "rspec", "~> 3.0" gem "simplecov" gem "yard" diff --git a/Gemfile.lock b/Gemfile.lock index ed41cd9..7308734 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,8 +9,12 @@ GEM ast (2.4.2) backport (1.2.0) benchmark (0.4.0) + bigdecimal (3.1.9) + bigdecimal (3.1.9-java) coderay (1.1.3) - debug (1.9.2) + date (3.4.1) + date (3.4.1-java) + debug (1.10.0) irb (~> 1.10) reline (>= 0.3.8) diff-lcs (1.5.1) @@ -21,6 +25,7 @@ GEM ffi (1.17.0-x86_64-darwin) ffi (1.17.0-x86_64-linux-gnu) formatador (1.1.0) + gem-ctags (1.0.9) guard (2.19.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) @@ -35,16 +40,16 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - io-console (0.7.2) - io-console (0.7.2-java) - irb (1.14.1) + io-console (0.8.0) + io-console (0.8.0-java) + irb (1.14.3) rdoc (>= 4.0.0) reline (>= 0.4.2) - jar-dependencies (0.4.1) + jar-dependencies (0.5.1) jaro_winkler (1.6.0) jaro_winkler (1.6.0-java) - json (2.8.2) - json (2.8.2-java) + json (2.9.1) + json (2.9.1-java) kramdown (2.5.1) rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) @@ -56,13 +61,13 @@ GEM lumberjack (1.2.10) method_source (1.1.0) nenv (0.3.0) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.18.0-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-java) + nokogiri (1.18.0-java) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.18.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.0-x86_64-linux-gnu) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -71,16 +76,18 @@ GEM parser (3.3.6.0) ast (~> 2.4.1) racc - pry (0.15.0) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - pry (0.15.0-java) + pry (0.15.2-java) coderay (~> 1.1) method_source (~> 1.0) spoon (~> 0.0) - psych (5.2.0) + psych (5.2.2) + date stringio - psych (5.2.0-java) + psych (5.2.2-java) + date jar-dependencies (>= 0.1.7) racc (1.8.1) racc (1.8.1-java) @@ -90,15 +97,15 @@ GEM rb-inotify (0.11.1) ffi (~> 1.0) rbs (2.8.4) - rdoc (6.8.1) + rdoc (6.10.0) psych (>= 4.0.0) redcarpet (3.6.0) - regexp_parser (2.9.2) - reline (0.5.11) + regexp_parser (2.10.0) + reline (0.6.0) io-console (~> 0.5) reverse_markdown (2.1.1) nokogiri - rexml (3.3.9) + rexml (3.4.0) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -111,24 +118,24 @@ GEM rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.1) - rubocop (1.68.0) + rspec-support (3.13.2) + rubocop (1.69.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.36.1) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) parser (>= 3.3.1.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (3.2.0) + rubocop-rspec (3.3.0) rubocop (~> 1.61) - ruby-maven (3.9.2) + ruby-maven (3.9.3) ruby-maven-libs (~> 3.9.9) ruby-maven-libs (3.9.9) ruby-prof (1.7.1) @@ -162,15 +169,18 @@ GEM terminal-notifier (2.0.0) terminal-notifier-guard (1.7.0) thor (1.3.2) - tilt (2.4.0) - unicode-display_width (2.6.0) - webrick (1.9.0) + tilt (2.5.0) + unicode-display_width (3.1.3) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + webrick (1.9.1) yard (0.9.37) PLATFORMS arm64-darwin-21 arm64-darwin-22 arm64-darwin-23 + arm64-darwin-24 java universal-java-11 universal-java-18 @@ -178,7 +188,9 @@ PLATFORMS x86_64-linux DEPENDENCIES + bigdecimal debug (>= 1.0.0) + gem-ctags guard-rspec pry rake @@ -199,4 +211,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.5.18 + 2.6.2 diff --git a/lib/ruby_units/definition.rb b/lib/ruby_units/definition.rb index 1b7a20e..793b4c5 100644 --- a/lib/ruby_units/definition.rb +++ b/lib/ruby_units/definition.rb @@ -93,10 +93,10 @@ def unity? # units are base units if the scalar is one, and the unit is defined in terms of itself. # @return [Boolean] def base? - (denominator == RubyUnits::Unit::UNITY_ARRAY) && - (numerator != RubyUnits::Unit::UNITY_ARRAY) && - (numerator.size == 1) && - (scalar == 1) && + (denominator == RubyUnits::Unit::UNITY_ARRAY) && + (numerator != RubyUnits::Unit::UNITY_ARRAY) && + (numerator.size == 1) && + (scalar == 1) && (numerator.first == self.name) end end diff --git a/lib/ruby_units/unit.rb b/lib/ruby_units/unit.rb index 58009e5..5de4930 100644 --- a/lib/ruby_units/unit.rb +++ b/lib/ruby_units/unit.rb @@ -397,7 +397,7 @@ def self.temp_regex temp_units = %w[tempK tempC tempF tempR degK degC degF degR] aliases = temp_units.map do |unit| d = definition(unit) - d && d.aliases + d&.aliases end.flatten.compact regex_str = aliases.empty? ? "(?!x)x" : aliases.join("|") Regexp.new "(?:#{regex_str})" diff --git a/ruby-units.gemspec b/ruby-units.gemspec index 409d3b0..3983ad8 100644 --- a/ruby-units.gemspec +++ b/ruby-units.gemspec @@ -1,31 +1,31 @@ -lib = File.expand_path('lib', __dir__) +# frozen_string_literal: true + +lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'ruby_units/version' +require "ruby_units/version" Gem::Specification.new do |spec| - spec.name = 'ruby-units' + spec.name = "ruby-units" spec.version = RubyUnits::Unit::VERSION - spec.authors = ['Kevin Olbrich'] - spec.email = ['kevin.olbrich@gmail.com'] + spec.authors = ["Kevin Olbrich"] + spec.email = ["kevin.olbrich@gmail.com"] - spec.required_rubygems_version = '>= 2.0' - spec.required_ruby_version = '>= 2.7' - spec.summary = 'Provides classes and methods to perform unit math and conversions' - spec.description = 'Provides classes and methods to perform unit math and conversions' - spec.homepage = 'https://github.com/olbrich/ruby-units' - spec.license = 'MIT' + spec.required_rubygems_version = ">= 2.0" + spec.required_ruby_version = ">= 2.7" + spec.summary = "Provides classes and methods to perform unit math and conversions" + spec.description = "Provides classes and methods to perform unit math and conversions" + spec.homepage = "https://github.com/olbrich/ruby-units" + spec.license = "MIT" - spec.metadata['homepage_uri'] = spec.homepage - spec.metadata['source_code_uri'] = 'https://github.com/olbrich/ruby-units' - spec.metadata['changelog_uri'] = 'https://github.com/olbrich/ruby-units/releases' + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "https://github.com/olbrich/ruby-units" + spec.metadata["changelog_uri"] = "https://github.com/olbrich/ruby-units/releases" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. spec.files = Dir.chdir(File.expand_path(__dir__)) do `git ls-files -z`.split("\x0").reject { _1.match(%r{^(test|spec|features)/}) } end - spec.require_paths = ['lib'] - - spec.add_development_dependency 'rake' - spec.add_development_dependency 'rspec', '~> 3.0' + spec.require_paths = ["lib"] + spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/spec/ruby_units/unit_spec.rb b/spec/ruby_units/unit_spec.rb index 068700b..d919231 100644 --- a/spec/ruby_units/unit_spec.rb +++ b/spec/ruby_units/unit_spec.rb @@ -2125,7 +2125,7 @@ end context RubyUnits::Unit.new("1 m") do - it { expect(subject**0).to eq(1) } + it { expect(subject**0).to eq(1) } # rubocop:disable Lint/NumericOperationWithConstantResult it { expect(subject**1).to eq(subject) } # rubocop:disable Lint/UselessNumericOperation it { expect(subject**-1).to eq(1 / subject) } it { expect(subject**2).to eq(RubyUnits::Unit.new("1 m^2")) }