diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index 73c74c7..cff3ce5 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,7 +1,7 @@ # # rules_ruby circleci Docker file. # -FROM ruby:3.0.1 +FROM ruby:3.0.2 # make Apt non-interactive RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \ @@ -95,7 +95,10 @@ RUN apt-get install -y openjdk-11-jdk python2.7 python3 golang-go RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.3.0/bazelisk-linux-amd64 \ && sudo chmod +x /usr/bin/bazel +RUN cd /usr/bin && ln -s python3 python + USER circleci ENV PATH /home/circleci/.local/bin:/home/circleci/bin:/usr/local/bin:/usr/bin:/bin:/sbin:${PATH} -CMD ["/bin/sh"] + +CMD ["/bin/bash"] diff --git a/.circleci/config.yml b/.circleci/config.yml index a848906..5ee0d7e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: working_directory: /home/circleci/repo resource_class: medium docker: - - image: bazelruby/ruby-3.0.1 + - image: bazelruby/ruby-3.0.2 environment: PATH: "/usr/local/bin:/usr/bin:/sbin:/opt/bin:/home/circleci/repo/bin:/bin:/sbin:/usr/sbin" BUNDLE_PATH: /home/circleci/.bundle_cache @@ -24,7 +24,7 @@ jobs: - run: name: Install Bundler command: | - gem install bundler:2.0.2 --no-doc + gem install bundler:2.2.28 --no-doc bundle install --jobs=4 --retry=3 --path ${BUNDLE_PATH} - run: diff --git a/.envrc b/.envrc index 3b31e6f..72e49b3 100644 --- a/.envrc +++ b/.envrc @@ -1,15 +1,6 @@ # vi: ft=sh PATH_add bin - -[[ -n $(command -V brew) ]] && { - completion="$(brew --prefix)/etc/bash_completion" - [[ -f "${completion}" ]] && { - echo "Loading bash completion" - source "${completion}" - } -} - eval "$(rbenv init -)" rbenv local $(cat .ruby-version) echo "Ruby Version is $(ruby --version)" diff --git a/.rubocop.yml b/.rubocop.yml index 0d331a5..632114d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,8 @@ -inherit_from: .relaxed-rubocop-2.4.yml +inherit_from: + - .rubocop_todo.yml + - .relaxed-rubocop-2.4.yml + + AllCops: TargetRubyVersion: 2.6 @@ -23,6 +27,7 @@ AllCops: - '**/*.ru' - '**/Gemfile' - '**/Rakefile' + NewCops: enable Layout/HashAlignment: Enabled: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..e7302d7 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,20 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2021-11-08 22:06:35 UTC using RuboCop version 0.93.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +Lint/UnreachableLoop: + Exclude: + - 'ruby/tests/testdata/bundle_includes_workspace/script.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'ruby/tests/testdata/bundle_includes_workspace/script.rb' diff --git a/.ruby-version b/.ruby-version index cb2b00e..b502146 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.0.1 +3.0.2 diff --git a/Gemfile.lock b/Gemfile.lock index 2004164..9243824 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.2) - parallel (1.20.1) - parser (3.0.1.1) + parallel (1.21.0) + parser (3.0.2.0) ast (~> 2.4.1) rainbow (3.0.0) regexp_parser (2.1.1) @@ -17,10 +17,10 @@ GEM rubocop-ast (>= 0.6.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.7.0) + rubocop-ast (1.11.0) parser (>= 3.0.1.1) ruby-progressbar (1.11.0) - unicode-display_width (1.7.0) + unicode-display_width (1.8.0) PLATFORMS ruby @@ -30,4 +30,4 @@ DEPENDENCIES rubocop (~> 0.88) BUNDLED WITH - 2.1.4 + 2.2.27 diff --git a/README.adoc b/README.adoc index 1fe1ba6..758e9bb 100644 --- a/README.adoc +++ b/README.adoc @@ -10,6 +10,7 @@ :icons: font :license: apache + ==== This repo is primarily maintained by https://github.com/kigster[Konstantin Gredeskoul] and https://github.com/yugui[Yuki "Yugui" Sonoda]. We are both very busy and would really love more contributors to join the core team. If you are interested in developing Ruby Rules for Bazel, please submit a couple of PRs and then lets talk! ==== @@ -55,9 +56,7 @@ NOTE: we have a short guide on https://github.com/bazelruby/rules_ruby/wiki/Buil ** <> ** <> *** <> - *** <> - *** <> - *** <> + *** <> *** <> *** <> ** <> *** <> *** <> @@ -114,7 +113,7 @@ rules_ruby_dependencies() load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() -rules_ruby_select_sdk(version = "3.0.1") +rules_ruby_select_sdk(version = "3.0.2") #——————————————————————————————————————————————————————————————————————— # Now, load the ruby_bundle rule & install gems specified in the Gemfile diff --git a/WORKSPACE b/WORKSPACE index 0ebc4dd..e08c5ee 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,7 +12,7 @@ load("@bazel_skylib//lib:versions.bzl", "versions") versions.check("3.4.1") -rules_ruby_select_sdk("3.0.1") +rules_ruby_select_sdk("3.0.2") local_repository( name = "bazelruby_rules_ruby_ruby_tests_testdata_another_workspace", diff --git a/bin/deps b/bin/deps index 13688af..dfdbbcc 100755 --- a/bin/deps +++ b/bin/deps @@ -15,7 +15,6 @@ # shellcheck disable=SC1090 source "${BASHMATIC_HOME}/init.sh" 1>/dev/null 2>&1 - command -v rbenv >/dev/null && eval "$(rbenv init -)" __version.detect() { diff --git a/examples/example_gem/WORKSPACE b/examples/example_gem/WORKSPACE index 06b7964..0f096a7 100644 --- a/examples/example_gem/WORKSPACE +++ b/examples/example_gem/WORKSPACE @@ -15,7 +15,7 @@ load( rules_ruby_dependencies() -rules_ruby_select_sdk("3.0.1") +rules_ruby_select_sdk("3.0.2") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") diff --git a/examples/simple_rails_api/Gemfile.lock b/examples/simple_rails_api/Gemfile.lock index 43c4eb3..63737a6 100644 --- a/examples/simple_rails_api/Gemfile.lock +++ b/examples/simple_rails_api/Gemfile.lock @@ -1,84 +1,84 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.0.4) - actionpack (= 6.0.4) + actioncable (6.0.4.1) + actionpack (= 6.0.4.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.4) - actionpack (= 6.0.4) - activejob (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) + actionmailbox (6.0.4.1) + actionpack (= 6.0.4.1) + activejob (= 6.0.4.1) + activerecord (= 6.0.4.1) + activestorage (= 6.0.4.1) + activesupport (= 6.0.4.1) mail (>= 2.7.1) - actionmailer (6.0.4) - actionpack (= 6.0.4) - actionview (= 6.0.4) - activejob (= 6.0.4) + actionmailer (6.0.4.1) + actionpack (= 6.0.4.1) + actionview (= 6.0.4.1) + activejob (= 6.0.4.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.4) - actionview (= 6.0.4) - activesupport (= 6.0.4) + actionpack (6.0.4.1) + actionview (= 6.0.4.1) + activesupport (= 6.0.4.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.4) - actionpack (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) + actiontext (6.0.4.1) + actionpack (= 6.0.4.1) + activerecord (= 6.0.4.1) + activestorage (= 6.0.4.1) + activesupport (= 6.0.4.1) nokogiri (>= 1.8.5) - actionview (6.0.4) - activesupport (= 6.0.4) + actionview (6.0.4.1) + activesupport (= 6.0.4.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.4) - activesupport (= 6.0.4) + activejob (6.0.4.1) + activesupport (= 6.0.4.1) globalid (>= 0.3.6) - activemodel (6.0.4) - activesupport (= 6.0.4) - activerecord (6.0.4) - activemodel (= 6.0.4) - activesupport (= 6.0.4) - activestorage (6.0.4) - actionpack (= 6.0.4) - activejob (= 6.0.4) - activerecord (= 6.0.4) + activemodel (6.0.4.1) + activesupport (= 6.0.4.1) + activerecord (6.0.4.1) + activemodel (= 6.0.4.1) + activesupport (= 6.0.4.1) + activestorage (6.0.4.1) + actionpack (= 6.0.4.1) + activejob (= 6.0.4.1) + activerecord (= 6.0.4.1) marcel (~> 1.0.0) - activesupport (6.0.4) + activesupport (6.0.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) - bootsnap (1.7.5) + bootsnap (1.9.1) msgpack (~> 1.0) builder (3.2.4) byebug (11.1.3) concurrent-ruby (1.1.9) crass (1.0.6) erubi (1.10.0) - ffi (1.15.3) - globalid (0.4.2) - activesupport (>= 4.2.0) + ffi (1.15.4) + globalid (0.5.2) + activesupport (>= 5.0) i18n (1.8.10) concurrent-ruby (~> 1.0) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.10.0) + loofah (2.12.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (1.0.1) + marcel (1.0.2) method_source (1.0.0) - mini_mime (1.1.0) + mini_mime (1.1.1) mini_portile2 (2.6.1) minitest (5.14.4) msgpack (1.4.2) @@ -92,33 +92,33 @@ GEM rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.4) - actioncable (= 6.0.4) - actionmailbox (= 6.0.4) - actionmailer (= 6.0.4) - actionpack (= 6.0.4) - actiontext (= 6.0.4) - actionview (= 6.0.4) - activejob (= 6.0.4) - activemodel (= 6.0.4) - activerecord (= 6.0.4) - activestorage (= 6.0.4) - activesupport (= 6.0.4) + rails (6.0.4.1) + actioncable (= 6.0.4.1) + actionmailbox (= 6.0.4.1) + actionmailer (= 6.0.4.1) + actionpack (= 6.0.4.1) + actiontext (= 6.0.4.1) + actionview (= 6.0.4.1) + activejob (= 6.0.4.1) + activemodel (= 6.0.4.1) + activerecord (= 6.0.4.1) + activestorage (= 6.0.4.1) + activesupport (= 6.0.4.1) bundler (>= 1.3.0) - railties (= 6.0.4) + railties (= 6.0.4.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (6.0.4) - actionpack (= 6.0.4) - activesupport (= 6.0.4) + railties (6.0.4.1) + actionpack (= 6.0.4.1) + activesupport (= 6.0.4.1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) - rake (13.0.4) + rake (13.0.6) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) @@ -158,4 +158,4 @@ DEPENDENCIES tzinfo-data BUNDLED WITH - 2.1.4 + 2.2.24 diff --git a/examples/simple_rails_api/WORKSPACE b/examples/simple_rails_api/WORKSPACE index 17e28c3..8585cfe 100644 --- a/examples/simple_rails_api/WORKSPACE +++ b/examples/simple_rails_api/WORKSPACE @@ -15,7 +15,7 @@ load( rules_ruby_dependencies() -rules_ruby_select_sdk(version = "3.0.1") +rules_ruby_select_sdk(version = "3.0.2") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") diff --git a/examples/simple_script/.ruby-version b/examples/simple_script/.ruby-version new file mode 100644 index 0000000..b502146 --- /dev/null +++ b/examples/simple_script/.ruby-version @@ -0,0 +1 @@ +3.0.2 diff --git a/examples/simple_script/Gemfile.lock b/examples/simple_script/Gemfile.lock index b5d358f..002c127 100644 --- a/examples/simple_script/Gemfile.lock +++ b/examples/simple_script/Gemfile.lock @@ -5,8 +5,8 @@ GEM awesome_print (1.9.2) colored2 (3.1.2) diff-lcs (1.4.4) - parallel (1.20.1) - parser (3.0.1.1) + parallel (1.21.0) + parser (3.0.2.0) ast (~> 2.4.1) rainbow (3.0.0) regexp_parser (2.1.1) @@ -27,19 +27,19 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.7.0) rspec-support (3.7.1) - rubocop (1.18.3) + rubocop (1.21.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.7.0, < 2.0) + rubocop-ast (>= 1.9.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.7.0) + rubocop-ast (1.11.0) parser (>= 3.0.1.1) ruby-progressbar (1.11.0) - unicode-display_width (2.0.0) + unicode-display_width (2.1.0) PLATFORMS ruby @@ -52,4 +52,4 @@ DEPENDENCIES rubocop BUNDLED WITH - 2.1.4 + 2.2.24 diff --git a/examples/simple_script/WORKSPACE b/examples/simple_script/WORKSPACE index 13cf766..4ad11d1 100644 --- a/examples/simple_script/WORKSPACE +++ b/examples/simple_script/WORKSPACE @@ -15,7 +15,7 @@ load( rules_ruby_dependencies() -rules_ruby_select_sdk(version = "3.0.1") +rules_ruby_select_sdk(version = "3.0.2") load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle") diff --git a/examples/simple_script/spec/script_spec.rb b/examples/simple_script/spec/script_spec.rb index 458b928..b325d32 100644 --- a/examples/simple_script/spec/script_spec.rb +++ b/examples/simple_script/spec/script_spec.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true require 'spec_helper' -require 'script' + +require_relative '../script' describe 'oss_rand' do it 'generates a String' do diff --git a/examples/simple_script_vendored/.rubocop.yml b/examples/simple_script_vendored/.rubocop.yml index 7b653d9..0687ca7 100644 --- a/examples/simple_script_vendored/.rubocop.yml +++ b/examples/simple_script_vendored/.rubocop.yml @@ -1,7 +1,7 @@ inherit_from: .relaxed-rubocop-2.4.yml AllCops: - TargetRubyVersion: 2.6 + TargetRubyVersion: 3.0 UseCache: true DefaultFormatter: progress DisplayStyleGuide: true @@ -23,6 +23,8 @@ AllCops: - '**/*.ru' - '**/Gemfile' - '**/Rakefile' + SuggestExtensions: false + NewCops: enable Layout/HashAlignment: Enabled: true diff --git a/examples/simple_script_vendored/Gemfile b/examples/simple_script_vendored/Gemfile index efb2cf7..48bd8b2 100644 --- a/examples/simple_script_vendored/Gemfile +++ b/examples/simple_script_vendored/Gemfile @@ -4,4 +4,4 @@ source 'https://rubygems.org' gem 'rspec', '~> 3.7.0' gem 'rspec-its' -gem 'rubocop', '~> 0.78.0' +gem 'rubocop' diff --git a/examples/simple_script_vendored/Gemfile.lock b/examples/simple_script_vendored/Gemfile.lock index 4460ad6..315f6e6 100644 --- a/examples/simple_script_vendored/Gemfile.lock +++ b/examples/simple_script_vendored/Gemfile.lock @@ -3,11 +3,12 @@ GEM specs: ast (2.4.2) diff-lcs (1.4.4) - jaro_winkler (1.5.4) - parallel (1.20.1) - parser (3.0.0.0) + parallel (1.21.0) + parser (3.0.2.0) ast (~> 2.4.1) rainbow (3.0.0) + regexp_parser (2.1.1) + rexml (3.2.5) rspec (3.7.0) rspec-core (~> 3.7.0) rspec-expectations (~> 3.7.0) @@ -24,15 +25,19 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.7.0) rspec-support (3.7.1) - rubocop (0.78.0) - jaro_winkler (~> 1.5.1) + rubocop (1.21.0) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.9.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.11.0) + parser (>= 3.0.1.1) ruby-progressbar (1.11.0) - unicode-display_width (1.6.1) + unicode-display_width (2.1.0) PLATFORMS ruby @@ -40,7 +45,7 @@ PLATFORMS DEPENDENCIES rspec (~> 3.7.0) rspec-its - rubocop (~> 0.78.0) + rubocop BUNDLED WITH - 2.1.4 + 2.2.24 diff --git a/examples/simple_script_vendored/spec/spec_helper.rb b/examples/simple_script_vendored/spec/spec_helper.rb index 9c7f07a..9de82de 100644 --- a/examples/simple_script_vendored/spec/spec_helper.rb +++ b/examples/simple_script_vendored/spec/spec_helper.rb @@ -11,9 +11,13 @@ # it is invoked by rpsec/autorun. So #warn_with raises an exception # 5. The process fails with an unhandled exception. -ENV['HOME'] ||= '/' +LIB = File.expand_path(File.dirname(__dir__)) +$LOAD_PATH.unshift(LIB) unless $LOAD_PATH.include?(LIB) -require 'rspec' +ENV["HOME"] ||= "/" + +require "rspec" +require "script" RSpec.configure do |config| config.expect_with :rspec do |expectations| diff --git a/examples/simple_script_vendored/vendor/cache/jaro_winkler-1.5.4.gem b/examples/simple_script_vendored/vendor/cache/jaro_winkler-1.5.4.gem deleted file mode 100644 index 5ed9b9b..0000000 Binary files a/examples/simple_script_vendored/vendor/cache/jaro_winkler-1.5.4.gem and /dev/null differ diff --git a/examples/simple_script_vendored/vendor/cache/parallel-1.20.1.gem b/examples/simple_script_vendored/vendor/cache/parallel-1.20.1.gem deleted file mode 100644 index 7804c61..0000000 Binary files a/examples/simple_script_vendored/vendor/cache/parallel-1.20.1.gem and /dev/null differ diff --git a/examples/simple_script_vendored/vendor/cache/parallel-1.21.0.gem b/examples/simple_script_vendored/vendor/cache/parallel-1.21.0.gem new file mode 100644 index 0000000..ca8f636 Binary files /dev/null and b/examples/simple_script_vendored/vendor/cache/parallel-1.21.0.gem differ diff --git a/examples/simple_script_vendored/vendor/cache/parser-3.0.0.0.gem b/examples/simple_script_vendored/vendor/cache/parser-3.0.0.0.gem deleted file mode 100644 index f542329..0000000 Binary files a/examples/simple_script_vendored/vendor/cache/parser-3.0.0.0.gem and /dev/null differ diff --git a/examples/simple_script_vendored/vendor/cache/parser-3.0.2.0.gem b/examples/simple_script_vendored/vendor/cache/parser-3.0.2.0.gem new file mode 100644 index 0000000..ee615aa Binary files /dev/null and b/examples/simple_script_vendored/vendor/cache/parser-3.0.2.0.gem differ diff --git a/examples/simple_script_vendored/vendor/cache/regexp_parser-2.1.1.gem b/examples/simple_script_vendored/vendor/cache/regexp_parser-2.1.1.gem new file mode 100644 index 0000000..4bb25a0 Binary files /dev/null and b/examples/simple_script_vendored/vendor/cache/regexp_parser-2.1.1.gem differ diff --git a/examples/simple_script_vendored/vendor/cache/rexml-3.2.5.gem b/examples/simple_script_vendored/vendor/cache/rexml-3.2.5.gem new file mode 100644 index 0000000..5680fec Binary files /dev/null and b/examples/simple_script_vendored/vendor/cache/rexml-3.2.5.gem differ diff --git a/examples/simple_script_vendored/vendor/cache/rubocop-0.78.0.gem b/examples/simple_script_vendored/vendor/cache/rubocop-0.78.0.gem deleted file mode 100644 index b8f797d..0000000 Binary files a/examples/simple_script_vendored/vendor/cache/rubocop-0.78.0.gem and /dev/null differ diff --git a/examples/simple_script_vendored/vendor/cache/rubocop-1.21.0.gem b/examples/simple_script_vendored/vendor/cache/rubocop-1.21.0.gem new file mode 100644 index 0000000..ddeba66 Binary files /dev/null and b/examples/simple_script_vendored/vendor/cache/rubocop-1.21.0.gem differ diff --git a/examples/simple_script_vendored/vendor/cache/rubocop-ast-1.11.0.gem b/examples/simple_script_vendored/vendor/cache/rubocop-ast-1.11.0.gem new file mode 100644 index 0000000..9a444da Binary files /dev/null and b/examples/simple_script_vendored/vendor/cache/rubocop-ast-1.11.0.gem differ diff --git a/examples/simple_script_vendored/vendor/cache/unicode-display_width-1.6.1.gem b/examples/simple_script_vendored/vendor/cache/unicode-display_width-1.6.1.gem deleted file mode 100644 index 55f1986..0000000 Binary files a/examples/simple_script_vendored/vendor/cache/unicode-display_width-1.6.1.gem and /dev/null differ diff --git a/examples/simple_script_vendored/vendor/cache/unicode-display_width-2.1.0.gem b/examples/simple_script_vendored/vendor/cache/unicode-display_width-2.1.0.gem new file mode 100644 index 0000000..bec8f2a Binary files /dev/null and b/examples/simple_script_vendored/vendor/cache/unicode-display_width-2.1.0.gem differ diff --git a/ruby/private/bundle/create_bundle_build_file.rb b/ruby/private/bundle/create_bundle_build_file.rb index e832310..52626cf 100755 --- a/ruby/private/bundle/create_bundle_build_file.rb +++ b/ruby/private/bundle/create_bundle_build_file.rb @@ -158,8 +158,7 @@ def buildify! puts 'Buildifier gave 👍 '.green + (output ? " and said: #{output}" : '') else raise BuildifierFailedError, - 'Generated BUILD file failed buildifier, with error — '.red + "\n\n" + - output.yellow + "Generated BUILD file failed buildifier, with error:\n\n#{output.yellow}\n\n".red end end end @@ -182,8 +181,7 @@ def initialize(workspace_name:, build_file: 'BUILD.bazel', gemfile_lock: 'Gemfile.lock', includes: nil, - excludes: nil, - additional_require_paths: nil) + excludes: nil) @workspace_name = workspace_name @repo_name = repo_name @build_file = build_file @@ -301,7 +299,7 @@ def find_bundle_binaries(gem_path) end.flatten .compact .sort - .map { |binary| 'bin/' + binary } + .map { |binary| "bin/#{binary}" } end def include_array(gem_name) diff --git a/ruby/private/toolchain.bzl b/ruby/private/toolchain.bzl index b8b6dc5..cbaebd6 100644 --- a/ruby/private/toolchain.bzl +++ b/ruby/private/toolchain.bzl @@ -11,13 +11,15 @@ RubyRuntimeInfo = provider( ) def _ruby_toolchain_impl(ctx): - return [platform_common.ToolchainInfo( - ruby_runtime = RubyRuntimeInfo( - interpreter = ctx.attr.interpreter, - runtime = ctx.files.runtime, - rubyopt = ctx.attr.rubyopt, + return [ + platform_common.ToolchainInfo( + ruby_runtime = RubyRuntimeInfo( + interpreter = ctx.attr.interpreter, + runtime = ctx.files.runtime, + rubyopt = ctx.attr.rubyopt, + ), ), - )] + ] _ruby_toolchain = rule( implementation = _ruby_toolchain_impl, diff --git a/ruby/tests/testdata/bundle_includes_workspace/BUILD.bazel b/ruby/tests/testdata/bundle_includes_workspace/BUILD.bazel index 5df776a..01b33fa 100644 --- a/ruby/tests/testdata/bundle_includes_workspace/BUILD.bazel +++ b/ruby/tests/testdata/bundle_includes_workspace/BUILD.bazel @@ -10,6 +10,7 @@ ruby_binary( srcs = ["script.rb"], main = "script.rb", deps = [ + "@gems//:awesome_print", "@gems//:grpc", ], ) diff --git a/ruby/tests/testdata/bundle_includes_workspace/Gemfile b/ruby/tests/testdata/bundle_includes_workspace/Gemfile index 9595a03..9f5ba60 100644 --- a/ruby/tests/testdata/bundle_includes_workspace/Gemfile +++ b/ruby/tests/testdata/bundle_includes_workspace/Gemfile @@ -2,4 +2,5 @@ source 'https://rubygems.org' +gem 'awesome_print' gem 'grpc' diff --git a/ruby/tests/testdata/bundle_includes_workspace/Gemfile.lock b/ruby/tests/testdata/bundle_includes_workspace/Gemfile.lock index 0417ff0..20db546 100644 --- a/ruby/tests/testdata/bundle_includes_workspace/Gemfile.lock +++ b/ruby/tests/testdata/bundle_includes_workspace/Gemfile.lock @@ -1,6 +1,7 @@ GEM remote: https://rubygems.org/ specs: + awesome_print (1.9.2) google-protobuf (3.17.3) googleapis-common-protos-types (1.1.0) google-protobuf (~> 3.14) @@ -12,7 +13,8 @@ PLATFORMS ruby DEPENDENCIES + awesome_print grpc BUNDLED WITH - 2.2.22 + 2.2.28 diff --git a/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE b/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE index c97411c..00a3bb4 100644 --- a/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE +++ b/ruby/tests/testdata/bundle_includes_workspace/WORKSPACE @@ -13,7 +13,7 @@ load( rules_ruby_dependencies() -rules_ruby_select_sdk(version = "3.0.1") +rules_ruby_select_sdk(version = "3.0.2") load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle") diff --git a/ruby/tests/testdata/bundle_includes_workspace/script.rb b/ruby/tests/testdata/bundle_includes_workspace/script.rb index c29eab5..bc718e5 100644 --- a/ruby/tests/testdata/bundle_includes_workspace/script.rb +++ b/ruby/tests/testdata/bundle_includes_workspace/script.rb @@ -1,25 +1,24 @@ -# frozen_string_literal: true - -expected_gem_require_paths = [ - 'etc', - 'src/ruby/bin', - 'src/ruby/lib', - 'src/ruby/pb' +expected_gem_require_paths = %w[ + etc + src/ruby/bin + src/ruby/lib + src/ruby/pb ] - gem_require_paths = $LOAD_PATH.map do |load_path| %r{.+script.runfiles/(?:gems|bundle)/lib/ruby/3.0.0/gems/grpc-.+?/(.+)}.match(load_path).to_a[1] end.compact -(expected_gem_require_paths - gem_require_paths).each do |missing_require_path| - raise "Expected requir_path '#{missing_require_path}' is missing in $LOAD_PATH." -end - begin require 'grpc' -rescue LoadError - $stderr.puts 'Failed to load grpc gem' +rescue LoadError => e + warn "Failed to load grpc gem: #{e.message}" raise end -puts GRPC::RpcServer.new +pp GRPC::RpcServer.new + +# TODO: what is this? I am not sure I fully understand the purpose of this +# check. Please elaborate, or it will be removed. --@kigster +(expected_gem_require_paths - gem_require_paths).each do |missing_require_path| + raise "Expected requir_path '#{missing_require_path}' is missing in $LOAD_PATH." +end