Skip to content

Make gli an optional dependency - #602

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

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

Conversation

@corsonknowles

@corsonknowles corsonknowles commented Oct 4, 2026 •

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. Both are under 3.3.0 (Next), and Slack::VERSION is bumped to 3.3.0.

Tests: a new spec runs bin/slack with --disable-gems and no inherited Bundler environment, so require 'gli' raises LoadError on every Ruby, and asserts the exit status and the message. An earlier version stubbed Kernel#require instead. That didn't take on 2.7, 3.0, 3.1, 3.3 or JRuby, where another require wrapper runs first. The new spec also passes on Ruby 2.6. 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

No issues found.

View run

@dblock dblock left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
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)

2 participants