Class: Ace::Overseer::Molecules::WorktreeContextCollector
- Inherits:
-
Object
- Object
- Ace::Overseer::Molecules::WorktreeContextCollector
- Defined in:
- lib/ace/overseer/molecules/worktree_context_collector.rb
Instance Method Summary collapse
- #collect(worktree_path, location_type: :worktree) ⇒ Object
- #collect_assignments_only(worktree_path, cached_branch:, cached_git_status:, location_type: :worktree) ⇒ Object
-
#initialize(repo_status_loader: nil, assignment_discoverer_factory: nil) ⇒ WorktreeContextCollector
constructor
A new instance of WorktreeContextCollector.
Constructor Details
#initialize(repo_status_loader: nil, assignment_discoverer_factory: nil) ⇒ WorktreeContextCollector
Returns a new instance of WorktreeContextCollector.
7 8 9 10 11 12 |
# File 'lib/ace/overseer/molecules/worktree_context_collector.rb', line 7 def initialize(repo_status_loader: nil, assignment_discoverer_factory: nil) @repo_status_loader = repo_status_loader || -> { Ace::Git::Organisms::RepoStatusLoader.load(include_pr_activity: false, include_commits: false) } @assignment_discoverer_factory = assignment_discoverer_factory || -> { Ace::Assign::Molecules::AssignmentDiscoverer.new } end |
Instance Method Details
#collect(worktree_path, location_type: :worktree) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ace/overseer/molecules/worktree_context_collector.rb', line 14 def collect(worktree_path, location_type: :worktree) with_worktree_context(worktree_path) do repo_status = @repo_status_loader.call assignments = load_all_assignments task_id = extract_task_id(worktree_path, repo_status.branch) Models::WorkContext.new( task_id: task_id, worktree_path: worktree_path, branch: repo_status.branch.to_s, assignments: assignments, git_status: repo_status.to_h, location_type: location_type ) end end |
#collect_assignments_only(worktree_path, cached_branch:, cached_git_status:, location_type: :worktree) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ace/overseer/molecules/worktree_context_collector.rb', line 31 def collect_assignments_only(worktree_path, cached_branch:, cached_git_status:, location_type: :worktree) with_worktree_context(worktree_path) do assignments = load_all_assignments task_id = extract_task_id(worktree_path, cached_branch) Models::WorkContext.new( task_id: task_id, worktree_path: worktree_path, branch: cached_branch, assignments: assignments, git_status: cached_git_status, location_type: location_type ) end end |