Class: RosettAi::Thor::Tasks::Hooks
- Inherits:
-
Thor
- Object
- Thor
- RosettAi::Thor::Tasks::Hooks
- Defined in:
- lib/rosett_ai/thor/tasks/hooks.rb
Overview
Thor CLI for git hook management.
Provides install, uninstall, list, and status subcommands for managing Rosett-AI-integrated git hooks.
Instance Method Summary collapse
-
#install ⇒ void
Install the component.
-
#list ⇒ void
List available items.
-
#status ⇒ String
Return the current status.
-
#uninstall ⇒ void
Remove the installed hooks.
Instance Method Details
#install ⇒ void
This method returns an undefined value.
Install the component.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rosett_ai/thor/tasks/hooks.rb', line 40 def install config = load_hooks_config return exit_with_error(t('no_config')) if config.empty? installer = RosettAi::GitHooks::Installer.new( project_root: project_root, hooks_config: config ) detect_existing_hooks(installer) if [:verbose] results = installer.install render_install_results(results) exit(results[:errors].empty? ? 0 : 1) end |
#list ⇒ void
This method returns an undefined value.
List available items.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/rosett_ai/thor/tasks/hooks.rb', line 90 def list installer = build_installer({}) hooks = installer.list if hooks.empty? say(t('no_hooks_installed')) return end render_list(hooks) end |
#status ⇒ String
Return the current status.
122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/rosett_ai/thor/tasks/hooks.rb', line 122 def status config = load_hooks_config installer = RosettAi::GitHooks::Installer.new( project_root: project_root, hooks_config: config ) result = installer.status render_status(result) all_synced = result[:missing].empty? && result[:drifted].empty? && result[:extra].empty? exit(all_synced ? 0 : 1) end |
#uninstall ⇒ void
This method returns an undefined value.
Remove the installed hooks.
68 69 70 71 72 73 |
# File 'lib/rosett_ai/thor/tasks/hooks.rb', line 68 def uninstall installer = build_installer({}) results = installer.uninstall render_uninstall_results(results) exit(results[:errors].empty? ? 0 : 1) end |