Skip to content

Make gli an optional dependency - #602

Open
corsonknowles wants to merge 2 commits into
slack-ruby:masterfrom
corsonknowles:optional-gli
Open

corsonknowles wants to merge 2 commits into
slack-ruby:masterfrom
corsonknowles:optional-gli

Conversation

@corsonknowles

Copy link
Copy Markdown

Closes #601, implementing option (1) as agreed there.

gli was a runtime dependency, but only the slack command-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 on ostruct (GLI::Options < OpenStruct), which Ruby 4.0 no longer ships as a default gem.

  • slack-ruby-client.gemspec: drops gli. The runtime dependencies are now faraday, faraday-mashify, faraday-multipart, hashie and logger.
  • bin/slack: requires gli itself. When gli is missing it exits with status 1: "The slack command-line client requires the gli gem. Add gem 'gli' to your Gemfile, or run gem install gli."
  • Gemfile: adds gli to the :test group, because spec/slack/slack_spec.rb runs bin/slack.
  • README / UPGRADING / CHANGELOG: the Command-Line Client section now says to install gli, and UPGRADING has an entry for CLI users. I put both under the current 3.2.1 (Next); renumber if you'd rather call this a minor release.

Tests: a new spec runs bin/slack with require 'gli' stubbed to raise LoadError, using spec/fixtures/without_gli.rb via ruby -r. It asserts the exit status and the message. The fixture lives outside spec/support, so spec_helper doesn't load it into the main process. bundle exec rspec gives 615 examples, 0 failures, and RuboCop reports 75 files with no offenses (Ruby 3.4.11). After require 'slack-ruby-client', neither gli nor ostruct is loaded.

🤖 Generated with Claude Code

corsonknowles and others added 2 commits October 4, 2026 07:11
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>
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Danger Report

Errors

  • One of the lines below found in CHANGELOG.md doesn't match the expected format. Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats.

Markdowns

* [#XXX](https://github.com/slack-ruby/slack-ruby-client/pull/XXX): Make gli an optional dependency; only the `slack` command-line client needs it - [@corsonknowles](https://github.com/corsonknowles).
does not include a pull request link

View run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make gli an optional dependency (only bin/slack needs it)

1 participant