Class: GitHubCli
- Inherits:
-
Object
- Object
- GitHubCli
- 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
-
#authenticated? ⇒ Boolean
Whether gh auth status reports a valid session.
-
#available? ⇒ Boolean
Whether the
ghbinary is on PATH. -
#ready? ⇒ Boolean
Whether the CLI is both installed and authenticated.
-
#warn_unauthenticated ⇒ Object
Prints advisory when
ghis installed but not logged in. -
#warn_unavailable ⇒ Object
Prints advisory when the
ghbinary cannot be found.
Instance Method Details
#authenticated? ⇒ Boolean
Whether gh auth status reports a valid session.
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.
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.
21 22 23 |
# File 'lib/ratatui_ruby/devtools/tasks/release/github_cli.rb', line 21 def ready? available? && authenticated? end |
#warn_unauthenticated ⇒ Object
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_unavailable ⇒ Object
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 |