Skip to content

Fixed CLI crashing after gem install - #14

Draft
HassanAkbar wants to merge 4 commits into
mainfrom
feat/tty-table-gemspec
Draft

Fixed CLI crashing after gem install#14
HassanAkbar wants to merge 4 commits into
mainfrom
feat/tty-table-gemspec

Conversation

@HassanAkbar

@HassanAkbar HassanAkbar commented Jul 31, 2026

Copy link
Copy Markdown
Member

gem install dcc produced a binary that crashed on every command, including dcc version.

cli.rb required tty-table, which was only a Gemfile development dependency.
exe/dcc loads that file directly, so every command died with LoadError.

  • Drops the require from cli.rb, which never used TTY::Table.
  • formatters.rb loads it on first use and falls back to its own plain renderer,
    with a note on stderr pointing at gem install tty-table.
  • Adds a spec asserting every gem the CLI requires is declared, unless named optional.

Known and accepted:

  • tty-table stays out of the gemspec. It costs 8 further gems that every library
    user would install just to parse XML. It joins the Gemfile's existing :optional
    group beside sinatra and tty-prompt.
  • CLI output now varies by install. Both paths render an aligned table.
  • The hint goes to stderr, so piped output stays clean data.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a packaging/runtime issue where the installed dcc executable could crash on startup due to a missing runtime dependency, by aligning CLI require usage with gem runtime dependencies and adding a regression spec to prevent recurrence.

Changes:

  • Adds tty-table as a runtime dependency in dcc.gemspec.
  • Removes an unused require "tty-table" from lib/dcc/cli/cli.rb (leaving tty-table required only where actually needed).
  • Adds a spec that scans lib/dcc/cli/** for third-party requires and asserts they are declared runtime dependencies.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
spec/dcc/cli/dependencies_spec.rb New guard spec to ensure CLI load-time requires map to gem runtime dependencies.
lib/dcc/cli/cli.rb Removes the tty-table require from CLI entrypoint.
Gemfile Drops tty-table from dev-only Gemfile dependencies.
dcc.gemspec Declares tty-table as a runtime dependency for packaged installs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread spec/dcc/cli/dependencies_spec.rb

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@HassanAkbar
HassanAkbar marked this pull request as ready for review August 11, 2026 15:30
@HassanAkbar
HassanAkbar marked this pull request as draft August 11, 2026 15:34
@HassanAkbar
HassanAkbar requested a lite review from Copilot August 13, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (1)

spec/dcc/cli/dependencies_spec.rb:14

  • root currently resolves to <repo>/spec (since this file lives under spec/dcc/cli), so Gem::Specification.load(File.join(root, "dcc.gemspec")) will look for spec/dcc.gemspec and return nil/error. The gemspec is at the repository root (dcc.gemspec), so this spec will fail as written.
  let(:root) { File.expand_path("../../..", __dir__) }
  let(:gemspec) { Gem::Specification.load(File.join(root, "dcc.gemspec")) }
  let(:declared) { gemspec.runtime_dependencies.map(&:name) }

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

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.

2 participants