Class: GitHubCli

Inherits:
Object
  • Object
show all
Defined in:
lib/ratatui_ruby/devtools/tasks/release/github_cli.rb

Overview

GitHubCli wraps availability and authentication checks for the gh CLI.

Instance Method Summary collapse

Instance Method Details

#authenticated?Boolean

Whether gh auth status reports a valid session.

Returns:



16
17
18
# File 'lib/ratatui_ruby/devtools/tasks/release/github_cli.rb', line 16

def authenticated?
  system("gh", "auth", "status", out: File::NULL, err: File::NULL)
end

#available?Boolean

Whether the gh binary is on PATH.

Returns:



11
12
13
# File 'lib/ratatui_ruby/devtools/tasks/release/github_cli.rb', line 11

def available?
  system("command", "-v", "gh", out: File::NULL, err: File::NULL)
end

#ready?Boolean

Whether the CLI is both installed and authenticated.

Returns:



21
22
23
# File 'lib/ratatui_ruby/devtools/tasks/release/github_cli.rb', line 21

def ready?
  available? && authenticated?
end

#warn_unauthenticatedObject

Prints advisory when gh is installed but not logged in.



32
33
34
35
# File 'lib/ratatui_ruby/devtools/tasks/release/github_cli.rb', line 32

def warn_unauthenticated
  warn "\n⚠  'gh' is not authenticated — skipping native gem push."
  warn "   Run: gh auth login\n\n"
end

#warn_unavailableObject

Prints advisory when the gh binary cannot be found.



26
27
28
29
# File 'lib/ratatui_ruby/devtools/tasks/release/github_cli.rb', line 26

def warn_unavailable
  warn "\n⚠  'gh' CLI not found — skipping native gem push."
  warn "   Install: https://cli.github.com\n\n"
end