From 0c13ada1f680cf5e6ebb4eeab294c0a3bdccec6b Mon Sep 17 00:00:00 2001 From: "Marcos G. Zimmermann" Date: Thu, 31 Oct 2024 13:14:21 -0300 Subject: [PATCH] add multiple gemfiles for rails --- .github/workflows/specs.yml | 23 ++- Gemfile | 2 - Gemfile.lock | 2 +- bin/setup | 1 + gemfiles/rails52.gemfile | 5 + gemfiles/rails52.gemfile.lock | 236 +++++++++++++++++++++++++++++++ gemfiles/rails61.gemfile | 5 + gemfiles/rails61.gemfile.lock | 254 ++++++++++++++++++++++++++++++++++ lepus.gemspec | 1 + lib/lepus.rb | 3 + lib/lepus/rails.rb | 5 + lib/lepus/supervisor.rb | 1 + 12 files changed, 528 insertions(+), 10 deletions(-) create mode 100644 gemfiles/rails52.gemfile create mode 100644 gemfiles/rails52.gemfile.lock create mode 100644 gemfiles/rails61.gemfile create mode 100644 gemfiles/rails61.gemfile.lock diff --git a/.github/workflows/specs.yml b/.github/workflows/specs.yml index cf4411b..b047275 100644 --- a/.github/workflows/specs.yml +++ b/.github/workflows/specs.yml @@ -7,8 +7,18 @@ on: branches: [ master ] jobs: - test: + ruby2-test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ['2.7', '3.0'] + gemfile: + - Gemfile + - gemfiles/rails61.gemfile + name: ${{ matrix.ruby }}-${{ matrix.gemfile }} + env: + BUNDLE_GEMFILE: ${{ matrix.gemfile }} services: rabbitmq: image: rabbitmq:3-management @@ -21,12 +31,11 @@ jobs: - 5672:5672 - 15672:15672 steps: - - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - bundler-cache: true + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true - name: Install dependencies run: bundle install - name: Run tests diff --git a/Gemfile b/Gemfile index 9cfface..f9c01b7 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,5 @@ source "https://rubygems.org" -gem "multi_json", "~> 1.15" - # Specify your gem's dependencies in lepus.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index 636238e..6e89bcf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,6 +4,7 @@ PATH lepus (0.0.1.beta1) bunny concurrent-ruby + multi_json zeitwerk GEM @@ -104,7 +105,6 @@ PLATFORMS DEPENDENCIES dotenv lepus! - multi_json (~> 1.15) pry rspec rubocop diff --git a/bin/setup b/bin/setup index cf4ad25..9b755f1 100755 --- a/bin/setup +++ b/bin/setup @@ -4,3 +4,4 @@ IFS=$'\n\t' set -vx bundle install +find gemfiles -type f \( -iname "*.gemfile" ! -iname "*.lock" \) -exec bundle install --gemfile {} \; diff --git a/gemfiles/rails52.gemfile b/gemfiles/rails52.gemfile new file mode 100644 index 0000000..fa488ee --- /dev/null +++ b/gemfiles/rails52.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gemspec path: ".." + +gem 'rails', '~> 5.2', '>= 5.2.8.1' diff --git a/gemfiles/rails52.gemfile.lock b/gemfiles/rails52.gemfile.lock new file mode 100644 index 0000000..2712b0a --- /dev/null +++ b/gemfiles/rails52.gemfile.lock @@ -0,0 +1,236 @@ +PATH + remote: .. + specs: + lepus (0.0.1.beta1) + bunny + concurrent-ruby + multi_json + zeitwerk + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.8.1) + actionpack (= 5.2.8.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.8.1) + actionview (= 5.2.8.1) + activesupport (= 5.2.8.1) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.8.1) + activesupport (= 5.2.8.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.8.1) + activesupport (= 5.2.8.1) + globalid (>= 0.3.6) + activemodel (5.2.8.1) + activesupport (= 5.2.8.1) + activerecord (5.2.8.1) + activemodel (= 5.2.8.1) + activesupport (= 5.2.8.1) + arel (>= 9.0) + activestorage (5.2.8.1) + actionpack (= 5.2.8.1) + activerecord (= 5.2.8.1) + marcel (~> 1.0.0) + activesupport (5.2.8.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + amq-protocol (2.3.2) + arel (9.0.0) + ast (2.4.2) + bigdecimal (3.1.8) + builder (3.3.0) + bunny (2.23.0) + amq-protocol (~> 2.3, >= 2.3.1) + sorted_set (~> 1, >= 1.0.2) + coderay (1.1.3) + concurrent-ruby (1.3.4) + crack (1.0.0) + bigdecimal + rexml + crass (1.0.6) + date (3.3.4) + diff-lcs (1.5.1) + dotenv (2.8.1) + erubi (1.13.0) + globalid (1.1.0) + activesupport (>= 5.0) + hashdiff (1.1.1) + i18n (1.14.6) + concurrent-ruby (~> 1.0) + json (2.7.5) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) + loofah (2.23.1) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.1) + multi_json (1.15.0) + net-imap (0.4.17) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4) + nokogiri (1.15.6-x86_64-linux) + racc (~> 1.4) + parallel (1.26.3) + parser (3.3.5.0) + ast (~> 2.4.1) + racc + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (5.1.1) + racc (1.8.1) + rack (2.2.10) + rack-test (2.1.0) + rack (>= 1.3) + rails (5.2.8.1) + actioncable (= 5.2.8.1) + actionmailer (= 5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + activemodel (= 5.2.8.1) + activerecord (= 5.2.8.1) + activestorage (= 5.2.8.1) + activesupport (= 5.2.8.1) + bundler (>= 1.3.0) + railties (= 5.2.8.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (5.2.8.1) + actionpack (= 5.2.8.1) + activesupport (= 5.2.8.1) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rainbow (3.1.1) + rake (13.2.1) + rbtree (0.4.6) + regexp_parser (2.9.2) + rexml (3.3.9) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + rubocop (1.64.1) + 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 (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.33.0) + parser (>= 3.3.1.0) + rubocop-performance (1.21.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.2.0) + rubocop (~> 1.61) + ruby-progressbar (1.13.0) + set (1.0.4) + sorted_set (1.0.3) + rbtree + set (~> 1.0) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + standard (1.37.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.64.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.4) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.4.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.21.0) + thor (1.3.2) + thread_safe (0.3.6) + timeout (0.4.1) + tzinfo (1.2.11) + thread_safe (~> 0.1) + unicode-display_width (2.6.0) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + dotenv + lepus! + pry + rails (~> 5.2, >= 5.2.8.1) + rspec + rubocop + rubocop-performance + rubocop-rspec + standard + webmock + +BUNDLED WITH + 2.3.22 diff --git a/gemfiles/rails61.gemfile b/gemfiles/rails61.gemfile new file mode 100644 index 0000000..38e2e2a --- /dev/null +++ b/gemfiles/rails61.gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gemspec path: ".." + +gem 'rails', '~> 6.1', '>= 6.1.7.10' diff --git a/gemfiles/rails61.gemfile.lock b/gemfiles/rails61.gemfile.lock new file mode 100644 index 0000000..3fa63a5 --- /dev/null +++ b/gemfiles/rails61.gemfile.lock @@ -0,0 +1,254 @@ +PATH + remote: .. + specs: + lepus (0.0.1.beta1) + bunny + concurrent-ruby + multi_json + zeitwerk + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) + mail (>= 2.7.1) + actionmailer (6.1.7.10) + actionpack (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activesupport (= 6.1.7.10) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.10) + actionview (= 6.1.7.10) + activesupport (= 6.1.7.10) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.10) + actionpack (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) + nokogiri (>= 1.8.5) + actionview (6.1.7.10) + activesupport (= 6.1.7.10) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.10) + activesupport (= 6.1.7.10) + globalid (>= 0.3.6) + activemodel (6.1.7.10) + activesupport (= 6.1.7.10) + activerecord (6.1.7.10) + activemodel (= 6.1.7.10) + activesupport (= 6.1.7.10) + activestorage (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activesupport (= 6.1.7.10) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.10) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + amq-protocol (2.3.2) + ast (2.4.2) + bigdecimal (3.1.8) + builder (3.3.0) + bunny (2.23.0) + amq-protocol (~> 2.3, >= 2.3.1) + sorted_set (~> 1, >= 1.0.2) + coderay (1.1.3) + concurrent-ruby (1.3.4) + crack (1.0.0) + bigdecimal + rexml + crass (1.0.6) + date (3.3.4) + diff-lcs (1.5.1) + dotenv (2.8.1) + erubi (1.13.0) + globalid (1.2.1) + activesupport (>= 6.1) + hashdiff (1.1.1) + i18n (1.14.6) + concurrent-ruby (~> 1.0) + json (2.7.5) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) + loofah (2.23.1) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.1) + multi_json (1.15.0) + net-imap (0.4.17) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4) + nokogiri (1.15.6-x86_64-linux) + racc (~> 1.4) + parallel (1.26.3) + parser (3.3.5.0) + ast (~> 2.4.1) + racc + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (5.1.1) + racc (1.8.1) + rack (2.2.10) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.10) + actioncable (= 6.1.7.10) + actionmailbox (= 6.1.7.10) + actionmailer (= 6.1.7.10) + actionpack (= 6.1.7.10) + actiontext (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activemodel (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) + bundler (>= 1.15.0) + railties (= 6.1.7.10) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) + method_source + rake (>= 12.2) + thor (~> 1.0) + rainbow (3.1.1) + rake (13.2.1) + rbtree (0.4.6) + regexp_parser (2.9.2) + rexml (3.3.9) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + rubocop (1.64.1) + 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 (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.33.0) + parser (>= 3.3.1.0) + rubocop-performance (1.21.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.2.0) + rubocop (~> 1.61) + ruby-progressbar (1.13.0) + set (1.0.4) + sorted_set (1.0.3) + rbtree + set (~> 1.0) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) + sprockets (>= 3.0.0) + standard (1.37.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.64.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.4) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.4.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.21.0) + thor (1.3.2) + timeout (0.4.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.6.0) + webmock (3.24.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + dotenv + lepus! + pry + rails (~> 6.1, >= 6.1.7.10) + rspec + rubocop + rubocop-performance + rubocop-rspec + standard + webmock + +BUNDLED WITH + 2.3.22 diff --git a/lepus.gemspec b/lepus.gemspec index 09b0941..a6a7001 100644 --- a/lepus.gemspec +++ b/lepus.gemspec @@ -39,6 +39,7 @@ Gem::Specification.new do |spec| spec.add_dependency "bunny", ">= 0.0.0" spec.add_dependency "zeitwerk", ">= 0.0.0" spec.add_dependency "concurrent-ruby", ">= 0.0.0" + spec.add_dependency "multi_json", ">= 0.0.0" spec.add_development_dependency "dotenv" spec.add_development_dependency "pry" diff --git a/lib/lepus.rb b/lib/lepus.rb index 7f5b684..a4cabe5 100644 --- a/lib/lepus.rb +++ b/lib/lepus.rb @@ -69,10 +69,13 @@ def loader @loader ||= Zeitwerk::Loader.for_gem(warn_on_extra_files: false).tap do |loader| loader.inflector.inflect "json" => "JSON" loader.inflector.inflect "cli" => "CLI" + loader.collapse("#{__dir__}/rails/railtie") + loader.collapse("#{__dir__}/rails/log_subscriber") loader.ignore("#{__dir__}/rails") loader.ignore("#{__dir__}/puma") loader.ignore("#{__dir__}/cli") loader.ignore("#{__dir__}/middlewares") + loader.log! if ENV["DEBUG"] end end diff --git a/lib/lepus/rails.rb b/lib/lepus/rails.rb index a369a69..182444e 100644 --- a/lib/lepus/rails.rb +++ b/lib/lepus/rails.rb @@ -3,5 +3,10 @@ require "rails/railtie" require "active_support/log_subscriber" +module Lepus + module Rails + end +end + require_relative "rails/log_subscriber" require_relative "rails/railtie" diff --git a/lib/lepus/supervisor.rb b/lib/lepus/supervisor.rb index 3d0c2fa..06ed697 100644 --- a/lib/lepus/supervisor.rb +++ b/lib/lepus/supervisor.rb @@ -55,6 +55,7 @@ def boot begin require "rails" require_relative "rails" + require File.expand_path("config/environment", Dir.pwd) rescue LoadError # Rails not found end