From c808e5f4493cd4d2642c9b523e78650dc08fd821 Mon Sep 17 00:00:00 2001 From: Chikahiro Tokoro Date: Fri, 15 Mar 2024 01:31:24 +0900 Subject: [PATCH] add Ruby 3.3 support (#99) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 🎸 update ruby minor version * feat: 🎸 add ruby3.3 * feat: 🎸 add circle ci build for 3.3 * feat: 🎸 fix for rubocop error * style: 💄 apply rubocop fix * docs: ✏️ add changelog --- .circleci/config.yml | 5 +++++ .ruby-version | 2 +- CHANGELOG.md | 2 ++ Dockerfile | 2 +- Dockerfile.ghcr | 2 +- Gemfile.lock | 28 ++++++++++++++++------------ README.md | 2 +- lib/masking/cli.rb | 2 +- lib/masking/insert_statement.rb | 2 +- spec/masking/cli_spec.rb | 4 ++-- spec/spec_helper.rb | 2 +- 11 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 784cbb02..54b4cd43 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,6 +18,10 @@ test_attributes: &test_attributes command: docker run --entrypoint sh -e CI -e CODECOV_TOKEN masking-$RUBY_VERSION-$CIRCLE_SHA1 -c "bundle exec rake" jobs: + test-ruby33: + <<: *test_attributes + environment: + RUBY_VERSION: '3.3' test-ruby32: <<: *test_attributes environment: @@ -42,6 +46,7 @@ jobs: workflows: 'CircleCI: build': jobs: + - test-ruby33 - test-ruby32 - test-ruby31 - test-ruby30 diff --git a/.ruby-version b/.ruby-version index e4604e3a..15a27998 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.1 +3.3.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ab61b26..f173e729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- add Ruby 3.3 support [#99](https://github.com/kibitan/masking/pull/99) + ## [v1.1.2] - 2023-09-24 ### Added diff --git a/Dockerfile b/Dockerfile index bfa75097..f508c6ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG RUBY_VERSION=3.2 +ARG RUBY_VERSION=3.3 FROM ruby:${RUBY_VERSION}-alpine AS builder RUN apk add --no-cache build-base git diff --git a/Dockerfile.ghcr b/Dockerfile.ghcr index 64721435..bc91f7e7 100644 --- a/Dockerfile.ghcr +++ b/Dockerfile.ghcr @@ -1,5 +1,5 @@ # `docker run ghcr.io/kibitan/masking` -ARG RUBY_VERSION=3.2 +ARG RUBY_VERSION=3.3 FROM ruby:$RUBY_VERSION-alpine RUN addgroup -S app && adduser -S -G app app diff --git a/Gemfile.lock b/Gemfile.lock index 9f8e2d4a..53b11f37 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,11 +17,12 @@ GEM concurrent-ruby (1.2.2) diff-lcs (1.5.0) docile (1.4.0) - json (2.6.3) + json (2.7.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) + language_server-protocol (3.17.0.3) mdl (0.12.0) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.1) @@ -34,22 +35,24 @@ GEM tomlrb mixlib-shellout (3.2.7) chef-utils - parallel (1.22.1) - parser (3.2.1.0) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) + racc pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + racc (1.7.3) rainbow (3.1.1) rake (13.0.6) rake-notes (0.2.2) colored rake - regexp_parser (2.7.0) - rexml (3.2.5) + regexp_parser (2.9.0) + rexml (3.2.6) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -63,25 +66,26 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.0) - rubocop (1.46.0) + rubocop (1.62.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.26.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.26.0) - parser (>= 3.2.1.0) + rubocop-ast (1.31.2) + parser (>= 3.3.0.4) rubocop-capybara (2.17.1) rubocop (~> 1.41) rubocop-rspec (2.18.1) rubocop (~> 1.33) rubocop-capybara (~> 2.17) ruby-prof (1.6.1) - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) @@ -92,7 +96,7 @@ GEM thor thor (1.2.1) tomlrb (2.0.3) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) PLATFORMS ruby diff --git a/README.md b/README.md index 8e528839..c96ea7b6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ gem install masking ## Requirement -* Ruby 2.6/2.7/3.0/3.1/3.2 +* Ruby 2.6/2.7/3.0/3.1/3.2/3.3 ## Supporting RDBMS diff --git a/lib/masking/cli.rb b/lib/masking/cli.rb index e0f42a34..2daeab6e 100644 --- a/lib/masking/cli.rb +++ b/lib/masking/cli.rb @@ -44,7 +44,7 @@ def define_config_option(parser) def define_version_option(parser) parser.on('-v', '--version', 'version') do puts Masking::VERSION - exit(true) + exit end end end diff --git a/lib/masking/insert_statement.rb b/lib/masking/insert_statement.rb index 26e0f4a2..1c9ef873 100644 --- a/lib/masking/insert_statement.rb +++ b/lib/masking/insert_statement.rb @@ -79,7 +79,7 @@ def values_regexp # e.g. INSERT ... VALUES (123,'string ),( abc'),(456,'ab'); # refs: implementation of parsing CSV on ruby standard library FasterCSV (ja): https://www.clear-code.com/blog/2018/12/25.html def recursive_pattern_value_concat!(value_rows, index) - return if value_rows[index].gsub(/\\\\/, '').gsub(/\\'/, '').count(?').even? + return if value_rows[index].gsub('\\\\', '').gsub("\\'", '').count(?').even? # make destructive change for values_rows value_rows[index] += VALUE_ROW_SPLITTER + value_rows.delete_at(index + 1) diff --git a/spec/masking/cli_spec.rb b/spec/masking/cli_spec.rb index 67c937c9..1dec7398 100644 --- a/spec/masking/cli_spec.rb +++ b/spec/masking/cli_spec.rb @@ -27,7 +27,7 @@ shared_examples 'print Version and exit' do it do - expect { subject }.to raise_error(SystemExit) & \ + expect { subject }.to raise_error(SystemExit) & output("#{Masking::VERSION}\n").to_stdout end @@ -75,7 +75,7 @@ shared_examples 'with errormessage and exitstatus is 1' do |error_text| it do - expect { subject }.to raise_error(SystemExit) & \ + expect { subject }.to raise_error(SystemExit) & output(error_text).to_stderr end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 147c9602..06cd512f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,7 @@ require 'tapp' require 'simplecov' -if ENV['CI'] == 'true' && \ +if ENV['CI'] == 'true' && # compare only for major/minor version of Ruby in order to enable report for Coverall Gem::Version.new(RUBY_VERSION).segments[0..1] == \ Gem::Version.new(File.read(File.join(File.dirname(__FILE__), '../.ruby-version'))).segments[0..1]