bazelruby / rules_ruby

Formerly canonical rules for ruby, that are about 2-3 years behind current Bazel. If they work for you great, but if not — please try the new rules ruby by Alex Radionov: https://github.com/bazel-contrib/rules_ruby
Apache License 2.0
99 stars 37 forks source link

Adds ruby_rspec and refactors the ruby_bundle rule, plus some more #60

Closed kigster closed 4 years ago

kigster commented 4 years ago

What’s Changed?

This is a PR that improves and refactors the bundle install command, its steps, build file generation and making installed gems and their binaries available for consumption by the ruby libraries, binaries and tests in the BUILD files.

We also spent considerable amount of time testing various ways of running rspec tests and were able to add three examples to simple script that show three ways of running rspec against a library: 1. Using RubyOpt with -rrspec/autorun, 2. Specifying rspec binary as @bundle//:bin/rspec, and finally 3. By using a new macro and a rule ruby_rspec, which provides sensible defaults and implements (2) in starlark.

We moved a lot of hard coded definitions into the constants file. Most defaults are now specified there.

We added a facility to declare a used attribute as deprecated and log it to the output,

We renamed bundle_install into ruby_bundle to be more consistent and more meaningful in this context, as ruby_bundle not only installs gems but makes them accessible later individually.

We refactored starlark code implementation of ruby_bundle to be modular making it easy to invoke bundler with different commands during the installation.

Other notable changes