Repository navigation
Make gli an optional dependency - #602
Conversation
Only the slack command-line client uses gli, so library users installed it (and its hard ostruct dependency, via GLI::Options < OpenStruct) for nothing. bin/slack now requires gli itself and exits with install instructions when it is missing. gli moves to the test group for the CLI specs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Danger ReportNo issues found. |
dblock
left a comment
There was a problem hiding this comment.
Fix CI, increment version to 3.3.0 since we're making a feature change.
Stubbing Kernel#require didn't take on every Ruby: where RubyGems, Bundler or bundled_gems wrap require ahead of Kernel's own method, gli still loaded and bin/slack exited 0 (2.7, 3.0, 3.1, 3.3, JRuby). Run bin/slack with --disable-gems and no inherited bundler environment instead, which leaves gli unloadable everywhere, and drop the fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dblock
left a comment
There was a problem hiding this comment.
Thanks! Merging. I'll cut a release.
Made some other changes, so will wait a few days before cutting a release, appreciate any testing on master if you have time @corsonknowles |
|
Thanks @dblock ! We built the 3.3.0 gem and installed it into an empty GEM_HOME: it brings in no gli or ostruct, the library loads, with_response/with_error return separate client copies, and slack prints the install hint until gli is installed, then makes real requests. I also pinned our main Rails app to 093baf4, coming from 3.1.0, and its full RSpec suite passed: 360,000 examples, no failures and no retries. gli and ostruct drop out of our lockfile. Only found at best, 1 very minor item: #603 changes user-visible exception message text (e.g. TooManyRequestsError is now "retry after N seconds"), so it might be worth calling that out in the CHANGELOG or UPGRADING for anyone matching on error messages. We were not. In any case, thumbs up from me. |
|
Thanks for merging this, @dblock! Would you be open to cutting 3.3.0 soon? We now flag |
Closes #601, implementing option (1) as agreed there.
gliwas a runtime dependency, but only theslackcommand-line client (bin/slack) uses it.require 'slack-ruby-client'never loads it. Library-only users therefore installed gli for nothing, and with it a hard dependency onostruct(GLI::Options < OpenStruct), which Ruby 4.0 no longer ships as a default gem.slack-ruby-client.gemspec: dropsgli. The runtime dependencies are now faraday, faraday-mashify, faraday-multipart, hashie and logger.bin/slack: requiresgliitself. When gli is missing it exits with status 1: "The slack command-line client requires the gli gem. Addgem 'gli'to your Gemfile, or rungem install gli."Gemfile: addsglito the:testgroup, becausespec/slack/slack_spec.rbrunsbin/slack.3.3.0 (Next), andSlack::VERSIONis bumped to3.3.0.Tests: a new spec runs
bin/slackwith--disable-gemsand no inherited Bundler environment, sorequire 'gli'raisesLoadErroron every Ruby, and asserts the exit status and the message. An earlier version stubbedKernel#requireinstead. That didn't take on 2.7, 3.0, 3.1, 3.3 or JRuby, where anotherrequirewrapper runs first. The new spec also passes on Ruby 2.6.bundle exec rspecgives 615 examples, 0 failures, and RuboCop reports 75 files with no offenses (Ruby 3.4.11). Afterrequire 'slack-ruby-client', neither gli nor ostruct is loaded.🤖 Generated with Claude Code