Skip to content

Fixed CLI crashing after gem install - #14

Merged
HassanAkbar merged 6 commits into
mainfrom
feat/tty-table-gemspec
Aug 24, 2026
Merged

HassanAkbar merged 6 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.

HassanAkbar and others added 2 commits August 24, 2026 17:10
The guard spec passed even without the gemspec fix: its regex treated
top-of-file and guarded requires alike, and the optional list excused
tty-table unconditionally. Scan unguarded (column-0) and guarded
(indented) requires separately -- the optional escape now applies only
to guarded ones -- and widen the scan from lib/dcc/cli to all of lib.

Declare nokogiri (~> 1.16), required unconditionally by
lib/dcc/validate/xsd.rb and hard-coded as the moxml adapter in
lib/dcc.rb. Drop csv and base64 from the spec's stdlib list (not
default gems since Ruby 3.4) and declare them too, as lib requires
both at file top level.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HassanAkbar
HassanAkbar marked this pull request as ready for review August 24, 2026 12:53
@HassanAkbar
HassanAkbar merged commit 5ed30e1 into main Aug 24, 2026
15 checks passed
@HassanAkbar
HassanAkbar deleted the feat/tty-table-gemspec branch August 24, 2026 14:33
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