diff --git a/.dockerignore b/.dockerignore index 79d11eb..0399063 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,6 +9,7 @@ node_modules/ .gitattributes .dockerignore Dockerfile +README.md bin/ !bin/run.sh !bin/run.rb diff --git a/.ruby-version b/.ruby-version index be94e6f..8b52f98 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +ruby-4.0.3 diff --git a/Dockerfile b/Dockerfile index cef62b9..b77fb10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,22 @@ -FROM ruby:3.2.2-alpine3.18 AS build +FROM ruby:4.0.4-alpine3.23@sha256:ac9c68cd41d6a49a9138fca74aa344968e8ddb5e20d8a3b1f455b97c7148f8da AS build RUN apk update && apk upgrade && \ apk add --no-cache git openssh build-base gcc wget git -COPY Gemfile Gemfile.lock . +COPY Gemfile Gemfile.lock ./ -RUN gem install bundler:2.4.18 && \ +RUN gem install bundler:4.0.11 && \ bundle config set without 'development test' && \ bundle install -RUN bundle install - -FROM ruby:3.2.2-alpine3.18 AS runtime +FROM ruby:4.0.4-alpine3.23@sha256:ac9c68cd41d6a49a9138fca74aa344968e8ddb5e20d8a3b1f455b97c7148f8da AS runtime RUN apk add --no-cache bash -WORKDIR /opt/representer - COPY --from=build /usr/local/bundle /usr/local/bundle +WORKDIR /opt/representer + COPY . . ENTRYPOINT ["sh", "/opt/representer/bin/run.sh"] diff --git a/Gemfile b/Gemfile index 1034bfc..bf8120d 100644 --- a/Gemfile +++ b/Gemfile @@ -5,19 +5,18 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end +gem 'activesupport' gem 'json' gem 'mandate' +gem 'minitest' +gem 'minitest-stub-const' +gem 'mocha' +gem 'mutex_m' +gem 'pry' gem 'rake' - -gem 'parser' gem 'rubocop' +gem 'rubocop-ast' gem 'rubocop-minitest' gem 'rubocop-performance' - -group :test do - gem 'minitest', '~> 5.10', '!= 5.10.2' - gem 'minitest-stub-const' - gem 'mocha' - gem 'pry' - gem 'simplecov', '~> 0.17.0' -end +gem 'sexp_processor' +gem 'simplecov', '~> 0.17.0' diff --git a/Gemfile.lock b/Gemfile.lock index 1edb244..645f69a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,70 +1,115 @@ GEM remote: https://rubygems.org/ specs: - ast (2.4.2) + activesupport (8.1.3) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + ast (2.4.3) + base64 (0.3.0) + bigdecimal (4.1.2) coderay (1.1.3) - docile (1.4.0) - json (2.6.3) - mandate (0.3.0) - method_source (1.0.0) - minitest (5.19.0) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + docile (1.4.1) + drb (2.2.3) + i18n (1.14.8) + concurrent-ruby (~> 1.0) + io-console (0.8.2) + json (2.19.5) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + mandate (2.2.0) + method_source (1.1.0) + minitest (6.0.6) + drb (~> 2.0) + prism (~> 1.5) minitest-stub-const (0.6) - mocha (2.1.0) + mocha (3.1.0) ruby2_keywords (>= 0.0.5) - parallel (1.23.0) - parser (3.2.2.3) + mutex_m (0.3.0) + parallel (2.1.0) + parser (3.3.11.1) ast (~> 2.4.1) racc - pry (0.13.1) + prism (1.9.0) + pry (0.16.0) coderay (~> 1.1) method_source (~> 1.0) - racc (1.7.1) + reline (>= 0.6.0) + racc (1.8.1) rainbow (3.1.1) - rake (13.0.1) - regexp_parser (2.8.1) - rexml (3.4.2) - rubocop (1.50.2) + rake (13.4.2) + regexp_parser (2.12.0) + reline (0.6.3) + io-console (~> 0.5) + rubocop (1.86.2) json (~> 2.3) - parallel (~> 1.10) - parser (>= 3.2.0.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (>= 1.10) + 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.28.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-minitest (0.10.1) - rubocop (>= 0.87) - rubocop-performance (1.9.0) - rubocop (>= 0.90.0, < 2.0) - rubocop-ast (>= 0.4.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.1) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-minitest (0.39.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) + securerandom (0.4.1) + sexp_processor (4.17.5) simplecov (0.17.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - unicode-display_width (2.4.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + uri (1.1.1) PLATFORMS ruby DEPENDENCIES + activesupport json mandate - minitest (~> 5.10, != 5.10.2) + minitest minitest-stub-const mocha - parser + mutex_m pry rake rubocop + rubocop-ast rubocop-minitest rubocop-performance + sexp_processor simplecov (~> 0.17.0) BUNDLED WITH - 2.4.18 + 4.0.11 diff --git a/README.md b/README.md index 1231ec3..13c77e9 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,15 @@ Then, run the following command to run the tests: ```bash bundle exec rake test ``` + +## Updating Gemfile.lock + +``` +$ docker run -it --rm -v $PWD:/ruby-representer --entrypoint sh $ruby_image +apk update && apk upgrade +apk add --no-cache git openssh build-base gcc wget git +cd /ruby-representer +gem install bundler:4.0.11 +bundle config set without 'development test' +bundle update --all +``` diff --git a/lib/representer.rb b/lib/representer.rb index c2ff508..d2d4980 100644 --- a/lib/representer.rb +++ b/lib/representer.rb @@ -2,7 +2,6 @@ require 'json' require 'rubocop' require 'parser/current' -require 'pathname' require_relative 'normalizers/naming_normalizer' diff --git a/test/test_helper.rb b/test/test_helper.rb index f909b27..6495020 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -9,7 +9,6 @@ require "minitest/autorun" require 'minitest/pride' require "mocha/minitest" -require 'pathname' class Minitest::Test SAFE_WRITE_PATH = Pathname.new('/tmp/output')