Class: Ace::Hitl::Molecules::WorktreeScopeResolver
- Inherits:
-
Object
- Object
- Ace::Hitl::Molecules::WorktreeScopeResolver
- Defined in:
- lib/ace/hitl/molecules/worktree_scope_resolver.rb
Constant Summary collapse
- VALID_SCOPES =
%w[current all].freeze
Instance Method Summary collapse
- #current_worktree_root ⇒ Object
- #default_scope ⇒ Object
- #effective_scope(requested_scope) ⇒ Object
- #worktree_roots(scope:) ⇒ Object
Instance Method Details
#current_worktree_root ⇒ Object
19 20 21 |
# File 'lib/ace/hitl/molecules/worktree_scope_resolver.rb', line 19 def current_worktree_root @current_worktree_root ||= git_output("rev-parse", "--show-toplevel") end |
#default_scope ⇒ Object
11 12 13 |
# File 'lib/ace/hitl/molecules/worktree_scope_resolver.rb', line 11 def default_scope main_checkout? ? "all" : "current" end |
#effective_scope(requested_scope) ⇒ Object
15 16 17 |
# File 'lib/ace/hitl/molecules/worktree_scope_resolver.rb', line 15 def effective_scope(requested_scope) requested_scope || default_scope end |
#worktree_roots(scope:) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ace/hitl/molecules/worktree_scope_resolver.rb', line 23 def worktree_roots(scope:) case scope when "current" [current_worktree_root].compact when "all" roots = parse_worktree_list roots = [current_worktree_root].compact if roots.empty? roots else [] end end |