Class: Aidp::Analyze::Progress
- Inherits:
-
Object
- Object
- Aidp::Analyze::Progress
- Defined in:
- lib/aidp/analyze/progress.rb
Overview
Manages progress tracking for analyze mode, isolated from execute mode
Instance Attribute Summary collapse
-
#progress_file ⇒ Object
readonly
Returns the value of attribute progress_file.
-
#project_dir ⇒ Object
readonly
Returns the value of attribute project_dir.
Instance Method Summary collapse
- #completed_steps ⇒ Object
- #current_step ⇒ Object
-
#initialize(project_dir, skip_persistence: false) ⇒ Progress
constructor
A new instance of Progress.
- #mark_step_completed(step_name) ⇒ Object
- #mark_step_in_progress(step_name) ⇒ Object
- #next_step ⇒ Object
- #reset ⇒ Object
- #started_at ⇒ Object
- #step_completed?(step_name) ⇒ Boolean
Constructor Details
#initialize(project_dir, skip_persistence: false) ⇒ Progress
12 13 14 15 16 17 |
# File 'lib/aidp/analyze/progress.rb', line 12 def initialize(project_dir, skip_persistence: false) @project_dir = project_dir @progress_file = File.join(project_dir, ".aidp", "progress", "analyze.yml") @skip_persistence = skip_persistence load_progress end |
Instance Attribute Details
#progress_file ⇒ Object (readonly)
Returns the value of attribute progress_file.
10 11 12 |
# File 'lib/aidp/analyze/progress.rb', line 10 def progress_file @progress_file end |
#project_dir ⇒ Object (readonly)
Returns the value of attribute project_dir.
10 11 12 |
# File 'lib/aidp/analyze/progress.rb', line 10 def project_dir @project_dir end |
Instance Method Details
#completed_steps ⇒ Object
19 20 21 |
# File 'lib/aidp/analyze/progress.rb', line 19 def completed_steps @progress["completed_steps"] || [] end |
#current_step ⇒ Object
23 24 25 |
# File 'lib/aidp/analyze/progress.rb', line 23 def current_step @progress["current_step"] end |
#mark_step_completed(step_name) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/aidp/analyze/progress.rb', line 35 def mark_step_completed(step_name) @progress["completed_steps"] ||= [] @progress["completed_steps"] << step_name unless step_completed?(step_name) @progress["current_step"] = nil save_progress end |
#mark_step_in_progress(step_name) ⇒ Object
42 43 44 45 46 |
# File 'lib/aidp/analyze/progress.rb', line 42 def mark_step_in_progress(step_name) @progress["current_step"] = step_name @progress["started_at"] ||= Time.now.iso8601 save_progress end |
#next_step ⇒ Object
57 58 59 |
# File 'lib/aidp/analyze/progress.rb', line 57 def next_step Aidp::Analyze::Steps::SPEC.keys.find { |step| !step_completed?(step) } end |
#reset ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/aidp/analyze/progress.rb', line 48 def reset @progress = { "completed_steps" => [], "current_step" => nil, "started_at" => nil } save_progress end |
#started_at ⇒ Object
27 28 29 |
# File 'lib/aidp/analyze/progress.rb', line 27 def started_at @progress["started_at"] ? Time.parse(@progress["started_at"]) : nil end |
#step_completed?(step_name) ⇒ Boolean
31 32 33 |
# File 'lib/aidp/analyze/progress.rb', line 31 def step_completed?(step_name) completed_steps.include?(step_name) end |